On 08/03/2015 02:39 AM, Michal Privoznik wrote:
This is no functional change. It's just that later in the series
we
will need to pass class_id as an integer.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/network/bridge_driver.c | 4 ++--
src/util/virnetdevbandwidth.c | 10 +++++++---
src/util/virnetdevbandwidth.h | 2 +-
3 files changed, 10 insertions(+), 6 deletions(-)
something that dawned on me reading later patches...
diff --git a/src/util/virnetdevbandwidth.c
b/src/util/virnetdevbandwidth.c
index 6ae0877..91201ae 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -638,7 +638,8 @@ virNetDevBandwidthUnplug(const char *brname,
/**
* virNetDevBandwidthUpdateRate:
* @ifname: interface name
- * @classid: ID of class to update
+ * @id: unique identifier (MUST be greater than 2)
^^^ Comment says MUST be > 2, but there's no check/error... Also I note
"2" is passed often...
John
+ * @bandwidth: used to derive 'ceil' of class with @id
* @new_rate: new rate
*
* This function updates the 'rate' attribute of HTB class.
@@ -650,16 +651,18 @@ virNetDevBandwidthUnplug(const char *brname,
*/
int
virNetDevBandwidthUpdateRate(const char *ifname,
- const char *class_id,
+ unsigned int id,
virNetDevBandwidthPtr bandwidth,
unsigned long long new_rate)
{
int ret = -1;
virCommandPtr cmd = NULL;
+ char *class_id = NULL;
char *rate = NULL;
char *ceil = NULL;
- if (virAsprintf(&rate, "%llukbps", new_rate) < 0 ||
+ if (virAsprintf(&class_id, "1:%x", id) < 0 ||
+ virAsprintf(&rate, "%llukbps", new_rate) < 0 ||
virAsprintf(&ceil, "%llukbps", bandwidth->in->peak ?
bandwidth->in->peak :
bandwidth->in->average) < 0)
@@ -677,6 +680,7 @@ virNetDevBandwidthUpdateRate(const char *ifname,
cleanup:
virCommandFree(cmd);
+ VIR_FREE(class_id);
VIR_FREE(rate);
VIR_FREE(ceil);
return ret;