Module Name:    src
Committed By:   pgoyette
Date:           Sun Jul 24 10:37:10 UTC 2016

Modified Files:
        src/sys/rump/dev/lib/libcgd [pgoyette-localcount]: cgd_component.c

Log Message:
since we're now attached the [bc]devsw's, grabbing the assigned majors,
and then detaching (in anticipation of the driver module doing its own
attach), we need to make sure that the driver name matches what is
expected in devsw_attach().  In particular, the driver name is "cgd"
and not "/dev/cgd0"  :)

While here, we might as well record the major numbers from the first
call, and just reuse them later.  So make the module's variables global,
and reference them in the rump initialization code.

Yay - cgd now works in the localcount world, both as a kernel module
and as a rump component.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/rump/dev/lib/libcgd/cgd_component.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/dev/lib/libcgd/cgd_component.c
diff -u src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2.2.2 src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2.2.3
--- src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2.2.2	Sat Jul 23 07:41:14 2016
+++ src/sys/rump/dev/lib/libcgd/cgd_component.c	Sun Jul 24 10:37:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgd_component.c,v 1.2.2.2 2016/07/23 07:41:14 pgoyette Exp $	*/
+/*	$NetBSD: cgd_component.c,v 1.2.2.3 2016/07/24 10:37:10 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd_component.c,v 1.2.2.2 2016/07/23 07:41:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd_component.c,v 1.2.2.3 2016/07/24 10:37:10 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -40,21 +40,21 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 {
 	extern const struct bdevsw cgd_bdevsw;
 	extern const struct cdevsw cgd_cdevsw;
-	devmajor_t bmaj, cmaj;
+	extern devmajor_t cgd_bmajor, cgd_cmajor;
 	int error;
 
 	/* go, mydevfs */
-	bmaj = cmaj = -1;
 
-	if ((error = devsw_attach("/dev/cgd0", &cgd_bdevsw, &bmaj,
-	    &cgd_cdevsw, &cmaj)) != 0)
+	if ((error = devsw_attach("cgd", &cgd_bdevsw, &cgd_bmajor,
+	    &cgd_cdevsw, &cgd_cmajor)) != 0)
 		panic("cannot attach cgd: %d", error);
 
 	if ((error = rump_vfs_makedevnodes(S_IFBLK, "/dev/cgd0", 'a',
-	    bmaj, 0, 7)) != 0)
+	    cgd_bmajor, 0, 7)) != 0)
 		panic("cannot create cooked cgd dev nodes: %d", error);
 	if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/rcgd0", 'a',
-	    cmaj, 0, 7)) != 0)
+	    cgd_cmajor, 0, 7)) != 0)
 		panic("cannot create raw cgd dev nodes: %d", error);
+
 	devsw_detach(&cgd_bdevsw, &cgd_cdevsw);
 }

Reply via email to