]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
f2fs: use generic names for generic ioctls
authorEric Biggers <ebiggers@google.com>
Tue, 14 Jul 2020 22:18:12 +0000 (15:18 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 20 Jul 2020 22:47:32 +0000 (15:47 -0700)
Don't define F2FS_IOC_* aliases to ioctls that already have a generic
FS_IOC_* name.  These aliases are unnecessary, and they make it unclear
which ioctls are f2fs-specific and which are generic.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/file.c

index f880b47a6671c546fd9b793cec1613f2f97ce6c2..163fd5fadf11e27454b565c665746924fab41714 100644 (file)
@@ -402,12 +402,8 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal,
 }
 
 /*
- * ioctl commands
+ * f2fs-specific ioctl commands
  */
-#define F2FS_IOC_GETFLAGS              FS_IOC_GETFLAGS
-#define F2FS_IOC_SETFLAGS              FS_IOC_SETFLAGS
-#define F2FS_IOC_GETVERSION            FS_IOC_GETVERSION
-
 #define F2FS_IOCTL_MAGIC               0xf5
 #define F2FS_IOC_START_ATOMIC_WRITE    _IO(F2FS_IOCTL_MAGIC, 1)
 #define F2FS_IOC_COMMIT_ATOMIC_WRITE   _IO(F2FS_IOCTL_MAGIC, 2)
@@ -435,13 +431,6 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal,
 #define F2FS_IOC_RESERVE_COMPRESS_BLOCKS                               \
                                        _IOR(F2FS_IOCTL_MAGIC, 19, __u64)
 
-#define F2FS_IOC_GET_VOLUME_NAME       FS_IOC_GETFSLABEL
-#define F2FS_IOC_SET_VOLUME_NAME       FS_IOC_SETFSLABEL
-
-#define F2FS_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY
-#define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
-#define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
-
 /*
  * should be same as XFS_IOC_GOINGDOWN.
  * Flags for going down operation used by FS_IOC_GOINGDOWN
@@ -453,18 +442,6 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal,
 #define F2FS_GOING_DOWN_METAFLUSH      0x3     /* going down with meta flush */
 #define F2FS_GOING_DOWN_NEED_FSCK      0x4     /* going down to trigger fsck */
 
-#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
-/*
- * ioctl commands in 32 bit emulation
- */
-#define F2FS_IOC32_GETFLAGS            FS_IOC32_GETFLAGS
-#define F2FS_IOC32_SETFLAGS            FS_IOC32_SETFLAGS
-#define F2FS_IOC32_GETVERSION          FS_IOC32_GETVERSION
-#endif
-
-#define F2FS_IOC_FSGETXATTR            FS_IOC_FSGETXATTR
-#define F2FS_IOC_FSSETXATTR            FS_IOC_FSSETXATTR
-
 struct f2fs_gc_range {
        u32 sync;
        u64 start;
index 1af37f3b3309f8d81836a97297ec17a67a0fb47d..521987cd8772f29f604bed4fde0c9a72e4c9e692 100644 (file)
@@ -3362,7 +3362,7 @@ static int f2fs_ioc_measure_verity(struct file *filp, unsigned long arg)
        return fsverity_ioctl_measure(filp, (void __user *)arg);
 }
 
-static int f2fs_get_volume_name(struct file *filp, unsigned long arg)
+static int f2fs_ioc_getfslabel(struct file *filp, unsigned long arg)
 {
        struct inode *inode = file_inode(filp);
        struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
@@ -3388,7 +3388,7 @@ static int f2fs_get_volume_name(struct file *filp, unsigned long arg)
        return err;
 }
 
