build: avoid struct fsxattr redefinition
authorJeffrey Bastian <jbastian@redhat.com>
Wed, 18 May 2016 17:40:54 +0000 (12:40 -0500)
committerEryu Guan <eguan@redhat.com>
Wed, 15 Jun 2016 07:28:46 +0000 (15:28 +0800)
Linux kernel v4.5 defines 'struct fsxattr' in linux/fs.h [0] but
it's still defined in xfs/linux.h as a backup [1].  If the files are
included in the wrong order, the compiler will complain with a
redefinition error.  This patch moves linux/fs.h (and linux/magic.h)
before the xfs headers for the t_immutable.c and fsstress.c tests.

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=334e580a6f97e
[1] http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/cmds/xfsprogs.git;a=blob;f=include/linux.h;h=cc0f70ceed72#l183

Signed-off-by: Jeffrey Bastian <jbastian@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
ltp/fsstress.c
src/t_immutable.c

index 1e6c913294aed6ae50f88ca67c2127e84a6d8ed8..7e7cf608f5f389b8167ffdb4b12c29765f505940 100644 (file)
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/fs.h>
 #include "global.h"
 
 #ifdef HAVE_ATTR_XATTR_H
@@ -34,7 +35,6 @@
 #include <sys/prctl.h>
 #endif
 
-#include <linux/fs.h>
 #ifndef FS_IOC_GETFLAGS
 #define FS_IOC_GETFLAGS                 _IOR('f', 1, long)
 #endif
index 87ffc75f2d0229941ad6c5235ce9deea272d66c9..7fd9e5dd96251f41a7435c9ddfa0dab1544807eb 100644 (file)
 #include <libgen.h>
 #include <sys/acl.h>
 #include <attr/xattr.h>
+#include <linux/fs.h>
+#include <linux/magic.h>
 #include <xfs/xfs.h>
 #include <xfs/handle.h>
 #include <xfs/jdm.h>
-#include <linux/fs.h>
-#include <linux/magic.h>
 
 #ifndef XFS_SUPER_MAGIC
 #define XFS_SUPER_MAGIC 0x58465342