History

fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion

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.

Dave Chinner committed 10 years ago

Commit 334e5801 parent 16830982 files · +50 −33Browse files

Unified · Split

2 files
  1. fs/xfs/libxfs/xfs_fs.h +18 −33
  2. include/uapi/linux/fs.h +32 −0
fs/xfs/libxfs/xfs_fs.h+18−33
@@ -36,38 +36,23 @@ struct dioattr { · 35 unmodified lines
3636 #endif
3737
3838 /*
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]
4040 */
41−#ifndef HAVE_FSXATTR
42−struct fsxattr {
43− __u32 fsx_xflags; /* xflags field value (get/set) */
44− __u32 fsx_extsize; /* extsize field value (get/set)*/
45− __u32 fsx_nextents; /* nextents field value (get) */
46− __u32 fsx_projid; /* project identifier (get/set) */
47− unsigned char fsx_pad[12];
48−};
49−#endif
50−
51−/*
52− * Flags for the bs_xflags/fsx_xflags field
53− * There should be a one-to-one correspondence between these flags and the
54− * XFS_DIFLAG_s.
55− */
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 */
41+#define XFS_XFLAG_REALTIME FS_XFLAG_REALTIME
42+#define XFS_XFLAG_PREALLOC FS_XFLAG_PREALLOC
43+#define XFS_XFLAG_IMMUTABLE FS_XFLAG_IMMUTABLE
44+#define XFS_XFLAG_APPEND FS_XFLAG_APPEND
45+#define XFS_XFLAG_SYNC FS_XFLAG_SYNC
46+#define XFS_XFLAG_NOATIME FS_XFLAG_NOATIME
47+#define XFS_XFLAG_NODUMP FS_XFLAG_NODUMP
48+#define XFS_XFLAG_RTINHERIT FS_XFLAG_RTINHERIT
49+#define XFS_XFLAG_PROJINHERIT FS_XFLAG_PROJINHERIT
50+#define XFS_XFLAG_NOSYMLINKS FS_XFLAG_NOSYMLINKS
51+#define XFS_XFLAG_EXTSIZE FS_XFLAG_EXTSIZE
52+#define XFS_XFLAG_EXTSZINHERIT FS_XFLAG_EXTSZINHERIT
53+#define XFS_XFLAG_NODEFRAG FS_XFLAG_NODEFRAG
54+#define XFS_XFLAG_FILESTREAM FS_XFLAG_FILESTREAM
55+#define XFS_XFLAG_HASATTR FS_XFLAG_HASATTR
7156
7257 /*
7358 * Structure for XFS_IOC_GETBMAP.
@@ -514,8 +499,8 @@ typedef struct xfs_swapext · 440 unmodified lines
514499 #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64)
515500 #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64)
516501 #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr)
517−#define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
518−#define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
502+#define XFS_IOC_FSGETXATTR FS_IOC_FSGETXATTR
503+#define XFS_IOC_FSSETXATTR FS_IOC_FSSETXATTR
519504 #define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64)
520505 #define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64)
521506 #define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap)
include/uapi/linux/fs.h+32−0
@@ -110,6 +110,36 @@ struct inodes_stat_t { · 109 unmodified lines
110110 #define MS_MGC_VAL 0xC0ED0000
111111 #define MS_MGC_MSK 0xffff0000
112112
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+
113143 /* the read-only stuff doesn't really belong here, but any other place is
114144 probably as bad and I don't want to create yet another include file. */
115145
@@ -169,6 +199,8 @@ struct inodes_stat_t { · 53 unmodified lines
169199 #define FS_IOC32_SETFLAGS _IOW('f', 2, int)
170200 #define FS_IOC32_GETVERSION _IOR('v', 1, int)
171201 #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)
172204
173205 /*
174206 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t