Skip to content

Commit 3357af8

Browse files
ebiggersJaegeuk Kim
authored andcommitted
f2fs: use generic names for generic ioctls
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 <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent aff6fbb commit 3357af8

File tree

2 files changed

+28
-51
lines changed

2 files changed

+28
-51
lines changed

fs/f2fs/f2fs.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,8 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal,
402402
}
403403

404404
/*
405-
* ioctl commands
405+
* f2fs-specific ioctl commands
406406
*/
407-
#define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS
408-
#define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS
409-
#define F2FS_IOC_GETVERSION FS_IOC_GETVERSION
410-
411407
#define F2FS_IOCTL_MAGIC 0xf5
412408
#define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1)
413409
#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,
435431
#define F2FS_IOC_RESERVE_COMPRESS_BLOCKS \
436432
_IOR(F2FS_IOCTL_MAGIC, 19, __u64)
437433

438-
#define F2FS_IOC_GET_VOLUME_NAME FS_IOC_GETFSLABEL
439-
#define F2FS_IOC_SET_VOLUME_NAME FS_IOC_SETFSLABEL
440-
441-
#define F2FS_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY
442-
#define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
443-
#define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
444-
445434
/*
446435
* should be same as XFS_IOC_GOINGDOWN.
447436
* Flags for going down operation used by FS_IOC_GOINGDOWN
@@ -453,18 +442,6 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal,
453442
#define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */
454443
#define F2FS_GOING_DOWN_NEED_FSCK 0x4 /* going down to trigger fsck */
455444

456-
#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
457-
/*
458-
* ioctl commands in 32 bit emulation
459-
*/
460-
#define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS
461-
#define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS
462-
#define F2FS_IOC32_GETVERSION FS_IOC32_GETVERSION
463-
#endif
464-
465-
#define F2FS_IOC_FSGETXATTR FS_IOC_FSGETXATTR
466-
#define F2FS_IOC_FSSETXATTR FS_IOC_FSSETXATTR
467-
468445
struct f2fs_gc_range {
469446
u32 sync;
470447
u64 start;

fs/f2fs/file.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,7 +3362,7 @@ static int f2fs_ioc_measure_verity(struct file *filp, unsigned long arg)
33623362
return fsverity_ioctl_measure(filp, (void __user *)arg);
33633363
}
33643364

3365-
static int f2fs_get_volume_name(struct file *filp, unsigned long arg)
3365+
static int f2fs_ioc_getfslabel(struct file *filp, unsigned long arg)
33663366
{
33673367
struct inode *inode = file_inode(filp);
33683368
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)
33883388
return err;
33893389
}
33903390

3391-
static int f2fs_set_volume_name(struct file *filp, unsigned long arg)
3391+
static int f2fs_ioc_setfslabel(struct file *filp, unsigned long arg)
33923392
{
33933393
struct inode *inode = file_inode(filp);
33943394
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)
37673767
return -ENOSPC;
37683768

