Now that it's unused except for the recursive call it can be dropped from all of the call tree. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 15 +++++---------- src/qemu/qemu_domain.h | 3 +-- src/qemu/qemu_snapshot.c | 28 +++++++++++----------------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e8e72e5091..5fdd7f9fc0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5708,8 +5708,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObj *vm, /* The domain is expected to be locked and inactive. Return -1 on normal * failure, 1 if we skipped a disk due to try_all. */ static int -qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver, - virDomainDef *def, +qemuDomainSnapshotForEachQcow2Raw(virDomainDef *def, virDomainMomentObj *snap, const char *op, bool try_all, @@ -5748,8 +5747,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver, } else if (STREQ(op, "-c") && i) { /* We must roll back partial creation by deleting * all earlier snapshots. */ - qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, - "-d", false, i); + qemuDomainSnapshotForEachQcow2Raw(def, snap, "-d", false, i); } virReportError(VIR_ERR_OPERATION_INVALID, _("Disk device '%1$s' does not support snapshotting"), @@ -5768,8 +5766,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver, } else if (STREQ(op, "-c") && i) { /* We must roll back partial creation by deleting * all earlier snapshots. */ - qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, - "-d", false, i); + qemuDomainSnapshotForEachQcow2Raw(def, snap, "-d", false, i); } return -1; } @@ -5781,14 +5778,12 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver, /* The domain is expected to be locked and inactive. Return -1 on normal * failure, 1 if we skipped a disk due to try_all. */ int -qemuDomainSnapshotForEachQcow2(virQEMUDriver *driver, - virDomainDef *def, +qemuDomainSnapshotForEachQcow2(virDomainDef *def, virDomainMomentObj *snap, const char *op, bool try_all) { - return qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, - op, try_all, def->ndisks); + return qemuDomainSnapshotForEachQcow2Raw(def, snap, op, try_all, def->ndisks); } /* Hash iterator callback to discard multiple snapshots. */ diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 091b27823b..ad0f4341c0 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -670,8 +670,7 @@ int qemuDomainSnapshotWriteMetadata(virDomainObj *vm, virDomainXMLOption *xmlopt, const char *snapshotDir); -int qemuDomainSnapshotForEachQcow2(virQEMUDriver *driver, - virDomainDef *def, +int qemuDomainSnapshotForEachQcow2(virDomainDef *def, virDomainMomentObj *snap, const char *op, bool try_all); diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 35c8d67d20..f1d5103abe 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -251,11 +251,10 @@ qemuSnapshotCreateQcow2Files(virDomainDef *def, /* The domain is expected to be locked and inactive. */ static int -qemuSnapshotCreateInactiveInternal(virQEMUDriver *driver, - virDomainObj *vm, +qemuSnapshotCreateInactiveInternal(virDomainObj *vm, virDomainMomentObj *snap) { - return qemuDomainSnapshotForEachQcow2(driver, vm->def, snap, "-c", false); + return qemuDomainSnapshotForEachQcow2(vm->def, snap, "-c", false); } @@ -1935,7 +1934,7 @@ qemuSnapshotCreate(virDomainObj *vm, if (qemuSnapshotCreateInactiveExternal(driver, vm, snap, reuse) < 0) goto error; } else { - if (qemuSnapshotCreateInactiveInternal(driver, vm, snap) < 0) + if (qemuSnapshotCreateInactiveInternal(vm, snap) < 0) goto error; } } @@ -2533,8 +2532,7 @@ qemuSnapshotRevertActive(virDomainObj *vm, /* The domain is expected to be locked and inactive. */ static int -qemuSnapshotInternalRevertInactive(virQEMUDriver *driver, - virDomainObj *vm, +qemuSnapshotInternalRevertInactive(virDomainObj *vm, virDomainMomentObj *snap) { size_t i; @@ -2553,7 +2551,7 @@ qemuSnapshotInternalRevertInactive(virQEMUDriver *driver, } /* Try all disks, but report failure if we skipped any. */ - if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-a", true) != 0) + if (qemuDomainSnapshotForEachQcow2(def, snap, "-a", true) != 0) return -1; return 0; @@ -2611,7 +2609,7 @@ qemuSnapshotRevertInactive(virDomainObj *vm, qemuSnapshotRevertExternalFinish(vm, tmpsnapdef, snap); } else { - if (qemuSnapshotInternalRevertInactive(driver, vm, snap) < 0) { + if (qemuSnapshotInternalRevertInactive(vm, snap) < 0) { qemuDomainRemoveInactive(driver, vm, 0, false); return -1; } @@ -3893,8 +3891,7 @@ qemuSnapshotDiscardActiveInternal(virDomainObj *vm, /* Discard one snapshot (or its metadata), without reparenting any children. */ static int -qemuSnapshotDiscardImpl(virQEMUDriver *driver, - virDomainObj *vm, +qemuSnapshotDiscardImpl(virDomainObj *vm, virDomainMomentObj *snap, GSList *externalData, bool update_parent, @@ -3922,7 +3919,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver, if (qemuSnapshotDiscardExternal(vm, snap, externalData) < 0) return -1; } else { - if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-d", true) < 0) + if (qemuDomainSnapshotForEachQcow2(def, snap, "-d", true) < 0) return -1; } } else { @@ -3961,13 +3958,13 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver, static int -qemuSnapshotDiscard(virQEMUDriver *driver, +qemuSnapshotDiscard(virQEMUDriver *driver G_GNUC_UNUSED, virDomainObj *vm, virDomainMomentObj *snap, bool update_parent, bool metadata_only) { - return qemuSnapshotDiscardImpl(driver, vm, snap, NULL, update_parent, metadata_only); + return qemuSnapshotDiscardImpl(vm, snap, NULL, update_parent, metadata_only); } @@ -3995,10 +3992,7 @@ qemuSnapshotDeleteSingle(virDomainObj *vm, GSList *externalData, bool metadata_only) { - qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; - - return qemuSnapshotDiscardImpl(driver, vm, snap, externalData, true, metadata_only); + return qemuSnapshotDiscardImpl(vm, snap, externalData, true, metadata_only); } -- 2.47.0