diff mbox

[v2,2/3] xfs_quota: changes to accomodate hoisted ioctl defs

Message ID 1471356998-2876-3-git-send-email-billodo@redhat.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Bill O'Donnell Aug. 16, 2016, 2:16 p.m. UTC
The kernel commit to make the ioctl promotion (334e580a6f) moved
the definitions for the XFS ioctl to uapi/linux/fs.h for the
following reason:

    Hoist the ioctl definitions for the XFS_IOC_FS[SG]SETXATTR API
    from fs/xfs/libxfs/xfs_fs.h to include/uapi/linux/fs.h so that
    the ioctls can be used by all filesystems, not just XFS. This
    enables (initially) ext4 to use the ioctl to set project IDs on
    inodes.

This means we now need to handle this change in userspace as the
uapi/linux/fs.h file may not contain the definitions (i.e. new
xfsprogs/ old linux uapi files) xfsprogs needs to build. Hence we
need to massage the definition in xfs_fs.h to take the values from
the system header if it exists, otherwise keep the old definitions
for compatibility and platforms other than linux..

This patch was originally submitted by Dave Chinner
(http://oss.sgi.com/archives/xfs/2016-02/msg00108.html)

Resubmitting with changes to accomodate upstream changes since
initial submission.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
 libxfs/xfs_fs.h | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

Comments

Dave Chinner Aug. 22, 2016, 1:18 a.m. UTC | #1
On Tue, Aug 16, 2016 at 09:16:37AM -0500, Bill O'Donnell wrote:
> The kernel commit to make the ioctl promotion (334e580a6f) moved
> the definitions for the XFS ioctl to uapi/linux/fs.h for the
> following reason:
> 
>     Hoist the ioctl definitions for the XFS_IOC_FS[SG]SETXATTR API
>     from fs/xfs/libxfs/xfs_fs.h to include/uapi/linux/fs.h so that
>     the ioctls can be used by all filesystems, not just XFS. This
>     enables (initially) ext4 to use the ioctl to set project IDs on
>     inodes.
> 
> This means we now need to handle this change in userspace as the
> uapi/linux/fs.h file may not contain the definitions (i.e. new
> xfsprogs/ old linux uapi files) xfsprogs needs to build. Hence we
> need to massage the definition in xfs_fs.h to take the values from
> the system header if it exists, otherwise keep the old definitions
> for compatibility and platforms other than linux..
> 
> This patch was originally submitted by Dave Chinner
> (http://oss.sgi.com/archives/xfs/2016-02/msg00108.html)
> 
> Resubmitting with changes to accomodate upstream changes since
> initial submission.

This is unnecessary - the "include local version" changes were made
to the platform headers (e.g. include/linux.h) in commit 83f4b5a
("xfs_fs.h: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR
promotion").

Cheers,

Dave.
Bill O'Donnell Aug. 22, 2016, 1:16 p.m. UTC | #2
On Mon, Aug 22, 2016 at 11:18:12AM +1000, Dave Chinner wrote:
> On Tue, Aug 16, 2016 at 09:16:37AM -0500, Bill O'Donnell wrote:
> > The kernel commit to make the ioctl promotion (334e580a6f) moved
> > the definitions for the XFS ioctl to uapi/linux/fs.h for the
> > following reason:
> > 
> >     Hoist the ioctl definitions for the XFS_IOC_FS[SG]SETXATTR API
> >     from fs/xfs/libxfs/xfs_fs.h to include/uapi/linux/fs.h so that
> >     the ioctls can be used by all filesystems, not just XFS. This
> >     enables (initially) ext4 to use the ioctl to set project IDs on
> >     inodes.
> > 
> > This means we now need to handle this change in userspace as the
> > uapi/linux/fs.h file may not contain the definitions (i.e. new
> > xfsprogs/ old linux uapi files) xfsprogs needs to build. Hence we
> > need to massage the definition in xfs_fs.h to take the values from
> > the system header if it exists, otherwise keep the old definitions
> > for compatibility and platforms other than linux..
> > 
> > This patch was originally submitted by Dave Chinner
> > (http://oss.sgi.com/archives/xfs/2016-02/msg00108.html)
> > 
> > Resubmitting with changes to accomodate upstream changes since
> > initial submission.
> 
> This is unnecessary - the "include local version" changes were made
> to the platform headers (e.g. include/linux.h) in commit 83f4b5a
> ("xfs_fs.h: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR
> promotion").

Sorry, I missed that. I'll remove this patch on v3.
Thanks-
Bill

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
diff mbox

Patch

diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h
index 085ea6f..6ecb7f2 100644
--- a/libxfs/xfs_fs.h
+++ b/libxfs/xfs_fs.h
@@ -35,10 +35,41 @@  struct dioattr {
 };
 #endif
 
+/* check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves */
+#ifndef FS_IOC_FSGETXATTR
+struct fsxattr {
+	__u32		fsx_xflags;	/* xflags field value (get/set) */
+	__u32		fsx_extsize;	/* extsize field value (get/set)*/
+	__u32		fsx_projid;	/* project identifier (get/set) */
+	unsigned char	fsx_pad[12];
+};
+
+/*
+ * Flags for the fsx_xflags field
+ */
+#define FS_XFLAG_REALTIME	0x00000001	/* data in realtime volume */
+#define FS_XFLAG_PREALLOC	0x00000002	/* preallocated file extents */
+#define FS_XFLAG_IMMUTABLE	0x00000008	/* file cannot be modified */
+#define FS_XFLAG_APPEND		0x00000010	/* all writes append */
+#define FS_XFLAG_SYNC		0x00000020	/* all writes synchronous */
+#define FS_XFLAG_NOATIME	0x00000040	/* do not update access time */
+#define FS_XFLAG_NODUMP		0x00000080	/* do not include in backups */
+#define FS_XFLAG_RTINHERIT	0x00000100	/* create with rt bit set */
+#define FS_XFLAG_PROJINHERIT	0x00000200	/* create with parents projid */
+#define FS_XFLAG_NOSYMLINKS	0x00000400	/* disallow symlink creation */
+#define FS_XFLAG_EXTSIZE	0x00000800	/* extent size allocator hint */
+#define FS_XFLAG_EXTSZINHERIT	0x00001000	/* inherit inode extent size */
+#define FS_XFLAG_NODEFRAG	0x00002000	/* do not defragment */
+#define FS_XFLAG_FILESTREAM	0x00004000	/* use filestream allocator */
+#define FS_XFLAG_HASATTR	0x80000000	/* no DIFLAG for this	*/
+
+#define FS_IOC_FSGETXATTR     _IOR ('X', 31, struct fsxattr)
+#define FS_IOC_FSSETXATTR     _IOW ('X', 32, struct fsxattr)
+
+#endif
+
 /*
- * Flags for the bs_xflags/fsx_xflags field in XFS_IOC_FS[GS]ETXATTR[A]
- * These are for backwards compatibility only. New code should
- * use the kernel [4.5 onwards] defined FS_XFLAG_* definitions directly.
+ * Flags for the bs_xflags/fsx_xflags field in FS_IOC_FS[GS]ETXATTR[A]
  */
 #define	XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME
 #define	XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC