Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Create the kern.ccd sysctl sub-tree when built as a ...



details:   https://anonhg.NetBSD.org/src/rev/d19cb4d4fa80
branches:  trunk
changeset: 346928:d19cb4d4fa80
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Aug 07 02:40:41 2016 +0000

description:
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.

diffstat:

 sys/dev/ccd.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r fb43007e2777 -r d19cb4d4fa80 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Sun Aug 07 02:31:03 2016 +0000
+++ b/sys/dev/ccd.c     Sun Aug 07 02:40:41 2016 +0000
@@ -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 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 @@
 
                error = devsw_attach("ccd", &ccd_bdevsw, &bmajor,
                    &ccd_cdevsw, &cmajor);
+               sysctl_kern_ccd_setup(&ccd_clog);
 #endif
                break;
 
@@ -1679,6 +1686,7 @@
                        error = devsw_detach(&ccd_bdevsw, &ccd_cdevsw);
                        ccddetach();
                }
+               sysctl_teardown(&ccd_clog);
 #endif
                break;
 



Home | Main Index | Thread Index | Old Index