[PATCH] modprobe and multiple options to modules

Rob Landley rob at landley.net
Wed Sep 28 21:37:24 UTC 2005


On Wednesday 28 September 2005 06:45, Yann E. MORIN wrote:
> Hi all!
>
> Could you review and comment this patch that allows modprobe to accept more
> than one option to modules?
...
> That looks like a lot... :-(

Yeah, it is a lot.

This code really should be shared with the shell and getopt(1) code.  
Unfortunately, _none_ of these share with each other (and I suspect the 
various shells don't either).

I've been meaning to take a stab at writing some generic code to parse a 
string into a command line.  There's lots of places we could use this, 
actually.

The code you've done isn't generic (nothing else is going to use mod_list_t), 
but the general concept is.  It seems like what you want is the ability to 
call some parse_command_string() function and have it append the split-up 
results to an argv[] you pass.  With details like error handling, bounds 
checking on the argv[] array (or possibly dynamically allocating the sucker, 
the MODPROBE_OPTIONS_NUMBER is a bit clumsy)...

This is an interesting problem to me and it's adjacent to other work I'm 
doing, but I'm not going to have _any_ time to work on it before monday.  
Tell you what: can you rename the parse function to parse_command_string(), 
move the do() loop outside so it doesn't have to know about the 
module-specific structure?  That way we can easily move this function to a 
separate file later to do more work on it and re-use it elsewhere, but for 
right now we can just check in a fix to modprobe without blocking the fix on 
the later work.

Sound good?

Rob



More information about the busybox mailing list