2 * Copyright (c) 2010 Marcel Moolenaar
3 * Copyright (c) 1999-2004 Poul-Henning Kamp
4 * Copyright (c) 1999 Michael Smith
5 * Copyright (c) 1989, 1993
6 * The Regents of the University of California. All rights reserved.
7 * (c) UNIX System Laboratories, Inc.
8 * All or some portions of this file are derived from material licensed
9 * to the University of California by American Telephone and Telegraph
10 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11 * the permission of UNIX System Laboratories, Inc.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 #include "opt_rootdevname.h"
40 #include <sys/cdefs.h>
41 __FBSDID("$FreeBSD$");
43 #include <sys/param.h>
46 #include <sys/fcntl.h>
48 #include <sys/kernel.h>
49 #include <sys/malloc.h>
50 #include <sys/mdioctl.h>
51 #include <sys/mount.h>
52 #include <sys/mutex.h>
53 #include <sys/namei.h>
56 #include <sys/filedesc.h>
57 #include <sys/reboot.h>
60 #include <sys/syscallsubr.h>
61 #include <sys/sysproto.h>
63 #include <sys/sysctl.h>
64 #include <sys/sysent.h>
65 #include <sys/systm.h>
66 #include <sys/vnode.h>
68 #include <geom/geom.h>
71 * The root filesystem is detailed in the kernel environment variable
72 * vfs.root.mountfrom, which is expected to be in the general format
74 * <vfsname>:[<path>][ <vfsname>:[<path>] ...]
75 * vfsname := the name of a VFS known to the kernel and capable
76 * of being mounted as root
77 * path := disk device name or other data used by the filesystem
78 * to locate its physical store
80 * If the environment variable vfs.root.mountfrom is a space separated list,
81 * each list element is tried in turn and the root filesystem will be mounted
82 * from the first one that suceeds.
84 * The environment variable vfs.root.mountfrom.options is a comma delimited
85 * set of string mount options. These mount options must be parseable
86 * by nmount() in the kernel.
89 static int parse_mount(char **);
90 static struct mntarg *parse_mountroot_options(struct mntarg *, const char *);
93 * The vnode of the system's root (/ in the filesystem, without chroot
96 struct vnode *rootvnode;
98 char *rootdevnames[2] = {NULL, NULL};
100 struct mtx root_holds_mtx;
101 MTX_SYSINIT(root_holds, &root_holds_mtx, "root_holds", MTX_DEF);
103 struct root_hold_token {
105 LIST_ENTRY(root_hold_token) list;
108 static LIST_HEAD(, root_hold_token) root_holds =
109 LIST_HEAD_INITIALIZER(root_holds);
118 static enum action root_mount_onfail = A_CONTINUE;
120 static int root_mount_mddev;
121 static int root_mount_complete;
123 /* By default wait up to 3 seconds for devices to appear. */
124 static int root_mount_timeout = 3;
125 TUNABLE_INT("vfs.mountroot.timeout", &root_mount_timeout);
127 struct root_hold_token *
128 root_mount_hold(const char *identifier)
130 struct root_hold_token *h;
135 h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
137 mtx_lock(&root_holds_mtx);
138 LIST_INSERT_HEAD(&root_holds, h, list);
139 mtx_unlock(&root_holds_mtx);
144 root_mount_rel(struct root_hold_token *h)
149 mtx_lock(&root_holds_mtx);
150 LIST_REMOVE(h, list);
152 mtx_unlock(&root_holds_mtx);
160 /* No mutex is acquired here because int stores are atomic. */
161 return (root_mount_complete);
165 root_mount_wait(void)
169 * Panic on an obvious deadlock - the function can't be called from
170 * a thread which is doing the whole SYSINIT stuff.
172 KASSERT(curthread->td_proc->p_pid != 0,
173 ("root_mount_wait: cannot be called from the swapper thread"));
174 mtx_lock(&root_holds_mtx);
175 while (!root_mount_complete) {
176 msleep(&root_mount_complete, &root_holds_mtx, PZERO, "rootwait",
179 mtx_unlock(&root_holds_mtx);
187 if (VFS_ROOT(TAILQ_FIRST(&mountlist), LK_EXCLUSIVE, &rootvnode))
188 panic("Cannot find root vnode");
190 VOP_UNLOCK(rootvnode, 0);
192 p = curthread->td_proc;
193 FILEDESC_XLOCK(p->p_fd);
195 if (p->p_fd->fd_cdir != NULL)
196 vrele(p->p_fd->fd_cdir);
197 p->p_fd->fd_cdir = rootvnode;
200 if (p->p_fd->fd_rdir != NULL)
201 vrele(p->p_fd->fd_rdir);
202 p->p_fd->fd_rdir = rootvnode;
205 FILEDESC_XUNLOCK(p->p_fd);
209 vfs_mountroot_devfs(struct thread *td, struct mount **mpp)
211 struct vfsoptlist *opts;
212 struct vfsconf *vfsp;
218 vfsp = vfs_byname("devfs");
219 KASSERT(vfsp != NULL, ("Could not find devfs by name"));
223 mp = vfs_mount_alloc(NULLVP, vfsp, "/dev", td->td_ucred);
225 error = VFS_MOUNT(mp);
226 KASSERT(error == 0, ("VFS_MOUNT(devfs) failed %d", error));
230 opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK);
234 mtx_lock(&mountlist_mtx);
235 TAILQ_INSERT_HEAD(&mountlist, mp, mnt_list);
236 mtx_unlock(&mountlist_mtx);
241 error = kern_symlink(td, "/", "dev", UIO_SYSSPACE);
243 printf("kern_symlink /dev -> / returns %d\n", error);
249 vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
252 struct mount *mporoot, *mpnroot;
253 struct vnode *vp, *vporoot, *vpdevfs;
257 mpnroot = TAILQ_NEXT(mpdevfs, mnt_list);
259 /* Shuffle the mountlist. */
260 mtx_lock(&mountlist_mtx);
261 mporoot = TAILQ_FIRST(&mountlist);
262 TAILQ_REMOVE(&mountlist, mpdevfs, mnt_list);
263 if (mporoot != mpdevfs) {
264 TAILQ_REMOVE(&mountlist, mpnroot, mnt_list);
265 TAILQ_INSERT_HEAD(&mountlist, mpnroot, mnt_list);
267 TAILQ_INSERT_TAIL(&mountlist, mpdevfs, mnt_list);
268 mtx_unlock(&mountlist_mtx);
270 cache_purgevfs(mporoot);
271 if (mporoot != mpdevfs)
272 cache_purgevfs(mpdevfs);
274 VFS_ROOT(mporoot, LK_EXCLUSIVE, &vporoot);
277 vporoot->v_iflag &= ~VI_MOUNT;
279 vporoot->v_mountedhere = NULL;
280 mporoot->mnt_flag &= ~MNT_ROOTFS;
281 mporoot->mnt_vnodecovered = NULL;
284 /* Set up the new rootvnode, and purge the cache */
285 mpnroot->mnt_vnodecovered = NULL;
287 cache_purgevfs(rootvnode->v_mount);
289 if (mporoot != mpdevfs) {
290 /* Remount old root under /.mount or /mnt */
292 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
296 NDFREE(&nd, NDF_ONLY_PNBUF);
298 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
304 error = (vp->v_type == VDIR) ? 0 : ENOTDIR;
306 error = vinvalbuf(vp, V_SAVE, 0, 0);
309 mporoot->mnt_vnodecovered = vp;
310 vp->v_mountedhere = mporoot;
311 strlcpy(mporoot->mnt_stat.f_mntonname,
317 NDFREE(&nd, NDF_ONLY_PNBUF);
319 if (error && bootverbose)
320 printf("mountroot: unable to remount previous root "
321 "under /.mount or /mnt (error %d).\n", error);
324 /* Remount devfs under /dev */
325 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev", td);
329 error = (vp->v_type == VDIR) ? 0 : ENOTDIR;
331 error = vinvalbuf(vp, V_SAVE, 0, 0);
333 vpdevfs = mpdevfs->mnt_vnodecovered;
334 if (vpdevfs != NULL) {
335 cache_purge(vpdevfs);
336 vpdevfs->v_mountedhere = NULL;
339 mpdevfs->mnt_vnodecovered = vp;
340 vp->v_mountedhere = mpdevfs;
345 if (error && bootverbose)
346 printf("mountroot: unable to remount devfs under /dev "
347 "(error %d).\n", error);
348 NDFREE(&nd, NDF_ONLY_PNBUF);
350 if (mporoot == mpdevfs) {
352 /* Unlink the no longer needed /dev/dev -> / symlink */
353 error = kern_unlink(td, "/dev/dev", UIO_SYSSPACE);
354 if (error && bootverbose)
355 printf("mountroot: unable to unlink /dev/dev "
356 "(error %d)\n", error);
363 * Configuration parser.
366 /* Parser character classes. */
367 #define CC_WHITESPACE -1
368 #define CC_NONWHITESPACE -2
375 parse_peek(char **conf)
382 parse_poke(char **conf, int c)
389 parse_advance(char **conf)
396 parse_skipto(char **conf, int mc)
401 c = parse_peek(conf);
406 match = (c == ' ' || c == '\t' || c == '\n') ? 1 : 0;
408 case CC_NONWHITESPACE:
411 match = (c != ' ' && c != '\t') ? 1 : 0;
414 match = (c == mc) ? 1 : 0;
425 parse_token(char **conf, char **tok)
432 error = parse_skipto(conf, CC_NONWHITESPACE);
436 error = parse_skipto(conf, CC_WHITESPACE);
438 *tok = malloc(len + 1, M_TEMP, M_WAITOK | M_ZERO);
444 parse_dir_ask_printenv(const char *var)
448 val = kern_getenv(var);
450 printf(" %s=%s\n", var, val);
456 parse_dir_ask(char **conf)
462 printf("\nLoader variables:\n");
463 parse_dir_ask_printenv("vfs.root.mountfrom");
464 parse_dir_ask_printenv("vfs.root.mountfrom.options");
466 printf("\nManual root filesystem specification:\n");
467 printf(" <fstype>:<device> [options]\n");
468 printf(" Mount <device> using filesystem <fstype>\n");
469 printf(" and with the specified (optional) option list.\n");
471 printf(" eg. ufs:/dev/da0s1a\n");
472 printf(" zfs:tank\n");
473 printf(" cd9660:/dev/acd0 ro\n");
474 printf(" (which is equivalent to: ");
475 printf("mount -t cd9660 -o ro /dev/acd0 /)\n");
477 printf(" ? List valid disk boot devices\n");
478 printf(" . Yield 1 second (for background tasks)\n");
479 printf(" <empty line> Abort manual input\n");
483 printf("\nmountroot> ");
484 cngets(name, sizeof(name), GETS_ECHO);
487 if (name[0] == '?' && name[1] == '\0') {
488 printf("\nList of GEOM managed disk devices:\n ");
492 if (name[0] == '.' && name[1] == '\0') {
497 error = parse_mount(&mnt);
499 printf("Invalid file system specification.\n");
500 } while (error != 0);
506 parse_dir_md(char **conf)
510 struct md_ioctl *mdio;
516 error = parse_token(conf, &tok);
521 mdio = malloc(sizeof(*mdio) + len + 1, M_TEMP, M_WAITOK | M_ZERO);
522 path = (void *)(mdio + 1);
523 bcopy(tok, path, len);
526 /* Get file status. */
527 error = kern_stat(td, path, UIO_SYSSPACE, &sb);
531 /* Open /dev/mdctl so that we can attach/detach. */
532 error = kern_open(td, "/dev/" MDCTL_NAME, UIO_SYSSPACE, O_RDWR, 0);
536 fd = td->td_retval[0];
537 mdio->md_version = MDIOVERSION;
538 mdio->md_type = MD_VNODE;
540 if (root_mount_mddev != -1) {
541 mdio->md_unit = root_mount_mddev;
543 error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio);
545 /* Ignore errors. We don't care. */
546 root_mount_mddev = -1;
549 mdio->md_file = (void *)(mdio + 1);
550 mdio->md_options = MD_AUTOUNIT | MD_READONLY;
551 mdio->md_mediasize = sb.st_size;
554 error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio);
559 if (mdio->md_unit > 9) {
560 printf("rootmount: too many md units\n");
561 mdio->md_file = NULL;
562 mdio->md_options = 0;
563 mdio->md_mediasize = 0;
565 error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio);
567 /* Ignore errors. We don't care. */
572 root_mount_mddev = mdio->md_unit;
573 printf(MD_NAME "%u attached to %s\n", root_mount_mddev, mdio->md_file);
575 error = kern_close(td, fd);
583 parse_dir_onfail(char **conf)
588 error = parse_token(conf, &action);
592 if (!strcmp(action, "continue"))
593 root_mount_onfail = A_CONTINUE;
594 else if (!strcmp(action, "panic"))
595 root_mount_onfail = A_PANIC;
596 else if (!strcmp(action, "reboot"))
597 root_mount_onfail = A_REBOOT;
598 else if (!strcmp(action, "retry"))
599 root_mount_onfail = A_RETRY;
601 printf("rootmount: %s: unknown action\n", action);
605 free(action, M_TEMP);
610 parse_dir_timeout(char **conf)
616 error = parse_token(conf, &tok);
620 secs = strtol(tok, &endtok, 0);
621 error = (secs < 0 || *endtok != '\0') ? EINVAL : 0;
623 root_mount_timeout = secs;
629 parse_directive(char **conf)
634 error = parse_token(conf, &dir);
638 if (strcmp(dir, ".ask") == 0)
639 error = parse_dir_ask(conf);
640 else if (strcmp(dir, ".md") == 0)
641 error = parse_dir_md(conf);
642 else if (strcmp(dir, ".onfail") == 0)
643 error = parse_dir_onfail(conf);
644 else if (strcmp(dir, ".timeout") == 0)
645 error = parse_dir_timeout(conf);
647 printf("mountroot: invalid directive `%s'\n", dir);
648 /* Ignore the rest of the line. */
649 (void)parse_skipto(conf, '\n');
657 parse_mount_dev_present(const char *dev)
662 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, dev, curthread);
666 NDFREE(&nd, NDF_ONLY_PNBUF);
667 return (error != 0) ? 0 : 1;
672 parse_mount(char **conf)
676 char *dev, *fs, *opts, *tok;
677 int delay, error, timeout;
679 error = parse_token(conf, &tok);
683 error = parse_skipto(&tok, ':');
688 parse_poke(&tok, '\0');
692 if (root_mount_mddev != -1) {
693 /* Handle substitution for the md unit number. */
694 tok = strstr(dev, "md#");
696 tok[2] = '0' + root_mount_mddev;
700 error = parse_token(conf, &tok);
701 opts = (error == 0) ? tok : NULL;
703 printf("Trying to mount root from %s:%s [%s]...\n", fs, dev,
704 (opts != NULL) ? opts : "");
706 errmsg = malloc(ERRMSGL, M_TEMP, M_WAITOK | M_ZERO);
708 if (vfs_byname(fs) == NULL) {
709 strlcpy(errmsg, "unknown file system", ERRMSGL);
714 if (strcmp(fs, "zfs") != 0 && strstr(fs, "nfs") == NULL &&
715 dev[0] != '\0' && !parse_mount_dev_present(dev)) {
716 printf("mountroot: waiting for device %s ...\n", dev);
718 timeout = root_mount_timeout * hz;
720 pause("rmdev", delay);
722 } while (timeout > 0 && !parse_mount_dev_present(dev));
730 ma = mount_arg(ma, "fstype", fs, -1);
731 ma = mount_arg(ma, "fspath", "/", -1);
732 ma = mount_arg(ma, "from", dev, -1);
733 ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL);
734 ma = mount_arg(ma, "ro", NULL, 0);
735 ma = parse_mountroot_options(ma, opts);
736 error = kernel_mount(ma, MNT_ROOTFS);
740 printf("Mounting from %s:%s failed with error %d",
742 if (errmsg[0] != '\0')
743 printf(": %s", errmsg);
747 free(errmsg, M_TEMP);
750 /* kernel_mount can return -1 on error. */
751 return ((error < 0) ? EDOOFUS : error);
756 vfs_mountroot_parse(struct sbuf *sb, struct mount *mpdevfs)
762 root_mount_mddev = -1;
765 conf = sbuf_data(sb);
766 mp = TAILQ_NEXT(mpdevfs, mnt_list);
767 error = (mp == NULL) ? 0 : EDOOFUS;
768 root_mount_onfail = A_CONTINUE;
770 error = parse_skipto(&conf, CC_NONWHITESPACE);
771 if (error == PE_EOL) {
772 parse_advance(&conf);
777 switch (parse_peek(&conf)) {
779 error = parse_skipto(&conf, '\n');
782 error = parse_directive(&conf);
785 error = parse_mount(&conf);
790 /* Ignore any trailing garbage on the line. */
791 if (parse_peek(&conf) != '\n') {
792 printf("mountroot: advancing to next directive...\n");
793 (void)parse_skipto(&conf, '\n');
795 mp = TAILQ_NEXT(mpdevfs, mnt_list);
801 * We failed to mount (a new) root.
803 switch (root_mount_onfail) {
807 panic("mountroot: unable to (re-)mount root.");
812 kern_reboot(RB_NOSYNC);
820 vfs_mountroot_conf0(struct sbuf *sb)
822 char *s, *tok, *mnt, *opt;
825 sbuf_printf(sb, ".onfail panic\n");
826 sbuf_printf(sb, ".timeout %d\n", root_mount_timeout);
827 if (boothowto & RB_ASKNAME)
828 sbuf_printf(sb, ".ask\n");
830 if (boothowto & RB_DFLTROOT)
831 sbuf_printf(sb, "%s\n", ROOTDEVNAME);
833 if (boothowto & RB_CDROM) {
834 sbuf_printf(sb, "cd9660:/dev/cd0 ro\n");
835 sbuf_printf(sb, ".timeout 0\n");
836 sbuf_printf(sb, "cd9660:/dev/acd0 ro\n");
837 sbuf_printf(sb, ".timeout %d\n", root_mount_timeout);
839 s = kern_getenv("vfs.root.mountfrom");
841 opt = kern_getenv("vfs.root.mountfrom.options");
843 error = parse_token(&tok, &mnt);
845 sbuf_printf(sb, "%s %s\n", mnt,
846 (opt != NULL) ? opt : "");
848 error = parse_token(&tok, &mnt);
854 if (rootdevnames[0] != NULL)
855 sbuf_printf(sb, "%s\n", rootdevnames[0]);
856 if (rootdevnames[1] != NULL)
857 sbuf_printf(sb, "%s\n", rootdevnames[1]);
859 if (!(boothowto & RB_DFLTROOT))
860 sbuf_printf(sb, "%s\n", ROOTDEVNAME);
862 if (!(boothowto & RB_ASKNAME))
863 sbuf_printf(sb, ".ask\n");
867 vfs_mountroot_readconf(struct thread *td, struct sbuf *sb)
869 static char buf[128];
873 int error, flags, len;
875 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/.mount.conf", td);
877 error = vn_open(&nd, &flags, 0, NULL);
881 NDFREE(&nd, NDF_ONLY_PNBUF);
883 len = sizeof(buf) - 1;
885 error = vn_rdwr(UIO_READ, nd.ni_vp, buf, len, ofs,
886 UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred,
892 buf[len - resid] = 0;
893 sbuf_printf(sb, "%s", buf);
897 VOP_UNLOCK(nd.ni_vp, 0);
898 vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
903 vfs_mountroot_wait(void)
905 struct root_hold_token *h;
906 struct timeval lastfail;
914 mtx_lock(&root_holds_mtx);
915 if (LIST_EMPTY(&root_holds)) {
916 mtx_unlock(&root_holds_mtx);
919 if (ppsratecheck(&lastfail, &curfail, 1)) {
920 printf("Root mount waiting for:");
921 LIST_FOREACH(h, &root_holds, list)
922 printf(" %s", h->who);
925 msleep(&root_holds, &root_holds_mtx, PZERO | PDROP, "roothold",
941 vfs_mountroot_wait();
943 sb = sbuf_new_auto();
944 vfs_mountroot_conf0(sb);
947 error = vfs_mountroot_devfs(td, &mp);
949 error = vfs_mountroot_parse(sb, mp);
951 error = vfs_mountroot_shuffle(td, mp);
954 error = vfs_mountroot_readconf(td, sb);
963 * Iterate over all currently mounted file systems and use
964 * the time stamp found to check and/or initialize the RTC.
965 * Call inittodr() only once and pass it the largest of the
966 * timestamps we encounter.
969 mtx_lock(&mountlist_mtx);
970 mp = TAILQ_FIRST(&mountlist);
972 if (mp->mnt_time > timebase)
973 timebase = mp->mnt_time;
974 mp = TAILQ_NEXT(mp, mnt_list);
976 mtx_unlock(&mountlist_mtx);
979 /* Keep prison0's root in sync with the global rootvnode. */
980 mtx_lock(&prison0.pr_mtx);
981 prison0.pr_root = rootvnode;
982 vref(prison0.pr_root);
983 mtx_unlock(&prison0.pr_mtx);
985 mtx_lock(&root_holds_mtx);
986 atomic_store_rel_int(&root_mount_complete, 1);
987 wakeup(&root_mount_complete);
988 mtx_unlock(&root_holds_mtx);
990 EVENTHANDLER_INVOKE(mountroot);
993 static struct mntarg *
994 parse_mountroot_options(struct mntarg *ma, const char *options)
997 char *name, *name_arg;
1001 if (options == NULL || options[0] == '\0')
1004 p = opts = strdup(options, M_MOUNT);
1009 while((name = strsep(&p, ",")) != NULL) {
1010 if (name[0] == '\0')
1013 val = strchr(name, '=');
1018 if( strcmp(name, "rw") == 0 ||
1019 strcmp(name, "noro") == 0) {
1021 * The first time we mount the root file system,
1022 * we need to mount 'ro', so We need to ignore
1023 * 'rw' and 'noro' mount options.
1027 name_arg = strdup(name, M_MOUNT);
1030 val_arg = strdup(val, M_MOUNT);
1032 ma = mount_arg(ma, name_arg, val_arg,
1033 (val_arg != NULL ? -1 : 0));
1035 free(opts, M_MOUNT);