All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] Make add and device ioctls device path len consistent
@ 2016-02-18  8:07 Anand Jain
  2016-02-18  8:07 ` [PATCH RFC] btrfs: make add and device ioctl args path max consistent Anand Jain
  2016-02-18  8:07 ` [PATCH RFC] btrfs-progs: make add and delete path max len consistent Anand Jain
  0 siblings, 2 replies; 3+ messages in thread
From: Anand Jain @ 2016-02-18  8:07 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, clm

 Just in case if need to fix it properly, this patch helps.
 Its a bit of overkill though, on the basis of being theoretically
 correct. As discussed, this or Chris suggested to use simpler
 BTRFS_SUBVOL_NAME_MAX will fix equally from practical perspective.

 This patch is ontop the patch
   btrfs: Introduce device delete by devid
   btrfs-progs: Introduce device delete by devid
 respectively.

Thanks, Anand

Anand Jain (1):
  btrfs: make add and device ioctl args path max consistent

 fs/btrfs/ioctl.c           |  2 +-
 include/uapi/linux/btrfs.h | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

Anand Jain (1):
  btrfs-progs: make add and delete path max len consistent

 cmds-device.c |  2 +-
 ioctl.h       | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

-- 
2.7.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH RFC] btrfs: make add and device ioctl args path max consistent
  2016-02-18  8:07 [PATCH RFC] Make add and device ioctls device path len consistent Anand Jain
@ 2016-02-18  8:07 ` Anand Jain
  2016-02-18  8:07 ` [PATCH RFC] btrfs-progs: make add and delete path max len consistent Anand Jain
  1 sibling, 0 replies; 3+ messages in thread
From: Anand Jain @ 2016-02-18  8:07 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, clm

Add device ioctl uses BTRFS_PATH_NAME_MAX however delete
uses BTRFS_SUBVOL_NAME_MAX for device path.  This patch makes
them consistent.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/ioctl.c           |  2 +-
 include/uapi/linux/btrfs.h | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 1f72f8ed38f5..15fc91291c40 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2672,7 +2672,7 @@ out:
 static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
 {
 	struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
-	struct btrfs_ioctl_vol_args_v2 *vol_args;
+	struct btrfs_ioctl_vol_args_v3 *vol_args;
 	int ret;
 
 	if (!capable(CAP_SYS_ADMIN))
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 3975e683af72..3d58182b68e8 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -90,6 +90,23 @@ struct btrfs_ioctl_vol_args_v2 {
 	};
 };
 
+struct btrfs_ioctl_vol_args_v3 {
+	__s64 fd;
+	__u64 transid;
+	__u64 flags;
+	union {
+		struct {
+			__u64 size;
+			struct btrfs_qgroup_inherit __user *qgroup_inherit;
+		};
+		__u64 unused[4];
+	};
+	union {
+		char name[BTRFS_PATH_NAME_MAX + 1];
+		u64 devid;
+	};
+};
+
 /*
  * structure to report errors and progress to userspace, either as a
  * result of a finished scrub, a canceled scrub or a progress inquiry
@@ -671,6 +688,6 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
 				   struct btrfs_ioctl_feature_flags[3])
 #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \
-				   struct btrfs_ioctl_vol_args_v2)
+				   struct btrfs_ioctl_vol_args_v3)
 
 #endif /* _UAPI_LINUX_BTRFS_H */
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RFC] btrfs-progs: make add and delete path max len consistent
  2016-02-18  8:07 [PATCH RFC] Make add and device ioctls device path len consistent Anand Jain
  2016-02-18  8:07 ` [PATCH RFC] btrfs: make add and device ioctl args path max consistent Anand Jain
@ 2016-02-18  8:07 ` Anand Jain
  1 sibling, 0 replies; 3+ messages in thread
From: Anand Jain @ 2016-02-18  8:07 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, clm

Add device ioctl uses BTRFS_PATH_NAME_MAX however delete
uses BTRFS_SUBVOL_NAME_MAX to hold device path. This patch
makes them consistent.

Depends on
  btrfs: make add and device ioctl args path max consistent

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds-device.c |  2 +-
 ioctl.h       | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/cmds-device.c b/cmds-device.c
index 879ba94d7ea5..be07e34c2af8 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -160,7 +160,7 @@ static int _cmd_device_remove(int argc, char **argv,
 		struct	btrfs_ioctl_vol_args arg;
 		int	res;
 
-		struct btrfs_ioctl_vol_args_v2 argv2 = {0};
+		struct btrfs_ioctl_vol_args_v3 argv2 = {0};
 		int is_devid = 0;
 
 		if (string_is_numerical(argv[i])) {
diff --git a/ioctl.h b/ioctl.h
index 1560dcb4b457..8e444ca374fd 100644
--- a/ioctl.h
+++ b/ioctl.h
@@ -92,6 +92,23 @@ struct btrfs_ioctl_vol_args_v2 {
 	};
 };
 
+struct btrfs_ioctl_vol_args_v3 {
+	__s64 fd;
+	__u64 transid;
+	__u64 flags;
+	union {
+		struct {
+			__u64 size;
+			struct btrfs_qgroup_inherit __user *qgroup_inherit;
+		};
+		__u64 unused[4];
+	};
+	union {
+		char name[BTRFS_PATH_NAME_MAX + 1];
+		u64 devid;
+	};
+};
+
 /*
  * structure to report errors and progress to userspace, either as a
  * result of a finished scrub, a canceled scrub or a progress inquiry
@@ -689,7 +706,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
                                   struct btrfs_ioctl_feature_flags[3])
 #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \
-				   struct btrfs_ioctl_vol_args_v2)
+				   struct btrfs_ioctl_vol_args_v3)
 #ifdef __cplusplus
 }
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-18  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-18  8:07 [PATCH RFC] Make add and device ioctls device path len consistent Anand Jain
2016-02-18  8:07 ` [PATCH RFC] btrfs: make add and device ioctl args path max consistent Anand Jain
2016-02-18  8:07 ` [PATCH RFC] btrfs-progs: make add and delete path max len consistent Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.