Module Name: src Committed By: pgoyette Date: Sun Aug 7 02:40:41 UTC 2016
Modified Files: src/sys/dev: ccd.c Log Message: Create the kern.ccd sysctl sub-tree when built as a module. Even though the contents of the sub-tree are all structures, and thus not displayed via sysctl(8), the info is potentially useful to programs. (For example, ccdconfig could use this to determine how many units are available.) The sub-tree is already available when the module is included as built-in module. To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/sys/dev/ccd.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.166 src/sys/dev/ccd.c:1.167 --- src/sys/dev/ccd.c:1.166 Tue Dec 8 20:36:14 2015 +++ src/sys/dev/ccd.c Sun Aug 7 02:40:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ccd.c,v 1.166 2015/12/08 20:36:14 christos Exp $ */ +/* $NetBSD: ccd.c,v 1.167 2016/08/07 02:40:41 pgoyette 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.166 2015/12/08 20:36:14 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.167 2016/08/07 02:40:41 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -220,6 +220,12 @@ static LIST_HEAD(, ccd_softc) ccds = LIS static kmutex_t ccd_lock; static size_t ccd_nactive = 0; +#ifdef _MODULE +static struct sysctllog *ccd_clog; +#endif + +SYSCTL_SETUP_PROTO(sysctl_kern_ccd_setup); + static struct ccd_softc * ccdcreate(int unit) { struct ccd_softc *sc = kmem_zalloc(sizeof(*sc), KM_SLEEP); @@ -1665,6 +1671,7 @@ ccd_modcmd(modcmd_t cmd, void *arg) error = devsw_attach("ccd", &ccd_bdevsw, &bmajor, &ccd_cdevsw, &cmajor); + sysctl_kern_ccd_setup(&ccd_clog); #endif break; @@ -1679,6 +1686,7 @@ ccd_modcmd(modcmd_t cmd, void *arg) error = devsw_detach(&ccd_bdevsw, &ccd_cdevsw); ccddetach(); } + sysctl_teardown(&ccd_clog); #endif break;