]> xenbits.xensource.com Git - libvirt.git/commit
snapshot: Rework virDomainSnapshotState enum
authorEric Blake <eblake@redhat.com>
Tue, 26 Feb 2019 20:14:36 +0000 (14:14 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 7 Mar 2019 23:31:40 +0000 (17:31 -0600)
commitf43eb6807ed3ceaaf6a068c2f58d82668345e454
treefae4bb4594ef5339b0dc39901cde566d6eaaafa8
parent7ff982f0bcc755387651443b9b7650bd3494d24a
snapshot: Rework virDomainSnapshotState enum

The existing virDomainSnapshotState is a superset of virDomainState,
adding one more state (disk-snapshot) on top of valid domain states.
But as written, the enum cannot be used for gcc validation that all
enum values are covered in a strongly-typed switch condition, because
the enum does not explicitly include the values it is adding to.

Copy the style used in qemu_blockjob.h of creating new enum names
for every inherited value, and update most clients to use the new
enum names anywhere snapshot state is referenced. The exception is
two switch statements in qemu code, which instead gain a fixme
comment about odd type usage (which will be cleaned up in the next
patch). The rest of the patch is fairly mechanical (I actually did
it by temporarily s/state/xstate/ in snapshot_conf.h to let the
compiler find which spots in the code used the field, did the
obvious search and replace in those functions, then undid the rename).

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/conf/snapshot_conf.c
src/conf/snapshot_conf.h
src/qemu/qemu_driver.c
src/test/test_driver.c
src/vbox/vbox_common.c