[PATCH] xfsprogs: guard fsxattr definition for newer kernels

Eric Sandeen sandeen at redhat.com
Tue Feb 9 11:40:57 CST 2016


After 334e580,
fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion

the file include/linux/fs.h now defines struct fsxattr.

It defines FS_IOC_FSGETXATTR as well, so use that to wrap
our local definition, and skip it if the kernel is providing
it so that we don't get multiple definitions.

Signed-off-by: Eric Sandeen <sandeen at redhat.com>
---

Should the kernel also #define HAVE_FSXATTR to help existing
xfsprogs-devel installations?

(And what if headers are included in the other order?  Should
we try to guard on the kernel side or no?)

diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h
index d8b733a..f4858df 100644
--- a/libxfs/xfs_fs.h
+++ b/libxfs/xfs_fs.h
@@ -37,8 +37,10 @@ struct dioattr {
 
 /*
  * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR.
+ * If FS_IOC_FSGETXATTR is defined, the kernel is now providing
+ * this structure definition.
  */
-#ifndef HAVE_FSXATTR
+#if (!defined(HAVE_FSXATTR) && !defined(FS_IOC_FSGETXATTR))
 struct fsxattr {
 	__u32		fsx_xflags;	/* xflags field value (get/set) */
 	__u32		fsx_extsize;	/* extsize field value (get/set)*/



More information about the xfs mailing list