1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 01:54:57 +00:00

Kernel: Pass a FileDescription to File::chmod() and File::chown()

We're going to make use of it in the next commit. But the idea is we want to
know how this File (more specifically, InodeFile) was opened in order to decide
how chown()/chmod() should behave, in particular whether it should be allowed or
not. Note that many other File operations, such as read(), write(), and ioctl(),
already require the caller to pass a FileDescription.
This commit is contained in:
Sergey Bugaev 2020-05-28 17:32:20 +03:00 committed by Andreas Kling
parent 67cbc015d5
commit a9946a99f2
6 changed files with 14 additions and 12 deletions

View file

@ -97,13 +97,15 @@ KResult InodeFile::truncate(u64 size)
return KSuccess;
}
KResult InodeFile::chown(uid_t uid, gid_t gid)
KResult InodeFile::chown(FileDescription& description, uid_t uid, gid_t gid)
{
ASSERT(description.inode() == m_inode);
return VFS::the().chown(*m_inode, uid, gid);
}
KResult InodeFile::chmod(mode_t mode)
KResult InodeFile::chmod(FileDescription& description, mode_t mode)
{
ASSERT(description.inode() == m_inode);
return VFS::the().chmod(*m_inode, mode);
}