Re: [PATCH v1 13/31] network_conf: Introduce virNetworkObjListForEach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]