kernel: Allow performing extra actions when opening an inode
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
05a0d912fa
commit
69a0600d45
@ -118,6 +118,11 @@ namespace VFS
|
||||
return err(EACCES);
|
||||
}
|
||||
|
||||
virtual Result<SharedPtr<Inode>> open()
|
||||
{
|
||||
return SharedPtr<Inode> { this };
|
||||
}
|
||||
|
||||
// Directory-specific methods
|
||||
virtual Result<SharedPtr<Inode>> find(const char* name) const = 0;
|
||||
|
||||
|
@ -62,6 +62,8 @@ Result<u64> sys_openat(Registers*, SyscallArgs args)
|
||||
if ((flags & O_WRONLY) && !VFS::can_write(inode, current->auth)) return err(EACCES);
|
||||
}
|
||||
|
||||
inode = TRY(inode->open());
|
||||
|
||||
// This should only be possible if O_NOFOLLOW was in flags.
|
||||
if (inode->type() == VFS::InodeType::Symlink) return err(ELOOP);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user