diff options
author | wollman <wollman@FreeBSD.org> | 1996-05-13 17:43:19 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1996-05-13 17:43:19 +0000 |
commit | 5eea098aaa4a43538ceabc7a7ffaeb0986cea33c (patch) | |
tree | 45a3a22a6378c4db6229097d19a3e57ef24f2e5c /sbin/mount_ext2fs | |
parent | e1cb6ef79c8ab94af413aabdbf5b2b7c1ffca3a9 (diff) | |
download | FreeBSD-src-5eea098aaa4a43538ceabc7a7ffaeb0986cea33c.zip FreeBSD-src-5eea098aaa4a43538ceabc7a7ffaeb0986cea33c.tar.gz |
Get rid of the last vestiges of the old MOUNT_* constants in the
mount_* programs. While we're at it, collapse the four now-identical
mount programs for devfs, fdesc, kernfs, and procfs into links to
a new mount_std(8) which can mount any really generic filesystem
such as these when called with the appropriate argv[0].
Also, convert the mount programs to use sysexits.h.
Diffstat (limited to 'sbin/mount_ext2fs')
-rw-r--r-- | sbin/mount_ext2fs/mount_ext2fs.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/sbin/mount_ext2fs/mount_ext2fs.c b/sbin/mount_ext2fs/mount_ext2fs.c index 102b515..96143a8 100644 --- a/sbin/mount_ext2fs/mount_ext2fs.c +++ b/sbin/mount_ext2fs/mount_ext2fs.c @@ -38,7 +38,11 @@ static char copyright[] = #endif /* not lint */ #ifndef lint +/* static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94"; +*/ +static const char rcsid[] = + "$Id"; #endif /* not lint */ #include <sys/param.h> @@ -48,6 +52,7 @@ static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94"; #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sysexits.h> #include <unistd.h> #include "mntopts.h" @@ -58,9 +63,7 @@ struct mntopt mopts[] = { { NULL } }; -void usage __P((void)); - -int short_rds, cleaner_debug; +static __dead void usage __P((void)) __dead2; int main(argc, argv) @@ -68,25 +71,17 @@ main(argc, argv) char *argv[]; { struct ufs_args args; - int ch, mntflags, noclean; + int ch, mntflags; char *fs_name, *options; + struct vfsconf *vfc; options = NULL; - mntflags = noclean = 0; - while ((ch = getopt(argc, argv, "dno:s")) != EOF) + mntflags = 0; + while ((ch = getopt(argc, argv, "o:")) != EOF) switch (ch) { - case 'd': - cleaner_debug = 1; - break; - case 'n': - noclean = 1; - break; case 'o': getmntopts(optarg, mopts, &mntflags); break; - case 's': - short_rds = 1; - break; case '?': default: usage(); @@ -106,11 +101,20 @@ main(argc, argv) args.export.ex_flags = MNT_EXRDONLY; else args.export.ex_flags = 0; - if (mount(MOUNT_EXT2FS, fs_name, mntflags, &args)) - err(1, NULL); - - /* NOTREACHED */ + vfc = getvfsbyname("ext2fs"); + if(!vfc && vfsisloadable("ext2fs")) { + if(vfsload("ext2fs")) { + err(EX_OSERR, "vfsload(ext2fs)"); + } + endvfsent(); /* flush cache */ + vfc = getvfsbyname("ext2fs"); + } + if (!vfc) + errx(EX_OSERR, "ext2fs filesystem not available"); + + if (mount(vfc->vfc_index, fs_name, mntflags, &args) < 0) + err(EX_OSERR, "%s", args.fspec); exit(0); } @@ -119,5 +123,5 @@ usage() { (void)fprintf(stderr, "usage: mount_ext2fs [-o options] special node\n"); - exit(1); + exit(EX_USAGE); } |