[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1374770840.1957.4.camel@joe-AO722>
Date: Thu, 25 Jul 2013 09:47:20 -0700
From: Joe Perches <joe@...ches.com>
To: "Du, Changbin" <changbin.du@...il.com>
Cc: jbaron@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dynamic_debug: add wildcard support to filter
files/functions/modules
On Thu, 2013-07-25 at 21:02 +0800, Du, Changbin wrote:
> From: "Du, Changbin" <changbin.du@...il.com>
>
> This patch add wildcard '*'(matches zero or more characters) and '?'
> (matches one character) support when qurying debug flags.
Seems very useful. Caveat below.
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
[]
> @@ -127,6 +127,21 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
> query->first_lineno, query->last_lineno);
> }
>
> +static int match_pattern(char *pat, char *str)
> +{
> + switch (*pat) {
> + case '\0':
> + return !*str;
> + case '*':
> + return match_pattern(pat+1, str) ||
> + (*str && match_pattern(pat, str+1));
> + case '?':
> + return *str && match_pattern(pat+1, str+1);
> + default:
> + return *pat == *str && match_pattern(pat+1, str 1);
> + }
> +}
What's the maximum length string used today?
On a very long pattern, can this recursion cause stack overflow?
Other than that, I like it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists