From: Christophe Varoqui Date: Thu, 13 Nov 2008 22:52:20 +0000 (+0100) Subject: [multipathd] add "show maps format ..." cli command X-Git-Tag: 0.4.9~175 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3484274184cc4be889718c97ebe0536623043fa8;p=platform%2Fupstream%2Fmultipath-tools.git [multipathd] add "show maps format ..." cli command Just like "show paths format ...", it gives users more control over the report format of multipaths information. Example: $ sudo multipathd -k'show maps format "%n %s %S %d %t %r %Q %N"' name vend/prod/rev size sysfs dm-st write_prot queueing paths 353333330000007d0 Linux,scsi_debug 8.0M dm-1 active rw - 2 353333330000007d1 Linux,scsi_debug 8.0M dm-2 active rw - 2 35333333000000bb8 Linux,scsi_debug 8.0M dm-3 active rw - 2 35333333000000bb9 Linux,scsi_debug 8.0M dm-4 active rw - 2 --- diff --git a/multipathd/cli.c b/multipathd/cli.c index b4b4d1e..c93aa83 100644 --- a/multipathd/cli.c +++ b/multipathd/cli.c @@ -413,6 +413,7 @@ cli_init (void) { add_handler(LIST+MAPS, NULL); add_handler(LIST+MAPS+STATUS, NULL); add_handler(LIST+MAPS+STATS, NULL); + add_handler(LIST+MAPS+FMT, NULL); add_handler(LIST+MAPS+TOPOLOGY, NULL); add_handler(LIST+TOPOLOGY, NULL); add_handler(LIST+MAP+TOPOLOGY, NULL); diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index e453220..6cf232a 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -297,6 +297,17 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style) } int +cli_list_maps_fmt (void * v, char ** reply, int * len, void * data) +{ + struct vectors * vecs = (struct vectors *)data; + char * fmt = get_keyparam(v, FMT); + + condlog(3, "list maps (operator)"); + + return show_maps(reply, len, vecs, fmt); +} + +int cli_list_maps (void * v, char ** reply, int * len, void * data) { struct vectors * vecs = (struct vectors *)data; diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h index cef9864..f57a160 100644 --- a/multipathd/cli_handlers.h +++ b/multipathd/cli_handlers.h @@ -2,6 +2,7 @@ int cli_list_paths (void * v, char ** reply, int * len, void * data); int cli_list_paths_fmt (void * v, char ** reply, int * len, void * data); int cli_list_status (void * v, char ** reply, int * len, void * data); int cli_list_maps (void * v, char ** reply, int * len, void * data); +int cli_list_maps_fmt (void * v, char ** reply, int * len, void * data); int cli_list_maps_status (void * v, char ** reply, int * len, void * data); int cli_list_maps_stats (void * v, char ** reply, int * len, void * data); int cli_list_map_topology (void * v, char ** reply, int * len, void * data); diff --git a/multipathd/main.c b/multipathd/main.c index 0d4c355..25fc41e 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -697,6 +697,7 @@ uxlsnrloop (void * ap) set_handler_callback(LIST+STATUS, cli_list_status); set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status); set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats); + set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt); set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology);