MODPROBE: next generation

Denys Vlasenko vda.linux at googlemail.com
Fri Jun 20 14:58:04 UTC 2008


On Tuesday 17 June 2008 19:24, dronnikov at gmail.com wrote:
> 0. Intro
> 
> depmod + modprobe is some kind of complicated codec.
> Though the syntax of modprobe.conf and friends is human-friendly most of module dependencies
> is intrinsic and are hardly a subject to be customized manually.
> du modules.* gives 150Kb on my reasonably small system and this amount of loosely defined textual data
> must be parsed at every modprobe invocation.
> 
> I suggest to invent for BB a custom modules.dep format which bites all above issues.
> 
> 1. Format of modules.dep (draft)
> 
> Consider a module X which depends on Y and Z, has aliases X1 and X2 and must be loaded with options O1 and O2.
> We could write this definition down as follows:
> 
> -------
> X
> Y Z
> X1 X2
> O1 O2
> -------
> 
> If any of parts of definition is missed we use empty line for it.
> No more continuation lines, delimiters and so on!
> Just mmap() the whole file and count for well-known amount of EOLs for each module and use skip_whitespace().
> <off>I wish we had gzmmap() invented (or have we?)</off>
> Extensions to such a format can be done trivially.
> 
> 9. Miscellany
> 
> depmod can be trivially (IMO) updated to generate new modules.dep
> Personally I think of depmod as of something redundant in terms of BB.
> modules.dep could be generated on-the-fly during the first call to modprobe if it is missed.
> 
> To not interfere with "old-style" modutils "new" modules.dep should be named, say, modules.bb.
> 
> Comments?

I must agree with others who say that divergence from "standard"
format is undesirable.

I see that your main concern is the size of this file (modprobe's
execution time is not so important since you do not run it often).

How about just teaching modprobe to use modules.dep.gz is it exists,
with fallback to modules.dep?

We already have open_transformer(), so you just call

fd = open_transformer(gzfile_fd, unpack_gz_stream, "gunzip");

and voila - you can gunzip file on the fly :)

gzip compresses modules.dep formatted file to ~1/20th of its size:

# wc -c <modules.dep
60646
# gzip <modules.dep | wc -c
3876

What do you think?
--
vda



More information about the busybox mailing list