On Fri, Apr 10, 2015 at 16:32:32 +0200, Ján Tomko wrote: > Use virBitmapDataToString instead of constructing the ranges bit > by bit, remove the checking of parameters (that is already done > by the callers). > > Let the callers choose the right bitmap, since there's only > one that uses this helper on a matrix-in-an-array. > --- > tools/virsh-domain.c | 41 ++++++++++------------------------------- > 1 file changed, 10 insertions(+), 31 deletions(-) > > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c > index 928360c..d5352d7 100644 > --- a/tools/virsh-domain.c > +++ b/tools/virsh-domain.c
...
> @@ -6526,7 +6505,8 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
> continue;
>
> vshPrint(ctl, "%4zu: ", i);
> - ret = vshPrintPinInfo(cpumap, cpumaplen, maxcpu, i);
> + ret = vshPrintPinInfo(VIR_GET_CPUMAP(cpumap, cpumaplen, i),
> + cpumaplen);
> vshPrint(ctl, "\n");
> if (!ret)
> break;
> @@ -6643,12 +6623,12 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd)
> flags = VIR_DOMAIN_AFFECT_CURRENT;
>
> cpumaps = vshMalloc(ctl, cpumaplen);
> - if (virDomainGetEmulatorPinInfo(dom, cpumaps,
> + if (virDomainGetEmulatorPinInfo(dom, cpumap,
@cpumap is NULL at this point. virDomainGetEmulatorPinInfo() requires
that it's non-NULL. Additionally after this change @cpumaps is unused
just allocated and freed.
> cpumaplen, flags) >= 0) {
> vshPrintExtra(ctl, "%s %s\n", _("emulator:"), _("CPU Affinity"));
> vshPrintExtra(ctl, "----------------------------------\n");
> vshPrintExtra(ctl, " *: ");
> - ret = vshPrintPinInfo(cpumaps, cpumaplen, maxcpu, 0);
> + ret = vshPrintPinInfo(cpumap, cpumaplen);
> vshPrint(ctl, "\n");
> }
> VIR_FREE(cpumaps);
ACK if you alocate @cpumap before the call and remove @cpumaps.
Peter
signature.asc
Description: Digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
