diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 1ea5d0fa08..08b610cf3a 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -157,8 +157,9 @@ virNetworkObjListPtr virNetworkObjListNew(void) return nets; } -virNetworkObjPtr virNetworkObjFindByUUID(virNetworkObjListPtr nets, - const unsigned char *uuid) +virNetworkObjPtr +virNetworkObjFindByUUIDLocked(virNetworkObjListPtr nets, + const unsigned char *uuid) { virNetworkObjPtr ret = NULL; char uuidstr[VIR_UUID_STRING_BUFLEN]; @@ -171,6 +172,18 @@ virNetworkObjPtr virNetworkObjFindByUUID(virNetworkObjListPtr nets, return ret; } +virNetworkObjPtr +virNetworkObjFindByUUID(virNetworkObjListPtr nets, + const unsigned char *uuid) +{ + virNetworkObjPtr ret; + + virObjectLock(nets); + ret = virNetworkObjFindByUUIDLocked(nets, uuid); + virObjectUnlock(nets); + return ret; +} + static int virNetworkObjSearchName(const void *payload, const void *name ATTRIBUTE_UNUSED, @@ -186,8 +199,9 @@ virNetworkObjSearchName(const void *payload, return want; } -virNetworkObjPtr virNetworkObjFindByName(virNetworkObjListPtr nets, - const char *name) +virNetworkObjPtr +virNetworkObjFindByNameLocked(virNetworkObjListPtr nets, + const char *name) { virNetworkObjPtr ret = NULL; @@ -197,6 +211,18 @@ virNetworkObjPtr virNetworkObjFindByName(virNetworkObjListPtr nets, return ret; } +virNetworkObjPtr +virNetworkObjFindByName(virNetworkObjListPtr nets, + const char *name) +{ + virNetworkObjPtr ret; + + virObjectLock(nets); + ret = virNetworkObjFindByNameLocked(nets, name); + virObjectUnlock(nets); + return ret; +} + bool virNetworkObjTaint(virNetworkObjPtr obj, virNetworkTaintFlags taint) diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index e0ed714341..3e926f78c5 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -300,8 +300,12 @@ virNetworkObjIsActive(const virNetworkObj *net) virNetworkObjListPtr virNetworkObjListNew(void); +virNetworkObjPtr virNetworkObjFindByUUIDLocked(virNetworkObjListPtr nets, + const unsigned char *uuid); virNetworkObjPtr virNetworkObjFindByUUID(virNetworkObjListPtr nets, const unsigned char *uuid); +virNetworkObjPtr virNetworkObjFindByNameLocked(virNetworkObjListPtr nets, + const char *name); virNetworkObjPtr virNetworkObjFindByName(virNetworkObjListPtr nets, const char *name); bool virNetworkObjTaint(virNetworkObjPtr obj, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5fbe094da2..64808ce9f4 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -565,7 +565,9 @@ virNetworkLoadAllState; virNetworkObjAssignDef; virNetworkObjEndAPI; virNetworkObjFindByName; +virNetworkObjFindByNameLocked; virNetworkObjFindByUUID; +virNetworkObjFindByUUIDLocked; virNetworkObjGetPersistentDef; virNetworkObjIsDuplicate; virNetworkObjListExport;