Module Name: src
Committed By: bad
Date: Mon May 13 17:49:05 UTC 2019
Modified Files:
src/sys/rump/librump/rumpdev: Makefile.rumpdev
src/sys/rump/librump/rumpkern: Makefile.rumpkern
Added Files:
src/sys/rump/librump/rumpkern: MAINBUS.ioconf rump_autoconf.c
Removed Files:
src/sys/rump/librump/rumpdev: MAINBUS.ioconf autoconf.c
Log Message:
On the one thousand and ninth day rump's mainbus was moved from
rumpdev to rumpkern, liberating all rumpnet users from the need to
-lrumpdev -lrumpvfs just because a loopback interface is mandatory.
Rename rumpdev/autoconf.c to rumpkern/rump_autoconf.c to avoid
accidentally picking up e.g. sys/arch/amd64/amd64/autoconf.c through
make's .PATH.
Move rumpdev/MAINBUS.ioconf to rumpkern.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/sys/rump/librump/rumpdev/MAINBUS.ioconf
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/librump/rumpdev/Makefile.rumpdev
cvs rdiff -u -r1.9 -r0 src/sys/rump/librump/rumpdev/autoconf.c
cvs rdiff -u -r0 -r1.1 src/sys/rump/librump/rumpkern/MAINBUS.ioconf \
src/sys/rump/librump/rumpkern/rump_autoconf.c
cvs rdiff -u -r1.174 -r1.175 src/sys/rump/librump/rumpkern/Makefile.rumpkern
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/librump/rumpdev/Makefile.rumpdev
diff -u src/sys/rump/librump/rumpdev/Makefile.rumpdev:1.12 src/sys/rump/librump/rumpdev/Makefile.rumpdev:1.13
--- src/sys/rump/librump/rumpdev/Makefile.rumpdev:1.12 Mon Oct 19 16:16:38 2015
+++ src/sys/rump/librump/rumpdev/Makefile.rumpdev Mon May 13 17:49:05 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.rumpdev,v 1.12 2015/10/19 16:16:38 pooka Exp $
+# $NetBSD: Makefile.rumpdev,v 1.13 2019/05/13 17:49:05 bad Exp $
#
LIB= rumpdev
@@ -8,13 +8,10 @@ COMMENT=Rump kernel device faction
${RUMPTOP}/../kern \
${RUMPTOP}/../dev
-IOCONFDIR:= ${.PARSEDIR}
-IOCONF= MAINBUS.ioconf
-
-SRCS= rump_dev.c autoconf.c
+SRCS= rump_dev.c
# sys/kern
-SRCS+= kern_pmf.c subr_autoconf.c
+SRCS+= kern_pmf.c
# sys/dev
SRCS+= dev_verbose.c
Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.174 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.175
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.174 Sun Jan 27 02:08:49 2019
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern Mon May 13 17:49:05 2019
@@ -1,9 +1,8 @@
-# $NetBSD: Makefile.rumpkern,v 1.174 2019/01/27 02:08:49 pgoyette Exp $
+# $NetBSD: Makefile.rumpkern,v 1.175 2019/05/13 17:49:05 bad Exp $
#
-.include "${RUMPTOP}/Makefile.rump"
-
-.include <bsd.own.mk>
+IOCONFDIR:= ${.PARSEDIR}
+IOCONF= MAINBUS.ioconf
LIB= rump
COMMENT= Rump kernel base
@@ -31,7 +30,7 @@ SRCS+= rump.c rumpcopy.c cons.c emul.c e
signals.c sleepq.c threads.c vm.c hyperentropy.c \
accessors.c
-SRCS+= rumpkern_syscalls.c
+SRCS+= rump_autoconf.c rumpkern_syscalls.c
# autogenerated into the correct namespace
RUMPOBJ_NORENAME= rump_syscalls.o rump_syscalls.pico rump_syscalls.po
@@ -99,6 +98,7 @@ SRCS+= init_sysctl_base.c \
kern_timeout.c \
kern_uidinfo.c \
param.c \
+ subr_autoconf.c \
subr_callback.c \
subr_copy.c \
subr_cprng.c \
@@ -160,6 +160,9 @@ SRCS+= rijndael-api-fst.c
SRCS+= rijndael.c
SRCS+= cprng_fast.c
+.include "${RUMPTOP}/Makefile.rump"
+.include <bsd.own.mk>
+
# compat
.if !empty(RUMP_NBCOMPAT:M50)
SRCS+= kern_select_50.c
Added files:
Index: src/sys/rump/librump/rumpkern/MAINBUS.ioconf
diff -u /dev/null src/sys/rump/librump/rumpkern/MAINBUS.ioconf:1.1
--- /dev/null Mon May 13 17:49:05 2019
+++ src/sys/rump/librump/rumpkern/MAINBUS.ioconf Mon May 13 17:49:05 2019
@@ -0,0 +1,6 @@
+ioconf mainbus
+
+include "conf/files"
+include "rump/dev/files.rump"
+
+mainbus0 at root
Index: src/sys/rump/librump/rumpkern/rump_autoconf.c
diff -u /dev/null src/sys/rump/librump/rumpkern/rump_autoconf.c:1.1
--- /dev/null Mon May 13 17:49:05 2019
+++ src/sys/rump/librump/rumpkern/rump_autoconf.c Mon May 13 17:49:05 2019
@@ -0,0 +1,140 @@
+/* $NetBSD: rump_autoconf.c,v 1.1 2019/05/13 17:49:05 bad Exp $ */
+
+/*
+ * Copyright (c) 2009 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/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: rump_autoconf.c,v 1.1 2019/05/13 17:49:05 bad Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+
+static int mainbus_match(device_t, cfdata_t, void *);
+static void mainbus_attach(device_t, device_t, void *);
+static int mainbus_search(device_t, cfdata_t, const int *, void *);
+
+struct mainbus_softc {
+ int mb_nada;
+};
+
+/*
+ * Initial lists as required by autoconf(9). The data from ioconf.c
+ * is patched in by rump_mainbus_init().
+ */
+const struct cfattachinit cfattachinit[] = {
+ { NULL, NULL },
+};
+struct cfdata cfdata[] = {
+ { NULL, NULL, 0, FSTATE_NOTFOUND, NULL, 0, NULL}, /* replaced by init */
+ { NULL, NULL, 0, FSTATE_NOTFOUND, NULL, 0, NULL},
+};
+struct cfdriver * const cfdriver_list_initial[] = {
+ NULL,
+};
+
+#include "ioconf.c"
+
+CFATTACH_DECL_NEW(mainbus, sizeof(struct mainbus_softc),
+ mainbus_match, mainbus_attach, NULL, NULL);
+
+const short cfroots[] = {
+ 0, /* mainbus */
+ -1
+};
+
+/* actually used */
+#define MAXPDEVS 256
+struct pdevinit pdevinit[MAXPDEVS] = {{NULL,0}, }; /* XXX: static limit */
+static int pdev_total = 0;
+
+#include <rump-sys/dev.h>
+
+void
+rump_pdev_add(void (*pdev_attach)(int), int pdev_count)
+{
+ struct pdevinit *pdev_new;
+
+ KASSERT(cold);
+
+ pdev_new = &pdevinit[pdev_total];
+ pdev_new->pdev_attach = pdev_attach;
+ pdev_new->pdev_count = pdev_count;
+
+ pdev_total++;
+ KASSERT(pdev_total < MAXPDEVS);
+}
+
+void
+rump_pdev_finalize()
+{
+
+ rump_pdev_add(NULL, 0);
+}
+
+static int
+mainbus_match(device_t parent, cfdata_t match, void *aux)
+{
+
+ return 1;
+}
+
+static void
+mainbus_attach(device_t parent, device_t self, void *aux)
+{
+
+ aprint_normal("\n");
+ config_search_ia(mainbus_search, self, "mainbus", NULL);
+}
+
+static int
+mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
+{
+ struct mainbus_attach_args maa;
+
+ maa.maa_unit = cf->cf_unit;
+ if (config_match(parent, cf, &maa) > 0)
+ config_attach(parent, cf, &maa, NULL);
+
+ return 0;
+}
+
+void
+rump_mainbus_init(void)
+{
+
+ /* replace cfdata[0] to a state expected by autoconf(9) */
+ memcpy(&cfdata[0], &cfdata_ioconf_mainbus[0], sizeof(cfdata[0]));
+}
+
+void
+rump_mainbus_attach(void)
+{
+ const struct cfattachinit *cfai = &cfattach_ioconf_mainbus[0];
+
+ config_cfdata_attach(cfdata, 0);
+ config_cfdriver_attach(cfdriver_ioconf_mainbus[0]);
+ config_cfattach_attach(cfai->cfai_name, cfai->cfai_list[0]);
+}