[PATCH v1 23/31] network_conf: Introduce virNetworkObjEndAPI

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

 



This is practically copy of qemuDomObjEndAPI. The reason why is
it so widely available is to avoid code duplication, since the
function is going to be called from our bridge driver, test
driver and parallels driver too.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/network_conf.c  | 13 +++++++++++--
 src/conf/network_conf.h  |  1 +
 src/libvirt_private.syms |  1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 7e8b867..95d8b4d 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -130,6 +130,16 @@ virNetworkObjNew(void)
     return NULL;
 }
 
+void
+virNetworkObjEndAPI(virNetworkObjPtr *net)
+{
+    if (!*net)
+        return;
+
+    virObjectUnlock(*net);
+    *net = NULL;
+}
+
 virNetworkObjListPtr virNetworkObjListNew(void)
 {
     virNetworkObjListPtr nets;
@@ -4240,8 +4250,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr nets,
     }
 
  cleanup:
-    if (net)
-        virObjectUnlock(net);
+    virNetworkObjEndAPI(&net);
     return ret;
 }
 
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 7f48b9a..2cedc0a 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -276,6 +276,7 @@ struct _virNetworkObj {
 };
 
 virNetworkObjPtr virNetworkObjNew(void);
+void virNetworkObjEndAPI(virNetworkObjPtr *net);
 
 typedef struct _virNetworkObjList virNetworkObjList;
 typedef virNetworkObjList *virNetworkObjListPtr;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 660579c..fb658fa 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -564,6 +564,7 @@ virNetworkIpDefPrefix;
 virNetworkLoadAllConfigs;
 virNetworkLoadAllState;
 virNetworkObjAssignDef;
+virNetworkObjEndAPI;
 virNetworkObjFindByName;
 virNetworkObjFindByUUID;
 virNetworkObjGetPersistentDef;
-- 
2.0.5

--
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]