diff options
| -rw-r--r-- | tools/include/nolibc/sys/stat.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/include/nolibc/sys/stat.h b/tools/include/nolibc/sys/stat.h index b2ef34a617ca..07ae715ff253 100644 --- a/tools/include/nolibc/sys/stat.h +++ b/tools/include/nolibc/sys/stat.h @@ -13,6 +13,7 @@ #include "../arch.h" #include "../types.h" #include "../sys.h" +#include "../sys/sysmacros.h" /* * int statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf); @@ -49,17 +50,13 @@ int fstatat(int fd, const char *path, struct stat *buf, int flag) if (ret == -1) return ret; - buf->st_dev = ((statx.stx_dev_minor & 0xff) - | (statx.stx_dev_major << 8) - | ((statx.stx_dev_minor & ~0xff) << 12)); + buf->st_dev = makedev(statx.stx_dev_major, statx.stx_dev_minor); buf->st_ino = statx.stx_ino; buf->st_mode = statx.stx_mode; buf->st_nlink = statx.stx_nlink; buf->st_uid = statx.stx_uid; buf->st_gid = statx.stx_gid; - buf->st_rdev = ((statx.stx_rdev_minor & 0xff) - | (statx.stx_rdev_major << 8) - | ((statx.stx_rdev_minor & ~0xff) << 12)); + buf->st_rdev = makedev(statx.stx_rdev_major, statx.stx_rdev_minor); buf->st_size = statx.stx_size; buf->st_blksize = statx.stx_blksize; buf->st_blocks = statx.stx_blocks; |
