From b85f1267c6e6e6d74cc819dc7770b3df8ce92add Mon Sep 17 00:00:00 2001 From: sobomax Date: Thu, 16 Feb 2006 21:28:54 +0000 Subject: Add new -E option, which allows to specify location of the mdconfig(8) utility instead of using default _PATH_MDCONFIG (/sbin/mdconfig). MFC after: 1 week --- sbin/mdmfs/mdmfs.8 | 8 ++++++++ sbin/mdmfs/mdmfs.c | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'sbin/mdmfs') diff --git a/sbin/mdmfs/mdmfs.8 b/sbin/mdmfs/mdmfs.8 index 3d42988..9bbf6d3 100644 --- a/sbin/mdmfs/mdmfs.8 +++ b/sbin/mdmfs/mdmfs.8 @@ -41,6 +41,7 @@ driver .Op Fl b Ar block-size .Op Fl c Ar cylinders .Op Fl d Ar rotdelay +.Op Fl E Ar path-mdconfig .Op Fl e Ar maxbpg .Op Fl F Ar file .Op Fl f Ar frag-size @@ -62,6 +63,7 @@ driver .Op Fl b Ar block-size .Op Fl c Ar cylinders .Op Fl d Ar rotdelay +.Op Fl E Ar path-mdconfig .Op Fl e Ar maxbpg .Op Fl F Ar file .Op Fl f Ar frag-size @@ -149,6 +151,12 @@ disk transfer on the same cylinder. Modern disks with read/write-behind achieve higher performance without this feature, so it is best to leave it at 0 milliseconds. +.It Fl E Ar path-mdconfig +Use +.Ar path-mdconfig +as a location of the +.Xr mdconfig 8 +utility. .It Fl e Ar maxbpg Indicate the maximum number of blocks any single file can allocate out of a cylinder group before it is forced to begin allocating diff --git a/sbin/mdmfs/mdmfs.c b/sbin/mdmfs/mdmfs.c index 33c35f9..e23d525 100644 --- a/sbin/mdmfs/mdmfs.c +++ b/sbin/mdmfs/mdmfs.c @@ -68,6 +68,7 @@ static bool norun; /* Actually run the helper programs? */ static int unit; /* The unit we're working with. */ static const char *mdname; /* Name of memory disk device (e.g., "md"). */ static size_t mdnamelen; /* Length of mdname. */ +static const char *path_mdconfig =_PATH_MDCONFIG; static void argappend(char **, const char *, ...) __printflike(2, 3); static void debugprintf(const char *, ...) __printflike(1, 2); @@ -122,7 +123,7 @@ main(int argc, char **argv) compat = true; while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:e:F:f:hi:LlMm:Nn:O:o:p:PSs:t:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:LlMm:Nn:O:o:Pp:Ss:t:Uv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -146,6 +147,9 @@ main(int argc, char **argv) case 'd': argappend(&newfs_arg, "-d %s", optarg); break; + case 'E': + path_mdconfig = optarg; + break; case 'e': argappend(&newfs_arg, "-e %s", optarg); break; @@ -355,7 +359,7 @@ do_mdconfig_attach(const char *args, const enum md_types mdtype) default: abort(); } - rv = run(NULL, "%s -a %s%s -u %s%d", _PATH_MDCONFIG, ta, args, + rv = run(NULL, "%s -a %s%s -u %s%d", path_mdconfig, ta, args, mdname, unit); if (rv) errx(1, "mdconfig (attach) exited with error code %d", rv); @@ -389,7 +393,7 @@ do_mdconfig_attach_au(const char *args, const enum md_types mdtype) default: abort(); } - rv = run(&fd, "%s -a %s%s", _PATH_MDCONFIG, ta, args); + rv = run(&fd, "%s -a %s%s", path_mdconfig, ta, args); if (rv) errx(1, "mdconfig (attach) exited with error code %d", rv); @@ -428,7 +432,7 @@ do_mdconfig_detach(void) { int rv; - rv = run(NULL, "%s -d -u %s%d", _PATH_MDCONFIG, mdname, unit); + rv = run(NULL, "%s -d -u %s%d", path_mdconfig, mdname, unit); if (rv && debug) /* This is allowed to fail. */ warnx("mdconfig (detach) exited with error code %d (ignored)", rv); @@ -676,14 +680,14 @@ usage(void) if (!compat) fprintf(stderr, "usage: %s [-DLlMNPSUX] [-a maxcontig] [-b block-size] [-c cylinders]\n" -"\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n" -"\t[-m percent-free] [-n rotational-positions] [-O optimization]\n" +"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n" +"\t[-i bytes] [-m percent-free] [-n rotational-positions] [-O optimization]\n" "\t[-o mount-options] [-p permissions] [-s size] [-v version]\n" "\t[-w user:group] md-device mount-point\n", name); fprintf(stderr, "usage: %s -C [-lNU] [-a maxcontig] [-b block-size] [-c cylinders]\n" -"\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n" -"\t[-m percent-free] [-n rotational-positions] [-O optimization]\n" +"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n" +"\t[-i bytes] [-m percent-free] [-n rotational-positions] [-O optimization]\n" "\t[-o mount-options] [-s size] [-v version] md-device mount-point\n", name); exit(1); } -- cgit v1.1