Index: mdconfig.8 =================================================================== RCS file: /home/ncvs/src/sbin/mdconfig/mdconfig.8,v retrieving revision 1.19 diff -u -r1.19 mdconfig.8 --- mdconfig.8 27 Apr 2003 01:46:56 -0000 1.19 +++ mdconfig.8 7 May 2003 15:07:36 -0000 @@ -51,6 +51,7 @@ .Nm .Fl a .Fl t Ar type +.Op Fl n .Oo .Fl o .Oo Cm no Oc Ns Ar option @@ -64,6 +65,7 @@ .Fl u Ar unit .Nm .Fl l +.Op Fl n .Op Fl u Ar unit .Sh DESCRIPTION The @@ -103,6 +105,9 @@ .Fl u option is used in conjuction with this, the output is limited to information on the specified device. +.It Fl n +When printing md device names, print only the unit number without the +md prefix. .It Fl s Ar size Size of the memory disk. .Ar Size Index: mdconfig.c =================================================================== RCS file: /home/ncvs/src/sbin/mdconfig/mdconfig.c,v retrieving revision 1.28 diff -u -r1.28 mdconfig.c --- mdconfig.c 9 Apr 2003 11:59:29 -0000 1.28 +++ mdconfig.c 7 May 2003 14:56:24 -0000 @@ -33,13 +33,15 @@ enum {UNSET, ATTACH, DETACH, LIST} action = UNSET; +int nflag; + void usage() { fprintf(stderr, "usage:\n"); - fprintf(stderr, "\tmdconfig -a -t type [-o [no]option]... [ -f file] [-s size] [-S sectorsize] [-u unit]\n"); + fprintf(stderr, "\tmdconfig -a -n -t type [-o [no]option]... [ -f file] [-s size] [-S sectorsize] [-u unit]\n"); fprintf(stderr, "\tmdconfig -d -u unit\n"); - fprintf(stderr, "\tmdconfig -l [-u unit]\n"); + fprintf(stderr, "\tmdconfig -l -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), %%dk (kB), %%dm (MB) or %%dg (GB)\n"); @@ -54,7 +56,7 @@ int cmdline = 0; for (;;) { - ch = getopt(argc, argv, "ab:df:lo:s:S:t:u:x:y:"); + ch = getopt(argc, argv, "ab:df:lno:s:S:t:u:x:y:"); if (ch == -1) break; switch (ch) { @@ -78,6 +80,9 @@ mdio.md_options = MD_AUTOUNIT; cmdline = 3; break; + case 'n': + nflag = 1; + break; case 't': if (cmdline != 1) usage(); @@ -202,7 +207,7 @@ if (i < 0) err(1, "ioctl(/dev/%s)", MDCTL_NAME); if (mdio.md_options & MD_AUTOUNIT) - printf("%s%d\n", MD_NAME, mdio.md_unit); + printf("%s%d\n", nflag ? "" : MD_NAME, mdio.md_unit); } else if (action == DETACH) { if (mdio.md_options & MD_AUTOUNIT) usage(); @@ -230,7 +235,8 @@ if (ioctl(fd, MDIOCLIST, &mdio) < 0) err(1, "ioctl(/dev/%s)", MDCTL_NAME); for (unit = 0; unit < mdio.md_pad[0] && unit < MDNPAD - 1; unit++) { - printf("%smd%d", unit > 0 ? " " : "", mdio.md_pad[unit + 1]); + printf("%s%s%d", unit > 0 ? " " : "", + nflag ? "" : MD_NAME, mdio.md_pad[unit + 1]); } if (mdio.md_pad[0] - unit > 0) printf(" ... %d more", mdio.md_pad[0] - unit);