Skip to contentSkip to conversation

Make remove-mdev command more intuitive

PATCH In review ramesh.thomas at intel.com 2 participants 4 messages May 7, 2021 – May 10, 2021 Documentation

lore
Share & tools
lore

ramesh.thomas at intel.com

#0 lore raw

cover Make remove-mdev command more intuitive

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

remove-mdev has an option to remove all mdevs if null uuid is passed as parameter. Null uuid is not easy for user to type in because it is long and needs to be in the uuid format. Change the command to take "all" as a special parameter value to indicate removal of all mdeves.

Ramesh Thomas (2):
accel-config: Make remove-mdev cmd "remove all" option more intuitive
accel-config: Update manpages with change to remove-mdev command

 Documentation/accfg/accel-config-remove-mdev.txt | 5 ++---
 accfg/mdev.c                                     | 6 ++++--
 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.26.3
#1 lore raw

PATCH 1/2 accel-config: Make remove-mdev cmd "remove all" option more intuitive

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Currently user needs to pass a null uuid to remove all mdevs. Null uuid string is too long and needs to be in the uuid format which is not easy for user to remember and type. Add support for a special parameter "all" to indicate removall of all mdevs.

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/mdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
accfg/mdev.c +4 -2
index 3bde7eb..3b74efd 100644
@@ -130,7 +130,7 @@ int cmd_remove_mdev(int argc, const char **argv, void *ctx)
 
 	const char *const u[] = {
 		"accfg remove-mdev <device name> [<uuid>|<options>]",
-		"Pass null uuid to remove all mdevs",
+		"Pass \"all\" to remove all mdevs",
 		NULL
 	};
 
@@ -152,7 +152,9 @@ int cmd_remove_mdev(int argc, const char **argv, void *ctx)
 	if (opt_called)
 		return 0;
 
-	if (uuid_parse(argv[1], uuid) < 0) {
+	if (!strcmp(argv[1], "all"))
+		uuid_clear(uuid);
+	else if (uuid_parse(argv[1], uuid) < 0) {
 		fprintf(stderr, "Invalid uuid\n");
 		usage_with_options(u, options);
 	}
Signature · 1 line
2.26.3
#2 lore raw

PATCH 2/2 accel-config: Update manpages with change to remove-mdev command

In reply to ramesh.thomas at intel.com

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Update manpages with the new method to remove all mdevs by passing a specal parameter "all"

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 Documentation/accfg/accel-config-remove-mdev.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/accfg/accel-config-remove-mdev.txt +2 -3
index 90cab5a..f796511 100644
@@ -6,8 +6,7 @@ accel-config-remove-mdev(1)
 NAME
 ----
 accel-config-remove-mdev - remove mdev of a device associated with
-the passed uuid. Passing a null uuid will remove all mdevs of the
-device.
+the passed uuid. Passing "all" will remove all mdevs of the device.
 
 SYNOPSIS
 --------
@@ -18,7 +17,7 @@ EXAMPLE
 -------
 accel-config remove-mdev dsa0 0f34f0ed-6f67-4086-a4b7-8e1ecf077dce
 
-accel-config remove-mdev dsa0 00000000-0000-0000-0000-000000000000
+accel-config remove-mdev dsa0 all
 
 accel-config remove-mdev dsa0 -l
 ----
Signature · 1 line
2.26.3
Reviewed-by on the v1 series
#3 lore raw
In reply to ramesh.thomas at intel.com
Quoted 6 lines · ramesh.thomas(a)intel.com

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

remove-mdev has an option to remove all mdevs if null uuid is passed as parameter. Null uuid is not easy for user to type in because it is long and needs to be in the uuid format. Change the command to take "all" as a special parameter value to indicate removal of all mdeves.

Reviewed-by Dave Jiang <dave.jiang(a)intel.com>

This is def better.

Quoted 9 lines

Ramesh Thomas (2):
accel-config: Make remove-mdev cmd "remove all" option more intuitive
accel-config: Update manpages with change to remove-mdev command

  Documentation/accfg/accel-config-remove-mdev.txt | 5 ++---
  accfg/mdev.c                                     | 6 ++++--
  2 files changed, 6 insertions(+), 5 deletions(-)