[Toybox] [PATCH] modprobe: add -d option to specify module directory path(s)

Rob Landley rob at landley.net
Sat Jan 28 15:34:43 PST 2017



On 01/25/2017 06:20 PM, enh wrote:
> On Wed, Jan 25, 2017 at 3:59 PM, Steve Muckle <smuckle at google.com> wrote:
>> While most systems have their kernel modules, modules.dep etc located at
>> /lib/modules/`uname -r` this is not always the case.
> 
> in case it isn't obvious: "...such as on Android".

I figured that out. :)

>> The -d option may be used to specify a nonstandard path for these files.
>> It may be used more than once to specify multiple directories where
>> these files may be found.
> 
> +    TT.dirs->arg = xmalloc(strlen(MODULE_BASE_DIR) + strlen(uts.release) + 1);
> +    strcpy(TT.dirs->arg, MODULE_BASE_DIR);
> +    strcat(TT.dirs->arg, uts.release);
> 
> or xmprintf?

Yeah, and move MODULE_BASE_DIR inline. And while I'm there...

I put a blank space between GLOBALS() filled out by option parsing and
the ones zeroed on entry.

The dummy() function and TT.debug means the code is always compiled in,
I switched TT.dbg to if (toys.optflags&FLAG_v) before each one because
if I want to get the code to drop out at compile time someday (via dead
code elimination when FLAG_v is zero) I can do that. (But I haven't yet
moved FLAG_v under TOYBOX_DEBUG because Android doesn't enable
CFG_TOYBOX_DEBUG so moving FLAG_v under that would be a behavior
difference for you guys. Thought you used that but double checking it's
off...)

Speaking of which: CONFIG_TOYBOX_DEBUG enables extra error checking and
error messages, mostly for things that can only be screwed up by
modifying the source, not at runtime. It also enables patch -x to show
the very verbose decisions it's making about what counts as a match. It
sounds like the kind of thing Android would want to enable anyway. :)

(I need to fix the option assembly logic so FLAG_x and FLAG_v can be in
a separate CONFIG option and the help entries get collated properly. It
worked at one point, I wonder what broke...)

That's probably enough for now, working through the backlog of release
todo items...

Rob



More information about the Toybox mailing list