mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
network_conf: Introduce virNetworkObjEndAPI
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@redhat.com>
This commit is contained in:
parent
ea57049156
commit
aa7c7f880e
@ -129,6 +129,16 @@ virNetworkObjNew(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
virNetworkObjEndAPI(virNetworkObjPtr *net)
|
||||||
|
{
|
||||||
|
if (!*net)
|
||||||
|
return;
|
||||||
|
|
||||||
|
virObjectUnlock(*net);
|
||||||
|
*net = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
virNetworkObjListPtr virNetworkObjListNew(void)
|
virNetworkObjListPtr virNetworkObjListNew(void)
|
||||||
{
|
{
|
||||||
virNetworkObjListPtr nets;
|
virNetworkObjListPtr nets;
|
||||||
@ -3034,8 +3044,8 @@ virNetworkLoadAllState(virNetworkObjListPtr nets,
|
|||||||
if (!virFileStripSuffix(entry->d_name, ".xml"))
|
if (!virFileStripSuffix(entry->d_name, ".xml"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((net = virNetworkLoadState(nets, stateDir, entry->d_name)))
|
net = virNetworkLoadState(nets, stateDir, entry->d_name);
|
||||||
virObjectUnlock(net);
|
virNetworkObjEndAPI(&net);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
@ -3075,8 +3085,7 @@ int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
|
|||||||
configDir,
|
configDir,
|
||||||
autostartDir,
|
autostartDir,
|
||||||
entry->d_name);
|
entry->d_name);
|
||||||
if (net)
|
virNetworkObjEndAPI(&net);
|
||||||
virObjectUnlock(net);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
@ -4260,8 +4269,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr nets,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (net)
|
virNetworkObjEndAPI(&net);
|
||||||
virObjectUnlock(net);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +276,7 @@ struct _virNetworkObj {
|
|||||||
};
|
};
|
||||||
|
|
||||||
virNetworkObjPtr virNetworkObjNew(void);
|
virNetworkObjPtr virNetworkObjNew(void);
|
||||||
|
void virNetworkObjEndAPI(virNetworkObjPtr *net);
|
||||||
|
|
||||||
typedef struct _virNetworkObjList virNetworkObjList;
|
typedef struct _virNetworkObjList virNetworkObjList;
|
||||||
typedef virNetworkObjList *virNetworkObjListPtr;
|
typedef virNetworkObjList *virNetworkObjListPtr;
|
||||||
|
@ -563,6 +563,7 @@ virNetworkIpDefPrefix;
|
|||||||
virNetworkLoadAllConfigs;
|
virNetworkLoadAllConfigs;
|
||||||
virNetworkLoadAllState;
|
virNetworkLoadAllState;
|
||||||
virNetworkObjAssignDef;
|
virNetworkObjAssignDef;
|
||||||
|
virNetworkObjEndAPI;
|
||||||
virNetworkObjFindByName;
|
virNetworkObjFindByName;
|
||||||
virNetworkObjFindByUUID;
|
virNetworkObjFindByUUID;
|
||||||
virNetworkObjGetPersistentDef;
|
virNetworkObjGetPersistentDef;
|
||||||
|
Loading…
Reference in New Issue
Block a user