[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [WIP PATCH 12/16] WIP: UNTESTED: tools/xl: Replace remaining options with format()
format() is meant to be a powerful tool, sweep the remaining bits away. Unfortunately I am unable to test this portion. Signed-off-by: Elliott Mitchell <ehem+xen@xxxxxxx> --- tools/xl/xl_list.c | 44 ++++++++------------------------------------ 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/tools/xl/xl_list.c b/tools/xl/xl_list.c index 10d076864e..ee20d2feee 100644 --- a/tools/xl/xl_list.c +++ b/tools/xl/xl_list.c @@ -371,56 +371,28 @@ static void list_domains(bool verbose, bool context, bool claim, bool numa, int i; const char lead[] = "%-40n %5i %5m %5v %s %8.1t"; - libxl_bitmap nodemap; - libxl_physinfo physinfo; - - libxl_bitmap_init(&nodemap); - libxl_physinfo_init(&physinfo); - format(formats, lead, NULL); if (verbose) { format(formats, " %u %r %16l", NULL); } else if (context) format(formats, " %16l", NULL); - if (claim) printf(" Claimed"); - if (cpupool) printf(" Cpupool"); - if (numa) { - if (libxl_node_bitmap_alloc(ctx, &nodemap, 0)) { - fprintf(stderr, "libxl_node_bitmap_alloc_failed.\n"); - exit(EXIT_FAILURE); - } - if (libxl_get_physinfo(ctx, &physinfo) != 0) { - fprintf(stderr, "libxl_physinfo failed.\n"); - libxl_bitmap_dispose(&nodemap); - exit(EXIT_FAILURE); - } - - printf(" NODE Affinity"); - } + if (claim) format(formats, " %5c", NULL); + if (cpupool) format(formats, " %16p", NULL); + if (numa) format(formats, " %A", NULL); printf("\n"); for (i = 0; i < nb_domain; i++) { format(formats, lead, info + i); if (verbose) format(formats, " %u %r", info + i); if (claim) - printf(" %5lu", (unsigned long)info[i].outstanding_memkb / 1024); + format(formats, " %5c", info + i); if (verbose || context) format(formats, " %16l", info + i); - if (cpupool) { - char *poolname = libxl_cpupoolid_to_name(ctx, info[i].cpupool); - printf("%16s", poolname); - free(poolname); - } - if (numa) { - libxl_domain_get_nodeaffinity(ctx, info[i].domid, &nodemap); - - putchar(' '); - print_bitmap(nodemap.map, physinfo.nr_nodes, stdout); - } + if (cpupool) + format(formats, " %16p", info + i); + if (numa) + format(formats, " %A", info + i); putchar('\n'); } - - libxl_bitmap_dispose(&nodemap); - libxl_physinfo_dispose(&physinfo); } -- -- (\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | ehem+sigmsg@xxxxxxx PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |