Module Name: src
Committed By: thorpej
Date: Sun Apr 4 19:23:54 UTC 2021
Modified Files:
src/sys/kern [thorpej-cfargs]: subr_autoconf.c
src/sys/sys [thorpej-cfargs]: device.h
Log Message:
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().
To generate a diff of this commit:
cvs rdiff -u -r1.277.2.11 -r1.277.2.12 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.167.2.8 -r1.167.2.9 src/sys/sys/device.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.277.2.11 src/sys/kern/subr_autoconf.c:1.277.2.12
--- src/sys/kern/subr_autoconf.c:1.277.2.11 Sun Apr 4 19:12:27 2021
+++ src/sys/kern/subr_autoconf.c Sun Apr 4 19:23:53 2021
@@ -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 @@ config_cfdata_detach(cfdata_t cf)
/*
* 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 @@ config_match(device_t parent, cfdata_t c
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 */
Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.167.2.8 src/sys/sys/device.h:1.167.2.9
--- src/sys/sys/device.h:1.167.2.8 Sun Apr 4 19:12:28 2021
+++ src/sys/sys/device.h Sun Apr 4 19:23:53 2021
@@ -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_found(device_t, void *,
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 *);