[LTP] [PATCH v6 2/7] fs: add struct fsxattr fallback definitions
Andrea Cervesato
andrea.cervesato@suse.de
Thu Aug 7 09:01:40 CEST 2025
From: Andrea Cervesato <andrea.cervesato@suse.com>
Add strut fsxattr fallback, as well as FS_IOC_FSGETFLAGS and
FS_IOC_FSSETFLAGS.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
configure.ac | 3 +++
include/lapi/fs.h | 22 +++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 12025be51c865719b68c06ec3c286210dafbfa43..8b506e43f8c8549f6dc9cbc4154db2be95851e59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,7 @@ AC_CHECK_HEADERS_ONCE([ \
linux/cryptouser.h \
linux/close_range.h \
linux/dccp.h \
+ linux/fs.h \
linux/futex.h \
linux/genetlink.h \
linux/genhd.h \
@@ -264,6 +265,8 @@ AC_CHECK_TYPES([struct statmount],,,[#include <sys/mount.h>])
AC_CHECK_TYPES([struct pidfd_info],,,[#include <sys/pidfd.h>])
+AC_CHECK_TYPES([struct fsxattr],,,[#include <linux/fs.h>])
+
# Tools knobs
# Bash
diff --git a/include/lapi/fs.h b/include/lapi/fs.h
index 8261ca41dab7d01ea5e7dc9d65e3d5604013cd46..44f299149abd9415c243b2052b93f1524442beb7 100644
--- a/include/lapi/fs.h
+++ b/include/lapi/fs.h
@@ -10,14 +10,26 @@
#define LAPI_FS_H__
#include "config.h"
-#ifndef HAVE_MOUNT_SETATTR
+#ifndef HAVE_LINUX_FS
# include <linux/fs.h>
#endif
+#include <stdint.h>
#include <sys/user.h>
#include <limits.h>
#include "lapi/abisize.h"
+#ifndef HAVE_STRUCT_FSXATTR
+struct fsxattr {
+ uint32_t fsx_xflags; /* xflags field value (get/set) */
+ uint32_t fsx_extsize; /* extsize field value (get/set)*/
+ uint32_t fsx_nextents; /* nextents field value (get) */
+ uint32_t fsx_projid; /* project identifier (get/set) */
+ uint32_t fsx_cowextsize; /* CoW extsize field value (get/set)*/
+ unsigned char fsx_pad[8];
+};
+#endif
+
#ifndef FS_IOC_GETFLAGS
# define FS_IOC_GETFLAGS _IOR('f', 1, long)
#endif
@@ -26,6 +38,14 @@
# define FS_IOC_SETFLAGS _IOW('f', 2, long)
#endif
+#ifndef FS_IOC_FSGETXATTR
+# define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr)
+#endif
+
+#ifndef FS_IOC_FSSETXATTR
+# define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
+#endif
+
#ifndef FS_COMPR_FL
# define FS_COMPR_FL 0x00000004 /* Compress file */
#endif
--
2.50.1
More information about the ltp
mailing list