Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/dev/lib Make it easier to create rump kernel compon...
details: https://anonhg.NetBSD.org/src/rev/638662ea2af8
branches: trunk
changeset: 341565:638662ea2af8
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Nov 11 21:52:45 2015 +0000
description:
Make it easier to create rump kernel components, part 1.
Reduce copypasteware for the component constructors. If a constructor
calls only config_init_component(), handle it from a common source file
instead of copying the same(ish) file around to every component.
diffstat:
sys/rump/dev/lib/Makefile.inc | 9 ++-
sys/rump/dev/lib/component_simple.c | 53 ++++++++++++++++++
sys/rump/dev/lib/libmiiphy/Makefile | 5 +-
sys/rump/dev/lib/libmiiphy/phy_at_mii.c | 45 ---------------
sys/rump/dev/lib/libpci_auich/Makefile | 5 +-
sys/rump/dev/lib/libpci_auich/auich_at_pci.c | 45 ---------------
sys/rump/dev/lib/libpci_eap/Makefile | 5 +-
sys/rump/dev/lib/libpci_eap/eap_at_pci.c | 45 ---------------
sys/rump/dev/lib/libpci_if_iwn/Makefile | 5 +-
sys/rump/dev/lib/libpci_if_iwn/iwn_at_pci.c | 45 ---------------
sys/rump/dev/lib/libpci_if_pcn/Makefile | 5 +-
sys/rump/dev/lib/libpci_if_pcn/pcn_at_pci.c | 44 --------------
sys/rump/dev/lib/libpci_if_wm/Makefile | 5 +-
sys/rump/dev/lib/libpci_if_wm/wm_at_pci.c | 45 ---------------
sys/rump/dev/lib/libpci_usbhc/Makefile | 4 +-
sys/rump/dev/lib/libpci_usbhc/usbhc_at_pci.c | 45 ---------------
sys/rump/dev/lib/libpci_virtio/Makefile | 5 +-
sys/rump/dev/lib/libpci_virtio/virtio_at_pci.c | 45 ---------------
sys/rump/dev/lib/libubt/Makefile | 5 +-
sys/rump/dev/lib/libubt/ubt_at_usb.c | 19 ------
sys/rump/dev/lib/libugenhc/Makefile | 5 +-
sys/rump/dev/lib/libugenhc/ugenhc_at_mainbus.c | 22 -------
sys/rump/dev/lib/libusb/Makefile | 4 +-
sys/rump/dev/lib/libusb/usb_at_hc.c | 20 ------
sys/rump/dev/lib/libvirtio_if_vioif/Makefile | 5 +-
sys/rump/dev/lib/libvirtio_if_vioif/vioif_at_virtio.c | 45 ---------------
sys/rump/dev/lib/libvirtio_ld/Makefile | 3 +-
sys/rump/dev/lib/libvirtio_viornd/Makefile | 5 +-
sys/rump/dev/lib/libvirtio_viornd/viornd_at_virtio.c | 49 ----------------
sys/rump/dev/lib/libvirtio_vioscsi/Makefile | 4 +-
sys/rump/dev/lib/libvirtio_vioscsi/vioscsi_at_virtio.c | 49 ----------------
31 files changed, 93 insertions(+), 602 deletions(-)
diffs (truncated from 981 to 300 lines):
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/Makefile.inc
--- a/sys/rump/dev/lib/Makefile.inc Wed Nov 11 17:54:17 2015 +0000
+++ b/sys/rump/dev/lib/Makefile.inc Wed Nov 11 21:52:45 2015 +0000
@@ -1,7 +1,14 @@
-# $NetBSD: Makefile.inc,v 1.4 2015/08/24 23:01:58 pooka Exp $
+# $NetBSD: Makefile.inc,v 1.5 2015/11/11 21:52:45 pooka Exp $
#
RUMPTOP= ${.CURDIR}/../../..
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpdev
+RUMPDEVLIBDIR:= ${.PARSEDIR}
+.ifdef COMPONENT_SIMPLE
+.PATH: ${RUMPDEVLIBDIR}
+SRCS+= component_simple.c
+CPPFLAGS.component_simple.c+= -DCOMPONENT_NAME=${COMPONENT_SIMPLE}
+.endif
+
.include "${RUMPTOP}/Makefile.rump"
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/component_simple.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/dev/lib/component_simple.c Wed Nov 11 21:52:45 2015 +0000
@@ -0,0 +1,53 @@
+/* $NetBSD: component_simple.c,v 1.1 2015/11/11 21:52:45 pooka Exp $ */
+
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#ifndef COMPONENT_NAME
+#error Internal error: COMPONENT_NAME not defined
+#endif
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: component_simple.c,v 1.1 2015/11/11 21:52:45 pooka Exp $");
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/bus.h>
+
+#include "rump_private.h"
+
+#include "ioconf.c"
+
+#define CONFIG_INIT_COMPONENT(a) config_init_component( \
+ __CONCAT(cfdriver_ioconf_,a), \
+ __CONCAT(cfattach_ioconf_,a), \
+ __CONCAT(cfdata_ioconf_,a));
+
+RUMP_COMPONENT(RUMP_COMPONENT_DEV)
+{
+
+ CONFIG_INIT_COMPONENT(COMPONENT_NAME);
+}
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libmiiphy/Makefile
--- a/sys/rump/dev/lib/libmiiphy/Makefile Wed Nov 11 17:54:17 2015 +0000
+++ b/sys/rump/dev/lib/libmiiphy/Makefile Wed Nov 11 21:52:45 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2015/10/19 16:16:33 pooka Exp $
+# $NetBSD: Makefile,v 1.5 2015/11/11 21:52:46 pooka Exp $
#
RUMPTOP=${TOPRUMP}
@@ -9,8 +9,7 @@
COMMENT=MII and PHY drivers (for networking)
IOCONF= MIIPHY.ioconf
-
-SRCS= phy_at_mii.c
+COMPONENT_SIMPLE= phy
SRCS+= mii.c mii_ethersubr.c mii_physubr.c ukphy.c ukphy_subr.c
SRCS+= acphy.c amhphy.c atphy.c bmtphy.c brgphy.c ciphy.c dmphy.c etphy.c \
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libmiiphy/phy_at_mii.c
--- a/sys/rump/dev/lib/libmiiphy/phy_at_mii.c Wed Nov 11 17:54:17 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* $NetBSD: phy_at_mii.c,v 1.1 2014/04/04 14:18:19 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/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: phy_at_mii.c,v 1.1 2014/04/04 14:18:19 pooka Exp $");
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/bus.h>
-
-#include "rump_private.h"
-
-#include "ioconf.c"
-
-RUMP_COMPONENT(RUMP_COMPONENT_DEV)
-{
-
- config_init_component(cfdriver_ioconf_phy,
- cfattach_ioconf_phy, cfdata_ioconf_phy);
-}
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libpci_auich/Makefile
--- a/sys/rump/dev/lib/libpci_auich/Makefile Wed Nov 11 17:54:17 2015 +0000
+++ b/sys/rump/dev/lib/libpci_auich/Makefile Wed Nov 11 21:52:45 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2015/10/19 16:16:33 pooka Exp $
+# $NetBSD: Makefile,v 1.3 2015/11/11 21:52:46 pooka Exp $
#
RUMPTOP=${TOPRUMP}
@@ -9,7 +9,8 @@
COMMENT=AC97 Intel Audio driver
IOCONF= PCI_AUICH.ioconf
-SRCS= auich_at_pci.c
+COMPONENT_SIMPLE= pci_auich
+
SRCS+= auich.c
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/../dev
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libpci_auich/auich_at_pci.c
--- a/sys/rump/dev/lib/libpci_auich/auich_at_pci.c Wed Nov 11 17:54:17 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* $NetBSD: auich_at_pci.c,v 1.1 2015/06/03 14:06:19 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/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich_at_pci.c,v 1.1 2015/06/03 14:06:19 pooka Exp $");
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/bus.h>
-
-#include "rump_private.h"
-
-#include "ioconf.c"
-
-RUMP_COMPONENT(RUMP_COMPONENT_DEV)
-{
-
- config_init_component(cfdriver_ioconf_pci_auich,
- cfattach_ioconf_pci_auich, cfdata_ioconf_pci_auich);
-}
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libpci_eap/Makefile
--- a/sys/rump/dev/lib/libpci_eap/Makefile Wed Nov 11 17:54:17 2015 +0000
+++ b/sys/rump/dev/lib/libpci_eap/Makefile Wed Nov 11 21:52:45 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2015/10/19 16:16:33 pooka Exp $
+# $NetBSD: Makefile,v 1.3 2015/11/11 21:52:46 pooka Exp $
#
RUMPTOP=${TOPRUMP}
@@ -9,7 +9,8 @@
COMMENT=Ensoniq AudioPCI driver
IOCONF= PCI_EAP.ioconf
-SRCS= eap_at_pci.c
+COMPONENT_SIMPLE= pci_eap
+
SRCS+= eap.c
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/../dev
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libpci_eap/eap_at_pci.c
--- a/sys/rump/dev/lib/libpci_eap/eap_at_pci.c Wed Nov 11 17:54:17 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* $NetBSD: eap_at_pci.c,v 1.1 2014/11/18 08:43:03 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/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: eap_at_pci.c,v 1.1 2014/11/18 08:43:03 pooka Exp $");
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/bus.h>
-
-#include "rump_private.h"
-
-#include "ioconf.c"
-
-RUMP_COMPONENT(RUMP_COMPONENT_DEV)
-{
-
- config_init_component(cfdriver_ioconf_pci_eap,
- cfattach_ioconf_pci_eap, cfdata_ioconf_pci_eap);
-}
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libpci_if_iwn/Makefile
--- a/sys/rump/dev/lib/libpci_if_iwn/Makefile Wed Nov 11 17:54:17 2015 +0000
+++ b/sys/rump/dev/lib/libpci_if_iwn/Makefile Wed Nov 11 21:52:45 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2015/10/19 16:16:33 pooka Exp $
+# $NetBSD: Makefile,v 1.3 2015/11/11 21:52:46 pooka Exp $
#
RUMPTOP=${TOPRUMP}
@@ -9,8 +9,7 @@
COMMENT=Intel wireless device driver
IOCONF= PCI_IF_IWN.ioconf
-
-SRCS= iwn_at_pci.c
+COMPONENT_SIMPLE= pci_if_iwn
SRCS+= if_iwn.c
diff -r 305b1b31038c -r 638662ea2af8 sys/rump/dev/lib/libpci_if_iwn/iwn_at_pci.c
Home |
Main Index |
Thread Index |
Old Index