Re: struct fsxattr redefinition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

-Eric

> [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
> 

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux