
On Wed, Mar 25, 2015 at 19:39:11 +0100, Ján Tomko wrote:
Just format the bitmap via virBitmapFormat. --- tools/virsh-domain.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index afd92b1..cb9cb9d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6834,6 +6834,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) size_t i; int maxcpu; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; + virBitmapPtr map = NULL;
VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -6863,16 +6864,24 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) _("IOThread ID"), _("CPU Affinity")); vshPrintExtra(ctl, "---------------------------------------------------\n"); for (i = 0; i < niothreads; i++) { + char *mapstr = NULL; + virBitmapFree(map); + map = virBitmapNewData(info[i]->cpumap, info[i]->cpumaplen); + if (!map) + goto cleanup; + + if (!(mapstr = virBitmapFormat(map))) + goto cleanup;
vshPrint(ctl, " %-15u ", info[i]->iothread_id); - ignore_value(vshPrintPinInfo(info[i]->cpumap, info[i]->cpumaplen, - maxcpu, 0)); + vshPrint(ctl, " %-15s ", mapstr); vshPrint(ctl, "\n"); virDomainIOThreadInfoFree(info[i]); } VIR_FREE(info);
cleanup: + virBitmapFree(map); virDomainFree(dom); return niothreads >= 0; }
Since vshPrintPinInfo produces the same output, how about we kill the reimplementation in vshPrintPinInfo and replace it with this code? And keep the use of vshPrintPinInfo here? Peter