[libvirt] [PATCH v2 07/20] network: Alter virNetworkObj @class_id to be @classIdMap

Michal Privoznik mprivozn at redhat.com
Tue Aug 15 15:32:32 UTC 2017


On 07/26/2017 05:05 PM, John Ferlan wrote:
> Change the variable name to be a bit more descriptive and less confusing
> when used with the data.network.actual->class_id.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/virnetworkobj.c    | 39 ++++++++++++++++++++-------------------
>  src/conf/virnetworkobj.h    |  2 +-
>  src/network/bridge_driver.c | 10 +++++-----
>  3 files changed, 26 insertions(+), 25 deletions(-)
> 
> diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
> index 533ed26..fb533b9 100644
> --- a/src/conf/virnetworkobj.c
> +++ b/src/conf/virnetworkobj.c
> @@ -79,13 +79,13 @@ virNetworkObjNew(void)
>      if (!(net = virObjectLockableNew(virNetworkObjClass)))
>          return NULL;
>  
> -    if (!(net->class_id = virBitmapNew(CLASS_ID_BITMAP_SIZE)))
> +    if (!(net->classIdMap = virBitmapNew(CLASS_ID_BITMAP_SIZE)))
>          goto error;

One thing I just realized: This creates a bitmap capable of holding
1<<16 bits - IOW it allocates 8KB of ram even though in reality just the
first 10-20 bits are going to be used. Back in the day when I was
implementing this there were no self-inflating bitmaps, but I guess we
do have them now, right? Maybe we can rewrite this (ofc after you merge
these to avoid conflicts) so that the new bitmap is used?

Michal




More information about the libvir-list mailing list