Re: [PATCH 1/2] Add lib/glob.c

From: Randy Dunlap
Date: Sat May 10 2014 - 13:29:27 EST


On 05/09/2014 08:13 PM, George Spelvin wrote:
> This is a helper function from drivers/ata/libata_core.c, where it is used
> to blacklist particular device models. It's being moved to lib/ so other
> drivers may use it for the same purpose.
>
> This implementation in non-recursive, so is safe for the kernel stack.
>
> Signed-off-by: George Spelvin <linux@xxxxxxxxxxx>
> ---
> Finally rescued this from the back burner. The code size will go back
> down in the second patch which removes the old implementation, although
> the number of source line reflects more comments and a test driver.
>
> The infrastructure parts of this, such as the module name and Kconfig
> declarations, are something I haven't done before, and comments are
> appreciated.
>
> Tejun Heo <htejun@xxxxxxxxx> wrote:
>> On Wed, Mar 12, 2014 at 06:52:44PM -0400, George Spelvin wrote:
>>> Sure; I'll prepare some patches. May I feed it through you, or
>>> is there a lib/ maintainer I need to go through?
>>
>> Please keep me cc'd but you'd probably also want to cc Linus, Andrew
>> Morton and Ingo.
>
> include/linux/glob.h | 10 +++
> lib/Kconfig | 14 ++++
> lib/Makefile | 2 +
> lib/glob.c | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 251 insertions(+)
> create mode 100644 include/linux/glob.h
> create mode 100644 lib/glob.c

> diff --git a/lib/Kconfig b/lib/Kconfig
> index 991c98b..5333d10 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -373,6 +373,20 @@ config CPU_RMAP
> config DQL
> bool
>
> +config GLOB
> + tristate
> +# (Prompt disabled to reduce kbuild clutter until someone needs it.)
> +# prompt "glob_match() function"
> + help
> + This option provides a glob_match function for performing simple
> + text pattern matching. It is primarily used by the ATA code
> + to blacklist particular drive models, but other device drivers
> + may need similar functionality.
> +
> + All in-kernel drivers that require this function automatically

I would drop "automatically". It has to be coded.

> + select this option. Say N unless you are compiling an out-of
> + tree driver which tells you it depend on it.

To support out-of-tree drivers, I'm pretty sure that you will need
to use obj- instead of lib-. lib- drops unused code, like Tejun said.

> +
> #
> # Netlink attribute parsing support is select'ed if needed
> #


--
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/