[libvirt] [PATCH 3/6] virsh: Create macro for "file" option

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


Rather than continually cut/paste the "file" option for pool command
option structures, generate a macro which will commonly define it for
any command.  Then of course use that macro.

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

diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 6922ad5..4b4fea0 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -40,6 +40,13 @@
      .help = N_("pool name or uuid")                          \
     },                                                        \
 
+#define OPT_FILE_COMMON                                       \
+    {.name = "file",                                          \
+     .type = VSH_OT_DATA,                                     \
+     .flags = VSH_OFLAG_REQ,                                  \
+     .help = N_("file containing an XML pool description")    \
+    },                                                        \
+
 virStoragePoolPtr
 virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
                       const char **name, unsigned int flags)
@@ -145,11 +152,8 @@ static const vshCmdInfo info_pool_create[] = {
 };
 
 static const vshCmdOptDef opts_pool_create[] = {
-    {.name = "file",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("file containing an XML pool description")
-    },
+    OPT_FILE_COMMON
+
     {.name = NULL}
 };
 
@@ -410,11 +414,8 @@ static const vshCmdInfo info_pool_define[] = {
 };
 
 static const vshCmdOptDef opts_pool_define[] = {
-    {.name = "file",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("file containing an XML pool description")
-    },
+    OPT_FILE_COMMON
+
     {.name = NULL}
 };
 
-- 
2.5.0




More information about the libvir-list mailing list