[Accel-config] [PATCH v1 4/6] accel-config: Add check for mdev support availability in commands

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Add check for mdev support availability in mdev commands and exit
with error message if support is not available.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/mdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/accfg/mdev.c b/accfg/mdev.c
index 652b734..3bde7eb 100644
--- a/accfg/mdev.c
+++ b/accfg/mdev.c
@@ -90,6 +90,11 @@ int cmd_create_mdev(int argc, const char **argv, void *ctx)
 		usage_with_options(u, options);
 	}
 
+	if (!accfg_device_get_mdev_enabled(device)) {
+		fprintf(stderr, "mdev support not available\n");
+		return 0;
+	}
+
 	argc = parse_options(argc, argv, options, u, 0);
 	if (opt_called)
 		return 0;
@@ -138,6 +143,11 @@ int cmd_remove_mdev(int argc, const char **argv, void *ctx)
 		usage_with_options(u, options);
 	}
 
+	if (!accfg_device_get_mdev_enabled(device)) {
+		fprintf(stderr, "mdev support not available\n");
+		return 0;
+	}
+
 	argc = parse_options(argc, argv, options, u, 0);
 	if (opt_called)
 		return 0;
-- 
2.26.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.