[libvirt] [PATCH v1 13/31] network_conf: Introduce virNetworkObjListForEach
Peter Krempa
pkrempa at redhat.com
Thu Feb 26 18:27:55 UTC 2015
On Thu, Feb 26, 2015 at 15:17:22 +0100, Michal Privoznik wrote:
> This API will be used in the future to call passed callback over
> each network object in the list. It's slightly different to it
s/to it/to it's/
> virDomainObjListForEach counterpart, because virDomainObjList
> uses a hash table to store domain object, while virNetworkObjList
> uses an array. Therefore, iterating over the entries is slightly
> more complicated, as we want to allow the callback to remove the
> network object while still iterating.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/conf/network_conf.c | 22 ++++++++++++++++++++++
> src/conf/network_conf.h | 6 ++++++
> src/libvirt_private.syms | 1 +
> 3 files changed, 29 insertions(+)
>
...
> diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
> index 16aea99..b9acc0e 100644
> --- a/src/conf/network_conf.h
> +++ b/src/conf/network_conf.h
> @@ -445,6 +445,12 @@ int virNetworkObjListExport(virConnectPtr conn,
> virNetworkObjListFilter filter,
> unsigned int flags);
>
> +typedef int (*virNetworkObjListIterator)(virNetworkObjPtr dom,
> + void *opaque);
Is there a reason you don't pass the object list as you want to allow
deletion from the list itself? Users will have to pull it through the
opaque argument.
> +
> +int virNetworkObjListForEach(virNetworkObjListPtr nets,
> + virNetworkObjListIterator callback,
> + void *opaque);
> /* for testing */
> int
> virNetworkDefUpdateSection(virNetworkDefPtr def,
ACK,
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150226/b61dc480/attachment-0001.sig>
More information about the libvir-list
mailing list