conf: Renamed 'controlBuf' to 'childrenBuf'

To add CMT/MBM feature and let code be consistent in later patches,
renaming variable name from 'controlBuf' to 'childrenBuf', locates
in functions 'virCapabilitiesFormatCaches' and
'virCapabilitiesFormatMemoryBandwidth'.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Wang Huaqiang 2018-08-27 19:23:04 +08:00 committed by John Ferlan
parent 74cd6a538d
commit a5d293c188

View File

@ -873,7 +873,7 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
{ {
size_t i = 0; size_t i = 0;
size_t j = 0; size_t j = 0;
virBuffer controlBuf = VIR_BUFFER_INITIALIZER; virBuffer childrenBuf = VIR_BUFFER_INITIALIZER;
if (!ncaches) if (!ncaches)
return 0; return 0;
@ -902,7 +902,7 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
short_size, unit, cpus_str); short_size, unit, cpus_str);
VIR_FREE(cpus_str); VIR_FREE(cpus_str);
virBufferSetChildIndent(&controlBuf, buf); virBufferSetChildIndent(&childrenBuf, buf);
for (j = 0; j < bank->ncontrols; j++) { for (j = 0; j < bank->ncontrols; j++) {
const char *min_unit; const char *min_unit;
virResctrlInfoPerCachePtr controls = bank->controls[j]; virResctrlInfoPerCachePtr controls = bank->controls[j];
@ -928,26 +928,26 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
} }
} }
virBufferAsprintf(&controlBuf, virBufferAsprintf(&childrenBuf,
"<control granularity='%llu'", "<control granularity='%llu'",
gran_short_size); gran_short_size);
if (min_short_size) if (min_short_size)
virBufferAsprintf(&controlBuf, " min='%llu'", min_short_size); virBufferAsprintf(&childrenBuf, " min='%llu'", min_short_size);
virBufferAsprintf(&controlBuf, virBufferAsprintf(&childrenBuf,
" unit='%s' type='%s' maxAllocs='%u'/>\n", " unit='%s' type='%s' maxAllocs='%u'/>\n",
unit, unit,
virCacheTypeToString(controls->scope), virCacheTypeToString(controls->scope),
controls->max_allocation); controls->max_allocation);
} }
if (virBufferCheckError(&controlBuf) < 0) if (virBufferCheckError(&childrenBuf) < 0)
return -1; return -1;
if (virBufferUse(&controlBuf)) { if (virBufferUse(&childrenBuf)) {
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAddBuffer(buf, &controlBuf); virBufferAddBuffer(buf, &childrenBuf);
virBufferAddLit(buf, "</bank>\n"); virBufferAddLit(buf, "</bank>\n");
} else { } else {
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
@ -966,7 +966,7 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr buf,
virCapsHostMemBWNodePtr *nodes) virCapsHostMemBWNodePtr *nodes)
{ {
size_t i = 0; size_t i = 0;
virBuffer controlBuf = VIR_BUFFER_INITIALIZER; virBuffer childrenBuf = VIR_BUFFER_INITIALIZER;
if (!nnodes) if (!nnodes)
return 0; return 0;
@ -987,19 +987,19 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr buf,
node->id, cpus_str); node->id, cpus_str);
VIR_FREE(cpus_str); VIR_FREE(cpus_str);
virBufferSetChildIndent(&controlBuf, buf); virBufferSetChildIndent(&childrenBuf, buf);
virBufferAsprintf(&controlBuf, virBufferAsprintf(&childrenBuf,
"<control granularity='%u' min ='%u' " "<control granularity='%u' min ='%u' "
"maxAllocs='%u'/>\n", "maxAllocs='%u'/>\n",
control->granularity, control->min, control->granularity, control->min,
control->max_allocation); control->max_allocation);
if (virBufferCheckError(&controlBuf) < 0) if (virBufferCheckError(&childrenBuf) < 0)
return -1; return -1;
if (virBufferUse(&controlBuf)) { if (virBufferUse(&childrenBuf)) {
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAddBuffer(buf, &controlBuf); virBufferAddBuffer(buf, &childrenBuf);
virBufferAddLit(buf, "</node>\n"); virBufferAddLit(buf, "</node>\n");
} else { } else {
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");