Search
j0ke.net Open Build Service
>
Projects
>
GFS
>
multipath-tools
> multipath-tools-dump-hwtable
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File multipath-tools-dump-hwtable of Package multipath-tools
diff --git a/libmultipath/print.c b/libmultipath/print.c index 8186cdf..cde5aa6 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -738,7 +738,7 @@ snprint_hwentry (char * buff, int len, s if (fwd > len) return len; iterate_sub_keywords(rootkw, kw, i) { - fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n", + fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k \"%v\"\n", kw, hwe); if (fwd > len) return len; diff --git a/multipath/main.c b/multipath/main.c index e77a742..d4ba96d 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -72,7 +72,7 @@ static void usage (char * progname) { fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F]\n", + fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-t]\n", progname); fprintf (stderr, "\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \ @@ -90,6 +90,7 @@ usage (char * progname) "\t-ll\t\tshow multipath topology (maximum info)\n" \ "\t-f\t\tflush a multipath device map\n" \ "\t-F\t\tflush all multipath device maps\n" \ + "\t-t\t\tprint internal hardware table\n" \ "\t-p policy\tforce all maps to specified policy :\n" \ "\t failover\t\t1 path per priority group\n" \ "\t multibus\t\tall paths in 1 priority group\n" \ @@ -303,6 +304,55 @@ out: return r; } +static int +dump_config (void) +{ + char * c; + char * reply; + unsigned int maxlen = 256; + int again = 1; + + reply = MALLOC(maxlen); + + while (again) { + if (!reply) + return 1; + c = reply; + c += snprint_defaults(c, reply + maxlen - c); + again = ((c - reply) == maxlen); + if (again) { + reply = REALLOC(reply, maxlen *= 2); + continue; + } + c += snprint_blacklist(c, reply + maxlen - c); + again = ((c - reply) == maxlen); + if (again) { + reply = REALLOC(reply, maxlen *= 2); + continue; + } + c += snprint_blacklist_except(c, reply + maxlen - c); + again = ((c - reply) == maxlen); + if (again) { + reply = REALLOC(reply, maxlen *= 2); + continue; + } + c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable); + again = ((c - reply) == maxlen); + if (again) { + reply = REALLOC(reply, maxlen *= 2); + continue; + } + c += snprint_mptable(c, reply + maxlen - c, conf->mptable); + again = ((c - reply) == maxlen); + if (again) + reply = REALLOC(reply, maxlen *= 2); + } + + printf("%s", reply); + FREE(reply); + return 0; +} + int main (int argc, char *argv[]) { @@ -326,7 +376,7 @@ main (int argc, char *argv[]) if (load_config(DEFAULT_CONFIGFILE)) exit(1); - while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:")) != EOF ) { + while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:t")) != EOF ) { switch(arg) { case 1: printf("optarg : %s\n",optarg); break; @@ -369,6 +419,9 @@ #endif usage(argv[0]); } break; + case 't': + dump_config(); + goto out; case 'h': usage(argv[0]); case ':': diff --git a/multipath/multipath.8 b/multipath/multipath.8 index 27dea96..8844619 100644 --- a/multipath/multipath.8 +++ b/multipath/multipath.8 @@ -47,6 +47,9 @@ flush a multipath device map specified a .B \-F flush all unused multipath device maps .TP +.B \-t +print internal hardware table to stdout +.TP .BI \-p " policy" force maps to specified policy: .RS 1.2i