summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ff880b2)
SCCS-vsn: sbin/umount/umount.8 8.2
SCCS-vsn: sbin/umount/umount.c 8.8
.\"
.\" %sccs.include.redist.roff%
.\"
.\"
.\" %sccs.include.redist.roff%
.\"
-.\" @(#)umount.8 8.1 (Berkeley) %G%
+.\" @(#)umount.8 8.2 (Berkeley) %G%
.\"
.Dd
.Dt UMOUNT 8
.Os BSD 4
.Sh NAME
.Nm umount
.\"
.Dd
.Dt UMOUNT 8
.Os BSD 4
.Sh NAME
.Nm umount
-.Nd unmount file systems
.Sh SYNOPSIS
.Nm umount
.Op Fl fv
.Ar special | node
.Nm umount
.Sh SYNOPSIS
.Nm umount
.Op Fl fv
.Ar special | node
.Nm umount
.Op Fl fv
.Op Fl h Ar host
.Op Fl fv
.Op Fl h Ar host
-.Op Fl t Ar ufs | lfs | external_type
.Sh DESCRIPTION
The
.Nm umount
.Sh DESCRIPTION
The
.Nm umount
.Xr unmount 2
system call to remove a
.Ar "special device"
.Xr unmount 2
system call to remove a
.Ar "special device"
-or the remote node (rhost:path) from the file system tree at the point
+or the remote node (rhost:path) from the filesystem tree at the point
.Ar node .
If either
.Ar special
.Ar node .
If either
.Ar special
The options are as follows:
.Bl -tag -width indent
.It Fl a
The options are as follows:
.Bl -tag -width indent
.It Fl a
-All of the file systems described in
+All the filesystems described in
.Xr fstab 5
are unmounted.
.Xr fstab 5
are unmounted.
+.It Fl A
+All the currently mounted filesystems except
+the root are unmounted.
-The file system is forcibly unmounted.
+The filesystem is forcibly unmounted.
Active special devices continue to work,
but all other files return errors if further accesses are attempted.
Active special devices continue to work,
but all other files return errors if further accesses are attempted.
-The root file system cannot be forcibly unmounted.
+The root filesystem cannot be forcibly unmounted.
.It Fl h Ar host
Only filesystems mounted from the specified host will be
unmounted.
This option is implies the
.It Fl h Ar host
Only filesystems mounted from the specified host will be
unmounted.
This option is implies the
option and, unless otherwise specified with the
.Fl t
option, will only unmount NFS filesystems.
option and, unless otherwise specified with the
.Fl t
option, will only unmount NFS filesystems.
-.It Fl t Ar "ufs \\*(Ba lfs \\*(Ba external type"
Is used to indicate the actions should only be taken on
filesystems of the specified type.
More than one type may be specified in a comma separated list.
Is used to indicate the actions should only be taken on
filesystems of the specified type.
More than one type may be specified in a comma separated list.
-Verbose, additional information is printed out as each file system
+Verbose, additional information is printed out as each filesystem
is unmounted.
.El
.Sh FILES
.Bl -tag -width /etc/fstab -compact
.It Pa /etc/fstab
is unmounted.
.El
.Sh FILES
.Bl -tag -width /etc/fstab -compact
.It Pa /etc/fstab
.El
.Sh SEE ALSO
.Xr unmount 2 ,
.El
.Sh SEE ALSO
.Xr unmount 2 ,
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)umount.c 8.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)umount.c 8.8 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
int argc;
char *argv[];
{
int argc;
char *argv[];
{
+ int all, ch, errs, mnts;
/* Start disks transferring immediately. */
sync();
all = 0;
/* Start disks transferring immediately. */
sync();
all = 0;
- while ((ch = getopt(argc, argv, "aFfh:t:v")) != EOF)
+ while ((ch = getopt(argc, argv, "AaFfh:t:v")) != EOF)
+ case 'A':
+ all = 2;
+ break;
case 'a':
all = 1;
break;
case 'a':
all = 1;
break;
case 'f':
fflag = MNT_FORCE;
break;
case 'f':
fflag = MNT_FORCE;
break;
- case 'h': /* -h implies -a. */
- all = 1;
+ case 'h': /* -h implies -A. */
+ all = 2;
nfshost = optarg;
break;
case 't':
nfshost = optarg;
break;
case 't':
if ((nfshost != NULL) && (typelist == NULL))
typelist = makevfslist("nfs");
if ((nfshost != NULL) && (typelist == NULL))
typelist = makevfslist("nfs");
+ switch (all) {
+ case 2:
+ if ((mnts = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
+ warn("getmntinfo");
+ errs = 1;
+ break;
+ }
+ for (errs = 0, mnts--; mnts > 0; mnts--) {
+ if (checkvfsname(mntbuf[mnts].f_fstypename, typelist))
+ continue;
+ if (umountfs(mntbuf[mnts].f_mntonname, typelist) != 0)
+ errs = 1;
+ }
+ break;
+ case 1:
if (setfsent() == 0)
err(1, "%s", _PATH_FSTAB);
errs = umountall(typelist);
if (setfsent() == 0)
err(1, "%s", _PATH_FSTAB);
errs = umountall(typelist);
for (errs = 0; *argv != NULL; ++argv)
if (umountfs(*argv, typelist) != 0)
errs = 1;
for (errs = 0; *argv != NULL; ++argv)
if (umountfs(*argv, typelist) != 0)
errs = 1;
mntwhat what;
char **type;
{
mntwhat what;
char **type;
{
- struct statfs *mntbuf;
- int i, mntsize;
+ static struct statfs *mntbuf;
+ static int mntsize;
+ int i;
- if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
+ if (mntbuf == NULL &&
+ (mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
warn("getmntinfo");
return (NULL);
}
warn("getmntinfo");
return (NULL);
}