[PATCH 01/10] globalvar: add scopes to snapshot and restore globalvars

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Nov 12 05:27:55 PST 2026



On 11/12/26 2:25 PM, Sascha Hauer wrote:
> On 2026-11-12 09:41, Ahmad Fatoum wrote:
>>> +static bool globalvar_scope_match(const struct globalvar_scope *scope,
>>> +				  const char *name)
>>> +{
>>> +	const char * const *prefix;
>>> +
>>> +	for (prefix = scope->prefixes; *prefix; prefix++)
>>> +		if (str_has_prefix(name, *prefix))
>>> +			return true;
>> I see that the prefixes have a trailing . to avoid partial matches, but
>> I think that's a bit of a surprising API compared to do boundary matching
>> (or matching to the end of string _or_ dot). Just a nit.
> 
> How about using fnmatch()? prefixes would become "bootm.*", "boot.watchdog_timeout"

That would remove the ambiguity. GLOBALVAR already selects FNMATCH, so
why not.

> 
> Sascha
> 
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list