diff options
author | dillon <dillon@FreeBSD.org> | 1999-11-22 04:23:11 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 1999-11-22 04:23:11 +0000 |
commit | e8e6885c6b0dee9c5ecf9f433c1eeac5cc116a51 (patch) | |
tree | db8aaaa6673d31f85b8712d63eb284e6fb9ce007 /sbin | |
parent | dadd809c39e5c694c3b2ecf910e3b181cea21530 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sbin/init/init.c | 11 | ||||
-rw-r--r-- | sbin/mount_nfs/Makefile | 9 | ||||
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 66 | ||||
-rw-r--r-- | sbin/umount/Makefile | 9 | ||||
-rw-r--r-- | sbin/umount/umount.c | 20 |
5 files changed, 44 insertions, 71 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c index 75287b5..30453a9 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -646,7 +646,8 @@ single_user() */ typ = getttynam("console"); pp = getpwnam("root"); - if (typ && (typ->ty_status & TTY_SECURE) == 0 && pp && *pp->pw_passwd) { + if (typ && (typ->ty_status & TTY_SECURE) == 0 && + pp && *pp->pw_passwd) { write(2, banner, sizeof banner - 1); for (;;) { clear = getpass("Password:"); @@ -1488,7 +1489,7 @@ runshutdown() int status; int shutdowntimeout; size_t len; - char *argv[3]; + char *argv[4]; struct sigaction sa; struct stat sb; @@ -1527,7 +1528,11 @@ runshutdown() */ argv[0] = "sh"; argv[1] = _PATH_RUNDOWN; - argv[2] = 0; + if (Reboot) + argv[2] = "reboot"; + else + argv[2] = "single"; + argv[3] = 0; sigprocmask(SIG_SETMASK, &sa.sa_mask, (sigset_t *) 0); diff --git a/sbin/mount_nfs/Makefile b/sbin/mount_nfs/Makefile index ebf516b..10b176b 100644 --- a/sbin/mount_nfs/Makefile +++ b/sbin/mount_nfs/Makefile @@ -1,12 +1,15 @@ # @(#)Makefile 8.2 (Berkeley) 3/27/94 +# +# $FreeBSD$ PROG= mount_nfs -SRCS= mount_nfs.c getmntopts.c +SRCS= mount_nfs.c getmntopts.c mounttab.c MAN8= mount_nfs.8 MOUNT= ${.CURDIR}/../mount -CFLAGS+= -DNFS -I${MOUNT} -.PATH: ${MOUNT} +UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall +CFLAGS+= -DNFS -I${MOUNT} -I${UMNTALL} +.PATH: ${MOUNT} ${UMNTALL} .if exists(${DESTDIR}/usr/lib/libkrb.a) && (defined(MAKE_KERBEROS) \ || defined(MAKE_EBONES)) diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index be1ddad..7fbea37 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -57,10 +57,6 @@ static const char rcsid[] = #include <rpc/pmap_clnt.h> #include <rpc/pmap_prot.h> -#ifdef ISO -#include <netiso/iso.h> -#endif - #ifdef NFSKERB #include <kerberosIV/des.h> #include <kerberosIV/krb.h> @@ -84,6 +80,7 @@ static const char rcsid[] = #include <unistd.h> #include "mntopts.h" +#include "mounttab.h" #define ALTF_BG 0x1 #define ALTF_NOCONN 0x2 @@ -121,9 +118,6 @@ struct mntopt mopts[] = { { "rdirplus", 0, ALTF_RDIRPLUS, 1 }, { "mntudp", 0, ALTF_MNTUDP, 1 }, { "resvport", 0, ALTF_RESVPORT, 1 }, -#ifdef ISO - { "seqpacket", 0, ALTF_SEQPACKET, 1 }, -#endif { "nqnfs", 0, ALTF_NQNFS, 1 }, { "soft", 0, ALTF_SOFT, 1 }, { "tcp", 0, ALTF_TCP, 1 }, @@ -199,9 +193,6 @@ NFSKERBKEYSCHED_T kerb_keysched; #endif int getnfsargs __P((char *, struct nfs_args *)); -#ifdef ISO -struct iso_addr *iso_addr __P((const char *)); -#endif void set_rpc_maxgrouplist __P((int)); void usage __P((void)) __dead2; int xdr_dir __P((XDR *, char *)); @@ -369,10 +360,6 @@ main(argc, argv) opflags |= BGRND; if(altflags & ALTF_MNTUDP) mnttcp_ok = 0; -#ifdef ISO - if(altflags & ALTF_SEQPACKET) - nfsargsp->sotype = SOCK_SEQPACKET; -#endif if(altflags & ALTF_TCP) { nfsargsp->sotype = SOCK_STREAM; nfsproto = IPPROTO_TCP; @@ -400,11 +387,6 @@ main(argc, argv) case 'P': /* obsolete for NFSMNT_RESVPORT, now default */ break; -#ifdef ISO - case 'p': - nfsargsp->sotype = SOCK_SEQPACKET; - break; -#endif case 'q': mountmode = V3; nfsargsp->flags |= NFSMNT_NQNFS; @@ -649,11 +631,6 @@ getnfsargs(spec, nfsargsp) register CLIENT *clp; struct hostent *hp; static struct sockaddr_in saddr; -#ifdef ISO - static struct sockaddr_iso isoaddr; - struct iso_addr *isop; - int isoflag = 0; -#endif struct timeval pertry, try; enum clnt_stat clnt_stat; int so = RPC_ANYSOCK, i, nfsvers, mntvers, orgcnt, speclen; @@ -702,35 +679,6 @@ getnfsargs(spec, nfsargsp) memmove(nam + len + 1, spec, speclen); nam[len + speclen + 1] = '\0'; } - /* - * DUMB!! Until the mount protocol works on iso transport, we must - * supply both an iso and an inet address for the host. - */ -#ifdef ISO - if (!strncmp(hostp, "iso=", 4)) { - u_short isoport; - - hostp += 4; - isoflag++; - if ((delimp = strchr(hostp, '+')) == NULL) { - warnx("no iso+inet address"); - return (0); - } - *delimp = '\0'; - if ((isop = iso_addr(hostp)) == NULL) { - warnx("bad ISO address"); - return (0); - } - memset(&isoaddr, 0, sizeof (isoaddr)); - memmove(&isoaddr.siso_addr, isop, sizeof (struct iso_addr)); - isoaddr.siso_len = sizeof (isoaddr); - isoaddr.siso_family = AF_ISO; - isoaddr.siso_tlen = 2; - isoport = htons(NFS_PORT); - memmove(TSEL(&isoaddr), &isoport, isoaddr.siso_tlen); - hostp = delimp + 1; - } -#endif /* ISO */ /* * Handle an internet host address and reverse resolve it if @@ -844,7 +792,8 @@ tryagain: } if (--retrycnt > 0) { if (opflags & BGRND) { - warnx("Cannot immediately mount %s:%s, backgrounding", hostp, spec); + warnx("Cannot immediately mount %s:%s, " + "backgrounding", hostp, spec); opflags &= ~BGRND; if ((i = fork())) { if (i == -1) @@ -868,12 +817,6 @@ tryagain: return (0); } saddr.sin_port = htons(tport); -#ifdef ISO - if (isoflag) { - nfsargsp->addr = (struct sockaddr *) &isoaddr; - nfsargsp->addrlen = sizeof (isoaddr); - } else -#endif /* ISO */ { nfsargsp->addr = (struct sockaddr *) &saddr; nfsargsp->addrlen = sizeof (saddr); @@ -881,6 +824,9 @@ tryagain: nfsargsp->fh = nfhret.nfh; nfsargsp->fhsize = nfhret.fhsize; nfsargsp->hostname = nam; + /* Add mounted filesystem to PATH_MOUNTTAB */ + if (!add_mtab(hostp, spec)) + warnx("can't update %s for %s:%s", PATH_MOUNTTAB, hostp, spec); return (1); } 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); |