All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-16  9:55 ` Mikulas Patocka
  0 siblings, 0 replies; 24+ messages in thread
From: Mikulas Patocka @ 2019-09-16  9:55 UTC (permalink / raw)
  To: Milan Broz, Mike Snitzer, Zdenek Kabelac; +Cc: dm-devel, lvm-devel

This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
target that is specified in the "name" entry in the parameter structure
and return its version.

This functionality is intended to be used by cryptsetup, so that it can
query kernel capabilities before activating the device.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/md/dm-ioctl.c         |   32 +++++++++++++++++++++++++++++---
 include/uapi/linux/dm-ioctl.h |    6 ++++--
 2 files changed, 33 insertions(+), 5 deletions(-)

Index: linux-2.6/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-ioctl.c	2019-09-16 11:42:45.000000000 +0200
+++ linux-2.6/drivers/md/dm-ioctl.c	2019-09-16 11:50:10.000000000 +0200
@@ -601,17 +601,27 @@ static void list_version_get_info(struct
     info->vers = align_ptr(((void *) ++info->vers) + strlen(tt->name) + 1);
 }
 
-static int list_versions(struct file *filp, struct dm_ioctl *param, size_t param_size)
+static int __list_versions(struct dm_ioctl *param, size_t param_size, const char *name)
 {
 	size_t len, needed = 0;
 	struct dm_target_versions *vers;
 	struct vers_iter iter_info;
+	struct target_type *tt = NULL;
+
+	if (name) {
+		tt = dm_get_target_type(name);
+		if (!tt)
+			return -EINVAL;
+	}
 
 	/*
 	 * Loop through all the devices working out how much
 	 * space we need.
 	 */
-	dm_target_iterate(list_version_get_needed, &needed);
+	if (!tt)
+		dm_target_iterate(list_version_get_needed, &needed);
+	else
+		list_version_get_needed(tt, &needed);
 
 	/*
 	 * Grab our output buffer.
@@ -632,13 +642,28 @@ static int list_versions(struct file *fi
 	/*
 	 * Now loop through filling out the names & versions.
 	 */
-	dm_target_iterate(list_version_get_info, &iter_info);
+	if (!tt)
+		dm_target_iterate(list_version_get_info, &iter_info);
+	else
+		list_version_get_info(tt, &iter_info);
 	param->flags |= iter_info.flags;
 
  out:
+	if (tt)
+		dm_put_target_type(tt);
 	return 0;
 }
 
+static int list_versions(struct file *filp, struct dm_ioctl *param, size_t param_size)
+{
+	return __list_versions(param, param_size, NULL);
+}
+
+static int get_target_version(struct file *filp, struct dm_ioctl *param, size_t param_size)
+{
+	return __list_versions(param, param_size, param->name);
+}
+
 static int check_name(const char *name)
 {
 	if (strchr(name, '/')) {
@@ -1664,6 +1689,7 @@ static ioctl_fn lookup_ioctl(unsigned in
 		{DM_TARGET_MSG_CMD, 0, target_message},
 		{DM_DEV_SET_GEOMETRY_CMD, 0, dev_set_geometry},
 		{DM_DEV_ARM_POLL, IOCTL_FLAGS_NO_PARAMS, dev_arm_poll},
+		{DM_GET_TARGET_VERSION, 0, get_target_version},
 	};
 
 	if (unlikely(cmd >= ARRAY_SIZE(_ioctls)))
Index: linux-2.6/include/uapi/linux/dm-ioctl.h
===================================================================
--- linux-2.6.orig/include/uapi/linux/dm-ioctl.h	2019-09-16 11:42:45.000000000 +0200
+++ linux-2.6/include/uapi/linux/dm-ioctl.h	2019-09-16 11:50:37.000000000 +0200
@@ -243,6 +243,7 @@ enum {
 	DM_TARGET_MSG_CMD,
 	DM_DEV_SET_GEOMETRY_CMD,
 	DM_DEV_ARM_POLL_CMD,
+	DM_GET_TARGET_VERSION_CMD,
 };
 
 #define DM_IOCTL 0xfd
@@ -265,14 +266,15 @@ enum {
 #define DM_TABLE_STATUS  _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl)
 
 #define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
+#define DM_GET_TARGET_VERSION _IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl)
 
 #define DM_TARGET_MSG	 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR	4
-#define DM_VERSION_MINOR	40
+#define DM_VERSION_MINOR	41
 #define DM_VERSION_PATCHLEVEL	0
-#define DM_VERSION_EXTRA	"-ioctl (2019-01-18)"
+#define DM_VERSION_EXTRA	"-ioctl (2019-09-16)"
 
 /* Status bits */
 #define DM_READONLY_FLAG	(1 << 0) /* In/Out */

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

* [PATCH] dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-16  9:55 ` Mikulas Patocka
  0 siblings, 0 replies; 24+ messages in thread
From: Mikulas Patocka @ 2019-09-16  9:55 UTC (permalink / raw)
  To: lvm-devel

This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
target that is specified in the "name" entry in the parameter structure
and return its version.

This functionality is intended to be used by cryptsetup, so that it can
query kernel capabilities before activating the device.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/md/dm-ioctl.c         |   32 +++++++++++++++++++++++++++++---
 include/uapi/linux/dm-ioctl.h |    6 ++++--
 2 files changed, 33 insertions(+), 5 deletions(-)

Index: linux-2.6/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-ioctl.c	2019-09-16 11:42:45.000000000 +0200
+++ linux-2.6/drivers/md/dm-ioctl.c	2019-09-16 11:50:10.000000000 +0200
@@ -601,17 +601,27 @@ static void list_version_get_info(struct
     info->vers = align_ptr(((void *) ++info->vers) + strlen(tt->name) + 1);
 }
 
