1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

Kernel: Allow passing initial UID and GID when creating new inodes

If we're creating something that should have a different owner than the
current process's UID/GID, we need to plumb that all the way through
VFS down to the FS functions.
This commit is contained in:
Andreas Kling 2020-01-03 20:13:21 +01:00
parent 82760998a9
commit 4abbedb6e4
11 changed files with 41 additions and 33 deletions

View file

@ -31,6 +31,11 @@ class Custody;
class Device;
class FileDescription;
struct UidAndGid {
uid_t uid;
gid_t gid;
};
class VFS {
AK_MAKE_ETERNAL
public:
@ -62,8 +67,8 @@ public:
KResult mount(NonnullRefPtr<FS>&&, Custody& mount_point);
KResult unmount(InodeIdentifier guest_inode_id);
KResultOr<NonnullRefPtr<FileDescription>> open(StringView path, int options, mode_t mode, Custody& base);
KResultOr<NonnullRefPtr<FileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody);
KResultOr<NonnullRefPtr<FileDescription>> open(StringView path, int options, mode_t mode, Custody& base, Optional<UidAndGid> = {});
KResultOr<NonnullRefPtr<FileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody, Optional<UidAndGid> = {});
KResult mkdir(StringView path, mode_t mode, Custody& base);
KResult link(StringView old_path, StringView new_path, Custody& base);
KResult unlink(StringView path, Custody& base);