From: Darrick J. Wong Date: Tue, 1 Jul 2025 17:45:13 +0000 (-0700) Subject: libfrog: move statx.h from io/ to libfrog/ X-Git-Tag: v6.16.0~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe8cfecb916fb1a3dc139bcd3f17d720188538de;p=thirdparty%2Fxfsprogs-dev.git libfrog: move statx.h from io/ to libfrog/ Move this header file so we can use the declaration and wrappers in other parts of xfsprogs. Signed-off-by: "Darrick J. Wong" Reviewed-by: John Garry --- diff --git a/io/stat.c b/io/stat.c index c3a4bb15..46475df3 100644 --- a/io/stat.c +++ b/io/stat.c @@ -14,7 +14,7 @@ #include "input.h" #include "init.h" #include "io.h" -#include "statx.h" +#include "libfrog/statx.h" #include "libxfs.h" #include "libfrog/logging.h" #include "libfrog/fsgeom.h" @@ -305,22 +305,6 @@ statfs_f( return 0; } -static ssize_t -_statx( - int dfd, - const char *filename, - unsigned int flags, - unsigned int mask, - struct statx *buffer) -{ -#ifdef __NR_statx - return syscall(__NR_statx, dfd, filename, flags, mask, buffer); -#else - errno = ENOSYS; - return -1; -#endif -} - struct statx_masks { const char *name; unsigned int mask; @@ -525,7 +509,7 @@ statx_f( return command_usage(&statx_cmd); memset(&stx, 0xbf, sizeof(stx)); - if (_statx(file->fd, "", atflag | AT_EMPTY_PATH, mask, &stx) < 0) { + if (statx(file->fd, "", atflag | AT_EMPTY_PATH, mask, &stx) < 0) { perror("statx"); exitcode = 1; return 0; diff --git a/libfrog/Makefile b/libfrog/Makefile index b64ca459..560bad41 100644 --- a/libfrog/Makefile +++ b/libfrog/Makefile @@ -62,6 +62,7 @@ ptvar.h \ radix-tree.h \ randbytes.h \ scrub.h \ +statx.h \ workqueue.h GETTEXT_PY = \ diff --git a/io/statx.h b/libfrog/statx.h similarity index 96% rename from io/statx.h rename to libfrog/statx.h index f7ef1d27..b76dfae2 100644 --- a/io/statx.h +++ b/libfrog/statx.h @@ -146,7 +146,24 @@ struct statx { __u64 __spare3[9]; /* Spare space for future expansion */ /* 0x100 */ }; + +static inline ssize_t +statx( + int dfd, + const char *filename, + unsigned int flags, + unsigned int mask, + struct statx *buffer) +{ +#ifdef __NR_statx + return syscall(__NR_statx, dfd, filename, flags, mask, buffer); +#else + errno = ENOSYS; + return -1; #endif +} + +#endif /* OVERRIDE_SYSTEM_STATX */ #ifndef STATX_TYPE /*