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
This commit is contained in:
parent
44c8009459
commit
c94b8307db
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179910
@ -41,7 +41,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd November 28, 2007
|
.Dd June 21, 2008
|
||||||
.Dt MDCONFIG 8
|
.Dt MDCONFIG 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -65,6 +65,7 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Fl l
|
.Fl l
|
||||||
.Op Fl n
|
.Op Fl n
|
||||||
|
.Op Fl v
|
||||||
.Op Fl u Ar unit
|
.Op Fl u Ar unit
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
@ -119,6 +120,9 @@ List configured devices.
|
|||||||
If given with
|
If given with
|
||||||
.Fl u ,
|
.Fl u ,
|
||||||
display details about that particular device.
|
display details about that particular device.
|
||||||
|
If
|
||||||
|
.Fl v
|
||||||
|
option specified, show all details.
|
||||||
.It Fl n
|
.It Fl n
|
||||||
When printing md device names, print only the unit number without the
|
When printing md device names, print only the unit number without the
|
||||||
md prefix.
|
md prefix.
|
||||||
|
@ -59,7 +59,7 @@ usage()
|
|||||||
" [-s size] [-S sectorsize] [-u unit]\n"
|
" [-s size] [-S sectorsize] [-u unit]\n"
|
||||||
" [-x sectors/track] [-y heads/cyl]\n"
|
" [-x sectors/track] [-y heads/cyl]\n"
|
||||||
" mdconfig -d -u unit\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\ttype = {malloc, preload, vnode, swap}\n");
|
||||||
fprintf(stderr, "\t\toption = {cluster, compress, reserve}\n");
|
fprintf(stderr, "\t\toption = {cluster, compress, reserve}\n");
|
||||||
fprintf(stderr, "\t\tsize = %%d (512 byte blocks), %%db (B),\n");
|
fprintf(stderr, "\t\tsize = %%d (512 byte blocks), %%db (B),\n");
|
||||||
@ -71,7 +71,7 @@ usage()
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ch, fd, i;
|
int ch, fd, i, vflag;
|
||||||
char *p;
|
char *p;
|
||||||
int cmdline = 0;
|
int cmdline = 0;
|
||||||
char *mdunit;
|
char *mdunit;
|
||||||
@ -80,9 +80,10 @@ main(int argc, char **argv)
|
|||||||
mdio.md_file = malloc(PATH_MAX);
|
mdio.md_file = malloc(PATH_MAX);
|
||||||
if (mdio.md_file == NULL)
|
if (mdio.md_file == NULL)
|
||||||
err(1, "could not allocate memory");
|
err(1, "could not allocate memory");
|
||||||
|
vflag = 0;
|
||||||
bzero(mdio.md_file, PATH_MAX);
|
bzero(mdio.md_file, PATH_MAX);
|
||||||
for (;;) {
|
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)
|
if (ch == -1)
|
||||||
break;
|
break;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@ -237,6 +238,11 @@ main(int argc, char **argv)
|
|||||||
mdunit = optarg;
|
mdunit = optarg;
|
||||||
mdio.md_options &= ~MD_AUTOUNIT;
|
mdio.md_options &= ~MD_AUTOUNIT;
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
if (cmdline != 3)
|
||||||
|
usage();
|
||||||
|
vflag = OPT_VERBOSE;
|
||||||
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
if (cmdline != 2)
|
if (cmdline != 2)
|
||||||
usage();
|
usage();
|
||||||
@ -282,7 +288,7 @@ main(int argc, char **argv)
|
|||||||
* Listing all devices. This is why we pass NULL
|
* Listing all devices. This is why we pass NULL
|
||||||
* together with OPT_LIST.
|
* together with OPT_LIST.
|
||||||
*/
|
*/
|
||||||
md_list(NULL, OPT_LIST);
|
md_list(NULL, OPT_LIST | vflag);
|
||||||
} else {
|
} else {
|
||||||
return (md_query(mdunit));
|
return (md_query(mdunit));
|
||||||
}
|
}
|
||||||
@ -373,13 +379,13 @@ md_list(char *units, int opt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
opt |= OPT_DONE;
|
opt |= OPT_DONE;
|
||||||
if (opt & OPT_LIST)
|
if ((opt & OPT_LIST) && !(opt & OPT_VERBOSE))
|
||||||
printf(" ");
|
printf(" ");
|
||||||
else
|
else
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((opt & OPT_LIST) && (opt & OPT_DONE))
|
if ((opt & OPT_LIST) && (opt & OPT_DONE) && !(opt & OPT_VERBOSE))
|
||||||
printf("\n");
|
printf("\n");
|
||||||
/* XXX: Check if it's enough to clean everything. */
|
/* XXX: Check if it's enough to clean everything. */
|
||||||
geom_stats_snapshot_free(sq);
|
geom_stats_snapshot_free(sq);
|
||||||
|
Loading…
Reference in New Issue
Block a user