• E
    virsh: use more compact VIR_ENUM_IMPL · 466b12ab
    Eric Blake 提交于
    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: NEric Blake <eblake@redhat.com>
    466b12ab
virsh-pool.c 54.3 KB