• E
    snapshot: make virDomainSnapshotObjList opaque · 3211deba
    Eric Blake 提交于
    We were failing to react to allocation failure when initializing
    a snapshot object list.  Changing things to store a pointer
    instead of a complete object adds one more possible point of
    allocation failure, but at the same time, will make it easier to
    react to failure now, as well as making it easier for a future
    patch to split all virDomainSnapshotPtr handling into a separate
    file, as I continue to add even more snapshot code.
    
    Luckily, there was only one client outside of domain_conf.c that
    was actually peeking inside the object, and a new wrapper function
    was easy.
    
    * src/conf/domain_conf.h (_virDomainObj): Use a pointer.
    (virDomainSnapshotObjListInit): Rename.
    (virDomainSnapshotObjListFree, virDomainSnapshotForEach): New
    declarations.
    (_virDomainSnapshotObjList): Move definitions...
    * src/conf/domain_conf.c: ...here.
    (virDomainSnapshotObjListInit, virDomainSnapshotObjListDeinit):
    Rename...
    (virDomainSnapshotObjListNew, virDomainSnapshotObjListFree): ...to
    these.
    (virDomainSnapshotForEach): New function.
    (virDomainObjDispose, virDomainListPopulate): Adjust callers.
    * src/qemu/qemu_domain.c (qemuDomainSnapshotDiscard)
    (qemuDomainSnapshotDiscardAllMetadata): Likewise.
    * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
    * src/qemu/qemu_driver.c (qemuDomainSnapshotLoad)
    (qemuDomainUndefineFlags, qemuDomainSnapshotCreateXML)
    (qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
    (qemuDomainListAllSnapshots)
    (qemuDomainSnapshotListChildrenNames)
    (qemuDomainSnapshotNumChildren)
    (qemuDomainSnapshotListAllChildren)
    (qemuDomainSnapshotLookupByName, qemuDomainSnapshotGetParent)
    (qemuDomainSnapshotGetXMLDesc, qemuDomainSnapshotIsCurrent)
    (qemuDomainSnapshotHasMetadata, qemuDomainRevertToSnapshot)
    (qemuDomainSnapshotDelete): Likewise.
    * src/libvirt_private.syms (domain_conf.h): Export new function.
    3211deba
qemu_domain.c 59.0 KB