summaryrefslogtreecommitdiff
path: root/Kernel/Devices/Device.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-28 22:11:16 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-29 01:09:19 +0200
commitae197deb6b076fb7b49bb035cfb3e4f8304004cb (patch)
treeb8c17f95b575be4453626c983c59e0a1c59a3658 /Kernel/Devices/Device.h
parent59335bd8eaf7c4f11bb5a9ab96373dfe8eca0893 (diff)
downloadserenity-ae197deb6b076fb7b49bb035cfb3e4f8304004cb.zip
Kernel: Strongly typed user & group ID's
Prior to this change, both uid_t and gid_t were typedef'ed to `u32`. This made it easy to use them interchangeably. Let's not allow that. This patch adds UserID and GroupID using the AK::DistinctNumeric mechanism we've already been employing for pid_t/ProcessID.
Diffstat (limited to 'Kernel/Devices/Device.h')
-rw-r--r--Kernel/Devices/Device.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/Devices/Device.h b/Kernel/Devices/Device.h
index 95459c8eca..c7c4048bff 100644
--- a/Kernel/Devices/Device.h
+++ b/Kernel/Devices/Device.h
@@ -34,8 +34,8 @@ public:
virtual String absolute_path(const FileDescription&) const override;
virtual String absolute_path() const;
- uid_t uid() const { return m_uid; }
- uid_t gid() const { return m_gid; }
+ UserID uid() const { return m_uid; }
+ GroupID gid() const { return m_gid; }
virtual mode_t required_mode() const = 0;
virtual String device_name() const = 0;
@@ -62,16 +62,16 @@ public:
protected:
Device(unsigned major, unsigned minor);
- void set_uid(uid_t uid) { m_uid = uid; }
- void set_gid(gid_t gid) { m_gid = gid; }
+ void set_uid(UserID uid) { m_uid = uid; }
+ void set_gid(GroupID gid) { m_gid = gid; }
static HashMap<u32, Device*>& all_devices();
private:
unsigned m_major { 0 };
unsigned m_minor { 0 };
- uid_t m_uid { 0 };
- gid_t m_gid { 0 };
+ UserID m_uid { 0 };
+ GroupID m_gid { 0 };
Spinlock<u8> m_requests_lock;
DoublyLinkedList<RefPtr<AsyncDeviceRequest>> m_requests;