Index: Makefile =================================================================== RCS file: /home/ncvs/src/sbin/mount/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- Makefile 1999/08/28 00:13:24 1.9 +++ Makefile 2000/10/14 02:25:59 @@ -1,9 +1,9 @@ # @(#)Makefile 8.6 (Berkeley) 5/8/95 # $FreeBSD: src/sbin/mount/Makefile,v 1.9 1999/08/28 00:13:24 peter Exp $ -PROG= mount +PROG= mount_ifs SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c -MAN8= mount.8 +NOMAN= true # We do NOT install the getmntopts.3 man page. .include Index: mount.c =================================================================== RCS file: /home/ncvs/src/sbin/mount/mount.c,v retrieving revision 1.40 diff -u -r1.40 mount.c --- mount.c 2000/08/23 09:59:25 1.40 +++ mount.c 2000/10/11 11:42:39 @@ -134,179 +134,8 @@ int all, ch, i, init_flags, mntsize, rval, have_fstab; char *options; - all = init_flags = 0; - options = NULL; - vfslist = NULL; - vfstype = "ufs"; - while ((ch = getopt(argc, argv, "adfo:prwt:uv")) != -1) - switch (ch) { - case 'a': - all = 1; - break; - case 'd': - debug = 1; - break; - case 'f': - init_flags |= MNT_FORCE; - break; - case 'o': - if (*optarg) - options = catopt(options, optarg); - break; - case 'p': - fstab_style = 1; - verbose = 1; - break; - case 'r': - init_flags |= MNT_RDONLY; - break; - case 't': - if (vfslist != NULL) - errx(1, "only one -t option may be specified"); - vfslist = makevfslist(optarg); - vfstype = optarg; - break; - case 'u': - init_flags |= MNT_UPDATE; - break; - case 'v': - verbose = 1; - break; - case 'w': - init_flags &= ~MNT_RDONLY; - break; - case '?': - default: - usage(); - /* NOTREACHED */ - } - argc -= optind; - argv += optind; - -#define BADTYPE(type) \ - (strcmp(type, FSTAB_RO) && \ - strcmp(type, FSTAB_RW) && strcmp(type, FSTAB_RQ)) - - rval = 0; - switch (argc) { - case 0: - if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) - err(1, "getmntinfo"); - if (all) { - while ((fs = getfsent()) != NULL) { - if (BADTYPE(fs->fs_type)) - continue; - if (checkvfsname(fs->fs_vfstype, vfslist)) - continue; - if (hasopt(fs->fs_mntops, "noauto")) - continue; - if (!(init_flags & MNT_UPDATE) && - ismounted(fs, mntbuf, mntsize)) - continue; - if (mountfs(fs->fs_vfstype, fs->fs_spec, - fs->fs_file, init_flags, options, - fs->fs_mntops)) - rval = 1; - } - } else if (fstab_style) { - for (i = 0; i < mntsize; i++) { - if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) - continue; - putfsent(&mntbuf[i]); - } - } else { - for (i = 0; i < mntsize; i++) { - if (checkvfsname(mntbuf[i].f_fstypename, - vfslist)) - continue; - prmount(&mntbuf[i]); - } - } - exit(rval); - case 1: - if (vfslist != NULL) - usage(); - - if (init_flags & MNT_UPDATE) { - mntfromname = NULL; - have_fstab = 0; - if ((mntbuf = getmntpt(*argv)) == NULL) - errx(1, "not currently mounted %s", *argv); - /* - * Only get the mntflags from fstab if both mntpoint - * and mntspec are identical. Also handle the special - * case where just '/' is mounted and 'spec' is not - * identical with the one from fstab ('/dev' is missing - * in the spec-string at boot-time). - */ - if ((fs = getfsfile(mntbuf->f_mntonname)) != NULL) { - if (strcmp(fs->fs_spec, - mntbuf->f_mntfromname) == 0 && - strcmp(fs->fs_file, - mntbuf->f_mntonname) == 0) { - have_fstab = 1; - mntfromname = mntbuf->f_mntfromname; - } else if (argv[0][0] == '/' && - argv[0][1] == '\0') { - fs = getfsfile("/"); - have_fstab = 1; - mntfromname = fs->fs_spec; - } - } - if (have_fstab) { - options = update_options(options, fs->fs_mntops, - mntbuf->f_flags); - } else { - mntfromname = mntbuf->f_mntfromname; - options = update_options(options, NULL, - mntbuf->f_flags); - } - rval = mountfs(mntbuf->f_fstypename, mntfromname, - mntbuf->f_mntonname, init_flags, options, 0); - break; - } - rmslashes(*argv, *argv); - if ((fs = getfsfile(*argv)) == NULL && - (fs = getfsspec(*argv)) == NULL) - errx(1, "%s: unknown special file or file system", - *argv); - if (BADTYPE(fs->fs_type)) - errx(1, "%s has unknown file system type", - *argv); - rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, - init_flags, options, fs->fs_mntops); - break; - case 2: - /* - * If -t flag has not been specified, the path cannot be - * found, spec contains either a ':' or a '@', and the - * spec is not a file with those characters, then assume - * that an NFS filesystem is being specified ala Sun. - */ - if (vfslist == NULL && strpbrk(argv[0], ":@") != NULL && - access(argv[0], 0) == -1) - vfstype = "nfs"; - rval = mountfs(vfstype, - argv[0], argv[1], init_flags, options, NULL); - break; - default: - usage(); - /* NOTREACHED */ - } - - /* - * If the mount was successfully, and done by root, tell mountd the - * good news. Pid checks are probably unnecessary, but don't hurt. - */ - if (rval == 0 && getuid() == 0 && - (mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) { - if (fscanf(mountdfp, "%d", &pid) == 1 && - pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH) - err(1, "signal mountd"); - (void)fclose(mountdfp); - } - - exit(rval); + mount_ifs(argc, argv); + /* NOTREACHED */ } int @@ -440,8 +269,8 @@ free(optbuf); return (1); case 0: /* Child. */ - if (strcmp(vfstype, "ufs") == 0) - exit(mount_ufs(argc, (char * const *) argv)); + if (strcmp(vfstype, "ifs") == 0) + exit(mount_ifs(argc, (char * const *) argv)); /* Go find an executable. */ for (edir = edirs; *edir; edir++) { Index: mount_ufs.c =================================================================== RCS file: /home/ncvs/src/sbin/mount/mount_ufs.c,v retrieving revision 1.18 diff -u -r1.18 mount_ufs.c --- mount_ufs.c 2000/08/16 07:36:30 1.18 +++ mount_ufs.c 2000/10/11 11:42:39 @@ -58,7 +58,7 @@ #include "extern.h" #include "mntopts.h" -static void ufs_usage __P((void)); +static void ifs_usage __P((void)); static struct mntopt mopts[] = { MOPT_STDOPTS, @@ -71,7 +71,7 @@ }; int -mount_ufs(argc, argv) +mount_ifs(argc, argv) int argc; char * const argv[]; { @@ -90,13 +90,13 @@ break; case '?': default: - ufs_usage(); + ifs_usage(); } argc -= optind; argv += optind; if (argc != 2) - ufs_usage(); + ifs_usage(); args.fspec = argv[0]; /* The name of the device file. */ fs_name = argv[1]; /* The mount point. */ @@ -108,17 +108,17 @@ else args.export.ex_flags = 0; - error = getvfsbyname("ufs", &vfc); - if (error && vfsisloadable("ufs")) { - if (vfsload("ufs")) { - warn("vfsload(ufs)"); + error = getvfsbyname("ifs", &vfc); + if (error && vfsisloadable("ifs")) { + if (vfsload("ifs")) { + warn("vfsload(ifs)"); return (1); } endvfsent(); /* flush old table */ - error = getvfsbyname("ufs", &vfc); + error = getvfsbyname("ifs", &vfc); } if (error) { - warnx("ufs filesystem is not available"); + warnx("ifs filesystem is not available"); return (1); } @@ -147,8 +147,8 @@ } static void -ufs_usage() +ifs_usage() { - (void)fprintf(stderr, "usage: mount_ufs [-o options] special node\n"); + (void)fprintf(stderr, "usage: mount_ifs [-o options] special node\n"); exit(1); }