37693769
switch (cmd) {
3770-
case F2FS_IOC_GETFLAGS:
3770+
case FS_IOC_GETFLAGS:
37713771
return f2fs_ioc_getflags(filp, arg);
3772-
case F2FS_IOC_SETFLAGS:
3772+
case FS_IOC_SETFLAGS:
37733773
return f2fs_ioc_setflags(filp, arg);
3774-
case F2FS_IOC_GETVERSION:
3774+
case FS_IOC_GETVERSION:
37753775
return f2fs_ioc_getversion(filp, arg);
37763776
case F2FS_IOC_START_ATOMIC_WRITE:
37773777
return f2fs_ioc_start_atomic_write(filp);
@@ -3787,11 +3787,11 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
37873787
return f2fs_ioc_shutdown(filp, arg);
37883788
case FITRIM:
37893789
return f2fs_ioc_fitrim(filp, arg);
3790-
case F2FS_IOC_SET_ENCRYPTION_POLICY:
3790+
case FS_IOC_SET_ENCRYPTION_POLICY:
37913791
return f2fs_ioc_set_encryption_policy(filp, arg);
3792-
case F2FS_IOC_GET_ENCRYPTION_POLICY:
3792+
case FS_IOC_GET_ENCRYPTION_POLICY:
37933793
return f2fs_ioc_get_encryption_policy(filp, arg);
3794-
case F2FS_IOC_GET_ENCRYPTION_PWSALT:
3794+
case FS_IOC_GET_ENCRYPTION_PWSALT:
37953795
return f2fs_ioc_get_encryption_pwsalt(filp, arg);
37963796
case FS_IOC_GET_ENCRYPTION_POLICY_EX:
37973797
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)
38193819
return f2fs_ioc_flush_device(filp, arg);
38203820
case F2FS_IOC_GET_FEATURES:
38213821
return f2fs_ioc_get_features(filp, arg);
3822-
case F2FS_IOC_FSGETXATTR:
3822+
case FS_IOC_FSGETXATTR:
38233823
return f2fs_ioc_fsgetxattr(filp, arg);
3824-
case F2FS_IOC_FSSETXATTR:
3824+
case FS_IOC_FSSETXATTR:
38253825
return f2fs_ioc_fssetxattr(filp, arg);
38263826
case F2FS_IOC_GET_PIN_FILE:
38273827
return f2fs_ioc_get_pin_file(filp, arg);
@@ -3835,10 +3835,10 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
38353835
return f2fs_ioc_enable_verity(filp, arg);
38363836
case FS_IOC_MEASURE_VERITY:
38373837
return f2fs_ioc_measure_verity(filp, arg);
3838-
case F2FS_IOC_GET_VOLUME_NAME:
3839-
return f2fs_get_volume_name(filp, arg);
3840-
case F2FS_IOC_SET_VOLUME_NAME:
3841-
return f2fs_set_volume_name(filp, arg);
3838+
case FS_IOC_GETFSLABEL:
3839+
return f2fs_ioc_getfslabel(filp, arg);
3840+
case FS_IOC_SETFSLABEL:
3841+
return f2fs_ioc_setfslabel(filp, arg);
38423842
case F2FS_IOC_GET_COMPRESS_BLOCKS:
38433843
return f2fs_get_compress_blocks(filp, arg);
38443844
case F2FS_IOC_RELEASE_COMPRESS_BLOCKS:
@@ -3969,14 +3969,14 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
39693969
long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
39703970
{
39713971
switch (cmd) {
3972-
case F2FS_IOC32_GETFLAGS:
3973-
cmd = F2FS_IOC_GETFLAGS;
3972+
case FS_IOC32_GETFLAGS:
3973+
cmd = FS_IOC_GETFLAGS;
39743974
break;
3975-
case F2FS_IOC32_SETFLAGS:
3976-
cmd = F2FS_IOC_SETFLAGS;
3975+
case FS_IOC32_SETFLAGS:
3976+
cmd = FS_IOC_SETFLAGS;
39773977
break;
3978-
case F2FS_IOC32_GETVERSION:
3979-
cmd = F2FS_IOC_GETVERSION;
3978+
case FS_IOC32_GETVERSION:
3979+
cmd = FS_IOC_GETVERSION;
39803980
break;
39813981
case F2FS_IOC_START_ATOMIC_WRITE:
39823982
case F2FS_IOC_COMMIT_ATOMIC_WRITE:
@@ -3985,9 +3985,9 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
39853985
case F2FS_IOC_ABORT_VOLATILE_WRITE:
39863986
case F2FS_IOC_SHUTDOWN:
39873987
case FITRIM:
3988-
case F2FS_IOC_SET_ENCRYPTION_POLICY:
3989-
case F2FS_IOC_GET_ENCRYPTION_PWSALT:
3990-
case F2FS_IOC_GET_ENCRYPTION_POLICY:
3988+
case FS_IOC_SET_ENCRYPTION_POLICY:
3989+
case FS_IOC_GET_ENCRYPTION_PWSALT:
3990+
case FS_IOC_GET_ENCRYPTION_POLICY:
39913991
case FS_IOC_GET_ENCRYPTION_POLICY_EX:
39923992
case FS_IOC_ADD_ENCRYPTION_KEY:
39933993
case FS_IOC_REMOVE_ENCRYPTION_KEY:
@@ -4001,16 +4001,16 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
40014001
case F2FS_IOC_MOVE_RANGE:
40024002
case F2FS_IOC_FLUSH_DEVICE:
40034003
case F2FS_IOC_GET_FEATURES:
4004-
case F2FS_IOC_FSGETXATTR:
4005-
case F2FS_IOC_FSSETXATTR:
4004+
case FS_IOC_FSGETXATTR:
4005+
case FS_IOC_FSSETXATTR:
40064006
case F2FS_IOC_GET_PIN_FILE:
40074007
case F2FS_IOC_SET_PIN_FILE:
40084008
case F2FS_IOC_PRECACHE_EXTENTS:
40094009
case F2FS_IOC_RESIZE_FS:
40104010
case FS_IOC_ENABLE_VERITY:
40114011
case FS_IOC_MEASURE_VERITY:
4012-
case F2FS_IOC_GET_VOLUME_NAME:
4013-
case F2FS_IOC_SET_VOLUME_NAME:
4012+
case FS_IOC_GETFSLABEL:
4013+
case FS_IOC_SETFSLABEL:
40144014
case F2FS_IOC_GET_COMPRESS_BLOCKS:
40154015
case F2FS_IOC_RELEASE_COMPRESS_BLOCKS:
40164016
case F2FS_IOC_RESERVE_COMPRESS_BLOCKS:

0 commit comments

Comments
 (0)