struct fsxattr redefinition

Jeffrey Bastian
2016-05-18T16:37:42Z

There was a discussion a few months ago about adding a guard for the
fsxattr struct [0] because it's defined in two places, the Linux kernel
header linux/fs.h [1] and xfsprogs header xfs/linux.h [2].

xfs/linux.h has a FS_IOC_FSGETXATTR guard around the struct fsxattr
definition, but this only works if linux/fs.h is included *before*
xfs/linux.h (or xfs/xfs.h). If you include linux/fs.h after, then you
get a struct redefinition error.

Is it a requirement that linux/fs.h is included first? If so, then
there is a bug in xfstests because it includes them in the wrong order
[3] and fails to build. If there is not an order requirement, then both
header files should probably have a HAVE_FSXATTR guard around the struct
definition.

[0] http://oss.sgi.com/archives/xfs/2016-02/msg00306.html
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fs.h?h=v4.6#n152
[2] http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/cmds/xfsprogs.git;a=blob;f=include/linux.h;h=cc0f70ceed72406822885d878b939b3e66c03ffd;hb=53cefc406eb1047ce9dc85906a0117f8da9f44ca#l177
[3] http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/cmds/xfstests.git;a=blob;f=src/t_immutable.c;h=87ffc75f2d0229941ad6c5235ce9deea272d66c9;hb=HEAD#l41

--
Jeff Bastian