提交 80ba4142 编写于 作者: J John Ferlan

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: NJohn Ferlan <jferlan@redhat.com>
上级 8473859a
...@@ -1342,7 +1342,9 @@ virNetworkObjListExport(virConnectPtr conn, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册