155338Spendry /*
255338Spendry  * Copyright (c) 1990, 1992 Jan-Simon Pendry
3*66470Sbostic  * Copyright (c) 1992, 1993, 1994
461507Sbostic  *	The Regents of the University of California.  All rights reserved.
555338Spendry  *
655338Spendry  * This code is derived from software contributed to Berkeley by
755338Spendry  * Jan-Simon Pendry.
855338Spendry  *
9*66470Sbostic  * %sccs.include.redist.c%
1055338Spendry  */
1155338Spendry 
12*66470Sbostic #ifndef lint
13*66470Sbostic char copyright[] =
14*66470Sbostic "@(#) Copyright (c) 1992, 1993, 1994\n\
15*66470Sbostic 	The Regents of the University of California.  All rights reserved.\n";
16*66470Sbostic #endif /* not lint */
17*66470Sbostic 
18*66470Sbostic #ifndef lint
19*66470Sbostic static char sccsid[] = "@(#)mount_kernfs.c	8.2 (Berkeley) 03/27/94";
20*66470Sbostic #endif /* not lint */
21*66470Sbostic 
2255338Spendry #include <sys/param.h>
2355338Spendry #include <sys/mount.h>
2455338Spendry 
25*66470Sbostic #include <err.h>
2655338Spendry #include <unistd.h>
2755338Spendry #include <stdio.h>
2855338Spendry #include <stdlib.h>
2955338Spendry #include <string.h>
3055338Spendry 
31*66470Sbostic #include "mntopts.h"
3255338Spendry 
33*66470Sbostic struct mntopt mopts[] = {
34*66470Sbostic 	MOPT_STDOPTS,
35*66470Sbostic 	{ NULL }
36*66470Sbostic };
37*66470Sbostic 
38*66470Sbostic void	usage __P((void));
39*66470Sbostic 
4055338Spendry int
4155338Spendry main(argc, argv)
4255338Spendry 	int argc;
4355338Spendry 	char *argv[];
4455338Spendry {
4555338Spendry 	int ch, mntflags;
4655338Spendry 
4755338Spendry 	mntflags = 0;
48*66470Sbostic 	while ((ch = getopt(argc, argv, "o:")) != EOF)
49*66470Sbostic 		switch (ch) {
50*66470Sbostic 		case 'o':
51*66470Sbostic 			getmntopts(optarg, mopts, &mntflags);
5255338Spendry 			break;
5355338Spendry 		case '?':
5455338Spendry 		default:
5555338Spendry 			usage();
5655338Spendry 		}
5755338Spendry 	argc -= optind;
5855338Spendry 	argv += optind;
5955338Spendry 
6055338Spendry 	if (argc != 2)
6155338Spendry 		usage();
6255338Spendry 
63*66470Sbostic 	if (mount(MOUNT_KERNFS, argv[1], mntflags, NULL))
64*66470Sbostic 		err(1, NULL);
6555338Spendry 	exit(0);
6655338Spendry }
6755338Spendry 
6855338Spendry void
6955338Spendry usage()
7055338Spendry {
7155338Spendry 	(void)fprintf(stderr,
72*66470Sbostic 		"usage: mount_kernfs [-o options] /kern mount_point\n");
7355338Spendry 	exit(1);
7455338Spendry }
75