summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-04-04 11:08:23 +0300
committerThomas Weißschuh <linux@weissschuh.net>2026-04-04 11:29:07 +0300
commit867fb336a65ac59260674382168d2d93896ffa8d (patch)
tree5e198fff1f7228ada8d35ac0b92b9d44b88c1510 /tools
parent572246dcddb5455d62d5d152fe31105542b10ff5 (diff)
downloadlinux-867fb336a65ac59260674382168d2d93896ffa8d.tar.xz
tools/nolibc: use makedev() in fstatat()
fstatat() contains two open-coded copies of makedev() to handle minor numbers >= 256. Now that the regular makedev() handles both large minor and major numbers correctly use the common function. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-6-456a429bf60c@weissschuh.net
Diffstat (limited to 'tools')
-rw-r--r--tools/include/nolibc/sys/stat.h9
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;