Source-Changes-HG archive

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

[src/trunk]: src/sys/net/npf Simplify even further and fix non-modular kernels:



details:   https://anonhg.NetBSD.org/src/rev/466fad19a4ae
branches:  trunk
changeset: 341279:466fad19a4ae
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 29 15:19:43 2015 +0000

description:
Simplify even further and fix non-modular kernels:
We cannot use the init at attach() trick, because other npf ext modules
will load before the attach function is called on non modular kernels.

diffstat:

 sys/net/npf/npf.c |  22 +++++-----------------
 1 files changed, 5 insertions(+), 17 deletions(-)

diffs (61 lines):

diff -r e2494b1c9b39 -r 466fad19a4ae sys/net/npf/npf.c
--- a/sys/net/npf/npf.c Thu Oct 29 11:31:52 2015 +0000
+++ b/sys/net/npf/npf.c Thu Oct 29 15:19:43 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf.c,v 1.30 2015/10/27 19:58:09 christos Exp $        */
+/*     $NetBSD: npf.c,v 1.31 2015/10/29 15:19:43 christos Exp $        */
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.30 2015/10/27 19:58:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.31 2015/10/29 15:19:43 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -63,11 +63,11 @@
 /*
  * Module and device structures.
  */
-#ifdef MODULAR
+#ifndef _MODULE
 /*
  * Modular kernels load drivers too early, and we need percpu to be inited
  * So we make this misc; a better way would be to have early boot and late
- * boot drivers
+ * boot drivers.
  */
 MODULE(MODULE_CLASS_MISC, npf, NULL);
 #else
@@ -175,12 +175,7 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-#if defined(MODULAR) || defined(_MODULE)
                return npf_init();
-#else
-               /* initialized by npfattach */
-               return 0;
-#endif
        case MODULE_CMD_FINI:
                return npf_fini();
        case MODULE_CMD_AUTOUNLOAD:
@@ -197,14 +192,7 @@
 void
 npfattach(int nunits)
 {
-#ifndef MODULAR
-       /*   
-        * Modular kernels will automatically load any built-in modules
-        * and call their modcmd() routine, so we don't need to do it
-        * again as part of pseudo-device configuration.
-        */     
-       (void)npf_init();
-#endif   
+       /* Nothing */
 }
 
 static int



Home | Main Index | Thread Index | Old Index