]> xenbits.xensource.com Git - libvirt.git/commit
virsh: use more compact VIR_ENUM_IMPL
authorEric Blake <eblake@redhat.com>
Fri, 21 Feb 2014 19:55:06 +0000 (12:55 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 24 Feb 2014 18:47:18 +0000 (11:47 -0700)
commit466b12ab797f3dc1b37005f5501ebec3549e5cad
tree1e6982c31fc78d0342190c9922963fefddf650e8
parent1984540206d36aff5bfe41337f56313d9a8f0bf6
virsh: use more compact VIR_ENUM_IMPL

Dan Berrange suggested that using VIR_ENUM_IMPL is more compact
than open-coding switch statements, and still just as forceful
at making us remember to update lists if we add enum values
in the future.  Make this change throughout virsh.

Sure enough, doing this change caught that we missed at least
VIR_STORAGE_VOL_NETDIR.

* tools/virsh-domain-monitor.c (vshDomainIOErrorToString)
(vshDomainControlStateToString, vshDomainStateToString)
(vshDomainStateReasonToString): Change switch to enum lookup.
(cmdDomControl, cmdDominfo): Update caller.
* tools/virsh-domain.c (vshDomainVcpuStateToString)
(vshDomainEventToString, vshDomainEventDetailToString): Change
switch to enum lookup.
(vshDomainBlockJobToString, vshDomainJobToString): New functions.
(cmdVcpuinfo, cmdBlockJob, cmdDomjobinfo, cmdEvent): Update
callers.
* tools/virsh-network.c (vshNetworkEventToString): Change switch
to enum lookup.
* tools/virsh-pool.c (vshStoragePoolStateToString): New function.
(cmdPoolList, cmdPoolInfo): Update callers.
* tools/virsh-volume.c (vshVolumeTypeToString): Change switch to
enum lookup.
(cmdVolInfo, cmdVolList): Update callers.

Signed-off-by: Eric Blake <eblake@redhat.com>
tools/virsh-domain-monitor.c
tools/virsh-domain.c
tools/virsh-network.c
tools/virsh-pool.c
tools/virsh-volume.c