]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Create macro for "overwrite" and no-overwrite" options
authorJohn Ferlan <jferlan@redhat.com>
Wed, 25 Nov 2015 14:35:41 +0000 (09:35 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 17 Dec 2015 16:56:18 +0000 (11:56 -0500)
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.

tools/virsh-pool.c

index 06f69d81783ce0f60ac8ba7dd8f226b89585a9fb..5bce69fd5f9f1616541ded707f9f40131d8923b0 100644 (file)
      .help = N_("file containing an XML pool description")    \
     }                                                         \
 
+#define VSH_POOL_NO_OVERWRITE_OPT_COMMON                          \
+    {.name = "no-overwrite",                                      \
+     .type = VSH_OT_BOOL,                                         \
+     .flags = 0,                                                  \
+     .help = N_("do not overwrite an existing pool of this type") \
+    }                                                             \
+
+#define VSH_POOL_OVERWRITE_OPT_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[] = {
     VSH_POOL_OPT_COMMON,
+    VSH_POOL_NO_OVERWRITE_OPT_COMMON,
+    VSH_POOL_OVERWRITE_OPT_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}
 };