From 9c75681315b995dc64c50ab71887f54aa78a4295 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 31 Jan 2016 15:38:09 -0500 Subject: [PATCH] update add-FS_IOC_FSSETXATT-ioctl-interface --- add-FS_IOC_FSSETXATT-ioctl-interface | 184 ++++++++++------------------------- timestamps | 4 +- 2 files changed, 52 insertions(+), 136 deletions(-) diff --git a/add-FS_IOC_FSSETXATT-ioctl-interface b/add-FS_IOC_FSSETXATT-ioctl-interface index 1ca2932c..9e264056 100644 --- a/add-FS_IOC_FSSETXATT-ioctl-interface +++ b/add-FS_IOC_FSSETXATT-ioctl-interface @@ -11,14 +11,12 @@ Signed-off-by: Theodore Ts'o Reviewed-by: Andreas Dilger Reviewed-by: Jan Kara --- - fs/ext4/ext4.h | 10 +++ - fs/ext4/ioctl.c | 376 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------- - fs/xfs/libxfs/xfs_fs.h | 47 +++++------- - include/uapi/linux/fs.h | 32 +++++++++ - 4 files changed, 348 insertions(+), 117 deletions(-) + fs/ext4/ext4.h | 47 +++++++++++ + fs/ext4/ioctl.c | 376 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- + 2 files changed, 336 insertions(+), 87 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index f4acd73..3c85af4 100644 +index 96cc151..1c12721 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -381,6 +381,13 @@ struct flex_groups { @@ -35,10 +33,47 @@ index f4acd73..3c85af4 100644 /* Flags that should be inherited by new inodes from their parent. */ #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ -@@ -623,6 +630,9 @@ enum { - #define EXT4_IOC_GET_ENCRYPTED_FILENAME _IOWR('f', 24, struct ext4_encrypted_metadata) - #define EXT4_IOC_SET_ENCRYPTED_FILENAME _IOR('f', 25, struct ext4_encrypted_metadata) +@@ -619,6 +626,46 @@ enum { + #define EXT4_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) + #define EXT4_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct ext4_encryption_policy) ++#ifndef FS_IOC_FSGETXATTR ++/* Until the uapi changes get merged for project quota... */ ++ ++#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) ++#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) ++ ++/* ++ * Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR. ++ */ ++struct fsxattr { ++ __u32 fsx_xflags; /* xflags field value (get/set) */ ++ __u32 fsx_extsize; /* extsize field value (get/set)*/ ++ __u32 fsx_nextents; /* nextents field value (get) */ ++ __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 */ ++#endif /* !defined(FS_IOC_FSGETXATTR) */ ++ +#define EXT4_IOC_FSGETXATTR FS_IOC_FSGETXATTR +#define EXT4_IOC_FSSETXATTR FS_IOC_FSSETXATTR + @@ -46,7 +81,7 @@ index f4acd73..3c85af4 100644 /* * ioctl commands in 32 bit emulation diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c -index ef55ce8..946560c 100644 +index 5e872fd..2b0cb84 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -14,6 +14,7 @@ @@ -57,9 +92,9 @@ index ef55ce8..946560c 100644 #include #include "ext4_jbd2.h" #include "ext4.h" -@@ -235,6 +236,238 @@ static int write_user_mdata(unsigned long arg, +@@ -202,6 +203,238 @@ static int uuid_is_zero(__u8 u[16]) + return 1; } - #endif +static int ext4_ioctl_setflags(struct inode *inode, + unsigned int flags) @@ -296,7 +331,7 @@ index ef55ce8..946560c 100644 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct inode *inode = file_inode(filp); -@@ -250,11 +483,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +@@ -217,11 +450,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) flags = ei->i_flags & EXT4_FL_USER_VISIBLE; return put_user(flags, (int __user *) arg); case EXT4_IOC_SETFLAGS: { @@ -309,7 +344,7 @@ index ef55ce8..946560c 100644 if (!inode_owner_or_capable(inode)) return -EACCES; -@@ -268,89 +497,8 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +@@ -235,89 +464,8 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) flags = ext4_mask_flags(inode->i_mode, flags); @@ -400,7 +435,7 @@ index ef55ce8..946560c 100644 mutex_unlock(&inode->i_mutex); mnt_drop_write_file(filp); return err; -@@ -799,6 +947,60 @@ encryption_policy_out: +@@ -689,6 +837,60 @@ encryption_policy_out: return -EOPNOTSUPP; #endif } @@ -461,122 +496,3 @@ index ef55ce8..946560c 100644 default: return -ENOTTY; } -diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h -index b2b73a9..7c03fe66 100644 ---- a/fs/xfs/libxfs/xfs_fs.h -+++ b/fs/xfs/libxfs/xfs_fs.h -@@ -36,38 +36,25 @@ struct dioattr { - #endif - - /* -- * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR. -- */ --#ifndef HAVE_FSXATTR --struct fsxattr { -- __u32 fsx_xflags; /* xflags field value (get/set) */ -- __u32 fsx_extsize; /* extsize field value (get/set)*/ -- __u32 fsx_nextents; /* nextents field value (get) */ -- __u32 fsx_projid; /* project identifier (get/set) */ -- unsigned char fsx_pad[12]; --}; --#endif -- --/* - * Flags for the bs_xflags/fsx_xflags field - * There should be a one-to-one correspondence between these flags and the - * XFS_DIFLAG_s. - */ --#define XFS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ --#define XFS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ --#define XFS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ --#define XFS_XFLAG_APPEND 0x00000010 /* all writes append */ --#define XFS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ --#define XFS_XFLAG_NOATIME 0x00000040 /* do not update access time */ --#define XFS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ --#define XFS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ --#define XFS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ --#define XFS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ --#define XFS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ --#define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ --#define XFS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ --#define XFS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ --#define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ -+#define XFS_XFLAG_REALTIME FS_XFLAG_REALTIME /* data in realtime volume */ -+#define XFS_XFLAG_PREALLOC FS_XFLAG_PREALLOC /* preallocated file extents */ -+#define XFS_XFLAG_IMMUTABLE FS_XFLAG_IMMUTABLE /* file cannot be modified */ -+#define XFS_XFLAG_APPEND FS_XFLAG_APPEND /* all writes append */ -+#define XFS_XFLAG_SYNC FS_XFLAG_SYNC /* all writes synchronous */ -+#define XFS_XFLAG_NOATIME FS_XFLAG_NOATIME /* do not update access time */ -+#define XFS_XFLAG_NODUMP FS_XFLAG_NODUMP /* do not include in backups */ -+#define XFS_XFLAG_RTINHERIT FS_XFLAG_RTINHERIT /* create with rt bit set */ -+#define XFS_XFLAG_PROJINHERIT FS_XFLAG_PROJINHERIT /* create with parents projid */ -+#define XFS_XFLAG_NOSYMLINKS FS_XFLAG_NOSYMLINKS /* disallow symlink creation */ -+#define XFS_XFLAG_EXTSIZE FS_XFLAG_EXTSIZE /* extent size allocator hint */ -+#define XFS_XFLAG_EXTSZINHERIT FS_XFLAG_EXTSZINHERIT /* inherit inode extent size */ -+#define XFS_XFLAG_NODEFRAG FS_XFLAG_NODEFRAG /* do not defragment */ -+#define XFS_XFLAG_FILESTREAM FS_XFLAG_FILESTREAM /* use filestream allocator */ -+#define XFS_XFLAG_HASATTR FS_XFLAG_HASATTR /* no DIFLAG for this */ - - /* - * Structure for XFS_IOC_GETBMAP. -@@ -514,8 +501,8 @@ typedef struct xfs_swapext - #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64) - #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64) - #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) --#define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) --#define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr) -+#define XFS_IOC_FSGETXATTR FS_IOC_FSGETXATTR -+#define XFS_IOC_FSSETXATTR FS_IOC_FSSETXATTR - #define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64) - #define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64) - #define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap) -diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h -index f15d980..627f58e 100644 ---- a/include/uapi/linux/fs.h -+++ b/include/uapi/linux/fs.h -@@ -58,6 +58,36 @@ struct inodes_stat_t { - long dummy[5]; /* padding for sysctl ABI compatibility */ - }; - -+/* -+ * Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR. -+ */ -+struct fsxattr { -+ __u32 fsx_xflags; /* xflags field value (get/set) */ -+ __u32 fsx_extsize; /* extsize field value (get/set)*/ -+ __u32 fsx_nextents; /* nextents field value (get) */ -+ __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 NR_FILE 8192 /* this can well be larger on a larger system */ - -@@ -165,6 +195,8 @@ struct inodes_stat_t { - #define FS_IOC_GETVERSION _IOR('v', 1, long) - #define FS_IOC_SETVERSION _IOW('v', 2, long) - #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) -+#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) -+#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) - #define FS_IOC32_GETFLAGS _IOR('f', 1, int) - #define FS_IOC32_SETFLAGS _IOW('f', 2, int) - #define FS_IOC32_GETVERSION _IOR('v', 1, int) diff --git a/timestamps b/timestamps index 706a2947..6e693fca 100755 --- a/timestamps +++ b/timestamps @@ -45,5 +45,5 @@ touch -d @1453097831 crypto-rename-ext4_get_encryption_info touch -d @1453097842 series touch -d @1453098199 crypto-fix-validate-when-key-add-remove touch -d @1453098259 crypto-add-ciphertext_access-mount-option -touch -d @1453171299 status -touch -d @1453174856 timestamps +touch -d @1453749472 status +touch -d @1454272677 timestamps -- 2.11.4.GIT