From 5ff4fff5350726d4f39710a4c05a28a148730bab Mon Sep 17 00:00:00 2001 From: Christophe Varoqui Date: Wed, 9 Jan 2008 00:39:57 +0100 Subject: [PATCH] [libmultipath] add %s wildcard the multipath printing function same as %s for path printing function, prints the vendor/product string --- libmultipath/print.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libmultipath/print.c b/libmultipath/print.c index 5752ffb..3c3f0fe 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -90,8 +90,8 @@ snprint_sysfs (char * buff, size_t len, struct multipath * mpp) { if (mpp->dmi) return snprintf(buff, len, "dm-%i", mpp->dmi->minor); - - return 0; + else + return snprintf(buff, len, "n/a"); } static int @@ -222,6 +222,16 @@ snprint_multipath_uuid (char * buff, size_t len, struct multipath * mpp) } static int +snprint_multipath_vpr (char * buff, size_t len, struct multipath * mpp) +{ + struct path * pp = first_path(mpp); + if (!pp) + return 0; + return snprintf(buff, len, "%s,%s", + pp->vendor_id, pp->product_id); +} + +static int snprint_action (char * buff, size_t len, struct multipath * mpp) { switch (mpp->action) { @@ -389,6 +399,7 @@ struct multipath_data mpd[] = { {'2', "map_loads", 0, snprint_map_loads}, {'3', "total_q_time", 0, snprint_total_q_time}, {'4', "q_timeouts", 0, snprint_q_timeouts}, + {'s', "vend/prod/rev", 0, snprint_multipath_vpr}, {0, NULL, 0 , NULL} }; @@ -693,8 +704,7 @@ snprint_multipath_topology (char * buff, int len, struct multipath * mpp, if (strncmp(mpp->alias, mpp->wwid, WWID_SIZE)) c += sprintf(c, " (%%w)"); - c += sprintf(c, " %%d "); - c += snprint_vpr(c, 24, first_path(mpp)); + c += sprintf(c, " %%d %%s"); fwd += snprint_multipath(buff + fwd, len - fwd, style, mpp); if (fwd > len) -- 2.7.4