libfrog: move statx.h from io/ to libfrog/
Move this header file so we can use it elsewhere.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
diff --git a/io/stat.c b/io/stat.c
index c3a4bb1..46475df 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 @@
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 @@
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 b64ca45..560bad4 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile
@@ -62,6 +62,7 @@
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 95%
rename from io/statx.h
rename to libfrog/statx.h
index f7ef1d2..b76dfae 100644
--- a/io/statx.h
+++ b/libfrog/statx.h
@@ -146,7 +146,24 @@
__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
/*