[Accel-config] [PATCH v1 1/2] accel-config: Make remove-mdev cmd "remove all" option more intuitive
ramesh.thomas at intel.com
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
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(-)
diff --git a/accfg/mdev.c b/accfg/mdev.c
index 3bde7eb..3b74efd 100644
--- a/accfg/mdev.c
+++ b/accfg/mdev.c
@@ -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);
}
--
2.26.3