History

btrfs: rename flags for vol args v2

Rename BTRFS_DEVICE_BY_ID so it's more descriptive that we specify the device by id, it'll be part of the public API. The mask of supported flags is also renamed, only for internal use. The error code for unknown flags is EOPNOTSUPP, fixed.

David Sterba committed 10 years ago

Commit 735654e1 parent 5c5c0df2 files · +8 −7Browse files

Unified · Split

2 files
  1. fs/btrfs/ioctl.c +4 −4
  2. include/uapi/linux/btrfs.h +4 −3
fs/btrfs/ioctl.c+4−4
@@ -2687,8 +2687,8 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) · 2686 unmodified lines
26872687 }
26882688
26892689 /* Check for compatibility reject unknown flags */
2690− if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS)
2691− return -ENOTTY;
2690+ if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED)
2691+ return -EOPNOTSUPP;
26922692
26932693 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
26942694 1)) {
@@ -2697,7 +2697,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) · 2 unmodified lines
26972697 }
26982698
26992699 mutex_lock(&root->fs_info->volume_mutex);
2700− if (vol_args->flags & BTRFS_DEVICE_BY_ID) {
2700+ if (vol_args->flags & BTRFS_DEVICE_SPEC_BY_ID) {
27012701 ret = btrfs_rm_device(root, NULL, vol_args->devid);
27022702 } else {
27032703 vol_args->name[BTRFS_SUBVOL_NAME_MAX] = '\0';
@@ -2707,7 +2707,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) · 3 unmodified lines
27072707 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
27082708
27092709 if (!ret) {
2710− if (vol_args->flags & BTRFS_DEVICE_BY_ID)
2710+ if (vol_args->flags & BTRFS_DEVICE_SPEC_BY_ID)
27112711 btrfs_info(root->fs_info, "device deleted: id %llu",
27122712 vol_args->devid);
27132713 else
include/uapi/linux/btrfs.h+4−3
@@ -36,12 +36,13 @@ struct btrfs_ioctl_vol_args { · 35 unmodified lines
3636 #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
3737 #define BTRFS_SUBVOL_RDONLY (1ULL << 1)
3838 #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
39−#define BTRFS_DEVICE_BY_ID (1ULL << 3)
40−#define BTRFS_VOL_ARG_V2_FLAGS \
39+#define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
40+
41+#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \
4142 (BTRFS_SUBVOL_CREATE_ASYNC | \
4243 BTRFS_SUBVOL_RDONLY | \
4344 BTRFS_SUBVOL_QGROUP_INHERIT | \
44− BTRFS_DEVICE_BY_ID)
45+ BTRFS_DEVICE_SPEC_BY_ID)
4546
4647 #define BTRFS_FSID_SIZE 16
4748 #define BTRFS_UUID_SIZE 16