diff options
Diffstat (limited to 'Kernel/FileSystem/InodeMetadata.h')
-rw-r--r-- | Kernel/FileSystem/InodeMetadata.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Kernel/FileSystem/InodeMetadata.h b/Kernel/FileSystem/InodeMetadata.h index 95bfba8367..1dc23b6d72 100644 --- a/Kernel/FileSystem/InodeMetadata.h +++ b/Kernel/FileSystem/InodeMetadata.h @@ -8,6 +8,7 @@ #include <AK/Error.h> #include <AK/Span.h> +#include <Kernel/FileSystem/DeviceFileTypes.h> #include <Kernel/FileSystem/InodeIdentifier.h> #include <Kernel/Forward.h> #include <Kernel/UnixTypes.h> @@ -16,12 +17,12 @@ namespace Kernel { class Process; -constexpr u32 encoded_device(unsigned major, unsigned minor) +constexpr u64 encoded_device(MajorNumber major, MinorNumber minor) { - return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); + return (minor.value() & 0xff) | (major.value() << 8) | ((minor.value() & ~0xff) << 12); } -static inline unsigned int major_from_encoded_device(dev_t dev) { return (dev & 0xfff00u) >> 8u; } -static inline unsigned int minor_from_encoded_device(dev_t dev) { return (dev & 0xffu) | ((dev >> 12u) & 0xfff00u); } +static inline MajorNumber major_from_encoded_device(dev_t dev) { return (dev & 0xfff00u) >> 8u; } +static inline MinorNumber minor_from_encoded_device(dev_t dev) { return (dev & 0xffu) | ((dev >> 12u) & 0xfff00u); } inline bool is_directory(mode_t mode) { return (mode & S_IFMT) == S_IFDIR; } inline bool is_character_device(mode_t mode) { return (mode & S_IFMT) == S_IFCHR; } @@ -122,8 +123,8 @@ struct InodeMetadata { time_t dtime { 0 }; blkcnt_t block_count { 0 }; blksize_t block_size { 0 }; - unsigned major_device { 0 }; - unsigned minor_device { 0 }; + MajorNumber major_device { 0 }; + MinorNumber minor_device { 0 }; }; } |