Source-Changes-HG archive

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

[src/trunk]: src/sys/rump Don't call the drvctl module's initialization code ...



details:   https://anonhg.NetBSD.org/src/rev/d4d03464251a
branches:  trunk
changeset: 820777:d4d03464251a
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Jan 14 21:36:58 2017 +0000

description:
Don't call the drvctl module's initialization code during rump component
initialization.  Instead, temporarily attach the drvctl's cdevsw to
determine its device c-major, create the /dev/drvctl node using that
c-major, and then detach.  This leaves things in a state where normal
module initialization can run.

Since we're now creating the /dev/drvctl device node correctly, we don't
need to create it again.  So mark the device as DEVNODE_DONTBOTHER in
the devsw_conv0 conversion table.

This bug was introduced more than a year ago (src/sys/kern/kern_drvctl.c
rev 1.40), but was silently ignored except when running a rump_server
built with LOCKDEBUG.

diffstat:

 sys/rump/dev/lib/libdrvctl/drvctl_component.c |  24 ++++++++++++++----------
 sys/rump/librump/rumpkern/devsw.c             |   2 +-
 2 files changed, 15 insertions(+), 11 deletions(-)

diffs (63 lines):

diff -r 3ce1fddb64de -r d4d03464251a sys/rump/dev/lib/libdrvctl/drvctl_component.c
--- a/sys/rump/dev/lib/libdrvctl/drvctl_component.c     Sat Jan 14 21:33:09 2017 +0000
+++ b/sys/rump/dev/lib/libdrvctl/drvctl_component.c     Sat Jan 14 21:36:58 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drvctl_component.c,v 1.2 2016/01/26 23:12:15 pooka Exp $       */
+/*     $NetBSD: drvctl_component.c,v 1.3 2017/01/14 21:36:58 pgoyette Exp $    */
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drvctl_component.c,v 1.2 2016/01/26 23:12:15 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drvctl_component.c,v 1.3 2017/01/14 21:36:58 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -36,6 +36,7 @@
 #include "ioconf.c"
 
 #include <rump-sys/kern.h>
+#include <rump-sys/vfs.h>
 
 RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 {
@@ -43,13 +44,16 @@
        devmajor_t bmaj, cmaj;
        int error;
 
-       drvctl_init();
-
-       config_init_component(cfdriver_ioconf_drvctl,
-           cfattach_ioconf_drvctl, cfdata_ioconf_drvctl);
+       bmaj = cmaj = NODEVMAJOR;
+       error = devsw_attach("drvctl", NULL, &bmaj, &drvctl_cdevsw, &cmaj);
+       if (error != 0)
+               panic("drvctl devsw attach failed: %d", error);
 
-       bmaj = cmaj = NODEVMAJOR;
-       if ((error = devsw_attach("drvctl", NULL, &bmaj,
-           &drvctl_cdevsw, &cmaj)) != 0)
-               panic("drvctl devsw attach failed: %d", error);
+       error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/drvctl", cmaj, 0);
+       if ( error !=0)
+               panic("cannot create drvctl device node: %d", error);
+
+       error = devsw_detach(NULL, &drvctl_cdevsw);
+       if (error != 0)
+               panic("cannot detach drvctl devsw: %d", error);
 }
diff -r 3ce1fddb64de -r d4d03464251a sys/rump/librump/rumpkern/devsw.c
--- a/sys/rump/librump/rumpkern/devsw.c Sat Jan 14 21:33:09 2017 +0000
+++ b/sys/rump/librump/rumpkern/devsw.c Sat Jan 14 21:36:58 2017 +0000
@@ -14,7 +14,7 @@
        { "pps", -1, 164, DEVNODE_DONTBOTHER, 0, { 0, 0 }},
        { "ptm", -1, 165, DEVNODE_DONTBOTHER, 0, { 0, 0 }},
        { "atabus", -1, 166, DEVNODE_VECTOR, 0, { 4, 0 }},
-       { "drvctl", -1, 167, DEVNODE_SINGLE, 0, { 0, 0 }},
+       { "drvctl", -1, 167, DEVNODE_DONTBOTHER, 0, { 0, 0 }},
        { "dk", 168, 168, DEVNODE_DONTBOTHER, 0, { 0, 0 }},
        { "tap", -1, 169, DEVNODE_VECTOR, 0, { 4, 0 }},
        { "veriexec", -1, 170, DEVNODE_DONTBOTHER, 0, { 0, 0 }},



Home | Main Index | Thread Index | Old Index