[libvirt] [PATCH 4/6] virsh: Create macro for "overwrite" and no-overwrite" options

John Ferlan jferlan at redhat.com
Wed Nov 25 19:11:06 UTC 2015


Although not currently used in more than one command, it soon will be
so create a common macro to be used in the new command location.

Additionally, add the ".flags = 0," for both to match the expections
of the structure being predefined.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 tools/virsh-pool.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 4b4fea0..ff77039 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -47,6 +47,20 @@
      .help = N_("file containing an XML pool description")    \
     },                                                        \
 
+#define OPT_NO_OVERWRITE_COMMON                                   \
+    {.name = "no-overwrite",                                      \
+     .type = VSH_OT_BOOL,                                         \
+     .flags = 0,                                                  \
+     .help = N_("do not overwrite an existing pool of this type") \
+    },                                                            \
+
+#define OPT_OVERWRITE_COMMON                                      \
+    {.name = "overwrite",                                         \
+     .type = VSH_OT_BOOL,                                         \
+     .flags = 0,                                                  \
+     .help = N_("overwrite any existing data")                    \
+    },                                                            \
+
 virStoragePoolPtr
 virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
                       const char **name, unsigned int flags)
@@ -506,15 +520,9 @@ static const vshCmdInfo info_pool_build[] = {
 
 static const vshCmdOptDef opts_pool_build[] = {
     OPT_POOL_COMMON
+    OPT_NO_OVERWRITE_COMMON
+    OPT_OVERWRITE_COMMON
 
-    {.name = "no-overwrite",
-     .type = VSH_OT_BOOL,
-     .help = N_("do not overwrite an existing pool of this type")
-    },
-    {.name = "overwrite",
-     .type = VSH_OT_BOOL,
-     .help = N_("overwrite any existing data")
-    },
     {.name = NULL}
 };
 
-- 
2.5.0




More information about the libvir-list mailing list