1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

Everywhere: Add serenity_dev_{makedev,major,minor}

Add them in `<Kernel/API/Device.h>` and use these to provides
`{makedev,major,minor}` in `<sys/sysmacros.h>`. It aims to be more in
line with other Unix implementations and avoid code duplication in user
land.
This commit is contained in:
Michel Hermier 2021-11-26 16:55:45 +01:00 committed by Andreas Kling
parent d4484f4de3
commit 69cabb3ead
7 changed files with 43 additions and 17 deletions

View file

@ -92,10 +92,6 @@ typedef struct __pthread_condattr_t {
int clockid; // clockid_t
} pthread_condattr_t;
static inline dev_t makedev(unsigned major, unsigned minor) { return (minor & 0xffu) | (major << 8u) | ((minor & ~0xffu) << 12u); }
static inline unsigned int major(dev_t dev) { return (dev & 0xfff00u) >> 8u; }
static inline unsigned int minor(dev_t dev) { return (dev & 0xffu) | ((dev >> 12u) & 0xfff00u); }
#ifdef __cplusplus
}
#endif