xfs
[Top] [All Lists]

Re: struct fsxattr redefinition

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: struct fsxattr redefinition
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 19 May 2016 09:34:42 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <237c0dad-b27a-7fa0-6283-2832ca00ac43@xxxxxxxxxxx>
References: <20160518163733.GB14165@xxxxxxxxxxxxxxxxxxxxx> <237c0dad-b27a-7fa0-6283-2832ca00ac43@xxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
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@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>