-static int f2fs_set_volume_name(struct file *filp, unsigned long arg)
+static int f2fs_ioc_setfslabel(struct file *filp, unsigned long arg)
 {
        struct inode *inode = file_inode(filp);
        struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
@@ -3767,11 +3767,11 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                return -ENOSPC;
 
        switch (cmd) {
-       case F2FS_IOC_GETFLAGS:
+       case FS_IOC_GETFLAGS:
                return f2fs_ioc_getflags(filp, arg);
-       case F2FS_IOC_SETFLAGS:
+       case FS_IOC_SETFLAGS:
                return f2fs_ioc_setflags(filp, arg);
-       case F2FS_IOC_GETVERSION:
+       case FS_IOC_GETVERSION:
                return f2fs_ioc_getversion(filp, arg);
        case F2FS_IOC_START_ATOMIC_WRITE:
                return f2fs_ioc_start_atomic_write(filp);
@@ -3787,11 +3787,11 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                return f2fs_ioc_shutdown(filp, arg);
        case FITRIM:
                return f2fs_ioc_fitrim(filp, arg);
-       case F2FS_IOC_SET_ENCRYPTION_POLICY:
+       case FS_IOC_SET_ENCRYPTION_POLICY:
                return f2fs_ioc_set_encryption_policy(filp, arg);
-       case F2FS_IOC_GET_ENCRYPTION_POLICY:
+       case FS_IOC_GET_ENCRYPTION_POLICY:
                return f2fs_ioc_get_encryption_policy(filp, arg);
-       case F2FS_IOC_GET_ENCRYPTION_PWSALT:
+       case FS_IOC_GET_ENCRYPTION_PWSALT:
                return f2fs_ioc_get_encryption_pwsalt(filp, arg);
        case FS_IOC_GET_ENCRYPTION_POLICY_EX:
                return f2fs_ioc_get_encryption_policy_ex(filp, arg);
@@ -3819,9 +3819,9 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                return f2fs_ioc_flush_device(filp, arg);
        case F2FS_IOC_GET_FEATURES:
                return f2fs_ioc_get_features(filp, arg);
-       case F2FS_IOC_FSGETXATTR:
+       case FS_IOC_FSGETXATTR:
                return f2fs_ioc_fsgetxattr(filp, arg);
-       case F2FS_IOC_FSSETXATTR:
+       case FS_IOC_FSSETXATTR:
                return f2fs_ioc_fssetxattr(filp, arg);
        case F2FS_IOC_GET_PIN_FILE:
                return f2fs_ioc_get_pin_file(filp, arg);
@@ -3835,10 +3835,10 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                return f2fs_ioc_enable_verity(filp, arg);
        case FS_IOC_MEASURE_VERITY:
                return f2fs_ioc_measure_verity(filp, arg);
-       case F2FS_IOC_GET_VOLUME_NAME:
-               return f2fs_get_volume_name(filp, arg);
-       case F2FS_IOC_SET_VOLUME_NAME:
-               return f2fs_set_volume_name(filp, arg);
+       case FS_IOC_GETFSLABEL:
+               return f2fs_ioc_getfslabel(filp, arg);
+       case FS_IOC_SETFSLABEL:
+               return f2fs_ioc_setfslabel(filp, arg);
        case F2FS_IOC_GET_COMPRESS_BLOCKS:
                return f2fs_get_compress_blocks(filp, arg);
        case F2FS_IOC_RELEASE_COMPRESS_BLOCKS:
@@ -3969,14 +3969,14 @@ out:
 long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        switch (cmd) {
-       case F2FS_IOC32_GETFLAGS:
-               cmd = F2FS_IOC_GETFLAGS;
+       case FS_IOC32_GETFLAGS:
+               cmd = FS_IOC_GETFLAGS;
                break;
-       case F2FS_IOC32_SETFLAGS:
-               cmd = F2FS_IOC_SETFLAGS;
+       case FS_IOC32_SETFLAGS:
+               cmd = FS_IOC_SETFLAGS;
                break;
-       case F2FS_IOC32_GETVERSION:
-               cmd = F2FS_IOC_GETVERSION;
+       case FS_IOC32_GETVERSION:
+               cmd = FS_IOC_GETVERSION;
                break;
        case F2FS_IOC_START_ATOMIC_WRITE:
        case F2FS_IOC_COMMIT_ATOMIC_WRITE:
@@ -3985,9 +3985,9 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case F2FS_IOC_ABORT_VOLATILE_WRITE:
        case F2FS_IOC_SHUTDOWN:
        case FITRIM:
-       case F2FS_IOC_SET_ENCRYPTION_POLICY:
-       case F2FS_IOC_GET_ENCRYPTION_PWSALT:
-       case F2FS_IOC_GET_ENCRYPTION_POLICY:
+       case FS_IOC_SET_ENCRYPTION_POLICY:
+       case FS_IOC_GET_ENCRYPTION_PWSALT:
+       case FS_IOC_GET_ENCRYPTION_POLICY:
        case FS_IOC_GET_ENCRYPTION_POLICY_EX:
        case FS_IOC_ADD_ENCRYPTION_KEY:
        case FS_IOC_REMOVE_ENCRYPTION_KEY:
@@ -4001,16 +4001,16 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case F2FS_IOC_MOVE_RANGE:
        case F2FS_IOC_FLUSH_DEVICE:
        case F2FS_IOC_GET_FEATURES:
-       case F2FS_IOC_FSGETXATTR:
-       case F2FS_IOC_FSSETXATTR:
+       case FS_IOC_FSGETXATTR:
+       case FS_IOC_FSSETXATTR:
        case F2FS_IOC_GET_PIN_FILE:
        case F2FS_IOC_SET_PIN_FILE:
        case F2FS_IOC_PRECACHE_EXTENTS:
        case F2FS_IOC_RESIZE_FS:
        case FS_IOC_ENABLE_VERITY:
        case FS_IOC_MEASURE_VERITY:
-       case F2FS_IOC_GET_VOLUME_NAME:
-       case F2FS_IOC_SET_VOLUME_NAME:
+       case FS_IOC_GETFSLABEL:
+       case FS_IOC_SETFSLABEL:
        case F2FS_IOC_GET_COMPRESS_BLOCKS:
        case F2FS_IOC_RELEASE_COMPRESS_BLOCKS:
        case F2FS_IOC_RESERVE_COMPRESS_BLOCKS: