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.
This commit is contained in:
parent
5a9be9571b
commit
aeebcff218
|
@ -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 = LIST_HEAD_INITIALIZER(ccds);
|
|||
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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue