date and time created 92/07/18 15:46:34 by pendry
authorJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Sun, 19 Jul 1992 06:46:34 +0000 (22:46 -0800)
committerJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Sun, 19 Jul 1992 06:46:34 +0000 (22:46 -0800)
SCCS-vsn: sbin/mount_kernfs/Makefile 5.1
SCCS-vsn: sbin/mount_kernfs/mount_kernfs.c 5.1

usr/src/sbin/mount_kernfs/Makefile [new file with mode: 0644]
usr/src/sbin/mount_kernfs/mount_kernfs.c [new file with mode: 0644]

diff --git a/usr/src/sbin/mount_kernfs/Makefile b/usr/src/sbin/mount_kernfs/Makefile
new file mode 100644 (file)
index 0000000..8c97ff6
--- /dev/null
@@ -0,0 +1,6 @@
+#      @(#)Makefile    5.1 (Berkeley) %G%
+
+PROG=  mount_kernfs
+MAN8=  mount_kernfs.0
+
+.include <bsd.prog.mk>
diff --git a/usr/src/sbin/mount_kernfs/mount_kernfs.c b/usr/src/sbin/mount_kernfs/mount_kernfs.c
new file mode 100644 (file)
index 0000000..c4ca189
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1990, 1992 Jan-Simon Pendry
+ * Copyright (c) 1992 The Regents of the University of California
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry.
+ *
+ * %sccs.redist.c.%
+ *
+ *     @(#)mount_kernfs.c      5.1 (Berkeley) %G%
+ */
+
+#include <sys/param.h>
+#include <sys/mount.h>
+
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void usage __P((void));
+
+int
+main(argc, argv)
+       int argc;
+       char *argv[];
+{
+       int ch, mntflags;
+
+       mntflags = 0;
+       while ((ch = getopt(argc, argv, "F:")) != EOF)
+               switch(ch) {
+               case 'F':
+                       mntflags = atoi(optarg);
+                       break;
+               case '?':
+               default:
+                       usage();
+               }
+       argc -= optind;
+       argv += optind;
+
+       if (argc != 2)
+               usage();
+
+       if (mount(MOUNT_KERNFS, argv[1], mntflags, NULL)) {
+               (void)fprintf(stderr, "mount_kernfs: %s\n", strerror(errno));
+               exit(1);
+       }
+       exit(0);
+}
+
+void
+usage()
+{
+       (void)fprintf(stderr,
+           "usage: mount_kernfs [ -F fsoptions ] /kern mount_point\n");
+       exit(1);
+}