mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-07 21:17:55 +03:00
network: Modify naming for virNetworkObjList* fetching APIs
Use the structure names in the @data setup - makes it easier than going back to find the struct fields to make sure the order of the data is correct. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
8473859a47
commit
80ba4142e1
@ -1342,7 +1342,9 @@ virNetworkObjListExport(virConnectPtr conn,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
struct virNetworkObjListData data = { conn, NULL, filter, flags, 0, false};
|
struct virNetworkObjListData data = {
|
||||||
|
.conn = conn, .nets = NULL, .filter = filter, .flags = flags,
|
||||||
|
.nnets = 0, .error = false };
|
||||||
|
|
||||||
virObjectLock(netobjs);
|
virObjectLock(netobjs);
|
||||||
if (nets && VIR_ALLOC_N(data.nets, virHashSize(netobjs->objs) + 1) < 0)
|
if (nets && VIR_ALLOC_N(data.nets, virHashSize(netobjs->objs) + 1) < 0)
|
||||||
@ -1408,7 +1410,8 @@ virNetworkObjListForEach(virNetworkObjListPtr nets,
|
|||||||
virNetworkObjListIterator callback,
|
virNetworkObjListIterator callback,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
struct virNetworkObjListForEachHelperData data = {callback, opaque, 0};
|
struct virNetworkObjListForEachHelperData data = {
|
||||||
|
.callback = callback, .opaque = opaque, .ret = 0};
|
||||||
virObjectLock(nets);
|
virObjectLock(nets);
|
||||||
virHashForEach(nets->objs, virNetworkObjListForEachHelper, &data);
|
virHashForEach(nets->objs, virNetworkObjListForEachHelper, &data);
|
||||||
virObjectUnlock(nets);
|
virObjectUnlock(nets);
|
||||||
@ -1474,7 +1477,8 @@ virNetworkObjListGetNames(virNetworkObjListPtr nets,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
struct virNetworkObjListGetHelperData data = {
|
struct virNetworkObjListGetHelperData data = {
|
||||||
conn, filter, names, maxnames, active, 0, false};
|
.conn = conn, .filter = filter, .names = names,
|
||||||
|
.maxnames = maxnames, .active = active, .got = 0, .error = false};
|
||||||
|
|
||||||
virObjectLock(nets);
|
virObjectLock(nets);
|
||||||
virHashForEach(nets->objs, virNetworkObjListGetHelper, &data);
|
virHashForEach(nets->objs, virNetworkObjListGetHelper, &data);
|
||||||
@ -1500,7 +1504,8 @@ virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets,
|
|||||||
virConnectPtr conn)
|
virConnectPtr conn)
|
||||||
{
|
{
|
||||||
struct virNetworkObjListGetHelperData data = {
|
struct virNetworkObjListGetHelperData data = {
|
||||||
conn, filter, NULL, -1, active, 0, false};
|
.conn = conn, .filter = filter, .names = NULL,
|
||||||
|
.maxnames = -1, .active = active, .got = 0, .error = false};
|
||||||
|
|
||||||
virObjectLock(nets);
|
virObjectLock(nets);
|
||||||
virHashForEach(nets->objs, virNetworkObjListGetHelper, &data);
|
virHashForEach(nets->objs, virNetworkObjListGetHelper, &data);
|
||||||
|
Loading…
Reference in New Issue
Block a user