Source-Changes-HG archive

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

[src/trunk]: src/sys/net fix rump tests.



details:   https://anonhg.NetBSD.org/src/rev/9c1031885ee0
branches:  trunk
changeset: 817242:9c1031885ee0
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Aug 14 11:03:21 2016 +0000

description:
fix rump tests.

diffstat:

 sys/net/if_tap.c |  36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diffs (117 lines):

diff -r 9fce32c5c703 -r 9c1031885ee0 sys/net/if_tap.c
--- a/sys/net/if_tap.c  Sun Aug 14 07:47:15 2016 +0000
+++ b/sys/net/if_tap.c  Sun Aug 14 11:03:21 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tap.c,v 1.90 2016/08/08 16:40:39 kre Exp $  */
+/*     $NetBSD: if_tap.c,v 1.91 2016/08/14 11:03:21 christos Exp $     */
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.90 2016/08/08 16:40:39 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.91 2016/08/14 11:03:21 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -76,7 +76,6 @@
 
 #include "ioconf.h"
 
-#if defined(COMPAT_40) || defined(MODULAR)
 /*
  * sysctl node management
  *
@@ -91,10 +90,9 @@
  * tap_log allows the module to log creations of nodes and
  * destroy them all at once using sysctl_teardown.
  */
-static int tap_node;
+static int     tap_node;
 static int     tap_sysctl_handler(SYSCTLFN_PROTO);
-SYSCTL_SETUP_PROTO(sysctl_tap_setup);
-#endif
+static void    sysctl_tap_setup(struct sysctllog **);
 
 /*
  * Since we're an Ethernet device, we need the 2 following
@@ -237,11 +235,10 @@
 static struct tap_softc *      tap_clone_creator(int);
 int    tap_clone_destroyer(device_t);
 
-#ifdef _MODULE
 static struct sysctllog *tap_sysctl_clog;
 
+#ifdef _MODULE
 devmajor_t tap_bmajor = -1, tap_cmajor = -1;
-
 #endif
 
 static u_int tap_count;
@@ -259,9 +256,17 @@
 static void
 tapinit(void)
 {
+        int error = config_cfattach_attach(tap_cd.cd_name, &tap_ca);
+        if (error) {
+                aprint_error("%s: unable to register cfattach\n",
+                    tap_cd.cd_name);
+                (void)config_cfdriver_detach(&tap_cd);
+                return;
+        }
+ 
        if_clone_attach(&tap_cloners);
+       sysctl_tap_setup(&tap_sysctl_clog);
 #ifdef _MODULE
-       sysctl_tap_setup(&tap_sysctl_clog);
        devsw_attach("tap", NULL, &tap_bmajor, &tap_cdevsw, &tap_cmajor);
 #endif
 }
@@ -275,13 +280,17 @@
                return EBUSY;
 
 #ifdef _MODULE
-       error = devsw_detach(NULL, &tap_cdevsw);
+       if (error == 0)
+               error = devsw_detach(NULL, &tap_cdevsw);
+#endif
        if (error == 0)
                sysctl_teardown(&tap_sysctl_clog);
-#endif
        if (error == 0)
                if_clone_detach(&tap_cloners);
 
+       if (error == 0)
+               error = config_cfattach_detach(tap_cd.cd_name, &tap_ca);
+
        return error;
 }
 
@@ -1313,7 +1322,6 @@
        return rv;
 }
 
-#if defined(COMPAT_40) || defined(MODULAR)
 /*
  * sysctl management routines
  * You can set the address of an interface through:
@@ -1342,7 +1350,8 @@
  * full path starting from the root for later calls to sysctl_createv
  * and sysctl_destroyv.
  */
-SYSCTL_SETUP(sysctl_tap_setup, "sysctl net.link.tap subtree setup")
+static void
+sysctl_tap_setup(struct sysctllog **clog)
 {
        const struct sysctlnode *node;
        int error = 0;
@@ -1437,7 +1446,6 @@
        if_set_sadl(ifp, enaddr, ETHER_ADDR_LEN, false);
        return (error);
 }
-#endif
 
 /*
  * Module infrastructure



Home | Main Index | Thread Index | Old Index