[PATCH 22/23] vsh: remove VSH_OFLAG_REQ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The flag was replaced by the 'required' field in the option definition.
Remove last few uses and all assignments.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/virsh-domain-monitor.c |  2 --
 tools/virsh-domain.c         | 62 +-----------------------------------
 tools/virsh-host.c           |  5 ---
 tools/virsh-interface.c      |  6 ----
 tools/virsh-network.c        |  7 ----
 tools/virsh-nodedev.c        | 10 ------
 tools/virsh-nwfilter.c       |  5 ---
 tools/virsh-pool.c           |  4 ---
 tools/virsh-secret.c         |  4 ---
 tools/virsh-snapshot.c       |  1 -
 tools/virsh-volume.c         |  6 ----
 tools/virsh.h                |  3 --
 tools/virt-admin.c           | 12 +------
 tools/vsh.c                  |  8 ++---
 tools/vsh.h                  |  1 -
 15 files changed, 6 insertions(+), 130 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 568ff770a1..6c2499fb9f 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -740,7 +740,6 @@ static const vshCmdOptDef opts_domif_getlink[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainInterfaceCompleter,
      .help = N_("interface device (MAC Address)")
     },
@@ -1042,7 +1041,6 @@ static const vshCmdOptDef opts_domifstat[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainInterfaceCompleter,
      .help = N_("interface device specified by name or MAC Address")
     },
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1dbef9a7a6..7c2613c85b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -422,14 +422,13 @@ static const vshCmdOptDef opts_attach_disk[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK,
+     .flags = VSH_OFLAG_EMPTY_OK,
      .help = N_("source of disk device or name of network disk")
     },
     {.name = "target",
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("target of disk device")
     },
@@ -818,14 +817,12 @@ static const vshCmdOptDef opts_attach_interface[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("network interface type")
     },
     {.name = "source",
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("source of network interface")
     },
     {.name = "target",
@@ -1198,7 +1195,6 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("block device")
     },
@@ -1993,7 +1989,6 @@ static const vshCmdOptDef opts_blockcommit[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("fully-qualified path of disk")
     },
@@ -2214,7 +2209,6 @@ static const vshCmdOptDef opts_blockcopy[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("fully-qualified path of source disk")
     },
@@ -2548,7 +2542,6 @@ static const vshCmdOptDef opts_blockjob[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("fully-qualified path of disk")
     },
@@ -2761,7 +2754,6 @@ static const vshCmdOptDef opts_blockpull[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("fully-qualified path of disk")
     },
@@ -2905,7 +2897,6 @@ static const vshCmdOptDef opts_blockresize[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("Fully-qualified path of block device")
     },
@@ -3064,7 +3055,6 @@ static const vshCmdOptDef opts_domif_setlink[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainInterfaceCompleter,
      .help = N_("interface device (MAC Address)")
     },
@@ -3072,7 +3062,6 @@ static const vshCmdOptDef opts_domif_setlink[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainInterfaceStateCompleter,
      .help = N_("new state of the device")
     },
@@ -3214,7 +3203,6 @@ static const vshCmdOptDef opts_domiftune[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainInterfaceCompleter,
      .help = N_("interface device (MAC Address)")
     },
