466b12a virsh: use more compact VIR_ENUM_IMPL

Authored and Committed by ericb 10 years ago
    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>
    
        
file modified
+119 -161
file modified
+145 -202
file modified
+14 -22
file modified
+24 -42
file modified
+14 -24