-static int list_versions(struct file *filp, struct dm_ioctl *param, size_t param_size)
+static int __list_versions(struct dm_ioctl *param, size_t param_size, const char *name)
 {
 	size_t len, needed = 0;
 	struct dm_target_versions *vers;
 	struct vers_iter iter_info;
+	struct target_type *tt = NULL;
+
+	if (name) {
+		tt = dm_get_target_type(name);
+		if (!tt)
+			return -EINVAL;
+	}
 
 	/*
 	 * Loop through all the devices working out how much
 	 * space we need.
 	 */
-	dm_target_iterate(list_version_get_needed, &needed);
+	if (!tt)
+		dm_target_iterate(list_version_get_needed, &needed);
+	else
+		list_version_get_needed(tt, &needed);
 
 	/*
 	 * Grab our output buffer.
@@ -632,13 +642,28 @@ static int list_versions(struct file *fi
 	/*
 	 * Now loop through filling out the names & versions.
 	 */
-	dm_target_iterate(list_version_get_info, &iter_info);
+	if (!tt)
+		dm_target_iterate(list_version_get_info, &iter_info);
+	else
+		list_version_get_info(tt, &iter_info);
 	param->flags |= iter_info.flags;
 
  out:
+	if (tt)
+		dm_put_target_type(tt);
 	return 0;
 }
 
