change `-a'' to be a synonym for
`-A''.
addresses PR 7629.
This commit is contained in:
parent
602ebf1e8d
commit
09218270f0
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: umount.8,v 1.7 1998/04/17 01:19:42 fair Exp $
|
.\" $NetBSD: umount.8,v 1.8 2000/06/06 07:09:14 chs Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1989, 1991, 1993
|
.\" Copyright (c) 1980, 1989, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -69,11 +69,10 @@ file.
|
|||||||
The options are as follows:
|
The options are as follows:
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl a
|
.It Fl a
|
||||||
All the filesystems described in
|
|
||||||
.Xr fstab 5
|
|
||||||
are unmounted.
|
|
||||||
.It Fl A
|
|
||||||
All the currently mounted filesystems except the root are unmounted.
|
All the currently mounted filesystems except the root are unmounted.
|
||||||
|
.It Fl A
|
||||||
|
Synonym for
|
||||||
|
.Fl a .
|
||||||
.It Fl f
|
.It Fl f
|
||||||
The filesystem is forcibly unmounted.
|
The filesystem is forcibly unmounted.
|
||||||
Active special devices continue to work,
|
Active special devices continue to work,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: umount.c,v 1.26 1999/11/09 15:06:34 drochner Exp $ */
|
/* $NetBSD: umount.c,v 1.27 2000/06/06 07:09:15 chs Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1980, 1989, 1993
|
* Copyright (c) 1980, 1989, 1993
|
||||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993\n\
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)umount.c 8.8 (Berkeley) 5/8/95";
|
static char sccsid[] = "@(#)umount.c 8.8 (Berkeley) 5/8/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: umount.c,v 1.26 1999/11/09 15:06:34 drochner Exp $");
|
__RCSID("$NetBSD: umount.c,v 1.27 2000/06/06 07:09:15 chs Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -77,7 +77,6 @@ char **makevfslist __P((char *));
|
|||||||
int main __P((int, char *[]));
|
int main __P((int, char *[]));
|
||||||
int namematch __P((struct hostent *));
|
int namematch __P((struct hostent *));
|
||||||
int selected __P((int));
|
int selected __P((int));
|
||||||
int umountall __P((char **));
|
|
||||||
int umountfs __P((char *, char **));
|
int umountfs __P((char *, char **));
|
||||||
void usage __P((void));
|
void usage __P((void));
|
||||||
int xdr_dir __P((XDR *, char *));
|
int xdr_dir __P((XDR *, char *));
|
||||||
@ -98,8 +97,6 @@ main(argc, argv)
|
|||||||
while ((ch = getopt(argc, argv, "AaFfRh:t:v")) != -1)
|
while ((ch = getopt(argc, argv, "AaFfRh:t:v")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'A':
|
case 'A':
|
||||||
all = 2;
|
|
||||||
break;
|
|
||||||
case 'a':
|
case 'a':
|
||||||
all = 1;
|
all = 1;
|
||||||
break;
|
break;
|
||||||
@ -110,7 +107,7 @@ main(argc, argv)
|
|||||||
fflag = MNT_FORCE;
|
fflag = MNT_FORCE;
|
||||||
break;
|
break;
|
||||||
case 'h': /* -h implies -A. */
|
case 'h': /* -h implies -A. */
|
||||||
all = 2;
|
all = 1;
|
||||||
nfshost = optarg;
|
nfshost = optarg;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -139,12 +136,10 @@ main(argc, argv)
|
|||||||
typelist = makevfslist("nfs");
|
typelist = makevfslist("nfs");
|
||||||
|
|
||||||
errs = 0;
|
errs = 0;
|
||||||
switch (all) {
|
if (all) {
|
||||||
case 2:
|
|
||||||
if ((mnts = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
|
if ((mnts = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
|
||||||
warn("getmntinfo");
|
warn("getmntinfo");
|
||||||
errs = 1;
|
errs = 1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
for (errs = 0, mnts--; mnts > 0; mnts--) {
|
for (errs = 0, mnts--; mnts > 0; mnts--) {
|
||||||
if (checkvfsname(mntbuf[mnts].f_fstypename, typelist))
|
if (checkvfsname(mntbuf[mnts].f_fstypename, typelist))
|
||||||
@ -152,49 +147,14 @@ main(argc, argv)
|
|||||||
if (umountfs(mntbuf[mnts].f_mntonname, typelist) != 0)
|
if (umountfs(mntbuf[mnts].f_mntonname, typelist) != 0)
|
||||||
errs = 1;
|
errs = 1;
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
case 1:
|
|
||||||
if (setfsent() == 0)
|
|
||||||
err(1, "%s", _PATH_FSTAB);
|
|
||||||
errs = umountall(typelist);
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
for (errs = 0; *argv != NULL; ++argv)
|
for (errs = 0; *argv != NULL; ++argv)
|
||||||
if (umountfs(*argv, typelist) != 0)
|
if (umountfs(*argv, typelist) != 0)
|
||||||
errs = 1;
|
errs = 1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
exit(errs);
|
exit(errs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
umountall(typelist)
|
|
||||||
char **typelist;
|
|
||||||
{
|
|
||||||
struct statfs *fs;
|
|
||||||
int n;
|
|
||||||
int rval;
|
|
||||||
|
|
||||||
n = getmntinfo(&fs, MNT_NOWAIT);
|
|
||||||
if (n == 0)
|
|
||||||
err(1, NULL);
|
|
||||||
|
|
||||||
rval = 0;
|
|
||||||
while (--n >= 0) {
|
|
||||||
/* Ignore the root. */
|
|
||||||
if (strncmp(fs[n].f_mntonname, "/", MNAMELEN) == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (checkvfsname(fs[n].f_fstypename, typelist))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (umountfs(fs[n].f_mntonname, typelist))
|
|
||||||
rval = 1;
|
|
||||||
}
|
|
||||||
return (rval);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
umountfs(name, typelist)
|
umountfs(name, typelist)
|
||||||
char *name;
|
char *name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user