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

[libvirt] [PATCH 1/4] snapshot: conf: Make virDomainSnapshotIsExternal more reusable



Allow to use definition objects with this predicate function.
---
 src/conf/snapshot_conf.c | 14 ++++++++++----
 src/conf/snapshot_conf.h |  1 +
 src/libvirt_private.syms |  1 +
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 201c586..0c5b005 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -1058,17 +1058,23 @@ cleanup:


 bool
-virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap)
+virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def)
 {
     int i;

-    if (snap->def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+    if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
         return true;

-    for (i = 0; i < snap->def->ndisks; i++) {
-        if (snap->def->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+    for (i = 0; i < def->ndisks; i++) {
+        if (def->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
             return true;
     }

     return false;
 }
+
+bool
+virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap)
+{
+    return virDomainSnapshotDefIsExternal(snap->def);
+}
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index b0f8760..f1d5995 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -166,6 +166,7 @@ int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
                            virDomainSnapshotPtr **snaps,
                            unsigned int flags);

+bool virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def);
 bool virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap);

 VIR_ENUM_DECL(virDomainSnapshotLocation)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 497d5d3..d063382 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1097,6 +1097,7 @@ virDomainSnapshotAlignDisks;
 virDomainSnapshotAssignDef;
 virDomainSnapshotDefFormat;
 virDomainSnapshotDefFree;
+virDomainSnapshotDefIsExternal;
 virDomainSnapshotDefParseString;
 virDomainSnapshotDropParent;
 virDomainSnapshotFindByName;
-- 
1.8.0.2


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