diff options
| author | pgoyette <pgoyette@NetBSD.org> | 2016-07-25 12:45:13 +0000 |
|---|---|---|
| committer | pgoyette <pgoyette@NetBSD.org> | 2016-07-25 12:45:13 +0000 |
| commit | b243e6a45ccc28f7aaa5539bc06fc2b1e5b5ff1b (patch) | |
| tree | c89d4412be0dbe6de8ec05f85765c88cb46fb5dc /sys/rump/dev | |
| parent | db0ef349a8370be7e32e23a811b53b73351db4cc (diff) | |
When initializing the rump cgd component, use the correct driver name
(as found in the devsw_conv[] table). This will get us the "official"
major numbers for the cgd device.
After creating the rump file-space nodes for /dev/cgd* we then need to
detach the [bc]devsw's because normal module initialization will do its
own attachment, and we don't want that to fail.
While here, since we're doing the devsw_attach() twice, share the
results from the first call rather than starting from scratch.
Diffstat (limited to 'sys/rump/dev')
| -rw-r--r-- | sys/rump/dev/lib/libcgd/cgd_component.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/rump/dev/lib/libcgd/cgd_component.c b/sys/rump/dev/lib/libcgd/cgd_component.c index 232e6508bbd..3e19a8be43b 100644 --- a/sys/rump/dev/lib/libcgd/cgd_component.c +++ b/sys/rump/dev/lib/libcgd/cgd_component.c @@ -1,4 +1,4 @@ -/* $NetBSD: cgd_component.c,v 1.2 2016/01/26 23:12:15 pooka Exp $ */ +/* $NetBSD: cgd_component.c,v 1.3 2016/07/25 12:45:13 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 2016/01/26 23:12:15 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgd_component.c,v 1.3 2016/07/25 12:45:13 pgoyette Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -40,20 +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); } |
