diff options
| author | ad <ad@NetBSD.org> | 2008-11-12 12:35:50 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2008-11-12 12:35:50 +0000 |
| commit | 0efea177e37295fed654875d875160c47500d6bd (patch) | |
| tree | 9d0589344a5d07b9a511a2e81ebbd701744d03b5 /sys/lkm/dev | |
| parent | 0f81d3e0a26c2833cd085c472a4a77c325486b75 (diff) | |
Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
Diffstat (limited to 'sys/lkm/dev')
24 files changed, 0 insertions, 513 deletions
diff --git a/sys/lkm/dev/Makefile b/sys/lkm/dev/Makefile deleted file mode 100644 index 665675d7161..00000000000 --- a/sys/lkm/dev/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2008/05/01 21:51:20 xtraeme Exp $ - -SUBDIR= vnd - -.if ${MACHINE} == "i386" || ${MACHINE} == "amd64" -SUBDIR+= isa -.endif - -.if ${MACHINE} == "i386" || ${MACHINE} == "alpha" -SUBDIR+= pci pcmcia -.endif - -.include <bsd.subdir.mk> diff --git a/sys/lkm/dev/Makefile.inc b/sys/lkm/dev/Makefile.inc deleted file mode 100644 index 295ef3aab41..00000000000 --- a/sys/lkm/dev/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.2 2006/05/07 20:48:01 christos Exp $ - -.include "../Makefile.inc" diff --git a/sys/lkm/dev/isa/Makefile b/sys/lkm/dev/isa/Makefile deleted file mode 100644 index a97826fbd9d..00000000000 --- a/sys/lkm/dev/isa/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2008/05/01 21:51:20 xtraeme Exp $ - -SUBDIR= aps finsio itesio nsclpcsio smsc ug -# -# lm(4) not enabled as this might need a different I/O port. -# -#SUBDIR+= lm - -.include <bsd.subdir.mk> diff --git a/sys/lkm/dev/isa/Makefile.inc b/sys/lkm/dev/isa/Makefile.inc deleted file mode 100644 index 8a09e2b6eab..00000000000 --- a/sys/lkm/dev/isa/Makefile.inc +++ /dev/null @@ -1,33 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.11 2008/10/25 22:27:38 apb Exp $ - -.include "../Makefile.inc" - -TEMPL_DIR?= ${.CURDIR}/../common -TEMPL_FILE?= lkm_isa.c.tmpl - -LKM_ISA_IO_PORT?= -1 -LKM_ISA_SIZE?= 0 -LKM_ISA_IOMEM?= -1 -LKM_ISA_IOSIZE?= 0 -LKM_ISA_IRQ?= -1 -LKM_ISA_DRQ?= -1 -LKM_ISA_DRQ2?= -1 -LKM_ISA_DRVNAME_CA?= ${LKM_ISA_DRVNAME} - -NOMAN= # defined -WARNS= 4 -CLEANFILES+= ${TEMPL_FILE:S/.tmpl//} *~ ${KMOD} - -DPSRCS+= ${TEMPL_FILE:S/.tmpl//} - -${TEMPL_FILE:S/.tmpl//}: - ${TOOL_SED} -e "s|@LKM_ISA_IO_PORT@|${LKM_ISA_IO_PORT}|g" \ - -e "s|@LKM_ISA_SIZE@|${LKM_ISA_SIZE}|g" \ - -e "s|@LKM_ISA_IOMEM@|${LKM_ISA_IOMEM}|g" \ - -e "s|@LKM_ISA_IOSIZE@|${LKM_ISA_IOSIZE}|g" \ - -e "s|@LKM_ISA_IRQ@|${LKM_ISA_IRQ}|g" \ - -e "s|@LKM_ISA_DRQ@|${LKM_ISA_DRQ}|g" \ - -e "s|@LKM_ISA_DRQ2@|${LKM_ISA_DRQ2}|g" \ - -e "s|@LKM_ISA_DRVNAME@|${LKM_ISA_DRVNAME}|g" \ - -e "s|@LKM_ISA_DRVNAME_CA@|${LKM_ISA_DRVNAME_CA}|g" \ - ${TEMPL_DIR}/${TEMPL_FILE} > ${.OBJDIR}/${TEMPL_FILE:S/.tmpl//} diff --git a/sys/lkm/dev/isa/aps/Makefile b/sys/lkm/dev/isa/aps/Makefile deleted file mode 100644 index 7171da9c182..00000000000 --- a/sys/lkm/dev/isa/aps/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2008/04/05 19:03:57 xtraeme Exp $ - -S= ${.CURDIR}/../../../.. -.PATH: $S/dev/isa $S/dev/ic - -KMOD= aps -SRCS= real-aps.c lkm_isa.c -BUILDSYMLINKS+= aps.c real-aps.c - -LKM_ISA_IO_PORT= 0x1600 -LKM_ISA_DRVNAME= aps - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/isa/common/lkm_isa.c.tmpl b/sys/lkm/dev/isa/common/lkm_isa.c.tmpl deleted file mode 100644 index fb390c9b714..00000000000 --- a/sys/lkm/dev/isa/common/lkm_isa.c.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: lkm_isa.c.tmpl,v 1.2 2008/04/26 20:10:15 xtraeme Exp $ */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/lkm.h> - -/* - * Common template for ISA drivers. - */ - -CFDRIVER_DECL(@LKM_ISA_DRVNAME@, DV_DULL, NULL); -extern struct cfattach @LKM_ISA_DRVNAME_CA@_ca; - -/* The ISA devices use 7 locators. */ -static int isaloc[] = { - @LKM_ISA_IO_PORT@, /* port */ - @LKM_ISA_SIZE@, /* size */ - @LKM_ISA_IOMEM@, /* iomem */ - @LKM_ISA_IOSIZE@, /* iosize */ - @LKM_ISA_IRQ@, /* irq */ - @LKM_ISA_DRQ@, /* drq */ - @LKM_ISA_DRQ2@, /* drq2 */ -}; - -static struct cfparent isaparent = { - "isa", "isa", DVUNIT_ANY -}; - -static struct cfdata @LKM_ISA_DRVNAME@_cfdata[] = { - { "@LKM_ISA_DRVNAME@", - "@LKM_ISA_DRVNAME_CA@", - 0, - FSTATE_NOTFOUND, - isaloc, - 0, - &isaparent }, - { .cf_pspec = NULL } -}; - -static struct cfdriver *@LKM_ISA_DRVNAME@_cfdrivers[] = { - &@LKM_ISA_DRVNAME@_cd, - NULL -}; - -static struct cfattach *@LKM_ISA_DRVNAME@_cfattachs[] = { - &@LKM_ISA_DRVNAME_CA@_ca, - NULL -}; - -static const struct cfattachlkminit @LKM_ISA_DRVNAME@_cfattachinit[] = { - { "@LKM_ISA_DRVNAME@", @LKM_ISA_DRVNAME@_cfattachs }, - { .cfai_list = NULL } -}; - -int @LKM_ISA_DRVNAME@_lkmentry(struct lkm_table *, int, int); - -MOD_DRV("@LKM_ISA_DRVNAME@", @LKM_ISA_DRVNAME@_cfdrivers, - @LKM_ISA_DRVNAME@_cfattachinit, @LKM_ISA_DRVNAME@_cfdata); - -int -@LKM_ISA_DRVNAME@_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) -{ - - DISPATCH(lkmtp, cmd, ver, lkm_nofunc, lkm_nofunc, lkm_nofunc); -} diff --git a/sys/lkm/dev/isa/finsio/Makefile b/sys/lkm/dev/isa/finsio/Makefile deleted file mode 100644 index 545aecb6903..00000000000 --- a/sys/lkm/dev/isa/finsio/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/04/05 19:03:57 xtraeme Exp $ - -S= ${.CURDIR}/../../../.. -.PATH: $S/dev/isa - -KMOD= finsio -SRCS+= lkm_isa.c finsio_isa.c - -LKM_ISA_IO_PORT= 0x4e -LKM_ISA_DRVNAME= finsio - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/isa/itesio/Makefile b/sys/lkm/dev/isa/itesio/Makefile deleted file mode 100644 index e7847b5f199..00000000000 --- a/sys/lkm/dev/isa/itesio/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2008/04/05 19:03:57 xtraeme Exp $ - -S= ${.CURDIR}/../../../.. -.PATH: $S/dev/isa - -KMOD= itesio -SRCS+= lkm_isa.c itesio_isa.c - -LKM_ISA_IO_PORT= 0x2e -LKM_ISA_DRVNAME= itesio - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/isa/lm/Makefile b/sys/lkm/dev/isa/lm/Makefile deleted file mode 100644 index e0766fbc0cc..00000000000 --- a/sys/lkm/dev/isa/lm/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/04/05 19:03:57 xtraeme Exp $ - -S= ${.CURDIR}/../../../.. -.PATH: $S/dev/isa $S/dev/ic - -KMOD= lm -SRCS= lm_isa.c nslm7x.c lkm_isa.c - -LKM_ISA_IO_PORT= 0x290 # Change this to another port if desired -LKM_ISA_DRVNAME= lm -LKM_ISA_DRVNAME_CA= lm_isa - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/isa/nsclpcsio/Makefile b/sys/lkm/dev/isa/nsclpcsio/Makefile deleted file mode 100644 index dd5cdebd703..00000000000 --- a/sys/lkm/dev/isa/nsclpcsio/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2008/04/05 19:03:57 xtraeme Exp $ - -S= ${.CURDIR}/../../../.. -.PATH: $S/dev/isa - -KMOD= nsclpcsio -SRCS= nsclpcsio_isa.c lkm_isa.c - -LKM_ISA_DRVNAME= nsclpcsio -LKM_ISA_DRVNAME_CA= nsclpcsio_isa - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/isa/smsc/Makefile b/sys/lkm/dev/isa/smsc/Makefile deleted file mode 100644 index 5a1d0ef3a1e..00000000000 --- a/sys/lkm/dev/isa/smsc/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2008/04/05 19:03:57 xtraeme Exp $ - -S= ${.CURDIR}/../../../.. -.PATH: $S/dev/isa - -KMOD= smsc -SRCS= real-smsc.c lkm_isa.c -BUILDSYMLINKS+= smsc.c real-smsc.c - -LKM_ISA_IO_PORT= 0x02e -LKM_ISA_DRVNAME= smsc - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/isa/ug/Makefile b/sys/lkm/dev/isa/ug/Makefile deleted file mode 100644 index 358eacc8b90..00000000000 --- a/sys/lkm/dev/isa/ug/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/04/05 19:03:57 xtraeme Exp $ - -S= ${.CURDIR}/../../../.. -.PATH: $S/dev/isa - -KMOD= ug -SRCS+= lkm_isa.c ug_isa.c - -LKM_ISA_IO_PORT= 0xe0 -LKM_ISA_DRVNAME= ug -LKM_ISA_DRVNAME_CA= ug_isa - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/pci/Makefile b/sys/lkm/dev/pci/Makefile deleted file mode 100644 index 56faaa47066..00000000000 --- a/sys/lkm/dev/pci/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2005/12/11 12:24:47 christos Exp $ - -SUBDIR= dummy_pci - -.include <bsd.subdir.mk> diff --git a/sys/lkm/dev/pci/Makefile.inc b/sys/lkm/dev/pci/Makefile.inc deleted file mode 100644 index d3b5cbd3a79..00000000000 --- a/sys/lkm/dev/pci/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ - -.include "../Makefile.inc" diff --git a/sys/lkm/dev/pci/dummy_pci/Makefile b/sys/lkm/dev/pci/dummy_pci/Makefile deleted file mode 100644 index 92b4d441383..00000000000 --- a/sys/lkm/dev/pci/dummy_pci/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2005/12/11 12:24:47 christos Exp $ - -S= ${.CURDIR}/../../../.. - -KMOD= dummy_pci -SRCS= dummy_pci_drv.c dummy_pci_lkm.c -NOMAN= #yes - -#CPPFLAGS+= -DDIAGNOSTIC -DLOCKDEBUG -CPPFLAGS+= -DDIAGNOSTIC -DDEBUG -WARNS= 2 - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/pci/dummy_pci/dummy_pci_drv.c b/sys/lkm/dev/pci/dummy_pci/dummy_pci_drv.c deleted file mode 100644 index 22a443d4ef5..00000000000 --- a/sys/lkm/dev/pci/dummy_pci/dummy_pci_drv.c +++ /dev/null @@ -1,40 +0,0 @@ -/* $NetBSD: dummy_pci_drv.c,v 1.3 2008/07/09 13:15:40 joerg Exp $ */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> - -#include <dev/pci/pcivar.h> - -struct mist_softc { -}; - -static int mist_match(device_t, cfdata_t, void *); -static void mist_attach(device_t, device_t, void *); -static int mist_detach(device_t, int); - -CFATTACH_DECL_NEW(mist, sizeof(struct mist_softc), - mist_match, mist_attach, mist_detach, NULL); - -int -mist_match(device_t parent, cfdata_t match, void *aux) -{ - - return (1); -} - -static void -mist_attach(device_t parent, device_t self, void *aux) -{ - - aprint_naive(": dummy catch-all PCI device\n"); - aprint_normal(": dummy catch-all PCI device\n"); -} - -static int -mist_detach(device_t self, int flags) -{ - - return (0); -} diff --git a/sys/lkm/dev/pci/dummy_pci/dummy_pci_lkm.c b/sys/lkm/dev/pci/dummy_pci/dummy_pci_lkm.c deleted file mode 100644 index 72803b561e4..00000000000 --- a/sys/lkm/dev/pci/dummy_pci/dummy_pci_lkm.c +++ /dev/null @@ -1,43 +0,0 @@ -/* $NetBSD: dummy_pci_lkm.c,v 1.3 2005/12/11 12:24:47 christos Exp $ */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/lkm.h> - -CFDRIVER_DECL(mist, DV_DULL, NULL); -extern struct cfattach mist_ca; - -static int pciloc[] = { -1, -1 }; /* device, function */ -static struct cfparent pciparent = { - "pci", "pci", DVUNIT_ANY -}; -static struct cfdata mist_cfdata[] = { - {"mist", "mist", 0, FSTATE_STAR, pciloc, 0, &pciparent}, - { 0 } -}; - -static struct cfdriver *mist_cfdrivers[] = { - &mist_cd, - NULL -}; -static struct cfattach *mist_cfattachs[] = { - &mist_ca, - NULL -}; -static const struct cfattachlkminit mist_cfattachinit[] = { - { "mist", mist_cfattachs }, - { NULL } -}; - -int dummy_pci_lkmentry(struct lkm_table *, int, int); -MOD_DRV("dummy_pci", mist_cfdrivers, mist_cfattachinit, - mist_cfdata); - -int -dummy_pci_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) -{ - - DISPATCH(lkmtp, cmd, ver, lkm_nofunc, lkm_nofunc, lkm_nofunc); -} diff --git a/sys/lkm/dev/pcmcia/Makefile b/sys/lkm/dev/pcmcia/Makefile deleted file mode 100644 index f2e8ae332b3..00000000000 --- a/sys/lkm/dev/pcmcia/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2005/12/11 12:24:48 christos Exp $ - -SUBDIR= wi_pcmcia - -.include <bsd.subdir.mk> diff --git a/sys/lkm/dev/pcmcia/Makefile.inc b/sys/lkm/dev/pcmcia/Makefile.inc deleted file mode 100644 index d3b5cbd3a79..00000000000 --- a/sys/lkm/dev/pcmcia/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ - -.include "../Makefile.inc" diff --git a/sys/lkm/dev/pcmcia/wi_pcmcia/Makefile b/sys/lkm/dev/pcmcia/wi_pcmcia/Makefile deleted file mode 100644 index c223f6a5d52..00000000000 --- a/sys/lkm/dev/pcmcia/wi_pcmcia/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2005/12/11 12:24:48 christos Exp $ - -S= ${.CURDIR}/../../../.. - -KMOD= wi_pcmcia -SRCS= wi_pcmcia_lkm.c -NOMAN= #yes -WARNS= 2 - -#CPPFLAGS+= -DDIAGNOSTIC -DLOCKDEBUG -CPPFLAGS+= -DDIAGNOSTIC -DDEBUG - -.PATH: $S/dev/pcmcia $S/dev/ic -SRCS+= if_wi_pcmcia.c - -# if the "wi" driver backend is already in the -# kernel (as "wi at pci"), comment out / uncomment -SRCS+= wi.c -#CPPFLAGS+= -DWI_DRIVER_IS_PRESENT - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/pcmcia/wi_pcmcia/bpfilter.h b/sys/lkm/dev/pcmcia/wi_pcmcia/bpfilter.h deleted file mode 100644 index 1dc01eb4072..00000000000 --- a/sys/lkm/dev/pcmcia/wi_pcmcia/bpfilter.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $NetBSD: bpfilter.h,v 1.2 2005/12/11 12:24:48 christos Exp $ */ - -/* This is a hack. */ - -#define NBPFILTER 0 diff --git a/sys/lkm/dev/pcmcia/wi_pcmcia/wi_pcmcia_lkm.c b/sys/lkm/dev/pcmcia/wi_pcmcia/wi_pcmcia_lkm.c deleted file mode 100644 index 866e50c873c..00000000000 --- a/sys/lkm/dev/pcmcia/wi_pcmcia/wi_pcmcia_lkm.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: wi_pcmcia_lkm.c,v 1.3 2005/12/11 12:24:48 christos Exp $ */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/lkm.h> - -#ifndef WI_DRIVER_IS_PRESENT -CFDRIVER_DECL(wi, DV_DULL, NULL); -#endif - -extern struct cfdriver wi_cd; -extern struct cfattach wi_pcmcia_ca; -extern struct cfiattrdata pcmciacf_iattrdata; - -static int pcmcialoc[] = { -1, -1 }; /* function, irq */ -static struct cfparent pcmciaparent = { - "pcmcia", "pcmcia", DVUNIT_ANY -}; -static struct cfdata wi_pcmcia_cfdata[] = { - {"wi", "wi_pcmcia", 0, FSTATE_STAR, pcmcialoc, 0, &pcmciaparent}, - { 0 } -}; - -static struct cfdriver *wi_pcmcia_cfdrivers[] = { - &wi_cd, - NULL -}; -static struct cfattach *wi_pcmcia_cfattachs[] = { - &wi_pcmcia_ca, - NULL -}; -static const struct cfattachlkminit wi_pcmcia_cfattachinit[] = { - { "wi", wi_pcmcia_cfattachs }, - { NULL } -}; - -int wi_pcmcia_lkmentry(struct lkm_table *, int, int); -MOD_DRV("wi_pcmcia", wi_pcmcia_cfdrivers, wi_pcmcia_cfattachinit, - wi_pcmcia_cfdata); - -int -wi_pcmcia_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) -{ - - DISPATCH(lkmtp, cmd, ver, lkm_nofunc, lkm_nofunc, lkm_nofunc); -} diff --git a/sys/lkm/dev/vnd/Makefile b/sys/lkm/dev/vnd/Makefile deleted file mode 100644 index 5c3549cbc03..00000000000 --- a/sys/lkm/dev/vnd/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2005/12/11 12:24:48 christos Exp $ - -.include "../Makefile.inc" - -.PATH: $S/kern - -KMOD= vnd - -SRCS= lkminit_vnd.c real-vnd.c - -BUILDSYMLINKS+=${S}/dev/vnd.c real-vnd.c - -.include <bsd.kmod.mk> diff --git a/sys/lkm/dev/vnd/lkminit_vnd.c b/sys/lkm/dev/vnd/lkminit_vnd.c deleted file mode 100644 index 86707ad6cd4..00000000000 --- a/sys/lkm/dev/vnd/lkminit_vnd.c +++ /dev/null @@ -1,103 +0,0 @@ -/* $NetBSD: lkminit_vnd.c,v 1.10 2008/06/13 14:22:22 cegger Exp $ */ - -/* - * Copyright (c) 2002 Matthew R. Green - * 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 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: lkminit_vnd.c,v 1.10 2008/06/13 14:22:22 cegger Exp $"); - -#include <sys/param.h> -#include <sys/ioctl.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/mount.h> -#include <sys/exec.h> -#include <sys/lkm.h> -#include <sys/file.h> -#include <sys/errno.h> -#include <sys/device.h> - -CFDRIVER_DECL(vnd, DV_DISK, NULL); - -extern struct cfattach vnd_ca; -extern const struct bdevsw vnd_bdevsw; -extern const struct cdevsw vnd_cdevsw; -extern void vndattach (int); -extern int vnd_destroy (struct device *); - -static int vnd_lkm(struct lkm_table *lkmtp, int cmd); -int vnd_lkmentry(struct lkm_table *lkmtp, int cmd, int ver); - -MOD_DEV("vnd", "vnd", &vnd_bdevsw, -1, &vnd_cdevsw, -1); - -static int -vnd_lkm(struct lkm_table *lkmtp, int cmd) -{ - int error = 0, i; - device_t dev; - - if (cmd == LKM_E_LOAD) { - error = config_cfdriver_attach(&vnd_cd); - if (error) { - aprint_error("%s: unable to register cfdriver\n", - vnd_cd.cd_name); - return error; - } - - vndattach(0); - } else if (cmd == LKM_E_UNLOAD) { - for (i = 0; i < vnd_cd.cd_ndevs; i++) { - dev = device_lookup(&vnd_cd, i); - if (dev != NULL && - (error = vnd_destroy(dev)) != 0) - return 0; - } - - if ((error = config_cfattach_detach(vnd_cd.cd_name, - &vnd_ca)) != 0) { - aprint_error("%s: unable to deregister cfattach\n", - vnd_cd.cd_name); - return error; - } - - if ((error = config_cfdriver_detach(&vnd_cd)) != 0) { - aprint_error("%s: unable to deregister cfdriver\n", - vnd_cd.cd_name); - return error; - } - } - return (error); -} - -int -vnd_lkmentry (lkmtp, cmd, ver) - struct lkm_table *lkmtp; - int cmd; - int ver; -{ - - DISPATCH(lkmtp, cmd, ver, vnd_lkm, vnd_lkm, lkm_nofunc); -} |
