]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: nvme.c: Allow plug-ins to access to output formats and helper.
authorChaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
Wed, 1 Mar 2017 02:14:08 +0000 (18:14 -0800)
committerKeith Busch <keith.busch@intel.com>
Wed, 1 Mar 2017 15:14:16 +0000 (10:14 -0500)
This patch allows plug-ins to access output format enums and
its helper by moving the enum definition and helper declaration
to the header file.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
nvme.c
nvme.h

diff --git a/nvme.c b/nvme.c
index 246736d1153658a8f8fa49c431ec46e752ced0b6..4971683573b258f4899e9a41faad62b49eee44e1 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -157,13 +157,7 @@ int parse_and_open(int argc, char **argv, const char *desc,
 
 static const char *output_format = "Output format: normal|json|binary";
 
-enum {
-       NORMAL,
-       JSON,
-       BINARY,
-};
-
-static int validate_output_format(char *format)
+int validate_output_format(char *format)
 {
        if (!format)
                return -EINVAL;
diff --git a/nvme.h b/nvme.h
index d3d8a93a00d6b3d46da4e688e75d84c4f10c0fb9..fb2a3a38c37da70f05f5dc201c39f91ac4d3cf21 100644 (file)
--- a/nvme.h
+++ b/nvme.h
@@ -149,6 +149,12 @@ struct list_item {
        unsigned            block;
 };
 
+enum {
+       NORMAL,
+       JSON,
+       BINARY,
+};
+
 void register_extension(struct plugin *plugin);
 
 #include "argconfig.h"
@@ -158,5 +164,6 @@ int parse_and_open(int argc, char **argv, const char *desc,
 extern const char *devicename;
 
 int __id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *plugin, void (*vs)(__u8 *vs, struct json_object *root));
+int    validate_output_format(char *format);
 
 #endif /* _NVME_H */