Re: [PATCH v2] dynamic_debug: add wildcard support to filterfiles/functions/modules

From: Andrew Morton
Date: Thu Oct 31 2013 - 18:53:00 EST

On Mon, 28 Oct 2013 23:29:10 +0800 "Du, Changbin" <changbin.du@xxxxxxxxx> wrote:

> This patch add wildcard '*'(matches zero or more characters) and '?'
> (matches one character) support when qurying debug flags.
> Now we can open debug messages using keywords. eg:
> 1. open debug logs in all usb drivers
> echo "file drivers/usb/* +p" > <debugfs>/dynamic_debug/control
> 2. open debug logs for usb xhci code
> echo "file *xhci* +p" > <debugfs>/dynamic_debug/control

This patch would be a lot easier to understand (and hence review) if
you had remembered to update Documentation/dynamic-debug-howto.txt!

> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -127,6 +127,41 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
> query->first_lineno, query->last_lineno);
> }
> +/* check if the string matches given pattern which includes wildcards */
> +static int match_pattern(const char *pattern, const char *string)

No, something like this should be in lib/ so that other callers can use
it. We already have at least one copy handy in
drivers/ata/libata-core.c:glob_match(). A better approach would be to
move that glob_match() into lib/glob_match.c then teach dynamic_debug
to use it.

There are probably other private globbing functions lying around the
kernel, but it's rather a hard thing to grep for...
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at