Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/puffs Add rump_au-naturel, which instead of mountin...



details:   https://anonhg.NetBSD.org/src/rev/386ef49dadbc
branches:  trunk
changeset: 754408:386ef49dadbc
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Apr 29 22:42:48 2010 +0000

description:
Add rump_au-naturel, which instead of mounting a file system inside
the rump kernel just attaches to / in said rump kernel instance.
This is mostly useful in case wanting to see what nodes components
create (see Makefile).

not built without manual intervention

diffstat:

 usr.sbin/puffs/Makefile                          |   6 +-
 usr.sbin/puffs/rump_au-naturel/Makefile          |  14 +++++
 usr.sbin/puffs/rump_au-naturel/rump_au-naturel.c |  66 ++++++++++++++++++++++++
 3 files changed, 85 insertions(+), 1 deletions(-)

diffs (106 lines):

diff -r 85c1f7e950df -r 386ef49dadbc usr.sbin/puffs/Makefile
--- a/usr.sbin/puffs/Makefile   Thu Apr 29 22:42:27 2010 +0000
+++ b/usr.sbin/puffs/Makefile   Thu Apr 29 22:42:48 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.13 2010/03/31 14:22:27 pooka Exp $
+#      $NetBSD: Makefile,v 1.14 2010/04/29 22:42:48 pooka Exp $
 
 SUBDIR=        mount_9p mount_psshfs mount_sysctlfs
 
@@ -20,4 +20,8 @@
 # rump_mqmfs is just another ffs, useful mainly for debugging
 #SUBDIR+=rump_nqmfs
 
+# rump_au-naturel presents lets you access '/' for a rump kernel.
+# mostly for debugging.
+#SUBDIR+=rump_au-naturel
+
 .include <bsd.subdir.mk>
diff -r 85c1f7e950df -r 386ef49dadbc usr.sbin/puffs/rump_au-naturel/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/puffs/rump_au-naturel/Makefile   Thu Apr 29 22:42:48 2010 +0000
@@ -0,0 +1,14 @@
+#      $NetBSD: Makefile,v 1.1 2010/04/29 22:42:48 pooka Exp $
+#
+
+PROG=          rump_au-naturel
+NOMAN=
+
+ISRUMP=                # persuadertron
+
+# Link in components to see which devices they create.  The
+# following is an example.  You should see /dev/bpf.
+#
+#LDADD+=       -lrumpdev_bpf -lrumpdev -lrumpnet_net -lrumpnet
+
+.include <bsd.prog.mk>
diff -r 85c1f7e950df -r 386ef49dadbc usr.sbin/puffs/rump_au-naturel/rump_au-naturel.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/puffs/rump_au-naturel/rump_au-naturel.c  Thu Apr 29 22:42:48 2010 +0000
@@ -0,0 +1,66 @@
+/*     $NetBSD: rump_au-naturel.c,v 1.1 2010/04/29 22:42:48 pooka Exp $        */
+
+/*
+ * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/mount.h>
+
+#include <err.h>
+#include <puffs.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <rump/p2k.h>
+
+/* NetBSD-5 compat */
+#ifndef MOUNT_RUMPFS
+#define MOUNT_RUMPFS    "rumpfs"
+#endif
+
+static void
+usage(void)
+{
+
+       fprintf(stderr, "usage: %s rump /mountpoint\n", getprogname());
+       exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+       int rv;
+
+       setprogname(argv[0]);
+       if (argc != 3)
+               usage();
+               
+       rv = p2k_run_fs(MOUNT_RUMPFS, argv[1], argv[2], 0, NULL, 0, 0);
+       if (rv == -1)
+               err(1, "p2k_run_fs");
+
+       return 0;
+}



Home | Main Index | Thread Index | Old Index