]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: move statx.h from io/ to libfrog/
authorDarrick J. Wong <djwong@kernel.org>
Tue, 1 Jul 2025 17:45:13 +0000 (10:45 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Fri, 18 Jul 2025 14:05:10 +0000 (16:05 +0200)
Move this header file so we can use the declaration and wrappers
in other parts of xfsprogs.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
io/stat.c
libfrog/Makefile
libfrog/statx.h [moved from io/statx.h with 96% similarity]

index c3a4bb15229ee5c6324717c7c77d167159ee9c01..46475df343470c1923137b2049eee3341359e189 100644 (file)
--- 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;
index b64ca4597f4ea903217f5ca92cb768a5e9c108d3..560bad417ee434b3bd7a2c66a45bdddab50f944d 100644 (file)
@@ -62,6 +62,7 @@ ptvar.h \
 radix-tree.h \
 randbytes.h \
 scrub.h \
+statx.h \
 workqueue.h
 
 GETTEXT_PY = \
similarity index 96%
rename from io/statx.h
rename to libfrog/statx.h
index f7ef1d2784a2a965354f58fc6025d4e1bfdee002..b76dfae21e709291c42f9eec1e5ee771e4b062f4 100644 (file)
@@ -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
 /*