From nobody Thu May 15 22:53:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15010816022231022.6370021039735; Wed, 26 Jul 2017 08:06:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 405D3267F6; Wed, 26 Jul 2017 15:06:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6F3593102; Wed, 26 Jul 2017 15:06:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2947914B2C; Wed, 26 Jul 2017 15:06:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6QF5orE028311 for ; Wed, 26 Jul 2017 11:05:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB16C65EB6; Wed, 26 Jul 2017 15:05:50 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-46.phx2.redhat.com [10.3.117.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1F4A692A5 for ; Wed, 26 Jul 2017 15:05:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 405D3267F6 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Wed, 26 Jul 2017 11:05:24 -0400 Message-Id: <20170726150537.4619-8-jferlan@redhat.com> In-Reply-To: <20170726150537.4619-1-jferlan@redhat.com> References: <20170726150537.4619-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 07/20] network: Alter virNetworkObj @class_id to be @classIdMap X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 26 Jul 2017 15:06:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D virObjectLockableNew(virNetworkObjClass))) return NULL; =20 - if (!(net->class_id =3D virBitmapNew(CLASS_ID_BITMAP_SIZE))) + if (!(net->classIdMap =3D virBitmapNew(CLASS_ID_BITMAP_SIZE))) goto error; =20 /* The first three class IDs are already taken */ - ignore_value(virBitmapSetBit(net->class_id, 0)); - ignore_value(virBitmapSetBit(net->class_id, 1)); - ignore_value(virBitmapSetBit(net->class_id, 2)); + ignore_value(virBitmapSetBit(net->classIdMap, 0)); + ignore_value(virBitmapSetBit(net->classIdMap, 1)); + ignore_value(virBitmapSetBit(net->classIdMap, 2)); =20 return net; =20 @@ -376,7 +376,7 @@ virNetworkObjDispose(void *obj) =20 virNetworkDefFree(net->def); virNetworkDefFree(net->newDef); - virBitmapFree(net->class_id); + virBitmapFree(net->classIdMap); virObjectUnref(net->macmap); } =20 @@ -716,17 +716,17 @@ virNetworkObjFormat(virNetworkObjPtr net, unsigned int flags) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; - char *class_id =3D virBitmapFormat(net->class_id); + char *classIdStr =3D virBitmapFormat(net->classIdMap); size_t i; =20 - if (!class_id) + if (!classIdStr) goto error; =20 virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); - virBufferAsprintf(&buf, "\n", class_id); + virBufferAsprintf(&buf, "\n", classIdStr); virBufferAsprintf(&buf, "\n", net->floor_sum); - VIR_FREE(class_id); + VIR_FREE(classIdStr); =20 for (i =3D 0; i < VIR_NETWORK_TAINT_LAST; i++) { if (net->taint & (1 << i)) @@ -783,7 +783,7 @@ virNetworkLoadState(virNetworkObjListPtr nets, xmlDocPtr xml =3D NULL; xmlNodePtr node =3D NULL, *nodes =3D NULL; xmlXPathContextPtr ctxt =3D NULL; - virBitmapPtr class_id_map =3D NULL; + virBitmapPtr classIdMap =3D NULL; unsigned long long floor_sum_val =3D 0; unsigned int taint =3D 0; int n; @@ -820,18 +820,19 @@ virNetworkLoadState(virNetworkObjListPtr nets, if (xmlStrEqual(node->name, BAD_CAST "networkstatus")) { /* Newer network status file. Contains useful * info which are not to be found in bare config XML */ - char *class_id =3D NULL; + char *classIdStr =3D NULL; char *floor_sum =3D NULL; =20 ctxt->node =3D node; - if ((class_id =3D virXPathString("string(./class_id[1]/@bitmap)", = ctxt))) { - if (virBitmapParse(class_id, &class_id_map, + if ((classIdStr =3D virXPathString("string(./class_id[1]/@bitmap)", + ctxt))) { + if (virBitmapParse(classIdStr, &classIdMap, CLASS_ID_BITMAP_SIZE) < 0) { - VIR_FREE(class_id); + VIR_FREE(classIdStr); goto error; } } - VIR_FREE(class_id); + VIR_FREE(classIdStr); =20 floor_sum =3D virXPathString("string(./floor[1]/@sum)", ctxt); if (floor_sum && @@ -873,9 +874,9 @@ virNetworkLoadState(virNetworkObjListPtr nets, /* do not put any "goto error" below this comment */ =20 /* assign status data stored in the network object */ - if (class_id_map) { - virBitmapFree(net->class_id); - net->class_id =3D class_id_map; + if (classIdMap) { + virBitmapFree(net->classIdMap); + net->classIdMap =3D classIdMap; } =20 if (floor_sum_val > 0) @@ -892,7 +893,7 @@ virNetworkLoadState(virNetworkObjListPtr nets, =20 error: VIR_FREE(nodes); - virBitmapFree(class_id_map); + virBitmapFree(classIdMap); virNetworkDefFree(def); goto cleanup; } diff --git a/src/conf/virnetworkobj.h b/src/conf/virnetworkobj.h index a07c7bf..0192913 100644 --- a/src/conf/virnetworkobj.h +++ b/src/conf/virnetworkobj.h @@ -38,7 +38,7 @@ struct _virNetworkObj { virNetworkDefPtr def; /* The current definition */ virNetworkDefPtr newDef; /* New definition to activate at shutdown */ =20 - virBitmapPtr class_id; /* bitmap of class IDs for QoS */ + virBitmapPtr classIdMap; /* bitmap of class IDs for QoS */ unsigned long long floor_sum; /* sum of all 'floor'-s of attached NICs= */ =20 unsigned int taint; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 5367773..ff0ad9c 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -5347,9 +5347,9 @@ networkNextClassID(virNetworkObjPtr obj) { ssize_t ret =3D 0; =20 - ret =3D virBitmapNextClearBit(obj->class_id, -1); + ret =3D virBitmapNextClearBit(obj->classIdMap, -1); =20 - if (ret < 0 || virBitmapSetBit(obj->class_id, ret) < 0) + if (ret < 0 || virBitmapSetBit(obj->classIdMap, ret) < 0) return -1; =20 return ret; @@ -5387,7 +5387,7 @@ networkPlugBandwidthImpl(virNetworkObjPtr obj, obj->floor_sum +=3D ifaceBand->in->floor; /* update status file */ if (virNetworkObjSaveStatus(driver->stateDir, obj) < 0) { - ignore_value(virBitmapClearBit(obj->class_id, class_id)); + ignore_value(virBitmapClearBit(obj->classIdMap, class_id)); obj->floor_sum -=3D ifaceBand->in->floor; iface->data.network.actual->class_id =3D 0; ignore_value(virNetDevBandwidthUnplug(obj->def->bridge, class_id)); @@ -5476,12 +5476,12 @@ networkUnplugBandwidth(virNetworkObjPtr obj, /* update sum of 'floor'-s of attached NICs */ obj->floor_sum -=3D ifaceBand->in->floor; /* return class ID */ - ignore_value(virBitmapClearBit(obj->class_id, + ignore_value(virBitmapClearBit(obj->classIdMap, iface->data.network.actual->class_i= d)); /* update status file */ if (virNetworkObjSaveStatus(driver->stateDir, obj) < 0) { obj->floor_sum +=3D ifaceBand->in->floor; - ignore_value(virBitmapSetBit(obj->class_id, + ignore_value(virBitmapSetBit(obj->classIdMap, iface->data.network.actual->class= _id)); goto cleanup; } --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list