struct fsxattr redefinition

Dave Chinner david at fromorbit.com
Wed May 18 18:34:42 CDT 2016


On Wed, May 18, 2016 at 03:44:46PM -0500, Eric Sandeen wrote:
> On 5/18/16 11:37 AM, Jeffrey Bastian wrote:
> > 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.
> 
> It seems best to me to include fs.h first.  That may not be written in
> stone, but it's at least common practice.
> 
> Having the same definition in both places, and guards going both ways,
> seems a little odd though.
> 
> Maybe xfsprogs' include/linux.h should just directly include
> the kernel's linux/fs.h at the top - would that make sense?

That's the easiest solution - stops people wasting even more time on
this.

Cheers,

Dave.
-- 
Dave Chinner
david at fromorbit.com



More information about the xfs mailing list