[PATCH v7 01/23] snapshot: Drop pointless function virDomainMomentIsCurrentName

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
a helper function added in commit commit 4819f54b.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 src/conf/virdomainmomentobjlist.h   | 2 --
 src/conf/virdomainsnapshotobjlist.h | 2 --
 src/conf/virdomainmomentobjlist.c   | 9 ---------
 src/conf/virdomainsnapshotobjlist.c | 9 ---------
 src/libvirt_private.syms            | 1 -
 src/qemu/qemu_driver.c              | 2 +-
 src/test/test_driver.c              | 7 ++++++-
 7 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/src/conf/virdomainmomentobjlist.h b/src/conf/virdomainmomentobjlist.h
index b67af24bba..6481c771de 100644
--- a/src/conf/virdomainmomentobjlist.h
+++ b/src/conf/virdomainmomentobjlist.h
@@ -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,
diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapshotobjlist.h
index 38d34ea010..b83f7a4ba9 100644
--- a/src/conf/virdomainsnapshotobjlist.h
+++ b/src/conf/virdomainsnapshotobjlist.h
@@ -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,
diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentobjlist.c
index 92cf52dd7d..b9ca5b1318 100644
--- a/src/conf/virdomainmomentobjlist.c
+++ b/src/conf/virdomainmomentobjlist.c
@@ -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,
diff --git a/src/conf/virdomainsnapshotobjlist.c b/src/conf/virdomainsnapshotobjlist.c
index 04221134da..4ddc2a4b65 100644
--- a/src/conf/virdomainsnapshotobjlist.c
+++ b/src/conf/virdomainsnapshotobjlist.c
@@ -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,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9c2d5e75fa..73ef24d66f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -995,7 +995,6 @@ virDomainSnapshotFindByName;
 virDomainSnapshotForEach;
 virDomainSnapshotGetCurrent;
 virDomainSnapshotGetCurrentName;
-virDomainSnapshotIsCurrentName;
 virDomainSnapshotObjListFree;
 virDomainSnapshotObjListGetNames;
 virDomainSnapshotObjListNew;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 51b434f0d2..930ce9d401 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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);
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b7e2bbcff4..fb0e683a06 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -6249,14 +6249,19 @@ testDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
 {
     virDomainObjPtr vm = NULL;
     int ret;
+    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;
 }
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux