]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: add autoconf mechanism to override system header fsxattr
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Oct 2016 22:14:32 +0000 (15:14 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 26 Oct 2016 18:14:48 +0000 (11:14 -0700)
By default, libxfs will use the kernel/system headers to define struct
fsxattr.  Unfortunately, this creates a problem for developers who are
writing new features but building xfsprogs on a stable system, because
the stable kernel's headers don't reflect the new feature.  In this
case, we want to be able to use the internal fsxattr definition while
the kernel headers catch up, so provide some configure magic to allow
further patches to force the use of the internal definition.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: Remove the user-visible configure option but leave the fsxattr
override ability so that subsequent patches can trigger it if
necessary.

configure.ac
include/builddefs.in
include/linux.h
io/fiemap.c
m4/package_libcdev.m4

index 50e04dfd93c27de0a85b29b2a3dc8a71cec6c084..ee918d1310194f0fa75897e37bef59545b43915e 100644 (file)
@@ -129,6 +129,7 @@ AC_HAVE_FLS
 AC_HAVE_READDIR
 AC_HAVE_FSETXATTR
 AC_HAVE_MREMAP
+AC_NEED_INTERNAL_FSXATTR
 
 if test "$enable_blkid" = yes; then
 AC_HAVE_BLKID_TOPO
index 7153d7a76132140596055dbd29c95a67c565e14c..317adc613af90b71bf8cea4a060d617a063a202d 100644 (file)
@@ -109,6 +109,7 @@ HAVE_MNTENT = @have_mntent@
 HAVE_FLS = @have_fls@
 HAVE_FSETXATTR = @have_fsetxattr@
 HAVE_MREMAP = @have_mremap@
+NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@
 
 GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
 #         -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
@@ -148,6 +149,9 @@ endif
 ifeq ($(ENABLE_BLKID),yes)
 PCFLAGS+= -DENABLE_BLKID
 endif
+ifeq ($(NEED_INTERNAL_FSXATTR),yes)
+PCFLAGS+= -DOVERRIDE_SYSTEM_FSXATTR
+endif
 
 
 GCFLAGS = $(OPTIMIZER) $(DEBUG) \
index ddc053e0ee2a6f63c840c03a792da46beef8c172..e26388b2e28a25f2abf798d5e104d0a4ec3353a3 100644 (file)
 #include <stdio.h>
 #include <asm/types.h>
 #include <mntent.h>
+#ifdef OVERRIDE_SYSTEM_FSXATTR
+# define fsxattr sys_fsxattr
+#endif
 #include <linux/fs.h> /* fsxattr defintion for new kernels */
+#ifdef OVERRIDE_SYSTEM_FSXATTR
+# undef fsxattr
+#endif
 
 static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
 {
@@ -175,7 +181,7 @@ static inline void platform_mntent_close(struct mntent_cursor * cursor)
  * are a copy of the definitions moved to linux/uapi/fs.h in the 4.5 kernel,
  * so this is purely for supporting builds against old kernel headers.
  */
-#ifndef FS_IOC_FSGETXATTR
+#if !defined FS_IOC_FSGETXATTR || defined OVERRIDE_SYSTEM_FSXATTR
 struct fsxattr {
        __u32           fsx_xflags;     /* xflags field value (get/set) */
        __u32           fsx_extsize;    /* extsize field value (get/set)*/
@@ -184,7 +190,9 @@ struct fsxattr {
        __u32           fsx_cowextsize; /* cow extsize field value (get/set) */
        unsigned char   fsx_pad[8];
 };
+#endif
 
+#ifndef FS_IOC_FSGETXATTR
 /*
  * Flags for the fsx_xflags field
  */
index f89da068e3258f411fbd12ae416a747ceb161485..bcbae49fe004f6bd5d4daf47d60d4defcfef0849 100644 (file)
@@ -19,7 +19,6 @@
 #include "platform_defs.h"
 #include "command.h"
 #include <linux/fiemap.h>
-#include <linux/fs.h>
 #include "init.h"
 #include "io.h"
 
index 7a847e91d482dadb773ece0dee7da2909d2ed8e4..e0a95e2d860cb1862b4648c0789e9f1887e8fde6 100644 (file)
@@ -265,3 +265,14 @@ AC_DEFUN([AC_HAVE_MREMAP],
        )
     AC_SUBST(have_mremap)
   ])
+
+#
+# Check if we need to override the system struct fsxattr with
+# the internal definition.  This /only/ happens if the system
+# actually defines struct fsxattr /and/ the system definition
+# is missing certain fields.
+#
+AC_DEFUN([AC_NEED_INTERNAL_FSXATTR],
+  [
+    AC_SUBST(need_internal_fsxattr)
+  ])