Source-Changes-HG archive

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

[src/trunk]: src/sys support building cas(4) as a module



details:   https://anonhg.NetBSD.org/src/rev/acb1f99e6e9b
branches:  trunk
changeset: 760540:acb1f99e6e9b
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jan 07 11:17:22 2011 +0000

description:
support building cas(4) as a module

diffstat:

 sys/dev/pci/if_cas.c             |  36 ++++++++++++++++++++++++++++++++++--
 sys/modules/if_cas/Makefile      |  14 ++++++++++++++
 sys/modules/if_cas/if_cas.ioconf |  10 ++++++++++
 3 files changed, 58 insertions(+), 2 deletions(-)

diffs (95 lines):

diff -r 01091528f0e6 -r acb1f99e6e9b sys/dev/pci/if_cas.c
--- a/sys/dev/pci/if_cas.c      Fri Jan 07 11:15:30 2011 +0000
+++ b/sys/dev/pci/if_cas.c      Fri Jan 07 11:17:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cas.c,v 1.12 2010/11/13 13:52:06 uebayasi Exp $     */
+/*     $NetBSD: if_cas.c,v 1.13 2011/01/07 11:17:22 jmcneill Exp $     */
 /*     $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $    */
 
 /*
@@ -44,9 +44,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.12 2010/11/13 13:52:06 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.13 2011/01/07 11:17:22 jmcneill Exp $");
 
+#ifndef _MODULE
 #include "opt_inet.h"
+#endif
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -59,6 +61,7 @@
 #include <sys/ioctl.h>
 #include <sys/errno.h>
 #include <sys/device.h>
+#include <sys/module.h>
 
 #include <machine/endian.h>
 
@@ -2064,3 +2067,32 @@
 
        sc->sc_tx_prod = bix;
 }
+
+MODULE(MODULE_CLASS_DRIVER, if_cas, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+if_cas_modcmd(modcmd_t cmd, void *opaque)
+{
+       int error = 0;
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+#ifdef _MODULE
+               error = config_init_component(cfdriver_ioconf_cas,
+                   cfattach_ioconf_cas, cfdata_ioconf_cas);
+#endif
+               return error;
+       case MODULE_CMD_FINI:
+#ifdef _MODULE
+               error = config_fini_component(cfdriver_ioconf_cas,
+                   cfattach_ioconf_cas, cfdata_ioconf_cas);
+#endif
+               return error;
+       default:
+               return ENOTTY;
+       }
+}
diff -r 01091528f0e6 -r acb1f99e6e9b sys/modules/if_cas/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/if_cas/Makefile       Fri Jan 07 11:17:22 2011 +0000
@@ -0,0 +1,14 @@
+#      $NetBSD: Makefile,v 1.1 2011/01/07 11:17:22 jmcneill Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/dev/pci
+
+KMOD=  if_cas
+IOCONF=        if_cas.ioconf
+SRCS=  if_cas.c
+CPPFLAGS+= -DINET
+
+WARNS= 3
+
+.include <bsd.kmodule.mk>
diff -r 01091528f0e6 -r acb1f99e6e9b sys/modules/if_cas/if_cas.ioconf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/if_cas/if_cas.ioconf  Fri Jan 07 11:17:22 2011 +0000
@@ -0,0 +1,10 @@
+#      $NetBSD: if_cas.ioconf,v 1.1 2011/01/07 11:17:22 jmcneill Exp $
+
+ioconf cas
+
+include "conf/files"
+include "dev/pci/files.pci"
+
+pseudo-root pci*
+
+cas* at pci? dev ? function ?



Home | Main Index | Thread Index | Old Index