Kernel: Pass a Custody instead of Inode to VFS methods

VFS no longer deals with inodes in public API, only with custodies and file
descriptions. Talk directly to the file system if you need to operate on a
inode. In most cases you actually want to go though VFS, to get proper
permission check and other niceties. For this to work, you have to provide a
custody, which describes *how* you have opened the inode, not just what the
inode is.
This commit is contained in:
Sergey Bugaev 2020-05-28 17:41:04 +03:00 committed by Andreas Kling
parent a9946a99f2
commit 6af2418de7
Notes: sideshowbarker 2024-07-19 06:01:12 +09:00
3 changed files with 12 additions and 10 deletions

View file

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