diff options
author | des <des@FreeBSD.org> | 2006-07-12 16:05:51 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2006-07-12 16:05:51 +0000 |
commit | 72b19002fe39572d46b16b35d90b9d58e7b696ec (patch) | |
tree | 9cc82f8d6cdb6dffe60dd823237ba04471feefa3 /sbin/mount/mount.c | |
parent | f82e9588d84ff8322c2063e9e0e1df59b4d8a184 (diff) | |
download | FreeBSD-src-72b19002fe39572d46b16b35d90b9d58e7b696ec.zip FreeBSD-src-72b19002fe39572d46b16b35d90b9d58e7b696ec.tar.gz |
Teach mount(8) about a 'late' keyword, which means the file system should
not be mounted unless the -l flag was specified.
Add an rc script, mountlate, which basically runs 'mount -a -l'. It runs
after DAEMON but before LOGIN.
This is useful for things like loopback mounts, because mountcritremote
runs before mountd / nfsd (since /usr might be a remote file system), so
an attempt to mount a loopback network file system in mountcritremote will
fail.
Also add a progress message to mountcritlocal, for the sake of symmetry
with similar messages in mountcritremote and mountlate.
Reviewed by: freebsd-rc
MFC after: 3 weeks
Diffstat (limited to 'sbin/mount/mount.c')
-rw-r--r-- | sbin/mount/mount.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 3da2d73..3d25b7b 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -191,17 +191,17 @@ main(int argc, char *argv[]) struct statfs *mntbuf; FILE *mountdfp; pid_t pid; - int all, ch, i, init_flags, mntsize, rval, have_fstab; + int all, ch, i, init_flags, late, mntsize, rval, have_fstab; char *cp, *ep, *options; options = strdup("noro"); if (options == NULL) errx(1, "malloc failed"); - all = init_flags = 0; + all = init_flags = late = 0; vfslist = NULL; vfstype = "ufs"; - while ((ch = getopt(argc, argv, "adF:fo:prwt:uv")) != -1) + while ((ch = getopt(argc, argv, "adlF:fo:prwt:uv")) != -1) switch (ch) { case 'a': all = 1; @@ -215,6 +215,9 @@ main(int argc, char *argv[]) case 'f': init_flags |= MNT_FORCE; break; + case 'l': + late = 1; + break; case 'o': options = catopt(options, optarg); break; @@ -265,6 +268,8 @@ main(int argc, char *argv[]) continue; if (hasopt(fs->fs_mntops, "noauto")) continue; + if (hasopt(fs->fs_mntops, "late") && !late) + continue; if (!(init_flags & MNT_UPDATE) && ismounted(fs, mntbuf, mntsize)) continue; @@ -628,6 +633,15 @@ mangle(char *options, int *argcp, char *argv[]) * not a real mount option. */ continue; + } else if (strcmp(p, "late") == 0) { + /* + * "late" is used to prevent certain file + * systems from being mounted before late + * in the boot cycle; for instance, + * loopback NFS mounts can't be mounted + * before mountd starts. + */ + continue; } else if (strcmp(p, "userquota") == 0) { continue; } else if (strncmp(p, userquotaeq, @@ -737,7 +751,7 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n", -"usage: mount [-adfpruvw] [-F fstab] [-o options] [-t ufs | external_type]", +"usage: mount [-adflpruvw] [-F fstab] [-o options] [-t ufs | external_type]", " mount [-dfpruvw] special | node", " mount [-dfpruvw] [-o options] [-t ufs | external_type] special node"); exit(1); |