Source-Changes-HG archive

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

[src/pgoyette-localcount]: src/sys/rump/dev/lib/libcgd since we're now attach...



details:   https://anonhg.NetBSD.org/src/rev/b21f3116f18c
branches:  pgoyette-localcount
changeset: 852857:b21f3116f18c
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jul 24 10:37:10 2016 +0000

description:
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.

diffstat:

 sys/rump/dev/lib/libcgd/cgd_component.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (46 lines):

diff -r be71de271218 -r b21f3116f18c sys/rump/dev/lib/libcgd/cgd_component.c
--- a/sys/rump/dev/lib/libcgd/cgd_component.c   Sun Jul 24 05:39:28 2016 +0000
+++ b/sys/rump/dev/lib/libcgd/cgd_component.c   Sun Jul 24 10:37:10 2016 +0000
@@ -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 @@
 {
        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);
 }



Home | Main Index | Thread Index | Old Index