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.
Unified · Split
| @@ -36,38 +36,23 @@ struct dioattr { · 35 unmodified lines | |||
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | /* | 38 | /* |
| 39 | * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR. | 39 | * Flags for the bs_xflags/fsx_xflags field in FS_IOC_FS[GS]ETXATTR[A] |
| 40 | */ | 40 | */ |
| 41 | #ifndef HAVE_FSXATTR | 41 | #define XFS_XFLAG_REALTIME FS_XFLAG_REALTIME |
| 42 | struct fsxattr { | 42 | #define XFS_XFLAG_PREALLOC FS_XFLAG_PREALLOC |
| 43 | __u32 fsx_xflags; /* xflags field value (get/set) */ | 43 | #define XFS_XFLAG_IMMUTABLE FS_XFLAG_IMMUTABLE |
| 44 | __u32 fsx_extsize; /* extsize field value (get/set)*/ | 44 | #define XFS_XFLAG_APPEND FS_XFLAG_APPEND |
| 45 | __u32 fsx_nextents; /* nextents field value (get) */ | 45 | #define XFS_XFLAG_SYNC FS_XFLAG_SYNC |
| 46 | __u32 fsx_projid; /* project identifier (get/set) */ | 46 | #define XFS_XFLAG_NOATIME FS_XFLAG_NOATIME |
| 47 | unsigned char fsx_pad[12]; | 47 | #define XFS_XFLAG_NODUMP FS_XFLAG_NODUMP |
| 48 | }; | 48 | #define XFS_XFLAG_RTINHERIT FS_XFLAG_RTINHERIT |
| 49 | #endif | 49 | #define XFS_XFLAG_PROJINHERIT FS_XFLAG_PROJINHERIT |
| 50 | 50 | #define XFS_XFLAG_NOSYMLINKS FS_XFLAG_NOSYMLINKS | |
| 51 | /* | 51 | #define XFS_XFLAG_EXTSIZE FS_XFLAG_EXTSIZE |
| 52 | * Flags for the bs_xflags/fsx_xflags field | 52 | #define XFS_XFLAG_EXTSZINHERIT FS_XFLAG_EXTSZINHERIT |
| 53 | * There should be a one-to-one correspondence between these flags and the | 53 | #define XFS_XFLAG_NODEFRAG FS_XFLAG_NODEFRAG |
| 54 | * XFS_DIFLAG_s. | 54 | #define XFS_XFLAG_FILESTREAM FS_XFLAG_FILESTREAM |
| 55 | */ | 55 | #define XFS_XFLAG_HASATTR FS_XFLAG_HASATTR |
| 56 | #define XFS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ | ||
| 57 | #define XFS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ | ||
| 58 | #define XFS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ | ||
| 59 | #define XFS_XFLAG_APPEND 0x00000010 /* all writes append */ | ||
| 60 | #define XFS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ | ||
| 61 | #define XFS_XFLAG_NOATIME 0x00000040 /* do not update access time */ | ||
| 62 | #define XFS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ | ||
| 63 | #define XFS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ | ||
| 64 | #define XFS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ | ||
| 65 | #define XFS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ | ||
| 66 | #define XFS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ | ||
| 67 | #define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ | ||
| 68 | #define XFS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ | ||
| 69 | #define XFS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ | ||
| 70 | #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ | ||
| 71 | 56 | ||
| 72 | /* | 57 | /* |
| 73 | * Structure for XFS_IOC_GETBMAP. | 58 | * Structure for XFS_IOC_GETBMAP. |
| @@ -514,8 +499,8 @@ typedef struct xfs_swapext · 440 unmodified lines | |||
| 514 | #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64) | 499 | #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64) |
| 515 | #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64) | 500 | #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64) |
| 516 | #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) | 501 | #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) |
| 517 | #define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) | 502 | #define XFS_IOC_FSGETXATTR FS_IOC_FSGETXATTR |
| 518 | #define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr) | 503 | #define XFS_IOC_FSSETXATTR FS_IOC_FSSETXATTR |
| 519 | #define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64) | 504 | #define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64) |
| 520 | #define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64) | 505 | #define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64) |
| 521 | #define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap) | 506 | #define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap) |
| @@ -110,6 +110,36 @@ struct inodes_stat_t { · 109 unmodified lines | |||
| 110 | #define MS_MGC_VAL 0xC0ED0000 | 110 | #define MS_MGC_VAL 0xC0ED0000 |
| 111 | #define MS_MGC_MSK 0xffff0000 | 111 | #define MS_MGC_MSK 0xffff0000 |
| 112 | 112 | ||
| 113 | /* | ||
| 114 | * Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR. | ||
| 115 | */ | ||
| 116 | struct fsxattr { | ||
| 117 | __u32 fsx_xflags; /* xflags field value (get/set) */ | ||
| 118 | __u32 fsx_extsize; /* extsize field value (get/set)*/ | ||
| 119 | __u32 fsx_nextents; /* nextents field value (get) */ | ||
| 120 | __u32 fsx_projid; /* project identifier (get/set) */ | ||
| 121 | unsigned char fsx_pad[12]; | ||
| 122 | }; | ||
| 123 | |||
| 124 | /* | ||
| 125 | * Flags for the fsx_xflags field | ||
| 126 | */ | ||
| 127 | #define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ | ||
| 128 | #define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ | ||
| 129 | #define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ | ||
| 130 | #define FS_XFLAG_APPEND 0x00000010 /* all writes append */ | ||
| 131 | #define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ | ||
| 132 | #define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */ | ||
| 133 | #define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ | ||
| 134 | #define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ | ||
| 135 | #define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ | ||
| 136 | #define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ | ||
| 137 | #define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ | ||
| 138 | #define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ | ||
| 139 | #define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ | ||
| 140 | #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ | ||
| 141 | #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ | ||
| 142 | |||
| 113 | /* the read-only stuff doesn't really belong here, but any other place is | 143 | /* the read-only stuff doesn't really belong here, but any other place is |
| 114 | probably as bad and I don't want to create yet another include file. */ | 144 | probably as bad and I don't want to create yet another include file. */ |
| 115 | 145 | ||
| @@ -169,6 +199,8 @@ struct inodes_stat_t { · 53 unmodified lines | |||
| 169 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) | 199 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) |
| 170 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) | 200 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) |
| 171 | #define FS_IOC32_SETVERSION _IOW('v', 2, int) | 201 | #define FS_IOC32_SETVERSION _IOW('v', 2, int) |
| 202 | #define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) | ||
| 203 | #define FS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr) | ||
| 172 | 204 | ||
| 173 | /* | 205 | /* |
| 174 | * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) | 206 | * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) |