@@ -3441,7 +3429,6 @@ static const vshCmdOptDef opts_dom_pm_suspend[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshNodeSuspendTargetCompleter,
      .help = N_("mem(Suspend-to-RAM), "
                 "disk(Suspend-to-Disk), "
@@ -4126,7 +4113,6 @@ static const vshCmdOptDef opts_save[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("where to save the data")
     },
     {.name = "bypass-cache",
@@ -4477,7 +4463,6 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("saved state file to read")
     },
     {.name = "security-info",
@@ -4536,14 +4521,12 @@ static const vshCmdOptDef opts_save_image_define[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("saved state file to modify")
     },
     {.name = "xml",
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompletePathLocalExisting,
      .help = N_("filename containing updated XML for the target")
     },
@@ -4603,7 +4586,6 @@ static const vshCmdOptDef opts_save_image_edit[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("saved state file to edit")
     },
     {.name = "running",
@@ -4944,7 +4926,6 @@ static const vshCmdOptDef opts_managed_save_define[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompletePathLocalExisting,
      .help = N_("filename containing updated XML for the target")
     },
@@ -5222,7 +5203,6 @@ static const vshCmdOptDef opts_restore[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("the state to restore")
     },
     {.name = "bypass-cache",
@@ -5307,7 +5287,6 @@ static const vshCmdOptDef opts_dump[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("where to dump the core")
     },
     VIRSH_COMMON_OPT_LIVE(N_("perform a live core dump if supported")),
@@ -5608,7 +5587,6 @@ static const vshCmdOptDef opts_setLifecycleAction[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainLifecycleCompleter,
      .help = N_("lifecycle type to modify")
     },
@@ -5616,7 +5594,6 @@ static const vshCmdOptDef opts_setLifecycleAction[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainLifecycleActionCompleter,
      .help = N_("lifecycle action to set")
     },
@@ -5704,14 +5681,12 @@ static const vshCmdOptDef opts_set_user_password[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("the username")
     },
     {.name = "password",
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("the new password")
     },
@@ -7128,7 +7103,6 @@ static const vshCmdOptDef opts_setvcpus[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("number of virtual CPUs")
     },
     {.name = "maximum",
@@ -7296,7 +7270,6 @@ static const vshCmdOptDef opts_setvcpu[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainVcpulistCompleter,
      .help = N_("ids of vcpus to manipulate")
     },
@@ -7372,7 +7345,6 @@ static const vshCmdOptDef opts_domblkthreshold[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("device to set threshold for")
     },
@@ -7380,7 +7352,6 @@ static const vshCmdOptDef opts_domblkthreshold[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("threshold as a scaled number (by default bytes)")
     },
     {.name = NULL}
@@ -7504,7 +7475,6 @@ static const vshCmdOptDef opts_iothreadpin[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainIOThreadIdCompleter,
      .help = N_("IOThread ID number")
     },
@@ -7512,7 +7482,6 @@ static const vshCmdOptDef opts_iothreadpin[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainCpulistCompleter,
      .help = N_("host cpu number(s) to set")
     },
@@ -7581,7 +7550,6 @@ static const vshCmdOptDef opts_iothreadadd[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("iothread for the new IOThread")
     },
     VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -7639,7 +7607,6 @@ static const vshCmdOptDef opts_iothreadset[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainIOThreadIdCompleter,
      .help = N_("iothread id of existing IOThread")
     },
@@ -7757,7 +7724,6 @@ static const vshCmdOptDef opts_iothreaddel[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainIOThreadIdCompleter,
      .help = N_("iothread_id for the IOThread to delete")
     },
@@ -8368,7 +8334,6 @@ static const vshCmdOptDef opts_metadata[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("URI of the namespace")
     },
     VIRSH_COMMON_OPT_LIVE(N_("modify/get running state")),
@@ -8547,7 +8512,6 @@ static const vshCmdOptDef opts_send_key[] = {
     {.name = "keycode",
      .type = VSH_OT_ARGV,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshKeycodeNameCompleter,
      .help = N_("the key code")
     },
@@ -8633,7 +8597,6 @@ static const vshCmdOptDef opts_send_process_signal[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("the process ID")
     },
@@ -8641,7 +8604,6 @@ static const vshCmdOptDef opts_send_process_signal[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainSignalCompleter,
      .help = N_("the signal number or name")
     },
@@ -8731,7 +8693,6 @@ static const vshCmdOptDef opts_setmem[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("new memory size, as scaled integer (default KiB)")
     },
     VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -8802,7 +8763,6 @@ static const vshCmdOptDef opts_setmaxmem[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("new maximum memory size, as scaled integer (default KiB)")
     },
     VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -9577,7 +9537,6 @@ static const vshCmdOptDef opts_dom_fd_associate[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("name of the FD group")
     },
@@ -9585,7 +9544,6 @@ static const vshCmdOptDef opts_dom_fd_associate[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("file descriptors N,M,... to associate")
     },
@@ -9662,7 +9620,6 @@ static const vshCmdOptDef opts_qemu_monitor_command[] = {
     {.name = "cmd",
      .type = VSH_OT_ARGV,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("command")
     },
     {.name = NULL}
@@ -9999,7 +9956,6 @@ static const vshCmdOptDef opts_qemu_attach[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("pid")
     },
@@ -10057,7 +10013,6 @@ static const vshCmdOptDef opts_qemu_agent_command[] = {
     {.name = "cmd",
      .type = VSH_OT_ARGV,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("command")
     },
     {.name = NULL}
@@ -10154,7 +10109,6 @@ static const vshCmdOptDef opts_lxc_enter_namespace[] = {
     {.name = "cmd",
      .type = VSH_OT_ARGV,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("command to run")
     },
     {.name = NULL}
@@ -10335,14 +10289,12 @@ static const vshCmdOptDef opts_domxmlfromnative[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("source config data format")
     },
     {.name = "config",
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompletePathLocalExisting,
      .help = N_("config data file to import from")
     },
@@ -10387,7 +10339,6 @@ static const vshCmdOptDef opts_domxmltonative[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("target config data type format")
     },
     VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(VSH_OFLAG_REQ_OPT, 0),
@@ -10456,7 +10407,6 @@ static const vshCmdOptDef opts_domname[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainUUIDCompleter,
      .help = N_("domain id or uuid")
     },
@@ -10491,7 +10441,6 @@ static const vshCmdOptDef opts_domrename[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("new domain name")
     },
@@ -10595,7 +10544,6 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("connection URI of the destination host as seen from the client(normal migration) or source(p2p migration)")
     },
@@ -11294,7 +11242,6 @@ static const vshCmdOptDef opts_migrate_setmaxdowntime[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("maximum tolerable downtime (in milliseconds) for migration")
     },
     {.name = NULL}
@@ -11414,7 +11361,6 @@ static const vshCmdOptDef opts_migrate_setspeed[] = {
      .type = VSH_OT_INT,
      .required = true,
      .positional = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("migration bandwidth limit in MiB/s")
     },
     {.name = "postcopy",
@@ -12005,7 +11951,6 @@ static const vshCmdOptDef opts_detach_device_alias[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDeviceAliasCompleter,
      .help = N_("device alias")
     },
@@ -12135,7 +12080,6 @@ static const vshCmdOptDef opts_detach_interface[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("network interface type")
     },
     {.name = "mac",
@@ -12509,7 +12453,6 @@ static const vshCmdOptDef opts_detach_disk[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("target of disk device")
     },
@@ -12671,7 +12614,6 @@ static const vshCmdOptDef opts_change_media[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshDomainDiskTargetCompleter,
      .help = N_("Fully-qualified path or target of disk device")
     },
@@ -13147,7 +13089,6 @@ static const vshCmdOptDef opts_get_user_sshkeys[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("user to list authorized keys for"),
     },
     {.name = NULL}
@@ -13196,7 +13137,6 @@ static const vshCmdOptDef opts_set_user_sshkeys[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("user to set authorized keys for"),
     },
     {.name = "file",
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 97de6f8bed..ffb993de79 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -470,7 +470,6 @@ static const vshCmdOptDef opts_allocpages[] = {
      .type = VSH_OT_INT,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshAllocpagesPagesizeCompleter,
      .help = N_("page size (in kibibytes)")
     },
@@ -478,7 +477,6 @@ static const vshCmdOptDef opts_allocpages[] = {
      .type = VSH_OT_INT,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("page count")
     },
     {.name = "cellno",
@@ -949,7 +947,6 @@ static const vshCmdOptDef opts_node_suspend[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshNodeSuspendTargetCompleter,
      .help = N_("mem(Suspend-to-RAM), disk(Suspend-to-Disk), "
                 "hybrid(Hybrid-Suspend)")
@@ -958,7 +955,6 @@ static const vshCmdOptDef opts_node_suspend[] = {
      .type = VSH_OT_INT,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("Suspend duration in seconds, at least 60")
     },
     {.name = NULL}
@@ -1281,7 +1277,6 @@ static const vshCmdOptDef opts_cpu_models[] = {
      .positional = true,
      .required = true,
      .completer = virshArchCompleter,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("architecture")
     },
     {.name = NULL}
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 109378ca71..1b1344c17c 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -23,7 +23,6 @@
      .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .help = N_("interface name or MAC address"), \
      .completer = virshInterfaceNameCompleter, \
      .completer_flags = cflags, \
@@ -387,7 +386,6 @@ static const vshCmdOptDef opts_interface_name[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshInterfaceMacCompleter,
      .help = N_("interface mac")
     },
@@ -420,7 +418,6 @@ static const vshCmdOptDef opts_interface_mac[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshInterfaceNameCompleter,
      .help = N_("interface name")
     },
@@ -724,7 +721,6 @@ static const vshCmdOptDef opts_interface_bridge[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshInterfaceNameCompleter,
      .help = N_("existing interface name")
     },
@@ -732,7 +728,6 @@ static const vshCmdOptDef opts_interface_bridge[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("new bridge device name")
     },
     {.name = "no-stp",
@@ -955,7 +950,6 @@ static const vshCmdOptDef opts_interface_unbridge[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("current bridge device name")
     },
     {.name = "no-start",
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index edbcebd682..376de46cf4 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -35,7 +35,6 @@
      .type = VSH_OT_STRING,\
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .help = _helpstr, \
      .completer = virshNetworkNameCompleter, \
      .completer_flags = cflags, \
@@ -60,7 +59,6 @@
      .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .help = N_("port UUID"), \
      .completer = virshNetworkPortUUIDCompleter, \
      .completer_flags = cflags, \
@@ -526,7 +524,6 @@ static const vshCmdOptDef opts_network_metadata[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("URI of the namespace")
     },
     VIRSH_COMMON_OPT_LIVE(N_("modify/get running state")),
@@ -1153,7 +1150,6 @@ static const vshCmdOptDef opts_network_name[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshNetworkUUIDCompleter,
      .help = N_("network uuid")
     },
@@ -1252,7 +1248,6 @@ static const vshCmdOptDef opts_network_update[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshNetworkUpdateCommandCompleter,
      .help = N_("type of update (add-first, add-last (add), delete, or modify)")
     },
@@ -1260,7 +1255,6 @@ static const vshCmdOptDef opts_network_update[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshNetworkUpdateSectionCompleter,
      .help = N_("which section of network configuration to update")
     },
@@ -1268,7 +1262,6 @@ static const vshCmdOptDef opts_network_update[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompletePathLocalExisting,
      .help = N_("name of file containing xml (or, if it starts with '<', the complete "
                 "xml element itself) to add/modify, or to be matched for search")
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 7d63581436..90cfc187e5 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -99,7 +99,6 @@ static const vshCmdOptDef opts_node_device_destroy[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -575,7 +574,6 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -640,7 +638,6 @@ static const vshCmdOptDef opts_node_device_detach[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device key"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -704,7 +701,6 @@ static const vshCmdOptDef opts_node_device_reattach[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device key"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -751,7 +747,6 @@ static const vshCmdOptDef opts_node_device_reset[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device key"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -1014,7 +1009,6 @@ static const vshCmdOptDef opts_node_device_undefine[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -1107,7 +1101,6 @@ static const vshCmdOptDef opts_node_device_start[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device name"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -1154,7 +1147,6 @@ static const vshCmdOptDef opts_node_device_autostart[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -1213,7 +1205,6 @@ static const vshCmdOptDef opts_node_device_info[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
      .completer = virshNodeDeviceNameCompleter,
     },
@@ -1265,7 +1256,6 @@ static const vshCmdOptDef opts_node_device_update[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
      .completer = virshNodeDeviceNameCompleter,
     },
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index faa8e98130..f54d2a0ae5 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -131,7 +131,6 @@ static const vshCmdOptDef opts_nwfilter_undefine[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("network filter name or uuid"),
      .completer = virshNWFilterNameCompleter,
     },
@@ -171,7 +170,6 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("network filter name or uuid"),
      .completer = virshNWFilterNameCompleter,
     },
@@ -397,7 +395,6 @@ static const vshCmdOptDef opts_nwfilter_edit[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("network filter name or uuid"),
      .completer = virshNWFilterNameCompleter,
     },
@@ -534,7 +531,6 @@ static const vshCmdOptDef opts_nwfilter_binding_delete[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("network filter binding port dev"),
      .completer = virshNWFilterBindingNameCompleter,
     },
@@ -576,7 +572,6 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("network filter binding portdev"),
      .completer = virshNWFilterBindingNameCompleter,
     },
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 8557e0d5e0..67cc1b94cf 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -60,7 +60,6 @@
      .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .completer = virshCompleteEmpty, \
      .help = N_("name of the pool") \
     }, \
@@ -68,7 +67,6 @@
      .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .completer = virshPoolTypeCompleter, \
      .help = N_("type of the pool") \
     }, \
@@ -1360,7 +1358,6 @@ static const vshCmdOptDef opts_find_storage_pool_sources_as[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshPoolTypeCompleter,
      .help = N_("type of storage pool sources to find")
     },
@@ -1445,7 +1442,6 @@ static const vshCmdOptDef opts_find_storage_pool_sources[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshPoolTypeCompleter,
      .help = N_("type of storage pool sources to discover")
     },
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 0d0db9877b..7e10afa765 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -126,7 +126,6 @@ static const vshCmdOptDef opts_secret_dumpxml[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("secret UUID"),
      .completer = virshSecretUUIDCompleter,
     },
@@ -183,7 +182,6 @@ static const vshCmdOptDef opts_secret_set_value[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("secret UUID"),
      .completer = virshSecretUUIDCompleter,
     },
@@ -296,7 +294,6 @@ static const vshCmdOptDef opts_secret_get_value[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("secret UUID"),
      .completer = virshSecretUUIDCompleter,
     },
@@ -351,7 +348,6 @@ static const vshCmdOptDef opts_secret_undefine[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("secret UUID"),
      .completer = virshSecretUUIDCompleter,
     },
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 9658fdefcd..899bae7e9a 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1570,7 +1570,6 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("snapshot name"),
      .completer = virshSnapshotNameCompleter,
     },
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 90a450ad14..8794126f21 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -59,7 +59,6 @@
      .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .help = _helpstr, \
      .completer = virshStorageVolNameCompleter, \
     }
@@ -69,7 +68,6 @@
      .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .help = _helpstr, \
      .completer = virshStorageVolKeyCompleter, \
     }
@@ -179,7 +177,6 @@ static const vshCmdOptDef opts_vol_create_as[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("name of the volume")
     },
@@ -187,7 +184,6 @@ static const vshCmdOptDef opts_vol_create_as[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("size of the vol, as scaled integer (default bytes)")
     },
@@ -530,7 +526,6 @@ static const vshCmdOptDef opts_vol_clone[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("clone name")
     },
@@ -1036,7 +1031,6 @@ static const vshCmdOptDef opts_vol_resize[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = virshCompleteEmpty,
      .help = N_("new capacity for the vol, as scaled integer (default bytes)")
     },
diff --git a/tools/virsh.h b/tools/virsh.h
index b009ed5854..73c0b826a5 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -60,7 +60,6 @@
      .type = VSH_OT_STRING,\
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .help = _helpstr, \
      .completer = virshStoragePoolNameCompleter, \
      .completer_flags = cflags, \
@@ -71,7 +70,6 @@
      .type = VSH_OT_STRING,\
      .positional = true, \
      .required = true, \
-     .flags = VSH_OFLAG_REQ, \
      .help = _helpstr, \
      .completer = virshDomainNameCompleter, \
      .completer_flags = cflags, \
@@ -107,7 +105,6 @@
      .type = VSH_OT_STRING, \
      .required = required_, \
      .positional = required_, \
-     .flags = required_ ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \
      .completer = virshCompletePathLocalExisting, \
      .help = _helpstr \
     }
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index d119116124..37bc6fe4f0 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -361,7 +361,6 @@ static const vshCmdOptDef opts_srv_threadpool_info[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = vshAdmServerCompleter,
      .help = N_("Server to retrieve threadpool attributes from."),
     },
@@ -420,7 +419,6 @@ static const vshCmdOptDef opts_srv_threadpool_set[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = vshAdmServerCompleter,
      .help = N_("Server to alter threadpool attributes on."),
     },
@@ -523,7 +521,6 @@ static const vshCmdOptDef opts_srv_clients_list[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = vshAdmServerCompleter,
      .help = N_("server which to list connected clients from"),
     },
@@ -607,7 +604,6 @@ static const vshCmdOptDef opts_client_info[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = vshAdmServerCompleter,
      .help = N_("server to which <client> is connected to"),
     },
@@ -615,7 +611,6 @@ static const vshCmdOptDef opts_client_info[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("client which to retrieve identity information for"),
     },
     {.name = NULL}
@@ -693,7 +688,6 @@ static const vshCmdOptDef opts_client_disconnect[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = vshAdmServerCompleter,
      .help = N_("server which the client is currently connected to"),
     },
@@ -701,7 +695,6 @@ static const vshCmdOptDef opts_client_disconnect[] = {
      .type = VSH_OT_INT,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("client which to disconnect, specified by ID"),
     },
     {.name = NULL}
@@ -758,7 +751,6 @@ static const vshCmdOptDef opts_srv_clients_info[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = vshAdmServerCompleter,
      .help = N_("Server to retrieve the client limits from."),
     },
@@ -814,7 +806,6 @@ static const vshCmdOptDef opts_srv_clients_set[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .completer = vshAdmServerCompleter,
      .help = N_("Server to alter the client-related configuration limits on."),
     },
@@ -913,7 +904,6 @@ static const vshCmdOptDef opts_srv_update_tls_file[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .flags = VSH_OFLAG_REQ,
      .help = N_("Available servers on a daemon. "
                 "Currently only supports 'libvirtd' or 'virtproxyd'.")
     },
@@ -1013,7 +1003,7 @@ static const vshCmdOptDef opts_daemon_timeout[] = {
      .type = VSH_OT_INT,
      .required = true,
      .help = N_("number of seconds the daemon will run without any active connection"),
-     .flags = VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT
+     .flags = VSH_OFLAG_REQ_OPT
     },
     {.name = NULL}
 };
diff --git a/tools/vsh.c b/tools/vsh.c
index 7e8fbf8050..85296c35c7 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -345,8 +345,8 @@ vshCmddefCheckInternals(vshControl *ctl,
                 return -1;
             }

-            if (opt->flags & VSH_OFLAG_REQ) {
-                vshError(ctl, "parameter '%s' of command '%s' misused VSH_OFLAG_REQ",
+            if (opt->required) {
+                vshError(ctl, "parameter '%s' of command '%s' misused 'required' flag",
                          opt->name, cmd->name);
                 return -1; /* bool can't be mandatory */
             }
@@ -445,7 +445,7 @@ vshCmddefOptParse(const vshCmdDef *cmd,
         if (!(opt->flags & VSH_OFLAG_REQ_OPT))
             *opts_need_arg |= 1ULL << i;

-        if (opt->flags & VSH_OFLAG_REQ)
+        if (opt->required)
             *opts_required |= 1ULL << i;
     }
 }
@@ -800,7 +800,7 @@ vshCommandOpt(const vshCmd *cmd, const char *name, vshCmdOpt **opt,
     if (!cmd->skipChecks)
         assert(valid && (!needData || valid->type != VSH_OT_BOOL));

-    if (valid && valid->flags & VSH_OFLAG_REQ)
+    if (valid && valid->required)
         ret = -1;

     /* See if option is present on command line.  */
diff --git a/tools/vsh.h b/tools/vsh.h
index 73b908a5f2..5f3e610dd7 100644
--- a/tools/vsh.h
+++ b/tools/vsh.h
@@ -98,7 +98,6 @@ typedef enum {
  */
 enum {
     VSH_OFLAG_NONE     = 0,        /* without flags */
-    VSH_OFLAG_REQ      = (1 << 0), /* option required */
     VSH_OFLAG_EMPTY_OK = (1 << 1), /* empty string option allowed */
     VSH_OFLAG_REQ_OPT  = (1 << 2), /* --optionname required */
 };
-- 
2.44.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux