Source-Changes-HG archive

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

[src/thorpej-cfargs]: src/sys Add a config_probe() function. This is current...



details:   https://anonhg.NetBSD.org/src/rev/fa3412b6fd75
branches:  thorpej-cfargs
changeset: 1019757:fa3412b6fd75
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Apr 04 19:23:53 2021 +0000

description:
Add a config_probe() function.  This is currently a synonym for config_match(),
but exists so as to make a distinction between probing (as is done in indirect
configuration) and matching (which is done in direct configuration).

The intention is for direct config "submatch" routines to use config_match()
and for indirect config "search" routines to use config_probe().

diffstat:

 sys/kern/subr_autoconf.c |  21 ++++++++++++++++++---
 sys/sys/device.h         |   3 ++-
 2 files changed, 20 insertions(+), 4 deletions(-)

diffs (66 lines):

diff -r bdedb47a3b6d -r fa3412b6fd75 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Sun Apr 04 19:12:27 2021 +0000
+++ b/sys/kern/subr_autoconf.c  Sun Apr 04 19:23:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.277.2.11 2021/04/04 19:12:27 thorpej Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.277.2.12 2021/04/04 19:23:53 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.277.2.11 2021/04/04 19:12:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.277.2.12 2021/04/04 19:23:53 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1004,7 +1004,7 @@
 
 /*
  * Invoke the "match" routine for a cfdata entry on behalf of
- * an external caller, usually a "submatch" routine.
+ * an external caller, usually a direct config "submatch" routine.
  */
 int
 config_match(device_t parent, cfdata_t cf, void *aux)
@@ -1020,6 +1020,21 @@
        return (*ca->ca_match)(parent, cf, aux);
 }
 
+/*
+ * Invoke the "probe" routine for a cfdata entry on behalf of
+ * an external caller, usually an indirect config "search" routine.
+ */
+int
+config_probe(device_t parent, cfdata_t cf, void *aux)
+{
+       /*
+        * This is currently a synonym for config_match(), but this
+        * is an implementation detail; "match" and "probe" routines
+        * have different behaviors.
+        */
+       return config_match(parent, cf, aux);
+}
+
 static void
 config_get_cfargs(cfarg_t tag,
                  cfsubmatch_t *fnp,            /* output */
diff -r bdedb47a3b6d -r fa3412b6fd75 sys/sys/device.h
--- a/sys/sys/device.h  Sun Apr 04 19:12:27 2021 +0000
+++ b/sys/sys/device.h  Sun Apr 04 19:23:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.167.2.8 2021/04/04 19:12:28 thorpej Exp $ */
+/* $NetBSD: device.h,v 1.167.2.9 2021/04/04 19:23:53 thorpej Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -587,6 +587,7 @@
 device_t config_rootfound(const char *, void *);
 device_t config_attach(device_t, cfdata_t, void *, cfprint_t, cfarg_t, ...);
 int    config_match(device_t, cfdata_t, void *);
+int    config_probe(device_t, cfdata_t, void *);
 
 bool   ifattr_match(const char *, const char *);
 



Home | Main Index | Thread Index | Old Index