Module Name: src Committed By: haad Date: Fri Jun 5 19:21:03 UTC 2009
Modified Files: src/sys/dev: ccd.c cgd.c Added Files: src/sys/modules/ccd: Makefile src/sys/modules/cgd: Makefile Log Message: Add work in support for compiling ccd and cgd drivers as a modules. I forgot to committ when I have written device module autoloading stuff. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/dev/ccd.c cvs rdiff -u -r1.57 -r1.58 src/sys/dev/cgd.c cvs rdiff -u -r0 -r1.1 src/sys/modules/ccd/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/cgd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ccd.c diff -u src/sys/dev/ccd.c:1.133 src/sys/dev/ccd.c:1.134 --- src/sys/dev/ccd.c:1.133 Sat Apr 4 08:29:39 2009 +++ src/sys/dev/ccd.c Fri Jun 5 19:21:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ccd.c,v 1.133 2009/04/04 08:29:39 ad Exp $ */ +/* $NetBSD: ccd.c,v 1.134 2009/06/05 19:21:02 haad Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. @@ -127,7 +127,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.133 2009/04/04 08:29:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.134 2009/06/05 19:21:02 haad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1563,3 +1563,38 @@ } } #endif + +#ifdef _MODULE + +#include <sys/module.h> + +MODULE(MODULE_CLASS_DRIVER, ccd, NULL); + +static int +ccd_modcmd(modcmd_t cmd, void *arg) +{ + int bmajor = -1, cmajor = -1, error = 0; + + switch (cmd) { + case MODULE_CMD_INIT: + ccdattach(4); + + return devsw_attach("ccd", &ccd_bdevsw, &bmajor, + &ccd_cdevsw, &cmajor); + break; + + case MODULE_CMD_FINI: + return devsw_detach(&ccd_bdevsw, &ccd_cdevsw); + break; + + case MODULE_CMD_STAT: + return ENOTTY; + + default: + return ENOTTY; + } + + return error; +} + +#endif Index: src/sys/dev/cgd.c diff -u src/sys/dev/cgd.c:1.57 src/sys/dev/cgd.c:1.58 --- src/sys/dev/cgd.c:1.57 Sat Mar 14 17:56:47 2009 +++ src/sys/dev/cgd.c Fri Jun 5 19:21:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cgd.c,v 1.57 2009/03/14 17:56:47 apb Exp $ */ +/* $NetBSD: cgd.c,v 1.58 2009/06/05 19:21:02 haad Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.57 2009/03/14 17:56:47 apb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.58 2009/06/05 19:21:02 haad Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -845,3 +845,38 @@ printf("%02x", (unsigned char) *c++); } #endif + +#ifdef _MODULE + +#include <sys/module.h> + +MODULE(MODULE_CLASS_DRIVER, cgd, NULL); + +static int +cgd_modcmd(modcmd_t cmd, void *arg) +{ + int bmajor = -1, cmajor = -1, error = 0; + + switch (cmd) { + case MODULE_CMD_INIT: + cgdattach(4); + + return devsw_attach("cgd", &cgd_bdevsw, &bmajor, + &cgd_cdevsw, &cmajor); + break; + + case MODULE_CMD_FINI: + return devsw_detach(&cgd_bdevsw, &cgd_cdevsw); + break; + + case MODULE_CMD_STAT: + return ENOTTY; + + default: + return ENOTTY; + } + + return error; +} + +#endif Added files: Index: src/sys/modules/ccd/Makefile diff -u /dev/null src/sys/modules/ccd/Makefile:1.1 --- /dev/null Fri Jun 5 19:21:03 2009 +++ src/sys/modules/ccd/Makefile Fri Jun 5 19:21:03 2009 @@ -0,0 +1,10 @@ +# $NetBSD: Makefile,v 1.1 2009/06/05 19:21:03 haad Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/dev + +KMOD= ccd +SRCS= ccd.c + +.include <bsd.kmodule.mk> Index: src/sys/modules/cgd/Makefile diff -u /dev/null src/sys/modules/cgd/Makefile:1.1 --- /dev/null Fri Jun 5 19:21:03 2009 +++ src/sys/modules/cgd/Makefile Fri Jun 5 19:21:03 2009 @@ -0,0 +1,10 @@ +# $NetBSD: Makefile,v 1.1 2009/06/05 19:21:03 haad Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/dev + +KMOD= cgd +SRCS= cgd.c cgd_crypto.c + +.include <bsd.kmodule.mk>