+static int list_versions(struct file *filp, struct dm_ioctl *param, size_t param_size)
+{
+	return __list_versions(param, param_size, NULL);
+}
+
+static int get_target_version(struct file *filp, struct dm_ioctl *param, size_t param_size)
+{
+	return __list_versions(param, param_size, param->name);
+}
+
 static int check_name(const char *name)
 {
 	if (strchr(name, '/')) {
@@ -1664,6 +1689,7 @@ static ioctl_fn lookup_ioctl(unsigned in
 		{DM_TARGET_MSG_CMD, 0, target_message},
 		{DM_DEV_SET_GEOMETRY_CMD, 0, dev_set_geometry},
 		{DM_DEV_ARM_POLL, IOCTL_FLAGS_NO_PARAMS, dev_arm_poll},
+		{DM_GET_TARGET_VERSION, 0, get_target_version},
 	};
 
 	if (unlikely(cmd >= ARRAY_SIZE(_ioctls)))
Index: linux-2.6/include/uapi/linux/dm-ioctl.h
===================================================================
--- linux-2.6.orig/include/uapi/linux/dm-ioctl.h	2019-09-16 11:42:45.000000000 +0200
+++ linux-2.6/include/uapi/linux/dm-ioctl.h	2019-09-16 11:50:37.000000000 +0200
@@ -243,6 +243,7 @@ enum {
 	DM_TARGET_MSG_CMD,
 	DM_DEV_SET_GEOMETRY_CMD,
 	DM_DEV_ARM_POLL_CMD,
+	DM_GET_TARGET_VERSION_CMD,
 };
 
 #define DM_IOCTL 0xfd
@@ -265,14 +266,15 @@ enum {
 #define DM_TABLE_STATUS  _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl)
 
 #define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
+#define DM_GET_TARGET_VERSION _IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl)
 
 #define DM_TARGET_MSG	 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR	4
-#define DM_VERSION_MINOR	40
+#define DM_VERSION_MINOR	41
 #define DM_VERSION_PATCHLEVEL	0
-#define DM_VERSION_EXTRA	"-ioctl (2019-01-18)"
+#define DM_VERSION_EXTRA	"-ioctl (2019-09-16)"
 
 /* Status bits */
 #define DM_READONLY_FLAG	(1 << 0) /* In/Out */



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

* [PATCH] lvm: introduce DM_GET_TARGET_VERSION
  2019-09-16  9:55 ` Mikulas Patocka
@ 2019-09-16  9:58   ` Mikulas Patocka
  -1 siblings, 0 replies; 24+ messages in thread
From: Mikulas Patocka @ 2019-09-16  9:58 UTC (permalink / raw)
  To: Milan Broz, Mike Snitzer, Zdenek Kabelac; +Cc: dm-devel, lvm-devel

This is userspace patch that adds support for the DM_GET_TARGET_VERSION to 
dmsetup. It introduces a new comman "target-version" that will accept list 
of targets and print their version.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 device_mapper/all.h               |    4 +++-
 device_mapper/ioctl/libdm-iface.c |    3 +++
 device_mapper/misc/dm-ioctl.h     |    3 +++
 libdm/dm-tools/dmsetup.c          |   28 ++++++++++++++++++++++++++++
 libdm/ioctl/libdm-iface.c         |    3 +++
 libdm/libdevmapper.h              |    4 +++-
 libdm/misc/dm-ioctl.h             |    2 ++
 7 files changed, 45 insertions(+), 2 deletions(-)

Index: lvm2/libdm/dm-tools/dmsetup.c
===================================================================
--- lvm2.orig/libdm/dm-tools/dmsetup.c	2019-09-16 10:11:12.000000000 +0200
+++ lvm2/libdm/dm-tools/dmsetup.c	2019-09-16 10:35:21.000000000 +0200
@@ -2587,6 +2587,33 @@ out:
 	return r;
 }
 
+/* Show target names and their version numbers */
+static int _target_version(CMD_ARGS)
+{
+	int r = 0;
+	struct dm_task *dmt;
+	struct dm_versions *target;
+
+	if (!(dmt = dm_task_create(DM_GET_TARGET_VERSION)))
+		return_0;
+
+	if (!dm_task_set_name(dmt, argv[0]))
+		goto_out;
+
+	if (!_task_run(dmt))
+		goto_out;
+
+	target = dm_task_get_versions(dmt);
+	printf("%-16s v%d.%d.%d\n", target->name, target->version[0],
+	       target->version[1], target->version[2]);
+
+	r = 1;
+
+out:
+	dm_task_destroy(dmt);
+	return r;
+}
+
 static int _info(CMD_ARGS)
 {
 	int r = 0;
@@ -6239,6 +6266,7 @@ static struct command _dmsetup_commands[
 	{"udevcomplete", "<cookie>", 1, 1, 0, 0, _udevcomplete},
 	{"udevcomplete_all", "[<age_in_minutes>]", 0, 1, 0, 0, _udevcomplete_all},
 	{"udevcookies", "", 0, 0, 0, 0, _udevcookies},
+	{"target-version", "[<target>...]", 1, -1, 1, 0, _target_version},
 	{"targets", "", 0, 0, 0, 0, _targets},
 	{"version", "", 0, 0, 0, 0, _version},
 	{"setgeometry", "<device> <cyl> <head> <sect> <start>", 5, 5, 0, 0, _setgeometry},
Index: lvm2/device_mapper/all.h
===================================================================
--- lvm2.orig/device_mapper/all.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/device_mapper/all.h	2019-09-16 10:19:16.000000000 +0200
@@ -121,7 +121,9 @@ enum {
 
 	DM_DEVICE_SET_GEOMETRY,
 
-	DM_DEVICE_ARM_POLL
+	DM_DEVICE_ARM_POLL,
+
+	DM_GET_TARGET_VERSION
 };
 
 /*
Index: lvm2/libdm/libdevmapper.h
===================================================================
--- lvm2.orig/libdm/libdevmapper.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/libdm/libdevmapper.h	2019-09-16 10:18:50.000000000 +0200
@@ -121,7 +121,9 @@ enum {
 
 	DM_DEVICE_SET_GEOMETRY,
 
-	DM_DEVICE_ARM_POLL
+	DM_DEVICE_ARM_POLL,
+
+	DM_GET_TARGET_VERSION
 };
 
 /*
Index: lvm2/device_mapper/ioctl/libdm-iface.c
===================================================================
--- lvm2.orig/device_mapper/ioctl/libdm-iface.c	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/device_mapper/ioctl/libdm-iface.c	2019-09-16 10:23:48.000000000 +0200
@@ -119,6 +119,9 @@ static struct cmd_data _cmd_data_v4[] =
 #ifdef DM_DEV_ARM_POLL
 	{"armpoll",	DM_DEV_ARM_POLL,	{4, 36, 0}},
 #endif
+#ifdef DM_GET_TARGET_VERSION
+	{"target-version", DM_GET_TARGET_VERSION, {4, 41, 0}},
+#endif
 };
 /* *INDENT-ON* */
 
Index: lvm2/libdm/ioctl/libdm-iface.c
===================================================================
--- lvm2.orig/libdm/ioctl/libdm-iface.c	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/libdm/ioctl/libdm-iface.c	2019-09-16 10:30:24.000000000 +0200
@@ -118,6 +118,9 @@ static struct cmd_data _cmd_data_v4[] =
 #ifdef DM_DEV_ARM_POLL
 	{"armpoll",	DM_DEV_ARM_POLL,	{4, 36, 0}},
 #endif
+#ifdef DM_GET_TARGET_VERSION
+	{"target-version", DM_GET_TARGET_VERSION, {4, 41, 0}},
+#endif
 };
 /* *INDENT-ON* */
 
Index: lvm2/device_mapper/misc/dm-ioctl.h
===================================================================
--- lvm2.orig/device_mapper/misc/dm-ioctl.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/device_mapper/misc/dm-ioctl.h	2019-09-16 10:29:24.000000000 +0200
@@ -244,6 +244,7 @@ enum {
 	DM_TARGET_MSG_CMD,
 	DM_DEV_SET_GEOMETRY_CMD,
 	DM_DEV_ARM_POLL_CMD,
+	DM_GET_TARGET_VERSION_CMD,
 };
 
 #define DM_IOCTL 0xfd
@@ -270,6 +271,8 @@ enum {
 #define DM_TARGET_MSG	 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
+#define DM_GET_TARGET_VERSION	_IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl)
+
 #define DM_VERSION_MAJOR	4
 #define DM_VERSION_MINOR	36
 #define DM_VERSION_PATCHLEVEL	0
Index: lvm2/libdm/misc/dm-ioctl.h
===================================================================
--- lvm2.orig/libdm/misc/dm-ioctl.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/libdm/misc/dm-ioctl.h	2019-09-16 10:30:04.000000000 +0200
@@ -244,6 +244,7 @@ enum {
 	DM_TARGET_MSG_CMD,
 	DM_DEV_SET_GEOMETRY_CMD,
 	DM_DEV_ARM_POLL_CMD,
+	DM_GET_TARGET_VERSION_CMD,
 };
 
 #define DM_IOCTL 0xfd
@@ -269,6 +270,7 @@ enum {
 
 #define DM_TARGET_MSG	 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
+#define DM_GET_TARGET_VERSION	_IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR	4
 #define DM_VERSION_MINOR	36

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

* [PATCH] lvm: introduce DM_GET_TARGET_VERSION
@ 2019-09-16  9:58   ` Mikulas Patocka
  0 siblings, 0 replies; 24+ messages in thread
From: Mikulas Patocka @ 2019-09-16  9:58 UTC (permalink / raw)
  To: lvm-devel

This is userspace patch that adds support for the DM_GET_TARGET_VERSION to 
dmsetup. It introduces a new comman "target-version" that will accept list 
of targets and print their version.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 device_mapper/all.h               |    4 +++-
 device_mapper/ioctl/libdm-iface.c |    3 +++
 device_mapper/misc/dm-ioctl.h     |    3 +++
 libdm/dm-tools/dmsetup.c          |   28 ++++++++++++++++++++++++++++
 libdm/ioctl/libdm-iface.c         |    3 +++
 libdm/libdevmapper.h              |    4 +++-
 libdm/misc/dm-ioctl.h             |    2 ++
 7 files changed, 45 insertions(+), 2 deletions(-)

Index: lvm2/libdm/dm-tools/dmsetup.c
===================================================================
--- lvm2.orig/libdm/dm-tools/dmsetup.c	2019-09-16 10:11:12.000000000 +0200
+++ lvm2/libdm/dm-tools/dmsetup.c	2019-09-16 10:35:21.000000000 +0200
@@ -2587,6 +2587,33 @@ out:
 	return r;
 }
 
+/* Show target names and their version numbers */
+static int _target_version(CMD_ARGS)
+{
+	int r = 0;
+	struct dm_task *dmt;
+	struct dm_versions *target;
+
+	if (!(dmt = dm_task_create(DM_GET_TARGET_VERSION)))
+		return_0;
+
+	if (!dm_task_set_name(dmt, argv[0]))
+		goto_out;
+
+	if (!_task_run(dmt))
+		goto_out;
+
+	target = dm_task_get_versions(dmt);
+	printf("%-16s v%d.%d.%d\n", target->name, target->version[0],
+	       target->version[1], target->version[2]);
+
+	r = 1;
+
+out:
+	dm_task_destroy(dmt);
+	return r;
+}
+
 static int _info(CMD_ARGS)
 {
 	int r = 0;
@@ -6239,6 +6266,7 @@ static struct command _dmsetup_commands[
 	{"udevcomplete", "<cookie>", 1, 1, 0, 0, _udevcomplete},
 	{"udevcomplete_all", "[<age_in_minutes>]", 0, 1, 0, 0, _udevcomplete_all},
 	{"udevcookies", "", 0, 0, 0, 0, _udevcookies},
+	{"target-version", "[<target>...]", 1, -1, 1, 0, _target_version},
 	{"targets", "", 0, 0, 0, 0, _targets},
 	{"version", "", 0, 0, 0, 0, _version},
 	{"setgeometry", "<device> <cyl> <head> <sect> <start>", 5, 5, 0, 0, _setgeometry},
Index: lvm2/device_mapper/all.h
===================================================================
--- lvm2.orig/device_mapper/all.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/device_mapper/all.h	2019-09-16 10:19:16.000000000 +0200
@@ -121,7 +121,9 @@ enum {
 
 	DM_DEVICE_SET_GEOMETRY,
 
-	DM_DEVICE_ARM_POLL
+	DM_DEVICE_ARM_POLL,
+
+	DM_GET_TARGET_VERSION
 };
 
 /*
Index: lvm2/libdm/libdevmapper.h
===================================================================
--- lvm2.orig/libdm/libdevmapper.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/libdm/libdevmapper.h	2019-09-16 10:18:50.000000000 +0200
@@ -121,7 +121,9 @@ enum {
 
 	DM_DEVICE_SET_GEOMETRY,
 
-	DM_DEVICE_ARM_POLL
+	DM_DEVICE_ARM_POLL,
+
+	DM_GET_TARGET_VERSION
 };
 
 /*
Index: lvm2/device_mapper/ioctl/libdm-iface.c
===================================================================
--- lvm2.orig/device_mapper/ioctl/libdm-iface.c	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/device_mapper/ioctl/libdm-iface.c	2019-09-16 10:23:48.000000000 +0200
@@ -119,6 +119,9 @@ static struct cmd_data _cmd_data_v4[] =
 #ifdef DM_DEV_ARM_POLL
 	{"armpoll",	DM_DEV_ARM_POLL,	{4, 36, 0}},
 #endif
+#ifdef DM_GET_TARGET_VERSION
+	{"target-version", DM_GET_TARGET_VERSION, {4, 41, 0}},
+#endif
 };
 /* *INDENT-ON* */
 
Index: lvm2/libdm/ioctl/libdm-iface.c
===================================================================
--- lvm2.orig/libdm/ioctl/libdm-iface.c	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/libdm/ioctl/libdm-iface.c	2019-09-16 10:30:24.000000000 +0200
@@ -118,6 +118,9 @@ static struct cmd_data _cmd_data_v4[] =
 #ifdef DM_DEV_ARM_POLL
 	{"armpoll",	DM_DEV_ARM_POLL,	{4, 36, 0}},
 #endif
+#ifdef DM_GET_TARGET_VERSION
+	{"target-version", DM_GET_TARGET_VERSION, {4, 41, 0}},
+#endif
 };
 /* *INDENT-ON* */
 
Index: lvm2/device_mapper/misc/dm-ioctl.h
===================================================================
--- lvm2.orig/device_mapper/misc/dm-ioctl.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/device_mapper/misc/dm-ioctl.h	2019-09-16 10:29:24.000000000 +0200
@@ -244,6 +244,7 @@ enum {
 	DM_TARGET_MSG_CMD,
 	DM_DEV_SET_GEOMETRY_CMD,
 	DM_DEV_ARM_POLL_CMD,
+	DM_GET_TARGET_VERSION_CMD,
 };
 
 #define DM_IOCTL 0xfd
@@ -270,6 +271,8 @@ enum {
 #define DM_TARGET_MSG	 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
+#define DM_GET_TARGET_VERSION	_IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl)
+
 #define DM_VERSION_MAJOR	4
 #define DM_VERSION_MINOR	36
 #define DM_VERSION_PATCHLEVEL	0
Index: lvm2/libdm/misc/dm-ioctl.h
===================================================================
--- lvm2.orig/libdm/misc/dm-ioctl.h	2019-09-16 09:58:45.000000000 +0200
+++ lvm2/libdm/misc/dm-ioctl.h	2019-09-16 10:30:04.000000000 +0200
@@ -244,6 +244,7 @@ enum {
 	DM_TARGET_MSG_CMD,
 	DM_DEV_SET_GEOMETRY_CMD,
 	DM_DEV_ARM_POLL_CMD,
+	DM_GET_TARGET_VERSION_CMD,
 };
 
 #define DM_IOCTL 0xfd
@@ -269,6 +270,7 @@ enum {
 
 #define DM_TARGET_MSG	 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
+#define DM_GET_TARGET_VERSION	_IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR	4
 #define DM_VERSION_MINOR	36



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

* Re: dm: introduce DM_GET_TARGET_VERSION
  2019-09-16  9:55 ` Mikulas Patocka
@ 2019-09-16 14:21   ` Mike Snitzer
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-16 14:21 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: dm-devel, Zdenek Kabelac, lvm-devel, Milan Broz

On Mon, Sep 16 2019 at  5:55am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
> target that is specified in the "name" entry in the parameter structure
> and return its version.
> 
> This functionality is intended to be used by cryptsetup, so that it can
> query kernel capabilities before activating the device.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

I've picked this up for 5.4, last change now that merge window is open,
thanks.

Mike

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

* dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-16 14:21   ` Mike Snitzer
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-16 14:21 UTC (permalink / raw)
  To: lvm-devel

On Mon, Sep 16 2019 at  5:55am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
> target that is specified in the "name" entry in the parameter structure
> and return its version.
> 
> This functionality is intended to be used by cryptsetup, so that it can
> query kernel capabilities before activating the device.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

I've picked this up for 5.4, last change now that merge window is open,
thanks.

Mike



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

* Re: [PATCH] dm: introduce DM_GET_TARGET_VERSION
  2019-09-16  9:55 ` Mikulas Patocka
@ 2019-09-16 18:01   ` Christoph Hellwig
  -1 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2019-09-16 18:01 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Mike Snitzer, Zdenek Kabelac, lvm-devel, dm-devel, Milan Broz

On Mon, Sep 16, 2019 at 05:55:42AM -0400, Mikulas Patocka wrote:
> This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
> target that is specified in the "name" entry in the parameter structure
> and return its version.
> 
> This functionality is intended to be used by cryptsetup, so that it can
> query kernel capabilities before activating the device.

Well, if you want to query kernel features you better ask for a feature
bitmap than a version number, which can be rather meaningless with
the amount of backporting that is going on.

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

* [dm-devel] [PATCH] dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-16 18:01   ` Christoph Hellwig
  0 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2019-09-16 18:01 UTC (permalink / raw)
  To: lvm-devel

On Mon, Sep 16, 2019 at 05:55:42AM -0400, Mikulas Patocka wrote:
> This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
> target that is specified in the "name" entry in the parameter structure
> and return its version.
> 
> This functionality is intended to be used by cryptsetup, so that it can
> query kernel capabilities before activating the device.

Well, if you want to query kernel features you better ask for a feature
bitmap than a version number, which can be rather meaningless with
the amount of backporting that is going on.



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

* Re: [PATCH] dm: introduce DM_GET_TARGET_VERSION
  2019-09-16 18:01   ` [dm-devel] " Christoph Hellwig
@ 2019-09-16 18:16     ` Milan Broz
  -1 siblings, 0 replies; 24+ messages in thread
From: Milan Broz @ 2019-09-16 18:16 UTC (permalink / raw)
  To: Christoph Hellwig, Mikulas Patocka
  Cc: Mike Snitzer, lvm-devel, dm-devel, Zdenek Kabelac

On 16/09/2019 20:01, Christoph Hellwig wrote:
> On Mon, Sep 16, 2019 at 05:55:42AM -0400, Mikulas Patocka wrote:
>> This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
>> target that is specified in the "name" entry in the parameter structure
>> and return its version.
>>
>> This functionality is intended to be used by cryptsetup, so that it can
>> query kernel capabilities before activating the device.
> 
> Well, if you want to query kernel features you better ask for a feature
> bitmap than a version number, which can be rather meaningless with
> the amount of backporting that is going on.

Actually we have a feature bitmap in userspace (derived from dm target version)
and there was even a nice versioning scheme way when backporting features
(used in RHEL for example).

Most of the libcrypsetup features that depend on some DM internals works the way
that userspace tries the feature and fallbacks if it fails.

But many functions are really user-unfriendly this way - imagine we ask for passphrases,
calculate LUKS keyslots, do benchmarks (all this do not need DM backend) - and then it
fails on activation because DM table load detects old (or missing) dm-crypt feature.
(There was no way to get dm target version before table load if module is not loaded.)

And I tried to avoid modprobe calls from libcryptsetup.

So the main idea behind this was just use already existing functionality
in kernel DM, and provide simple user-friendly way to detect some incompatibilites
more early. If detection is not there, we just fallback to the old way.

Milan

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

* [dm-devel] [PATCH] dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-16 18:16     ` Milan Broz
  0 siblings, 0 replies; 24+ messages in thread
From: Milan Broz @ 2019-09-16 18:16 UTC (permalink / raw)
  To: lvm-devel

On 16/09/2019 20:01, Christoph Hellwig wrote:
> On Mon, Sep 16, 2019 at 05:55:42AM -0400, Mikulas Patocka wrote:
>> This patch introduces a new ioctl DM_GET_TARGET_VERSION. It will load a
>> target that is specified in the "name" entry in the parameter structure
>> and return its version.
>>
>> This functionality is intended to be used by cryptsetup, so that it can
>> query kernel capabilities before activating the device.
> 
> Well, if you want to query kernel features you better ask for a feature
> bitmap than a version number, which can be rather meaningless with
> the amount of backporting that is going on.

Actually we have a feature bitmap in userspace (derived from dm target version)
and there was even a nice versioning scheme way when backporting features
(used in RHEL for example).

Most of the libcrypsetup features that depend on some DM internals works the way
that userspace tries the feature and fallbacks if it fails.

But many functions are really user-unfriendly this way - imagine we ask for passphrases,
calculate LUKS keyslots, do benchmarks (all this do not need DM backend) - and then it
fails on activation because DM table load detects old (or missing) dm-crypt feature.
(There was no way to get dm target version before table load if module is not loaded.)

And I tried to avoid modprobe calls from libcryptsetup.

So the main idea behind this was just use already existing functionality
in kernel DM, and provide simple user-friendly way to detect some incompatibilites
more early. If detection is not there, we just fallback to the old way.

Milan



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

* Re: [PATCH] dm: introduce DM_GET_TARGET_VERSION
  2019-09-16 18:16     ` [dm-devel] " Milan Broz
@ 2019-09-17  6:32       ` Christoph Hellwig
  -1 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2019-09-17  6:32 UTC (permalink / raw)
  To: Milan Broz
  Cc: Mike Snitzer, lvm-devel, Christoph Hellwig, dm-devel,
	Mikulas Patocka, Zdenek Kabelac

On Mon, Sep 16, 2019 at 08:16:41PM +0200, Milan Broz wrote:
> 
> So the main idea behind this was just use already existing functionality
> in kernel DM, and provide simple user-friendly way to detect some incompatibilites
> more early. If detection is not there, we just fallback to the old way.

Well, and the nice way to do that is to actually report the features,
not some arbitrary version number.  That is have a sysfs file (or
ioctl for dm if that is the way to go) that reports a list of
capabilities.  Then userspace checks for that desired capability and
only tries the feture if it is supported.

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

* [dm-devel] [PATCH] dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-17  6:32       ` Christoph Hellwig
  0 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2019-09-17  6:32 UTC (permalink / raw)
  To: lvm-devel

On Mon, Sep 16, 2019 at 08:16:41PM +0200, Milan Broz wrote:
> 
> So the main idea behind this was just use already existing functionality
> in kernel DM, and provide simple user-friendly way to detect some incompatibilites
> more early. If detection is not there, we just fallback to the old way.

Well, and the nice way to do that is to actually report the features,
not some arbitrary version number.  That is have a sysfs file (or
ioctl for dm if that is the way to go) that reports a list of
capabilities.  Then userspace checks for that desired capability and
only tries the feture if it is supported.



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

* Re: dm: introduce DM_GET_TARGET_VERSION
  2019-09-17  6:32       ` [dm-devel] " Christoph Hellwig
@ 2019-09-17 13:39         ` Mike Snitzer
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-17 13:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dm-devel, Zdenek Kabelac, Mikulas Patocka, Milan Broz, lvm-devel

On Tue, Sep 17 2019 at  2:32am -0400,
Christoph Hellwig <hch@infradead.org> wrote:

> On Mon, Sep 16, 2019 at 08:16:41PM +0200, Milan Broz wrote:
> > 
> > So the main idea behind this was just use already existing functionality
> > in kernel DM, and provide simple user-friendly way to detect some incompatibilites
> > more early. If detection is not there, we just fallback to the old way.
> 
> Well, and the nice way to do that is to actually report the features,
> not some arbitrary version number.  That is have a sysfs file (or
> ioctl for dm if that is the way to go) that reports a list of
> capabilities.  Then userspace checks for that desired capability and
> only tries the feture if it is supported.

A target's version, while opaque and imperfect, has served DM pretty
well for a long time.  Requires discipline when backporting changes but
stable@ version bumps generally don't occur because such a bump triggers
conflicts across the N stable@ kernels.

So I'm not opposed to fined grained reporting of target features.  But
doing so can come later.

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

* dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-17 13:39         ` Mike Snitzer
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-17 13:39 UTC (permalink / raw)
  To: lvm-devel

On Tue, Sep 17 2019 at  2:32am -0400,
Christoph Hellwig <hch@infradead.org> wrote:

> On Mon, Sep 16, 2019 at 08:16:41PM +0200, Milan Broz wrote:
> > 
> > So the main idea behind this was just use already existing functionality
> > in kernel DM, and provide simple user-friendly way to detect some incompatibilites
> > more early. If detection is not there, we just fallback to the old way.
> 
> Well, and the nice way to do that is to actually report the features,
> not some arbitrary version number.  That is have a sysfs file (or
> ioctl for dm if that is the way to go) that reports a list of
> capabilities.  Then userspace checks for that desired capability and
> only tries the feture if it is supported.

A target's version, while opaque and imperfect, has served DM pretty
well for a long time.  Requires discipline when backporting changes but
stable@ version bumps generally don't occur because such a bump triggers
conflicts across the N stable@ kernels.

So I'm not opposed to fined grained reporting of target features.  But
doing so can come later.



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

* Re: [PATCH] dm: introduce DM_GET_TARGET_VERSION
  2019-09-16 18:16     ` [dm-devel] " Milan Broz
@ 2019-09-17 13:56       ` John Dorminy
  -1 siblings, 0 replies; 24+ messages in thread
From: John Dorminy @ 2019-09-17 13:56 UTC (permalink / raw)
  To: Milan Broz
  Cc: Mike Snitzer, lvm-devel, Christoph Hellwig,
	device-mapper development, Mikulas Patocka, Zdenek Kabelac


[-- Attachment #1.1: Type: text/plain, Size: 785 bytes --]

I'm confused here:
>...and then it fails on activation because DM table load detects old (or
missing) dm-crypt feature.
>(There was no way to get dm target version before table load if module is
not loaded.)
>And I tried to avoid modprobe calls from libcryptsetup.

I'm not understanding how this could work. Let's say there's a module
providing target 'splice' which is currently unloaded. Then `dmsetup
target-version splice` is unaware of the splice target, and thus reports
nothing. So in order to get the proper version number, we do have to do a
modprobe first.
But, if the module providing splice *is* already loaded, `dmsetup targets`
will report splice's version number already, so `dmsetup target-version
splice` is a convenience instead of parsing `dmsetup targets` output?

[-- Attachment #1.2: Type: text/html, Size: 907 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* [dm-devel] [PATCH] dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-17 13:56       ` John Dorminy
  0 siblings, 0 replies; 24+ messages in thread
From: John Dorminy @ 2019-09-17 13:56 UTC (permalink / raw)
  To: lvm-devel

I'm confused here:
>...and then it fails on activation because DM table load detects old (or
missing) dm-crypt feature.
>(There was no way to get dm target version before table load if module is
not loaded.)
>And I tried to avoid modprobe calls from libcryptsetup.

I'm not understanding how this could work. Let's say there's a module
providing target 'splice' which is currently unloaded. Then `dmsetup
target-version splice` is unaware of the splice target, and thus reports
nothing. So in order to get the proper version number, we do have to do a
modprobe first.
But, if the module providing splice *is* already loaded, `dmsetup targets`
will report splice's version number already, so `dmsetup target-version
splice` is a convenience instead of parsing `dmsetup targets` output?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20190917/1d7c5525/attachment.htm>

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

* Re: dm: introduce DM_GET_TARGET_VERSION
  2019-09-17 13:56       ` [dm-devel] " John Dorminy
@ 2019-09-17 14:06         ` Mike Snitzer
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-17 14:06 UTC (permalink / raw)
  To: John Dorminy
  Cc: lvm-devel, Christoph Hellwig, device-mapper development,
	Zdenek Kabelac, Milan Broz

On Tue, Sep 17 2019 at  9:56am -0400,
John Dorminy <jdorminy@redhat.com> wrote:

>    I'm confused here:

>    >...and then it fails on activation because DM table load detects old (or
>    missing) dm-crypt feature.
>    >(There was no way to get dm target version before table load if module is
>    not loaded.)
>    >And I tried to avoid modprobe calls from libcryptsetup.
> 
>    I'm not understanding how this could work. Let's say there's a module
>    providing target 'splice' which is currently unloaded. Then `dmsetup
>    target-version splice` is unaware of the splice target, and thus reports
>    nothing. So in order to get the proper version number, we do have to do a
>    modprobe first.
>    But, if the module providing splice *is* already loaded, `dmsetup targets`
>    will report splice's version number already, so `dmsetup target-version
>    splice` is a convenience instead of parsing `dmsetup targets` output?

dm_get_target_type() loads the requested module.  No userspace modprobe
needed.

--
lvm-devel mailing list
lvm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel

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

* dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-17 14:06         ` Mike Snitzer
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-17 14:06 UTC (permalink / raw)
  To: lvm-devel

On Tue, Sep 17 2019 at  9:56am -0400,
John Dorminy <jdorminy@redhat.com> wrote:

>    I'm confused here:

>    >...and then it fails on activation because DM table load detects old (or
>    missing) dm-crypt feature.
>    >(There was no way to get dm target version before table load if module is
>    not loaded.)
>    >And I tried to avoid modprobe calls from libcryptsetup.
> 
>    I'm not understanding how this could work. Let's say there's a module
>    providing target 'splice' which is currently unloaded. Then `dmsetup
>    target-version splice` is unaware of the splice target, and thus reports
>    nothing. So in order to get the proper version number, we do have to do a
>    modprobe first.
>    But, if the module providing splice *is* already loaded, `dmsetup targets`
>    will report splice's version number already, so `dmsetup target-version
>    splice` is a convenience instead of parsing `dmsetup targets` output?

dm_get_target_type() loads the requested module.  No userspace modprobe
needed.



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

* Re: dm: introduce DM_GET_TARGET_VERSION
  2019-09-17 14:06         ` Mike Snitzer
@ 2019-09-17 15:38           ` Mikulas Patocka
  -1 siblings, 0 replies; 24+ messages in thread
From: Mikulas Patocka @ 2019-09-17 15:38 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: John Dorminy, lvm-devel, Christoph Hellwig,
	device-mapper development, Zdenek Kabelac, Milan Broz



On Tue, 17 Sep 2019, Mike Snitzer wrote:

> On Tue, Sep 17 2019 at  9:56am -0400,
> John Dorminy <jdorminy@redhat.com> wrote:
> 
> >    I'm confused here:
> 
> >    >...and then it fails on activation because DM table load detects old (or
> >    missing) dm-crypt feature.
> >    >(There was no way to get dm target version before table load if module is
> >    not loaded.)
> >    >And I tried to avoid modprobe calls from libcryptsetup.
> > 
> >    I'm not understanding how this could work. Let's say there's a module
> >    providing target 'splice' which is currently unloaded. Then `dmsetup
> >    target-version splice` is unaware of the splice target, and thus reports
> >    nothing. So in order to get the proper version number, we do have to do a
> >    modprobe first.
> >    But, if the module providing splice *is* already loaded, `dmsetup targets`
> >    will report splice's version number already, so `dmsetup target-version
> >    splice` is a convenience instead of parsing `dmsetup targets` output?
> 
> dm_get_target_type() loads the requested module.  No userspace modprobe
> needed.

The reason why Milan wanted it is - that it is bad practice to call 
external processes from libraries. He doesn't want to call modprobe from 
libcryptsetup. So I created this patch that calls modprobe from the kernel 
ioctl.

Mikulas

--
lvm-devel mailing list
lvm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel

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

* dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-17 15:38           ` Mikulas Patocka
  0 siblings, 0 replies; 24+ messages in thread
From: Mikulas Patocka @ 2019-09-17 15:38 UTC (permalink / raw)
  To: lvm-devel



On Tue, 17 Sep 2019, Mike Snitzer wrote:

> On Tue, Sep 17 2019 at  9:56am -0400,
> John Dorminy <jdorminy@redhat.com> wrote:
> 
> >    I'm confused here:
> 
> >    >...and then it fails on activation because DM table load detects old (or
> >    missing) dm-crypt feature.
> >    >(There was no way to get dm target version before table load if module is
> >    not loaded.)
> >    >And I tried to avoid modprobe calls from libcryptsetup.
> > 
> >    I'm not understanding how this could work. Let's say there's a module
> >    providing target 'splice' which is currently unloaded. Then `dmsetup
> >    target-version splice` is unaware of the splice target, and thus reports
> >    nothing. So in order to get the proper version number, we do have to do a
> >    modprobe first.
> >    But, if the module providing splice *is* already loaded, `dmsetup targets`
> >    will report splice's version number already, so `dmsetup target-version
> >    splice` is a convenience instead of parsing `dmsetup targets` output?
> 
> dm_get_target_type() loads the requested module.  No userspace modprobe
> needed.

The reason why Milan wanted it is - that it is bad practice to call 
external processes from libraries. He doesn't want to call modprobe from 
libcryptsetup. So I created this patch that calls modprobe from the kernel 
ioctl.

Mikulas



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

* Re: dm: introduce DM_GET_TARGET_VERSION
  2019-09-17 15:38           ` Mikulas Patocka
@ 2019-09-17 15:44             ` John Dorminy
  -1 siblings, 0 replies; 24+ messages in thread
From: John Dorminy @ 2019-09-17 15:44 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Mike Snitzer, lvm-devel, Christoph Hellwig,
	device-mapper development, Zdenek Kabelac, Milan Broz


[-- Attachment #1.1: Type: text/plain, Size: 534 bytes --]

Makes sense, sorry I missed that detail.

Might it be better to just extend 'dmsetup targets' to take an optional
target-name parameter? When I saw this change, I thought 'dmsetup targets
<name>' surely worked already for the purpose, and was somewhat surprised
when experiment disagreed. Then list_versions() has much the same code
change as in this change, there's a little change in validate_params(), and
it seems less surprising (to me) to extend the existing
target-information-printing dmsetup command than to add another one.

[-- Attachment #1.2: Type: text/html, Size: 611 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-17 15:44             ` John Dorminy
  0 siblings, 0 replies; 24+ messages in thread
From: John Dorminy @ 2019-09-17 15:44 UTC (permalink / raw)
  To: lvm-devel

Makes sense, sorry I missed that detail.

Might it be better to just extend 'dmsetup targets' to take an optional
target-name parameter? When I saw this change, I thought 'dmsetup targets
<name>' surely worked already for the purpose, and was somewhat surprised
when experiment disagreed. Then list_versions() has much the same code
change as in this change, there's a little change in validate_params(), and
it seems less surprising (to me) to extend the existing
target-information-printing dmsetup command than to add another one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20190917/59045754/attachment.htm>

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

* Re: dm: introduce DM_GET_TARGET_VERSION
  2019-09-17 15:44             ` John Dorminy
@ 2019-09-17 20:08               ` Mike Snitzer
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-17 20:08 UTC (permalink / raw)
  To: John Dorminy
  Cc: lvm-devel, Christoph Hellwig, device-mapper development,
	Zdenek Kabelac, Milan Broz

On Tue, Sep 17 2019 at 11:44am -0400,
John Dorminy <jdorminy@redhat.com> wrote:

>    Makes sense, sorry I missed that detail.
> 
>    Might it be better to just extend 'dmsetup targets' to take an optional
>    target-name parameter? When I saw this change, I thought 'dmsetup targets
>    <name>' surely worked already for the purpose, and was somewhat surprised
>    when experiment disagreed. Then list_versions() has much the same code
>    change as in this change, there's a little change in validate_params(),
>    and it seems less surprising (to me) to extend the existing
>    target-information-printing dmsetup command than to add another one.

No, I don't think it better to extend 'dmsetup targets'.  There is
little to be gained in doing so.

The DM_GET_TARGET_VERSION ioctl's implementation happens to be shared
with the DM_LIST_VERSIONS ioctl (used by 'dmsetup targets') but that
doesn't imply DM_LIST_VERSIONS should be extended instead.

This is a simple change that enables userspace to accomplish a specific
goal without altering an established DM ioctl.

--
lvm-devel mailing list
lvm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel

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

* dm: introduce DM_GET_TARGET_VERSION
@ 2019-09-17 20:08               ` Mike Snitzer
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Snitzer @ 2019-09-17 20:08 UTC (permalink / raw)
  To: lvm-devel

On Tue, Sep 17 2019 at 11:44am -0400,
John Dorminy <jdorminy@redhat.com> wrote:

>    Makes sense, sorry I missed that detail.
> 
>    Might it be better to just extend 'dmsetup targets' to take an optional
>    target-name parameter? When I saw this change, I thought 'dmsetup targets
>    <name>' surely worked already for the purpose, and was somewhat surprised
>    when experiment disagreed. Then list_versions() has much the same code
>    change as in this change, there's a little change in validate_params(),
>    and it seems less surprising (to me) to extend the existing
>    target-information-printing dmsetup command than to add another one.

No, I don't think it better to extend 'dmsetup targets'.  There is
little to be gained in doing so.

The DM_GET_TARGET_VERSION ioctl's implementation happens to be shared
with the DM_LIST_VERSIONS ioctl (used by 'dmsetup targets') but that
doesn't imply DM_LIST_VERSIONS should be extended instead.

This is a simple change that enables userspace to accomplish a specific
goal without altering an established DM ioctl.



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

end of thread, other threads:[~2019-09-17 20:08 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16  9:55 [PATCH] dm: introduce DM_GET_TARGET_VERSION Mikulas Patocka
2019-09-16  9:55 ` Mikulas Patocka
2019-09-16  9:58 ` [PATCH] lvm: " Mikulas Patocka
2019-09-16  9:58   ` Mikulas Patocka
2019-09-16 14:21 ` dm: " Mike Snitzer
2019-09-16 14:21   ` Mike Snitzer
2019-09-16 18:01 ` [PATCH] " Christoph Hellwig
2019-09-16 18:01   ` [dm-devel] " Christoph Hellwig
2019-09-16 18:16   ` Milan Broz
2019-09-16 18:16     ` [dm-devel] " Milan Broz
2019-09-17  6:32     ` Christoph Hellwig
2019-09-17  6:32       ` [dm-devel] " Christoph Hellwig
2019-09-17 13:39       ` Mike Snitzer
2019-09-17 13:39         ` Mike Snitzer
2019-09-17 13:56     ` [PATCH] " John Dorminy
2019-09-17 13:56       ` [dm-devel] " John Dorminy
2019-09-17 14:06       ` Mike Snitzer
2019-09-17 14:06         ` Mike Snitzer
2019-09-17 15:38         ` Mikulas Patocka
2019-09-17 15:38           ` Mikulas Patocka
2019-09-17 15:44           ` John Dorminy
2019-09-17 15:44             ` John Dorminy
2019-09-17 20:08             ` Mike Snitzer
2019-09-17 20:08               ` Mike Snitzer

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.