summaryrefslogtreecommitdiffstats
path: root/sbin/umount
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>1999-11-22 04:23:11 +0000
committerdillon <dillon@FreeBSD.org>1999-11-22 04:23:11 +0000
commite8e6885c6b0dee9c5ecf9f433c1eeac5cc116a51 (patch)
treedb8aaaa6673d31f85b8712d63eb284e6fb9ce007 /sbin/umount
parentdadd809c39e5c694c3b2ecf910e3b181cea21530 (diff)
downloadFreeBSD-src-e8e6885c6b0dee9c5ecf9f433c1eeac5cc116a51.zip
FreeBSD-src-e8e6885c6b0dee9c5ecf9f433c1eeac5cc116a51.tar.gz
Finish up umntall support. init now passed an argument to the
rundown script 'reboot' or 'single'. ISO support (which never worked) has been removed from mount_nfs. mount_nfs and umount now use mounttab, which allows umntall to work properly. The rc scripts now call umntall as appropriate. Submitted by: Martin Blapp <mb@imp.ch>
Diffstat (limited to 'sbin/umount')
-rw-r--r--sbin/umount/Makefile9
-rw-r--r--sbin/umount/umount.c20
2 files changed, 24 insertions, 5 deletions
diff --git a/sbin/umount/Makefile b/sbin/umount/Makefile
index e2ea521..0ffd0f7 100644
--- a/sbin/umount/Makefile
+++ b/sbin/umount/Makefile
@@ -1,11 +1,14 @@
# @(#)Makefile 8.4 (Berkeley) 6/22/95
+#
+# $FreeBSD$
PROG= umount
-SRCS= umount.c vfslist.c
+SRCS= umount.c vfslist.c mounttab.c
MAN8= umount.8
MOUNT= ${.CURDIR}/../mount
-CFLAGS+= -I${MOUNT}
-.PATH: ${MOUNT}
+UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall
+CFLAGS+= -I${MOUNT} -I${UMNTALL}
+.PATH: ${MOUNT} ${UMNTALL}
.include <bsd.prog.mk>
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index 5183513..93b50c0 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -59,12 +59,15 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
+#include "mounttab.h"
+
#define ISDOT(x) ((x)[0] == '.' && (x)[1] == '\0')
#define ISDOTDOT(x) ((x)[0] == '.' && (x)[1] == '.' && (x)[2] == '\0')
typedef enum { MNTON, MNTFROM, NOTHING } mntwhat;
typedef enum { MARK, UNMARK, NAME, COUNT, FREE } dowhat;
+struct mtablist *mtabhead;
int fflag, vflag;
char *nfshost;
@@ -76,7 +79,6 @@ char *getrealname(char *, char *resolved_path);
char **makevfslist (const char *);
size_t mntinfo (struct statfs **);
int namematch (struct hostent *);
-int selected (int);
int umountall (char **);
int umountfs (char *, char **);
void usage (void);
@@ -240,6 +242,7 @@ umountfs(char *name, char **typelist)
{
enum clnt_stat clnt_stat;
struct hostent *hp;
+ struct mtablist *mtab;
struct sockaddr_in saddr;
struct timeval pertry, try;
CLIENT *clp;
@@ -252,6 +255,7 @@ umountfs(char *name, char **typelist)
char *type, *delimp, *hostp, *origname;
len = 0;
+ mtab = NULL;
mntfromname = mntonname = delimp = hostp = orignfsdirname = NULL;
/*
@@ -428,6 +432,17 @@ umountfs(char *name, char **typelist)
clnt_perror(clp, "Bad MNT RPC");
return (1);
}
+ /*
+ * Remove the unmounted entry from /var/db/mounttab.
+ */
+ if (read_mtab(mtab)) {
+ mtab = mtabhead;
+ clean_mtab(hostp, nfsdirname);
+ if(!write_mtab())
+ warnx("cannot remove entry %s:%s",
+ hostp, nfsdirname);
+ free_mtab();
+ }
free(orignfsdirname);
auth_destroy(clp->cl_auth);
clnt_destroy(clp);
@@ -533,6 +548,7 @@ getmntname(const char *fromname, const char *onname,
case FREE:
free(mntbuf);
free(mntcheck);
+ free(mntcount);
return (NULL);
default:
return (NULL);
@@ -587,7 +603,7 @@ mntinfo(struct statfs **mntbuf)
size_t bufsize;
int mntsize;
- mntsize = getfsstat(NULL, 0l, MNT_NOWAIT);
+ mntsize = getfsstat(NULL, 0, MNT_NOWAIT);
if (mntsize <= 0)
return (0);
bufsize = (mntsize + 1) * sizeof(struct statfs);
OpenPOWER on IntegriCloud