Index: sbin/mount/mount.8 =================================================================== RCS file: /home/ncvs/src/sbin/mount/mount.8,v retrieving revision 1.68 diff -u -p -r1.68 mount.8 --- sbin/mount/mount.8 17 May 2004 08:35:42 -0000 1.68 +++ sbin/mount/mount.8 20 Jul 2004 13:00:16 -0000 @@ -37,6 +37,7 @@ .Sh SYNOPSIS .Nm .Op Fl adfpruvw +.Op Fl c Ar prefix .Op Fl F Ar fstab .Op Fl o Ar options .Op Fl t Ar ufs | external_type @@ -80,9 +81,18 @@ Exceptions are those marked as .Dq noauto , excluded by the .Fl t +flag (see below), restricted by the +.Fl c flag (see below), or if they are already mounted (except the root file system which is always remounted to preserve traditional single user mode behavior). +.It Fl c +This flag can be used to indicate that the action should only occur +when the mount point matches +.Pa prefix . +Note that this does only make sense with the +.Fl a +flag. .It Fl d Causes everything to be done except for the actual system call. This option is useful in conjunction with the Index: sbin/mount/mount.c =================================================================== RCS file: /home/ncvs/src/sbin/mount/mount.c,v retrieving revision 1.66 diff -u -p -r1.66 mount.c --- sbin/mount/mount.c 26 Apr 2004 15:13:45 -0000 1.66 +++ sbin/mount/mount.c 20 Jul 2004 13:00:16 -0000 @@ -132,17 +132,21 @@ main(argc, argv) FILE *mountdfp; pid_t pid; int all, ch, i, init_flags, mntsize, rval, have_fstab; - char *cp, *ep, *options; + char *cmp, *cp, *ep, *options; all = init_flags = 0; + cmp = NULL; options = NULL; vfslist = NULL; vfstype = "ufs"; - while ((ch = getopt(argc, argv, "adF:fo:prwt:uv")) != -1) + while ((ch = getopt(argc, argv, "ac:dF:fo:prwt:uv")) != -1) switch (ch) { case 'a': all = 1; break; + case 'c': + cmp = optarg; + break; case 'd': debug = 1; break; @@ -186,6 +190,9 @@ main(argc, argv) argc -= optind; argv += optind; + if (all == 0 && cmp != NULL) + warnx("Warning: use of -c without -a"); + #define BADTYPE(type) \ (strcmp(type, FSTAB_RO) && \ strcmp(type, FSTAB_RW) && strcmp(type, FSTAB_RQ)) @@ -200,6 +207,9 @@ main(argc, argv) if (BADTYPE(fs->fs_type)) continue; if (checkvfsname(fs->fs_vfstype, vfslist)) + continue; + if (cmp != NULL && + strncmp(fs->fs_file, cmp, strlen(cmp))) continue; if (hasopt(fs->fs_mntops, "noauto")) continue; Index: sbin/umount/umount.8 =================================================================== RCS file: /home/ncvs/src/sbin/umount/umount.8,v retrieving revision 1.20 diff -u -p -r1.20 umount.8 --- sbin/umount/umount.8 9 Apr 2004 19:58:40 -0000 1.20 +++ sbin/umount/umount.8 20 Jul 2004 13:00:17 -0000 @@ -40,6 +40,7 @@ .Ar special | node | fsid .Nm .Fl a | A +.Op Fl c Ar prefix .Op Fl F Ar fstab .Op Fl fv .Op Fl h Ar host @@ -68,6 +69,15 @@ are unmounted. .It Fl A All the currently mounted file systems except the root are unmounted. +.It Fl c +This flag can be used to indicate that the action should only occur +when the mount point matches +.Pa prefix . +Note that this does only make sens with the +.Fl a +or +.Fl A +flags. .It Fl F Ar fstab Specify the .Pa fstab Index: sbin/umount/umount.c =================================================================== RCS file: /home/ncvs/src/sbin/umount/umount.c,v retrieving revision 1.44 diff -u -p -r1.44 umount.c --- sbin/umount/umount.c 9 Apr 2004 19:58:40 -0000 1.44 +++ sbin/umount/umount.c 20 Jul 2004 13:00:17 -0000 @@ -66,6 +66,7 @@ typedef enum { FIND, REMOVE, CHECKUNIQUE struct addrinfo *nfshost_ai = NULL; int fflag, vflag; char *nfshost; +char *cmp = NULL; struct statfs *checkmntlist(char *); int checkvfsname (const char *, char **); @@ -94,7 +95,7 @@ main(int argc, char *argv[]) sync(); all = errs = 0; - while ((ch = getopt(argc, argv, "AaF:fh:t:v")) != -1) + while ((ch = getopt(argc, argv, "Aac:F:fh:t:v")) != -1) switch (ch) { case 'A': all = 2; @@ -102,6 +103,9 @@ main(int argc, char *argv[]) case 'a': all = 1; break; + case 'c': + cmp = optarg; + break; case 'F': setfstab(optarg); break; @@ -153,6 +157,9 @@ main(int argc, char *argv[]) sfs = &mntbuf[mntsize]; if (checkvfsname(sfs->f_fstypename, typelist)) continue; + if (cmp != NULL && + strncmp(sfs->f_mntonname, cmp, strlen(cmp))) + continue; if (umountfs(sfs) != 0) errs = 1; } @@ -164,6 +171,8 @@ main(int argc, char *argv[]) errs = umountall(typelist); break; case 0: + if (cmp != NULL) + warnx("Warning: use of -c without -a nor -A"); for (errs = 0; *argv != NULL; ++argv) if (checkname(*argv, typelist) != 0) errs = 1; @@ -203,6 +212,8 @@ umountall(char **typelist) if (getvfsbyname(fs->fs_vfstype, &vfc) == -1) continue; if (checkvfsname(fs->fs_vfstype, typelist)) + continue; + if (cmp != NULL && strncmp(fs->fs_file, cmp, strlen(cmp))) continue; /*