diff options
author | marck <marck@FreeBSD.org> | 2008-06-21 15:04:42 +0000 |
---|---|---|
committer | marck <marck@FreeBSD.org> | 2008-06-21 15:04:42 +0000 |
commit | f95442f594cc909711b0fc1b9e4b9f11c738ad3c (patch) | |
tree | 46eede702efd9ddb21f7e8c57d884fb4cfc0d5b6 /sbin/mdconfig | |
parent | badb7ec1c61be40a40cb3f6c081d7f5035a35fdf (diff) | |
download | FreeBSD-src-f95442f594cc909711b0fc1b9e4b9f11c738ad3c.zip FreeBSD-src-f95442f594cc909711b0fc1b9e4b9f11c738ad3c.tar.gz |
Add -v (verbose) option to -l command, to show size and backing store
of all md devices at one time.
Approved by: phk
MFC after: 2 weeks
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r-- | sbin/mdconfig/mdconfig.8 | 6 | ||||
-rw-r--r-- | sbin/mdconfig/mdconfig.c | 18 |
2 files changed, 17 insertions, 7 deletions
diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8 index ba79b34..28c17c5 100644 --- a/sbin/mdconfig/mdconfig.8 +++ b/sbin/mdconfig/mdconfig.8 @@ -41,7 +41,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2007 +.Dd June 21, 2008 .Dt MDCONFIG 8 .Os .Sh NAME @@ -65,6 +65,7 @@ .Nm .Fl l .Op Fl n +.Op Fl v .Op Fl u Ar unit .Sh DESCRIPTION The @@ -119,6 +120,9 @@ List configured devices. If given with .Fl u , display details about that particular device. +If +.Fl v +option specified, show all details. .It Fl n When printing md device names, print only the unit number without the md prefix. diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index 9142b47..d1abf68 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -59,7 +59,7 @@ usage() " [-s size] [-S sectorsize] [-u unit]\n" " [-x sectors/track] [-y heads/cyl]\n" " mdconfig -d -u unit\n" -" mdconfig -l [-n] [-u unit]\n"); +" mdconfig -l [-v] [-n] [-u unit]\n"); fprintf(stderr, "\t\ttype = {malloc, preload, vnode, swap}\n"); fprintf(stderr, "\t\toption = {cluster, compress, reserve}\n"); fprintf(stderr, "\t\tsize = %%d (512 byte blocks), %%db (B),\n"); @@ -71,7 +71,7 @@ usage() int main(int argc, char **argv) { - int ch, fd, i; + int ch, fd, i, vflag; char *p; int cmdline = 0; char *mdunit; @@ -80,9 +80,10 @@ main(int argc, char **argv) mdio.md_file = malloc(PATH_MAX); if (mdio.md_file == NULL) err(1, "could not allocate memory"); + vflag = 0; bzero(mdio.md_file, PATH_MAX); for (;;) { - ch = getopt(argc, argv, "ab:df:lno:s:S:t:u:x:y:"); + ch = getopt(argc, argv, "ab:df:lno:s:S:t:u:vx:y:"); if (ch == -1) break; switch (ch) { @@ -237,6 +238,11 @@ main(int argc, char **argv) mdunit = optarg; mdio.md_options &= ~MD_AUTOUNIT; break; + case 'v': + if (cmdline != 3) + usage(); + vflag = OPT_VERBOSE; + break; case 'x': if (cmdline != 2) usage(); @@ -282,7 +288,7 @@ main(int argc, char **argv) * Listing all devices. This is why we pass NULL * together with OPT_LIST. */ - md_list(NULL, OPT_LIST); + md_list(NULL, OPT_LIST | vflag); } else { return (md_query(mdunit)); } @@ -373,13 +379,13 @@ md_list(char *units, int opt) } } opt |= OPT_DONE; - if (opt & OPT_LIST) + if ((opt & OPT_LIST) && !(opt & OPT_VERBOSE)) printf(" "); else printf("\n"); } } - if ((opt & OPT_LIST) && (opt & OPT_DONE)) + if ((opt & OPT_LIST) && (opt & OPT_DONE) && !(opt & OPT_VERBOSE)) printf("\n"); /* XXX: Check if it's enough to clean everything. */ geom_stats_snapshot_free(sq); |