Module Name:    src
Committed By:   jruoho
Date:           Tue Jun 21 06:23:38 UTC 2011

Modified Files:
        src/sys/dev: ccd.c cgd.c

Log Message:
Adjust the #ifdefs such that ccd(4) and cgd(4) show in
modstat(8) even if built into the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/ccd.c
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/cgd.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/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.139 src/sys/dev/ccd.c:1.140
--- src/sys/dev/ccd.c:1.139	Sun Jun 12 03:35:51 2011
+++ src/sys/dev/ccd.c	Tue Jun 21 06:23:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd.c,v 1.139 2011/06/12 03:35:51 rmind Exp $	*/
+/*	$NetBSD: ccd.c,v 1.140 2011/06/21 06:23:38 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.139 2011/06/12 03:35:51 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.140 2011/06/21 06:23:38 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,6 +98,7 @@
 #include <sys/buf.h>
 #include <sys/kmem.h>
 #include <sys/pool.h>
+#include <sys/module.h>
 #include <sys/namei.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
@@ -1532,27 +1533,29 @@
 }
 #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;
-	
+	int bmajor, cmajor, error = 0;
+
+	bmajor = cmajor = -1;
+
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+#ifdef _MODULE
 		ccdattach(4);
-		
+
 		return devsw_attach("ccd", &ccd_bdevsw, &bmajor,
 		    &ccd_cdevsw, &cmajor);
+#endif
 		break;
 
 	case MODULE_CMD_FINI:
+#ifdef _MODULE
 		return devsw_detach(&ccd_bdevsw, &ccd_cdevsw);
+#endif
 		break;
 
 	case MODULE_CMD_STAT:
@@ -1564,5 +1567,3 @@
 
 	return error;
 }
-
-#endif

Index: src/sys/dev/cgd.c
diff -u src/sys/dev/cgd.c:1.73 src/sys/dev/cgd.c:1.74
--- src/sys/dev/cgd.c:1.73	Sun Jun 12 03:35:51 2011
+++ src/sys/dev/cgd.c	Tue Jun 21 06:23:38 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.73 2011/06/12 03:35:51 rmind Exp $ */
+/* $NetBSD: cgd.c,v 1.74 2011/06/21 06:23:38 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.73 2011/06/12 03:35:51 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.74 2011/06/21 06:23:38 jruoho Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -40,6 +40,7 @@
 #include <sys/buf.h>
 #include <sys/bufq.h>
 #include <sys/malloc.h>
+#include <sys/module.h>
 #include <sys/pool.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
@@ -939,20 +940,22 @@
 }
 #endif
 
-#ifdef _MODULE
-
-#include <sys/module.h>
-
 MODULE(MODULE_CLASS_DRIVER, cgd, NULL);
+
+#ifdef _MODULE
 CFDRIVER_DECL(cgd, DV_DISK, NULL);
+#endif
 
 static int
 cgd_modcmd(modcmd_t cmd, void *arg)
 {
-	int bmajor = -1, cmajor = -1,  error = 0;
-	
+	int bmajor, cmajor, error = 0;
+
+	bmajor = cmajor = -1;
+
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+#ifdef _MODULE
 		error = config_cfdriver_attach(&cgd_cd);
 		if (error)
 			break;
@@ -964,7 +967,7 @@
 			    cgd_cd.cd_name);
 			break;
 		}
-		
+
 		error = devsw_attach("cgd", &cgd_bdevsw, &bmajor,
 		    &cgd_cdevsw, &cmajor);
 		if (error) {
@@ -972,15 +975,17 @@
 			config_cfdriver_detach(&cgd_cd);
 			break;
 		}
-		
+#endif
 		break;
 
 	case MODULE_CMD_FINI:
+#ifdef _MODULE
 		error = config_cfattach_detach(cgd_cd.cd_name, &cgd_ca);
 		if (error)
 			break;
 		config_cfdriver_detach(&cgd_cd);
 		devsw_detach(&cgd_bdevsw, &cgd_cdevsw);
+#endif
 		break;
 
 	case MODULE_CMD_STAT:
@@ -992,5 +997,3 @@
 
 	return error;
 }
-
-#endif

Reply via email to