1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:57:44 +00:00

Kernel: Make major and minor numbers to be DistinctNumerics

This helps avoid confusion in general, and make constructors, methods
and code patterns much more clean and understandable.
This commit is contained in:
Liav A 2021-12-23 20:08:18 +02:00 committed by Andreas Kling
parent 6d14940053
commit 9eb08bdb0f
24 changed files with 70 additions and 52 deletions

View file

@ -20,6 +20,7 @@
#include <AK/HashMap.h>
#include <AK/RefPtr.h>
#include <Kernel/Devices/AsyncDeviceRequest.h>
#include <Kernel/FileSystem/DeviceFileTypes.h>
#include <Kernel/FileSystem/File.h>
#include <Kernel/FileSystem/SysFS.h>
#include <Kernel/Locking/Mutex.h>
@ -37,8 +38,8 @@ protected:
public:
virtual ~Device() override;
unsigned major() const { return m_major; }
unsigned minor() const { return m_minor; }
MajorNumber major() const { return m_major; }
MinorNumber minor() const { return m_minor; }
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
@ -63,13 +64,13 @@ public:
}
protected:
Device(unsigned major, unsigned minor);
Device(MajorNumber major, MinorNumber minor);
void set_uid(UserID uid) { m_uid = uid; }
void set_gid(GroupID gid) { m_gid = gid; }
private:
unsigned m_major { 0 };
unsigned m_minor { 0 };
MajorNumber m_major { 0 };
MinorNumber m_minor { 0 };
UserID m_uid { 0 };
GroupID m_gid { 0 };