summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/DevFS.cpp8
-rw-r--r--Kernel/FileSystem/DevFS.h12
-rw-r--r--Kernel/FileSystem/DevPtsFS.cpp4
-rw-r--r--Kernel/FileSystem/DevPtsFS.h4
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp16
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.h8
-rw-r--r--Kernel/FileSystem/FIFO.cpp4
-rw-r--r--Kernel/FileSystem/FIFO.h8
-rw-r--r--Kernel/FileSystem/File.h2
-rw-r--r--Kernel/FileSystem/FileDescription.cpp2
-rw-r--r--Kernel/FileSystem/FileDescription.h2
-rw-r--r--Kernel/FileSystem/ISO9660FileSystem.cpp4
-rw-r--r--Kernel/FileSystem/ISO9660FileSystem.h4
-rw-r--r--Kernel/FileSystem/Inode.h4
-rw-r--r--Kernel/FileSystem/InodeFile.cpp2
-rw-r--r--Kernel/FileSystem/InodeFile.h2
-rw-r--r--Kernel/FileSystem/InodeMetadata.h14
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp4
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.h4
-rw-r--r--Kernel/FileSystem/ProcFS.cpp4
-rw-r--r--Kernel/FileSystem/ProcFS.h4
-rw-r--r--Kernel/FileSystem/SysFS.cpp4
-rw-r--r--Kernel/FileSystem/SysFS.h4
-rw-r--r--Kernel/FileSystem/TmpFS.cpp4
-rw-r--r--Kernel/FileSystem/TmpFS.h4
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp12
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.h8
27 files changed, 76 insertions, 76 deletions
diff --git a/Kernel/FileSystem/DevFS.cpp b/Kernel/FileSystem/DevFS.cpp
index dd168196c5..d32e02f2d3 100644
--- a/Kernel/FileSystem/DevFS.cpp
+++ b/Kernel/FileSystem/DevFS.cpp
@@ -107,7 +107,7 @@ KResultOr<size_t> DevFSInode::write_bytes(off_t, size_t, const UserOrKernelBuffe
VERIFY_NOT_REACHED();
}
-KResultOr<NonnullRefPtr<Inode>> DevFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t)
+KResultOr<NonnullRefPtr<Inode>> DevFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
@@ -127,7 +127,7 @@ KResult DevFSInode::chmod(mode_t)
return EPERM;
}
-KResult DevFSInode::chown(uid_t, gid_t)
+KResult DevFSInode::chown(UserID, GroupID)
{
return EPERM;
}
@@ -253,7 +253,7 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::lookup(StringView name)
}
return ENOENT;
}
-KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(StringView name, mode_t mode, dev_t, uid_t, gid_t)
+KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(StringView name, mode_t mode, dev_t, UserID, GroupID)
{
MutexLocker locker(fs().m_lock);
@@ -325,7 +325,7 @@ DevFSDeviceInode::~DevFSDeviceInode()
{
}
-KResult DevFSDeviceInode::chown(uid_t uid, gid_t gid)
+KResult DevFSDeviceInode::chown(UserID uid, GroupID gid)
{
MutexLocker locker(m_inode_lock);
m_uid = uid;
diff --git a/Kernel/FileSystem/DevFS.h b/Kernel/FileSystem/DevFS.h
index a28ee5dde2..fb0a64ae1d 100644
--- a/Kernel/FileSystem/DevFS.h
+++ b/Kernel/FileSystem/DevFS.h
@@ -58,11 +58,11 @@ protected:
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual void flush_metadata() override;
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult add_child(Inode&, const StringView& name, mode_t) override;
virtual KResult remove_child(const StringView& name) override;
virtual KResult chmod(mode_t) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
virtual KResult truncate(u64) override;
};
@@ -80,13 +80,13 @@ private:
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer& buffer, FileDescription*) const override;
virtual InodeMetadata metadata() const override;
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
NonnullRefPtr<Device> m_attached_device;
NonnullOwnPtr<KString> m_name;
- uid_t m_uid { 0 };
- gid_t m_gid { 0 };
+ UserID m_uid { 0 };
+ GroupID m_gid { 0 };
};
class DevFSLinkInode : public DevFSInode {
@@ -147,7 +147,7 @@ public:
private:
explicit DevFSRootDirectoryInode(DevFS&);
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual InodeMetadata metadata() const override;
diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp
index 07f56d2e3f..555b2cbc88 100644
--- a/Kernel/FileSystem/DevPtsFS.cpp
+++ b/Kernel/FileSystem/DevPtsFS.cpp
@@ -160,7 +160,7 @@ KResult DevPtsFSInode::add_child(Inode&, const StringView&, mode_t)
return EROFS;
}
-KResultOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t)
+KResultOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
@@ -175,7 +175,7 @@ KResult DevPtsFSInode::chmod(mode_t)
return EROFS;
}
-KResult DevPtsFSInode::chown(uid_t, gid_t)
+KResult DevPtsFSInode::chown(UserID, GroupID)
{
return EROFS;
}
diff --git a/Kernel/FileSystem/DevPtsFS.h b/Kernel/FileSystem/DevPtsFS.h
index d89ab1dfe4..5e82671274 100644
--- a/Kernel/FileSystem/DevPtsFS.h
+++ b/Kernel/FileSystem/DevPtsFS.h
@@ -53,11 +53,11 @@ private:
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual void flush_metadata() override;
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult add_child(Inode&, const StringView& name, mode_t) override;
virtual KResult remove_child(const StringView& name) override;
virtual KResult chmod(mode_t) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
WeakPtr<SlavePTY> m_pty;
InodeMetadata m_metadata;
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index 9616eb04e0..4df65b7187 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -1176,7 +1176,7 @@ KResult Ext2FSInode::write_directory(Vector<Ext2FSDirectoryEntry>& entries)
return KSuccess;
}
-KResultOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t mode, dev_t dev, uid_t uid, gid_t gid)
+KResultOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
{
if (::is_directory(mode))
return fs().create_directory(*this, name, mode, uid, gid);
@@ -1539,7 +1539,7 @@ KResult Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_stat
return update_bitmap_block(bgd.bg_block_bitmap, bit_index, new_state, m_super_block.s_free_blocks_count, bgd.bg_free_blocks_count);
}
-KResult Ext2FS::create_directory(Ext2FSInode& parent_inode, const String& name, mode_t mode, uid_t uid, gid_t gid)
+KResult Ext2FS::create_directory(Ext2FSInode& parent_inode, const String& name, mode_t mode, UserID uid, GroupID gid)
{
MutexLocker locker(m_lock);
VERIFY(is_directory(mode));
@@ -1569,7 +1569,7 @@ KResult Ext2FS::create_directory(Ext2FSInode& parent_inode, const String& name,
return KSuccess;
}
-KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode, const String& name, mode_t mode, dev_t dev, uid_t uid, gid_t gid)
+KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode, const String& name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
{
if (name.length() > EXT2_NAME_LEN)
return ENAMETOOLONG;
@@ -1580,8 +1580,8 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode,
ext2_inode e2inode {};
auto now = kgettimeofday().to_truncated_seconds();
e2inode.i_mode = mode;
- e2inode.i_uid = uid;
- e2inode.i_gid = gid;
+ e2inode.i_uid = uid.value();
+ e2inode.i_gid = gid.value();
e2inode.i_size = 0;
e2inode.i_atime = now;
e2inode.i_ctime = now;
@@ -1740,13 +1740,13 @@ KResult Ext2FSInode::chmod(mode_t mode)
return KSuccess;
}
-KResult Ext2FSInode::chown(uid_t uid, gid_t gid)
+KResult Ext2FSInode::chown(UserID uid, GroupID gid)
{
MutexLocker locker(m_inode_lock);
if (m_raw_inode.i_uid == uid && m_raw_inode.i_gid == gid)
return KSuccess;
- m_raw_inode.i_uid = uid;
- m_raw_inode.i_gid = gid;
+ m_raw_inode.i_uid = uid.value();
+ m_raw_inode.i_gid = gid.value();
set_metadata_dirty(true);
return KSuccess;
}
diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h
index 8ef16a05f2..e116fbbc94 100644
--- a/Kernel/FileSystem/Ext2FileSystem.h
+++ b/Kernel/FileSystem/Ext2FileSystem.h
@@ -44,7 +44,7 @@ private:
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual void flush_metadata() override;
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, FileDescription*) override;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult add_child(Inode& child, const StringView& name, mode_t) override;
virtual KResult remove_child(const StringView& name) override;
virtual KResult set_atime(time_t) override;
@@ -53,7 +53,7 @@ private:
virtual KResult increment_link_count() override;
virtual KResult decrement_link_count() override;
virtual KResult chmod(mode_t) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
virtual KResult truncate(u64) override;
virtual KResultOr<int> get_block_address(int) override;
@@ -130,8 +130,8 @@ private:
virtual StringView class_name() const override { return "Ext2FS"sv; }
virtual Ext2FSInode& root_inode() override;
RefPtr<Inode> get_inode(InodeIdentifier) const;
- KResultOr<NonnullRefPtr<Inode>> create_inode(Ext2FSInode& parent_inode, const String& name, mode_t, dev_t, uid_t, gid_t);
- KResult create_directory(Ext2FSInode& parent_inode, const String& name, mode_t, uid_t, gid_t);
+ KResultOr<NonnullRefPtr<Inode>> create_inode(Ext2FSInode& parent_inode, const String& name, mode_t, dev_t, UserID, GroupID);
+ KResult create_directory(Ext2FSInode& parent_inode, const String& name, mode_t, UserID, GroupID);
virtual void flush_writes() override;
BlockIndex first_block_index() const;
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp
index 1572436cfa..0edad03aac 100644
--- a/Kernel/FileSystem/FIFO.cpp
+++ b/Kernel/FileSystem/FIFO.cpp
@@ -16,7 +16,7 @@ namespace Kernel {
static Atomic<int> s_next_fifo_id = 1;
-RefPtr<FIFO> FIFO::try_create(uid_t uid)
+RefPtr<FIFO> FIFO::try_create(UserID uid)
{
auto buffer = DoubleBuffer::try_create();
if (buffer)
@@ -65,7 +65,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction_blocking(FIFO::Di
return description;
}
-FIFO::FIFO(uid_t uid, NonnullOwnPtr<DoubleBuffer> buffer)
+FIFO::FIFO(UserID uid, NonnullOwnPtr<DoubleBuffer> buffer)
: m_buffer(move(buffer))
, m_uid(uid)
{
diff --git a/Kernel/FileSystem/FIFO.h b/Kernel/FileSystem/FIFO.h
index 4e7ae49725..84c35b7d44 100644
--- a/Kernel/FileSystem/FIFO.h
+++ b/Kernel/FileSystem/FIFO.h
@@ -24,10 +24,10 @@ public:
Writer
};
- static RefPtr<FIFO> try_create(uid_t);
+ static RefPtr<FIFO> try_create(UserID);
virtual ~FIFO() override;
- uid_t uid() const { return m_uid; }
+ UserID uid() const { return m_uid; }
KResultOr<NonnullRefPtr<FileDescription>> open_direction(Direction);
KResultOr<NonnullRefPtr<FileDescription>> open_direction_blocking(Direction);
@@ -49,13 +49,13 @@ private:
virtual StringView class_name() const override { return "FIFO"; }
virtual bool is_fifo() const override { return true; }
- explicit FIFO(uid_t, NonnullOwnPtr<DoubleBuffer> buffer);
+ explicit FIFO(UserID, NonnullOwnPtr<DoubleBuffer> buffer);
unsigned m_writers { 0 };
unsigned m_readers { 0 };
NonnullOwnPtr<DoubleBuffer> m_buffer;
- uid_t m_uid { 0 };
+ UserID m_uid { 0 };
int m_fifo_id { 0 };
diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h
index 276a383747..d0b0574a89 100644
--- a/Kernel/FileSystem/File.h
+++ b/Kernel/FileSystem/File.h
@@ -95,7 +95,7 @@ public:
virtual String absolute_path(const FileDescription&) const = 0;
virtual KResult truncate(u64) { return EINVAL; }
- virtual KResult chown(FileDescription&, uid_t, gid_t) { return EBADF; }
+ virtual KResult chown(FileDescription&, UserID, GroupID) { return EBADF; }
virtual KResult chmod(FileDescription&, mode_t) { return EBADF; }
virtual StringView class_name() const = 0;
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 1bd5da16a0..d5c503de17 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -437,7 +437,7 @@ KResult FileDescription::chmod(mode_t mode)
return m_file->chmod(*this, mode);
}
-KResult FileDescription::chown(uid_t uid, gid_t gid)
+KResult FileDescription::chown(UserID uid, GroupID gid)
{
MutexLocker locker(m_lock);
return m_file->chown(*this, uid, gid);
diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h
index 6f2ddec7fb..3f1d67c93a 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -123,7 +123,7 @@ public:
off_t offset() const { return m_current_offset; }
- KResult chown(uid_t, gid_t);
+ KResult chown(UserID, GroupID);
FileBlockerSet& blocker_set();
diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp
index 35b6eddbfd..5afb80c2d9 100644
--- a/Kernel/FileSystem/ISO9660FileSystem.cpp
+++ b/Kernel/FileSystem/ISO9660FileSystem.cpp
@@ -565,7 +565,7 @@ KResultOr<size_t> ISO9660Inode::write_bytes(off_t, size_t, const UserOrKernelBuf
return EROFS;
}
-KResultOr<NonnullRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev_t, uid_t, gid_t)
+KResultOr<NonnullRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
@@ -585,7 +585,7 @@ KResult ISO9660Inode::chmod(mode_t)
return EROFS;
}
-KResult ISO9660Inode::chown(uid_t, gid_t)
+KResult ISO9660Inode::chown(UserID, GroupID)
{
return EROFS;
}
diff --git a/Kernel/FileSystem/ISO9660FileSystem.h b/Kernel/FileSystem/ISO9660FileSystem.h
index b11aba3893..042edd9738 100644
--- a/Kernel/FileSystem/ISO9660FileSystem.h
+++ b/Kernel/FileSystem/ISO9660FileSystem.h
@@ -353,11 +353,11 @@ public:
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual void flush_metadata() override;
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult add_child(Inode&, const StringView& name, mode_t) override;
virtual KResult remove_child(const StringView& name) override;
virtual KResult chmod(mode_t) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
virtual KResult truncate(u64) override;
virtual KResult set_atime(time_t) override;
virtual KResult set_ctime(time_t) override;
diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h
index 0584a25b13..b1135b2e70 100644
--- a/Kernel/FileSystem/Inode.h
+++ b/Kernel/FileSystem/Inode.h
@@ -55,11 +55,11 @@ public:
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const = 0;
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) = 0;
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, FileDescription*) = 0;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) = 0;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0;
virtual KResult add_child(Inode&, const StringView& name, mode_t) = 0;
virtual KResult remove_child(const StringView& name) = 0;
virtual KResult chmod(mode_t) = 0;
- virtual KResult chown(uid_t, gid_t) = 0;
+ virtual KResult chown(UserID, GroupID) = 0;
virtual KResult truncate(u64) { return KSuccess; }
virtual KResultOr<NonnullRefPtr<Custody>> resolve_as_link(Custody& base, RefPtr<Custody>* out_parent, int options, int symlink_recursion_level) const;
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp
index 93ab6e67ce..94b8730e50 100644
--- a/Kernel/FileSystem/InodeFile.cpp
+++ b/Kernel/FileSystem/InodeFile.cpp
@@ -127,7 +127,7 @@ KResult InodeFile::truncate(u64 size)
return KSuccess;
}
-KResult InodeFile::chown(FileDescription& description, uid_t uid, gid_t gid)
+KResult InodeFile::chown(FileDescription& description, UserID uid, GroupID gid)
{
VERIFY(description.inode() == m_inode);
VERIFY(description.custody());
diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h
index d60cc1584d..cc16047dc4 100644
--- a/Kernel/FileSystem/InodeFile.h
+++ b/Kernel/FileSystem/InodeFile.h
@@ -39,7 +39,7 @@ public:
virtual String absolute_path(const FileDescription&) const override;
virtual KResult truncate(u64) override;
- virtual KResult chown(FileDescription&, uid_t, gid_t) override;
+ virtual KResult chown(FileDescription&, UserID, GroupID) override;
virtual KResult chmod(FileDescription&, mode_t) override;
virtual StringView class_name() const override { return "InodeFile"; }
diff --git a/Kernel/FileSystem/InodeMetadata.h b/Kernel/FileSystem/InodeMetadata.h
index 0b3c060d06..1e029f1cc3 100644
--- a/Kernel/FileSystem/InodeMetadata.h
+++ b/Kernel/FileSystem/InodeMetadata.h
@@ -38,7 +38,7 @@ struct InodeMetadata {
bool may_write(const Process&) const;
bool may_execute(const Process&) const;
- bool may_read(uid_t u, gid_t g, Span<const gid_t> eg) const
+ bool may_read(UserID u, GroupID g, Span<GroupID const> eg) const
{
if (u == 0)
return true;
@@ -49,7 +49,7 @@ struct InodeMetadata {
return mode & S_IROTH;
}
- bool may_write(uid_t u, gid_t g, Span<const gid_t> eg) const
+ bool may_write(UserID u, GroupID g, Span<GroupID const> eg) const
{
if (u == 0)
return true;
@@ -60,7 +60,7 @@ struct InodeMetadata {
return mode & S_IWOTH;
}
- bool may_execute(uid_t u, gid_t g, Span<const gid_t> eg) const
+ bool may_execute(UserID u, GroupID g, Span<GroupID const> eg) const
{
if (u == 0)
return true;
@@ -91,8 +91,8 @@ struct InodeMetadata {
buffer.st_ino = inode.index().value();
buffer.st_mode = mode;
buffer.st_nlink = link_count;
- buffer.st_uid = uid;
- buffer.st_gid = gid;
+ buffer.st_uid = uid.value();
+ buffer.st_gid = gid.value();
buffer.st_dev = 0; // FIXME
buffer.st_size = size;
buffer.st_blksize = block_size;
@@ -109,8 +109,8 @@ struct InodeMetadata {
InodeIdentifier inode;
off_t size { 0 };
mode_t mode { 0 };
- uid_t uid { 0 };
- gid_t gid { 0 };
+ UserID uid { 0 };
+ GroupID gid { 0 };
nlink_t link_count { 0 };
time_t atime { 0 };
time_t ctime { 0 };
diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp
index 82eda6c882..2d0c23df81 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -934,7 +934,7 @@ KResultOr<NonnullRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
return Plan9FSInode::create(fs(), newfid);
}
-KResultOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t)
+KResultOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
// TODO
return ENOTIMPL;
@@ -958,7 +958,7 @@ KResult Plan9FSInode::chmod(mode_t)
return ENOTIMPL;
}
-KResult Plan9FSInode::chown(uid_t, gid_t)
+KResult Plan9FSInode::chown(UserID, GroupID)
{
// TODO
return ENOTIMPL;
diff --git a/Kernel/FileSystem/Plan9FileSystem.h b/Kernel/FileSystem/Plan9FileSystem.h
index a101ebfe2f..79f3fdd0b0 100644
--- a/Kernel/FileSystem/Plan9FileSystem.h
+++ b/Kernel/FileSystem/Plan9FileSystem.h
@@ -160,11 +160,11 @@ public:
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, FileDescription*) override;
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult add_child(Inode&, const StringView& name, mode_t) override;
virtual KResult remove_child(const StringView& name) override;
virtual KResult chmod(mode_t) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
virtual KResult truncate(u64) override;
private:
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index 5af24f0f6a..3174af40e9 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -83,7 +83,7 @@ KResult ProcFSInode::add_child(Inode&, const StringView&, mode_t)
return EROFS;
}
-KResultOr<NonnullRefPtr<Inode>> ProcFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t)
+KResultOr<NonnullRefPtr<Inode>> ProcFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
@@ -98,7 +98,7 @@ KResult ProcFSInode::chmod(mode_t)
return EPERM;
}
-KResult ProcFSInode::chown(uid_t, gid_t)
+KResult ProcFSInode::chown(UserID, GroupID)
{
return EPERM;
}
diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h
index d5676f8c2d..ae77b6c76e 100644
--- a/Kernel/FileSystem/ProcFS.h
+++ b/Kernel/FileSystem/ProcFS.h
@@ -57,11 +57,11 @@ protected:
virtual KResult attach(FileDescription& description) = 0;
virtual void did_seek(FileDescription&, off_t) = 0;
virtual void flush_metadata() override final;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override final;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override final;
virtual KResult add_child(Inode&, const StringView& name, mode_t) override final;
virtual KResult remove_child(const StringView& name) override final;
virtual KResult chmod(mode_t) override final;
- virtual KResult chown(uid_t, gid_t) override final;
+ virtual KResult chown(UserID, GroupID) override final;
virtual KResult truncate(u64) override final;
};
diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp
index 54503162e5..ed925c93b8 100644
--- a/Kernel/FileSystem/SysFS.cpp
+++ b/Kernel/FileSystem/SysFS.cpp
@@ -133,7 +133,7 @@ KResultOr<size_t> SysFSInode::write_bytes(off_t offset, size_t count, UserOrKern
return m_associated_component->write_bytes(offset, count, buffer, fd);
}
-KResultOr<NonnullRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t)
+KResultOr<NonnullRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
@@ -153,7 +153,7 @@ KResult SysFSInode::chmod(mode_t)
return EPERM;
}
-KResult SysFSInode::chown(uid_t, gid_t)
+KResult SysFSInode::chown(UserID, GroupID)
{
return EPERM;
}
diff --git a/Kernel/FileSystem/SysFS.h b/Kernel/FileSystem/SysFS.h
index 94f4ed8e65..32c441df5a 100644
--- a/Kernel/FileSystem/SysFS.h
+++ b/Kernel/FileSystem/SysFS.h
@@ -89,11 +89,11 @@ protected:
virtual void flush_metadata() override;
virtual InodeMetadata metadata() const override;
virtual KResultOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, FileDescription*) override;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult add_child(Inode&, StringView const& name, mode_t) override;
virtual KResult remove_child(StringView const& name) override;
virtual KResult chmod(mode_t) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
virtual KResult truncate(u64) override;
NonnullRefPtr<SysFSComponent> m_associated_component;
diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp
index fab03a460d..1f8454dd1c 100644
--- a/Kernel/FileSystem/TmpFS.cpp
+++ b/Kernel/FileSystem/TmpFS.cpp
@@ -249,7 +249,7 @@ KResult TmpFSInode::chmod(mode_t mode)
return KSuccess;
}
-KResult TmpFSInode::chown(uid_t uid, gid_t gid)
+KResult TmpFSInode::chown(UserID uid, GroupID gid)
{
MutexLocker locker(m_inode_lock);
@@ -259,7 +259,7 @@ KResult TmpFSInode::chown(uid_t uid, gid_t gid)
return KSuccess;
}
-KResultOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(StringView name, mode_t mode, dev_t dev, uid_t uid, gid_t gid)
+KResultOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
{
MutexLocker locker(m_inode_lock);
diff --git a/Kernel/FileSystem/TmpFS.h b/Kernel/FileSystem/TmpFS.h
index 611a59d293..bc84dbcbf2 100644
--- a/Kernel/FileSystem/TmpFS.h
+++ b/Kernel/FileSystem/TmpFS.h
@@ -58,11 +58,11 @@ public:
virtual KResultOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual void flush_metadata() override;
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override;
- virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override;
+ virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual KResult add_child(Inode&, const StringView& name, mode_t) override;
virtual KResult remove_child(const StringView& name) override;
virtual KResult chmod(mode_t) override;
- virtual KResult chown(uid_t, gid_t) override;
+ virtual KResult chown(UserID, GroupID) override;
virtual KResult truncate(u64) override;
virtual KResult set_atime(time_t) override;
virtual KResult set_ctime(time_t) override;
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index 8bba5d1f98..1d8d319081 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -370,8 +370,8 @@ KResultOr<NonnullRefPtr<FileDescription>> VirtualFileSystem::create(StringView p
return EROFS;
dbgln_if(VFS_DEBUG, "VirtualFileSystem::create: '{}' in {}", basename, parent_inode.identifier());
- uid_t uid = owner.has_value() ? owner.value().uid : current_process.euid();
- gid_t gid = owner.has_value() ? owner.value().gid : current_process.egid();
+ auto uid = owner.has_value() ? owner.value().uid : current_process.euid();
+ auto gid = owner.has_value() ? owner.value().gid : current_process.egid();
auto inode_or_error = parent_inode.create_child(basename, mode, 0, uid, gid);
if (inode_or_error.is_error())
return inode_or_error.error();
@@ -582,7 +582,7 @@ KResult VirtualFileSystem::rename(StringView old_path, StringView new_path, Cust
return KSuccess;
}
-KResult VirtualFileSystem::chown(Custody& custody, uid_t a_uid, gid_t a_gid)
+KResult VirtualFileSystem::chown(Custody& custody, UserID a_uid, GroupID a_gid)
{
auto& inode = custody.inode();
auto metadata = inode.metadata();
@@ -591,8 +591,8 @@ KResult VirtualFileSystem::chown(Custody& custody, uid_t a_uid, gid_t a_gid)
if (current_process.euid() != metadata.uid && !current_process.is_superuser())
return EPERM;
- uid_t new_uid = metadata.uid;
- gid_t new_gid = metadata.gid;
+ UserID new_uid = metadata.uid;
+ GroupID new_gid = metadata.gid;
if (a_uid != (uid_t)-1) {
if (current_process.euid() != a_uid && !current_process.is_superuser())
@@ -619,7 +619,7 @@ KResult VirtualFileSystem::chown(Custody& custody, uid_t a_uid, gid_t a_gid)
return inode.chown(new_uid, new_gid);
}
-KResult VirtualFileSystem::chown(StringView path, uid_t a_uid, gid_t a_gid, Custody& base)
+KResult VirtualFileSystem::chown(StringView path, UserID a_uid, GroupID a_gid, Custody& base)
{
auto custody_or_error = resolve_path(path, base);
if (custody_or_error.is_error())
diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h
index 9218b50146..d4695174fa 100644
--- a/Kernel/FileSystem/VirtualFileSystem.h
+++ b/Kernel/FileSystem/VirtualFileSystem.h
@@ -29,8 +29,8 @@ namespace Kernel {
#define O_UNLINK_INTERNAL (1 << 30)
struct UidAndGid {
- uid_t uid;
- gid_t gid;
+ UserID uid;
+ GroupID gid;
};
class VirtualFileSystem {
@@ -57,8 +57,8 @@ public:
KResult rmdir(StringView path, Custody& base);
KResult chmod(StringView path, mode_t, Custody& base);
KResult chmod(Custody&, mode_t);
- KResult chown(StringView path, uid_t, gid_t, Custody& base);
- KResult chown(Custody&, uid_t, gid_t);
+ KResult chown(StringView path, UserID, GroupID, Custody& base);
+ KResult chown(Custody&, UserID, GroupID);
KResult access(StringView path, int mode, Custody& base);
KResultOr<InodeMetadata> lookup_metadata(StringView path, Custody& base, int options = 0);
KResult utime(StringView path, Custody& base, time_t atime, time_t mtime);