From ff8750baf39dfc8936ba4e689fe05abe04cd41c7 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 16 Jan 2015 17:58:21 -0800 Subject: [PATCH] kernel - Augment resource_string_value() to check kenv. * resource_string_value() now checks for a kenv hint called ., similar to how resource_int_value() and resource_long_value() work. --- sys/kern/subr_bus.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 3a64b1d366..79a3b62b73 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2124,6 +2124,14 @@ resource_string_value(const char *name, int unit, const char *resname, { int error; struct config_resource *res; + char buf[64]; + const char *env; + + ksnprintf(buf, sizeof(buf), "%s%d.%s", name, unit, resname); + if ((env = kgetenv(buf)) != NULL) { + *result = env; + return 0; + } if ((error = resource_find(name, unit, resname, &res)) != 0) return(error); -- 2.11.4.GIT