Re: [PATCH v3 02/15] network_conf: Make virNetworkObj actually virObject

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

 



On Tue, Mar 10, 2015 at 17:45:08 +0100, Michal Privoznik wrote:
> So far it's just a structure which happens to have 'Obj' in its
> name, but otherwise it not related to virObject at all. No
> reference counting, not virObjectLock(), nothing.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  cfg.mk                            |   2 -
>  src/conf/network_conf.c           | 110 ++++++++++++++++++++------------------
>  src/conf/network_conf.h           |   8 ++-
>  src/libvirt_private.syms          |   4 +-
>  src/network/bridge_driver.c       |  56 +++++++++----------
>  src/parallels/parallels_network.c |  16 +++---
>  src/test/test_driver.c            |  32 +++++------
>  tests/networkxml2conftest.c       |   4 +-
>  tests/objectlocking.ml            |   2 -
>  9 files changed, 116 insertions(+), 118 deletions(-)
> 
> diff --git a/cfg.mk b/cfg.mk
> index 07a794a..6885f9e 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -160,7 +160,6 @@ useless_free_options =				\
>    --name=virNWFilterRuleDefFree			\
>    --name=virNWFilterRuleInstFree		\
>    --name=virNetworkDefFree			\
> -  --name=virNetworkObjFree			\
>    --name=virNodeDeviceDefFree			\
>    --name=virNodeDeviceObjFree			\
>    --name=virObjectUnref                         \
> @@ -249,7 +248,6 @@ useless_free_options =				\
>  # y virNetworkDefFree
>  # n virNetworkFree (returns int)
>  # n virNetworkFreeName (returns int)
> -# y virNetworkObjFree
>  # n virNodeDevCapsDefFree FIXME
>  # y virNodeDeviceDefFree
>  # n virNodeDeviceFree (returns int)
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index ae29c47..609990c 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -79,11 +79,19 @@ VIR_ENUM_IMPL(virNetworkForwardDriverName,
>  VIR_ENUM_IMPL(virNetworkTaint, VIR_NETWORK_TAINT_LAST,
>                "hook-script");
>  
> +static virClassPtr virNetworkObjClass;
>  static virClassPtr virNetworkObjListClass;
> +static void virNetworkObjDispose(void *obj);
>  static void virNetworkObjListDispose(void *obj);
>  
>  static int virNetworkObjOnceInit(void)
>  {
> +    if (!(virNetworkObjClass = virClassNew(virClassForObjectLockable(),
> +                                           "virNetworkObj",
> +                                           sizeof(virNetworkObj),
> +                                           virNetworkObjDispose)))
> +        return -1;
> +
>      if (!(virNetworkObjListClass = virClassNew(virClassForObject(),
>                                                 "virNetworkObjList",
>                                                 sizeof(virNetworkObjList),
> @@ -99,7 +107,33 @@ static void
>  virNetworkObjListDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)

This function can now be replaced with virObjectFreeHashData.

>  {
>      virNetworkObjPtr obj = payload;
> -    virNetworkObjFree(obj);
> +    virObjectUnref(obj);
> +}

Since I've already reviewed this previously and the conversion to
virHash is ok here.

ACK if you use the existing free helper.

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]