lkml.org 
[lkml]   [2014]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] Add lib/glob.c
On Sat, 10 May 2014 08:21:38 -0400, Tejun Heo wrote:
> On Fri, May 09, 2014 at 11:13:56PM -0400, George Spelvin wrote:
>> +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
>> + select this option. Say N unless you are compiling an out-of
>> + tree driver which tells you it depend on it.

> Just adding glob.o to lib-y should be enough. It will be excluded
> from linking if unused.

But, I just confirmed, it will also be excluded from linking if
CONFIG_ATA=m. See for example commit b4d3ba3346f0 where some helpers
had to be moved from lib-y to obj-y to fix module load errors.
(Thanks to Randy Dunlap for this example.)

>> +#else
>> +
>> +#include <linux/module.h>
>> +#include <linux/glob.h>
>> +
>> +MODULE_DESCRIPTION("glob(7) matching");
>> +MODULE_LICENSE("Dual MIT/GPL");

> Do we make library routines separate modules usually?

There are basically three options I can see:
1) Make it non-configurable and always include the code in the kernel
using oby-y, and just accept the wasted space if CONFIG_ATA=n
2) Make it a boolean option, so CONFIG_ATA=m will force CONFIG_GLOB=y and
it will be included in the static kernel but unused until the module
is loaded.
3) Make it a tristate option, which compiles into the kernel if
CONFIG_ATA=y (the common case), and is its own module if CONFIG_ATA=m.
An awful lot of the files in lib/ take this approach.

Do you have a preference? Option 3 is the current status.

(Revised patch will come when I have the self-test converted.)


\
 
 \ /
  Last update: 2014-05-11 08:41    [W:0.032 / U:1.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site