mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
snapshot: Drop pointless function virDomainMomentIsCurrentName
The qemu driver already had a full-blown virDomainMomentObjPtr to
check against, and the test driver ought to have one since we get
better error checking that the user passed in a valid object. Removes
the need for a helper function added in commit commit 4819f54b
.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
0bc965342b
commit
3d7c683a27
@ -409,15 +409,6 @@ virDomainMomentGetCurrentName(virDomainMomentObjListPtr moments)
|
||||
}
|
||||
|
||||
|
||||
/* Return true if name matches the current moment */
|
||||
bool
|
||||
virDomainMomentIsCurrentName(virDomainMomentObjListPtr moments,
|
||||
const char *name)
|
||||
{
|
||||
return moments->current && STREQ(moments->current->def->name, name);
|
||||
}
|
||||
|
||||
|
||||
/* Update the current moment, using NULL if no current remains */
|
||||
void
|
||||
virDomainMomentSetCurrent(virDomainMomentObjListPtr moments,
|
||||
|
@ -109,8 +109,6 @@ virDomainMomentObjPtr virDomainMomentFindByName(virDomainMomentObjListPtr moment
|
||||
int virDomainMomentObjListSize(virDomainMomentObjListPtr moments);
|
||||
virDomainMomentObjPtr virDomainMomentGetCurrent(virDomainMomentObjListPtr moments);
|
||||
const char *virDomainMomentGetCurrentName(virDomainMomentObjListPtr moments);
|
||||
bool virDomainMomentIsCurrentName(virDomainMomentObjListPtr moments,
|
||||
const char *name);
|
||||
void virDomainMomentSetCurrent(virDomainMomentObjListPtr moments,
|
||||
virDomainMomentObjPtr moment);
|
||||
bool virDomainMomentObjListRemove(virDomainMomentObjListPtr moments,
|
||||
|
@ -187,15 +187,6 @@ virDomainSnapshotGetCurrentName(virDomainSnapshotObjListPtr snapshots)
|
||||
}
|
||||
|
||||
|
||||
/* Return true if name matches the current snapshot */
|
||||
bool
|
||||
virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots,
|
||||
const char *name)
|
||||
{
|
||||
return virDomainMomentIsCurrentName(snapshots->base, name);
|
||||
}
|
||||
|
||||
|
||||
/* Update the current snapshot, using NULL if no current remains */
|
||||
void
|
||||
virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
|
||||
|
@ -44,8 +44,6 @@ virDomainMomentObjPtr virDomainSnapshotFindByName(virDomainSnapshotObjListPtr sn
|
||||
const char *name);
|
||||
virDomainMomentObjPtr virDomainSnapshotGetCurrent(virDomainSnapshotObjListPtr snapshots);
|
||||
const char *virDomainSnapshotGetCurrentName(virDomainSnapshotObjListPtr snapshots);
|
||||
bool virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots,
|
||||
const char *name);
|
||||
void virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
|
||||
virDomainMomentObjPtr snapshot);
|
||||
bool virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
|
||||
|
@ -995,7 +995,6 @@ virDomainSnapshotFindByName;
|
||||
virDomainSnapshotForEach;
|
||||
virDomainSnapshotGetCurrent;
|
||||
virDomainSnapshotGetCurrentName;
|
||||
virDomainSnapshotIsCurrentName;
|
||||
virDomainSnapshotObjListFree;
|
||||
virDomainSnapshotObjListGetNames;
|
||||
virDomainSnapshotObjListNew;
|
||||
|
@ -16201,7 +16201,7 @@ qemuDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
||||
if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainSnapshotIsCurrentName(vm->snapshots, snapshot->name);
|
||||
ret = snap == virDomainSnapshotGetCurrent(vm->snapshots);
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
|
@ -6248,15 +6248,20 @@ testDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags)
|
||||
{
|
||||
virDomainObjPtr vm = NULL;
|
||||
int ret;
|
||||
int ret = -1;
|
||||
virDomainMomentObjPtr snap = NULL;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (!(vm = testDomObjFromSnapshot(snapshot)))
|
||||
return -1;
|
||||
|
||||
ret = virDomainSnapshotIsCurrentName(vm->snapshots, snapshot->name);
|
||||
if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
|
||||
goto cleanup;
|
||||
|
||||
ret = snap == virDomainSnapshotGetCurrent(vm->snapshots);
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user