aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2011-12-17depmod: fix tabs in help outputHEADmasterdevMike Frysinger1-1/+1
Don't mix spaces and tabs in the help output so things always line up. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-12-15announce: module-init-tools to be replaced with new library-based toolsJon Masters1-0/+6
Work is in progress to replace this existing code base with a new one. Updated the README file with details. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02Merge branch 'dev'Jon Masters3-2/+4
Conflicts: ChangeLog Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02release: bump release to 3.16Jon Masters2-1/+4
Fix another build problem encountered in Fedora build system. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02build: remove stale modprobe.d.5 from top-level directoryJon Masters1-1/+0
This was breaking some builds when the stale file was detected. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02Merge branch 'dev' of ↵Jon Masters0-0/+0
master.kernel.org:/pub/scm/utils/kernel/module-init-tools/module-init-tools into dev Conflicts: ChangeLog Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02Merge branch 'master' of ↵Jon Masters0-0/+0
master.kernel.org:/pub/scm/utils/kernel/module-init-tools/module-init-tools Conflicts: ChangeLog Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02release: bump release to 3.15Jon Masters2-1/+5
A brown paper bag fix for 3.14 to correct man page output handling. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02doc: properly fix documentation generationJon Masters3-8/+7
The docbook2man package does not allow output to be written to standard out, nor does the SGML allow for more than one file to be created. A previous hack was to use symlinks and hope for the best. Rather than doing this, retain the symlinks, but explicitly match on them during build and create symlinks to the output files. Furthermore, clean up the documentation source files to remove invalid multiple outputs. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02changelog: update changelog for missing v3.14 changesJon Masters1-0/+8
Fix the changelog. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02changelog: fix the changelog for v3.14 releaseJon Masters1-0/+8
Quick edit to the 3.14 release to include an updated changelog. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02release: bump the release to 3.14Jon Masters1-1/+1
This pi release includes various fixes, an updated build release system, and improved code documentation. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-02build: fix release process to drive tools such as git, gpg, and scpJon Masters1-3/+54
The legacy release process was outdated. Fix it to use modern tools, and create additional make targets, such as "push" to kernel.org. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01todo: add various todo itemsJon Masters1-1/+9
Some more todos, this time for modprobe Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01modprobe: add documentation and clean upJon Masters1-35/+413
Add proper function documentation and clean up Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01modprobe: cleanup source, Free Software Foundation mailing address.Jon Masters1-17/+20
The FSF GPLv2 boilerplate has needed updating for a long, long time. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01depmod: cleanup source, Free Software Foundation mailing address.Jon Masters1-3/+19
The FSF GPLv2 boilerplate has needed updating for a long, long time. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01todo: update todo with various cleanup exercisesJon Masters1-0/+8
Some cleanup activities for depmod, and more generally. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01depmod: add function documentationJon Masters1-15/+377
Document various functions within depmod. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01todo: add a note to fix depmod list handling wheel re-invention diseaseJon Masters1-0/+1
There are too many different functions basically managing lists in depmod. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01doc: describe the incompatibility of the -E and -F optionsJon Masters1-0/+2
These options are incompatible. Make sure that is clear. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01doc: add description of -m depmod parameterJon Masters1-0/+13
The -m depmod parameter forces generation of legacy map files. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01doc: add description of -w depmod parameterJon Masters1-0/+11
The -w parameter can be used to instruct depmod to detect duplicates when generating its index tables. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-06-01doc: add documentation for depmod -P argumentJon Masters1-2/+14
The -P argument can be supplied to specify a prefix character to strip from all symbols. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-31doc: add documentation for modules.devname depmod filesJon Masters1-0/+4
Depmod has an ability to output a file named modules.devname containing a list of all "devname" aliases provided by modules. This file is read by a utility such as udev, which can create necessary devices in /dev. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-31doc: add description of -E (--symvers) option to depmod manpageJon Masters1-0/+14
A previous patch added support for verifying the list of symbols supplied by modules matches with the kernel list. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-31doc: fix alignment of depmod SYNOPSIS in man pageJon Masters1-2/+2
Add an additional space character to fix formatting in SYNOPSIS. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-31logs: update changelog and authors fileJon Masters2-0/+22
These files were a little out of date. There's always the git history, but it's nice to have a record of various relevant changes here too. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-31release: bump release to 3.13Jon Masters1-1/+1
This latest release includes multiple modprobe configuration directories (allowing for runtime preference /run/modprobe.d, /etc/modprobe.d, /usr/local/lib/modprobe.d, /lib/modprobe.d). There is also support for kernel versions other than 2.6.x since a 3.x release is forthcoming. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-31modprobe: remove extraneous info() callJon Masters1-2/+0
A previous patch for multiple modprobe configuration directories added a call to info() for each configuration file loaded. This breaks various existing behavior (for example --show-depends output) and so is reverted for now. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-31depmod: Handle X.Y kernel versionsMichal Marek1-1/+1
What a stupid check. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-30modprobe: implement precedence of configuration directoriesTom Gundersen1-25/+44
Configuration files are parsed in alphabetic order, regardles of what directory they reside in. Furthermore, if several files by the same name exist in different directories only the one in the directory with highest precedence is loaded. The order of precedence is /run, /etc, /usr/local/lib, /lib. Cc: Jon Masters <jcm@jonmasters.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Aaron Griffin <aaron@archlinux.org> Cc: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Tom Gundersen <teg@jklm.no> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-30modprobe: use more than one config directoryTom Gundersen1-64/+73
Read config files from the following directories: /run/modprobe.d config files generated at runtime, useful e.g. for compatibility with non-standard config files (such as /etc/rc.conf in Arch) /etc/modprobe.d config files manually created by the administrator /lib/modprobe.d config files installed by third-party packages /usr/local/lib/modprobe.d config files during development of third-party packages This scheme is the same as the one employed by udev, systemd and possibly others. A follow-up patch lets files in one directory override files in others, as done elsewhere. Cc: Jon Masters <jcm@jonmasters.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Aaron Griffin <aaron@archlinux.org> Cc: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Tom Gundersen <teg@jklm.no> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-05-30modprobe: blacklist modules on kernel commandlineTom Gundersen1-2/+15
Modules mod1, mod2 and mod3 can now be blacklisted by passing modprobe.blacklist=mod1,mod2,mod3 on the kernel command line. This is useful in case a module prevents the system from booting. Cc: Jon Masters <jcm@jonmasters.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Aaron Griffin <aaron@archlinux.org> Cc: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Tom Gundersen <teg@jklm.no> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2011-04-13testsuite: check size against the right fileKeegan McAllister1-1/+1
Signed-off-by: Keegan McAllister <keegan@ksplice.com>
2011-04-13testsuite: remove modprobe module renaming testKeegan McAllister1-100/+0
Support for this feature was removed in 30df3f6e. Signed-off-by: Keegan McAllister <keegan@ksplice.com>
2011-04-13testsuite: pass -F to depmod when passing -eKeegan McAllister10-48/+66
depmod -e without -E or -F will print a warning and have no effect. Signed-off-by: Keegan McAllister <keegan@ksplice.com>
2011-04-13testsuite: mock unlink()Keegan McAllister1-0/+11
Needed by depmod. Signed-off-by: Keegan McAllister <keegan@ksplice.com>
2011-04-13testsuite: export TEST_ENDIAN and TEST_BITSKeegan McAllister1-0/+2
These environment variables were introduced in f2668710 but were not exported by tests/runtests. As a result, a lot of tests were silently failing to run. Signed-off-by: Keegan McAllister <keegan@ksplice.com>
2011-04-13m-i-t: constifyMike Frysinger7-12/+12
Constify a bunch of data structures that need not be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-13depmod/modprobe: localize functions/variablesMike Frysinger2-13/+13
No reason for these guys to be exported, so mark them all static. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-13depmod: new --symbol-prefix optionMike Frysinger1-5/+23
Some ports (like the Blackfin architecture) prefix all their symbols with an underscore. So add a new --symbol-prefix option to support this. In the past, I've always used depmod.pl from busybox, so the limitation in m-i-t's depmod wasn't a blocker for me. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-06-07release: module-init-tools v3.12Jon Masters1-1/+1
The latest version of module-init-tools contains new features such as "devname" and "softdep" alias support, as well as various bug fixes and other miscellaneous enhancements. A detailed list of changes is also available on modules.wiki.kernel.org: https://modules.wiki.kernel.org/index.php/Module_init_tools_3_12 Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-05-25depmod: export static device node information to modules.devnameKay Sievers1-0/+38
To be able to let udev support kernel module on-demand loading, the next kernel will export: alias: devname:<name> for some well-defined common kernel modules. This will let the kernel call modprobe when the device node is accessed, the subsystem/driver will be initialized and the open() of the device node will magically succeed. The static device node aliases will be carried in the module itself. depmod extracts this information: $ cat /lib/modules/2.6.34-00650-g537b60d-dirty/modules.devname # Device nodes to trigger on-demand module loading. microcode cpu/microcode c10:184 fuse fuse c10:229 ppp_generic ppp c108:0 tun net/tun c10:200 dm_mod mapper/control c10:235 Udev will pick up the depmod created file on startup and create all the static device nodes which the kernel modules specify, so that these modules get automatically loaded when the device node is accessed: $ /sbin/udevd --debug ... static_dev_create_from_modules: mknod '/dev/cpu/microcode' c10:184 static_dev_create_from_modules: mknod '/dev/fuse' c10:229 static_dev_create_from_modules: mknod '/dev/ppp' c108:0 static_dev_create_from_modules: mknod '/dev/net/tun' c10:200 static_dev_create_from_modules: mknod '/dev/mapper/control' c10:235 udev_rules_apply_static_dev_perms: chmod '/dev/net/tun' 0666 udev_rules_apply_static_dev_perms: chmod '/dev/fuse' 0666 Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-05-25depmod: add some comments to the codeJon Masters2-5/+8
Some comments I was working on recently. More coming later. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-05-25BUGS: Update the bugs fileJon Masters1-0/+7
2010-05-25BUGS: Tracking bugs being worked on from bugzillaJon Masters1-0/+11
BUGS contains bugs being worked on/status if they are simple enough for ease of reference - canonical source is bugzilla.kernel.org Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-05-04pre-release: module-init-tools v3.12-pre3Jon Masters1-1/+1
A few more misc. fixes. Assuming nothing blows up 3.12 will follow with a couple more fixes shortly after this one. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-05-04build: handle old (System V) style wc outputAlan Jenkins1-3/+3
wc -w may output " 0" instead of "0". Handle this using an integer comparison (instead of a string comparison). Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-17modprobe: try to remove unused modules firstAlan Jenkins1-1/+36
This allows e.g. removing all alsa modules with modprobe -r `lsmod|cut -d " " -f1|grep snd` or even removing all currently unused modules. modprobe -r `lsmod|cut -d " " -f1|grep -v Module`
2010-03-17modprobe: pull underscores() out of do_modprobe()Alan Jenkins1-7/+10
The softdep parser should probably have done the conversion already. Both callers (do_softdep() and main()) are able to run underscores() in-place. So this means we don't need to allocate and free a copy. It also makes the next commit easier.
2010-03-17modprobe: --dump-modversions takes one filename onlyAlan Jenkins2-7/+8
[--all would have worked, but that wasn't documented as a feature] Fix the documentation. Move the code out of the top-level loop. This also makes the next commit easier.
2010-03-17modprobe: remove some redundant softdep codeAlan Jenkins1-8/+0
If we can't find a module, we don't need to check for a softdep. The initial softdep design allowed you to define "fake" modules, in the same way as with install commands. But we decided this had only bad effects, so the feature was removed.
2010-03-17modprobe: remove support for renaming modulesAlan Jenkins4-136/+19
This was prompted by the observation that do_softdep() doesn't implement module renaming. Searching for "modprobe -o" and "modprobe --name" turns up two possible uses: creating multiple instances of the "bonding" or "dummy" network devices. Modern kernels provide cleaner ways to do this. The old way using "modprobe --name" doesn't work any more. <https://bugzilla.redhat.com/show_bug.cgi?id=247718> "Bonding Module fails to recognise the '-o' parameter on load" Comment #1 should explain how to resolve this issue. To create an additional bond on rhel5, please do this: # echo another_name > /sys/class/net/bonding_masters rather than using modprobe. The kernel's bonding code now uses sysfs for configuration of multiple bonds <http://lkml.org/lkml/2007/6/8/381> "2.6 kernel: Cannot make multiple dummy network interfaces" [solution was to use the "numdummies" module option]
2010-03-17modprobe: fix softdep flagsAlan Jenkins1-6/+10
1. When a softdep is present, all the flags e.g. --use-blacklist are being ignored. Fix that. 2. When processing softdeps, mask out the "first_time" flag. This brings them into line with both install commands and normal dependencies. (We don't need to worry about "ignore_commands", because it would prevent softdeps from being loaded in the first place). If we're unloading, we should also mask in the "quiet_inuse" flag.
2010-03-17modprobe: fix dump_configAlan Jenkins1-4/+1
I broke this when refactoring the config handling. --show-config ended up printing the contents of user config files twice. Also parse_kcmdline() was always called with dump_only=1, regardless of whether --show-config was requested.
2010-03-17doc: fix sgml errorsAlan Jenkins3-4/+2
2010-03-16doc: fix typoAlan Jenkins1-1/+1
2010-03-10build: remove explicit call to build modules.dep.binJon Masters1-1/+1
There's a known bug with docbook2man in some cases (Fedora) not following multiple names for a manpage and only generating a single output file. We use links in the source to ensure those other versions will be built if possible. A better fix will be to figure out how to make docbook2man behave. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-10build: fix the release location for automated buildsJon Masters1-1/+1
The location for my test builds is in a new directory. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-10doc: fix reference for modules.dep.binJon Masters1-0/+2
The build scripts calling out to docbook2man need to have entries in the individual man page sources for each of the output files. Correct the missing entry for the modules.dep.bin file. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-10pre-release: module-init-tools v3.12-pre2Jon Masters1-1/+1
The latest pre-release version including all of the hard work on softdep support from Andreas and some cleanups from Alan and I. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-10modprobe: fix the softdep docs and re-order the modprobe.conf man pageJon Masters1-31/+34
The softdep docs were great but I cleaned them up slightly, and I also added a warning to the new COMPATIBILITY section I had added recently. Also, re-order this file so that everything is in alphabetical order. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-10modprobe: trivial cleanups post-merge of softdep bitsJon Masters1-1/+3
In order to merge in the softdep bits from alan, I wound up resetting the dev tree and remerging the whole lot. Next time, I'll just review the patches in another tree and then pull the lot, which is better. These two trivial differences were in my tree and are ok to keep. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-10Merge branch 'alan-softdep-merge' into devJon Masters12-305/+627
2010-03-09depmod: trivial add comment to depmod.hJon Masters1-0/+4
Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-04config_filter: add some documentationJon Masters2-0/+15
Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-02doc: Further documentation updates and rewritesJon Masters7-75/+123
The documentation has been sadly lacking. Fortunately, there is a new wiki and some great plans for content on module design/implementation. Until that is all done, at least get these docs in better shape. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-02tests: enable leak checking under --valgrindalan-softdep-mergeAlan Jenkins1-1/+1
Since we have squashed all the leaks (or at least the ones that show up in the test suite), we can now use valgrind to look out for new ones. One of the reasons for this exercise is the index code, which mixes recursion with allocating and freeing memory. Memory leaks may not cause any problems at run-time - but they're still bugs, and bugs can make code harder to maintain.
2010-03-02Merge branch 'cleanups' into softdep-mergeAlan Jenkins16-175/+421
Conflicts: modprobe.c
2010-03-02modprobe: re-use config data across multiple calls to do_modprobe()alan-softdep-cleanupsAlan Jenkins1-54/+42
This avoids having do_softdep() leak the memory allocated for config data.
2010-03-02modprobe: complete the separation of config parsing and alias resolutionAlan Jenkins1-43/+96
The parser now records all the aliases from the config file, deferring alias resolution to do_modprobe(). This will allow the config data to be re-used across multiple invocations of do_modprobe().
2010-03-02modprobe: clean up minor memory leaksAlan Jenkins2-14/+47
- "struct module" - use of setenv() - internal node leak in index_search() and index_searchwild() - some of the more obscure modprobe options, which were bypassing the cleanup code in main() I can see only one more leak (which occurred during the softdep work): - the contents of "struct modprobe_conf"
2010-03-02modprobe: re-enable inadvertently disabled optionsJon Masters1-1/+1
At some point several short options versions (-S, -D, -R) were inadvertently disabled. The first is used to override the kernel version, the second is used to dump dependency information, and the third dumps resolved alias information. The documentation was updated in the manpages in the previous commit and is now in sync with how modprobe is actually implemented. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-03-02doc: cleanup all of the man page documentationJon Masters11-274/+327
The man pages have suffered from a little bitrot over time. Fix that by updating them with references to recent changes, noting some planned future behavioral changes (modprobe "install" commands), and improve readability by re-ordering modprobe options to ensure everything is documented in the current release. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-02-28meta: update various documentation, logs, authors, etc.Jon Masters3-2/+33
The various files within the tree documenting who did what and when were rather sadly out of date. I have begun cleaning this up properly. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-02-26modprobe: refactor read_aliases()Alan Jenkins1-17/+27
It doesn't care whether we are "removing", and it only parses aliases (not an entire config). Enhance readability by splitting it into two functions, for binary and text files respectively. This matches the way read_depends() is written. Fix some sites to use read_aliases() instead of parse_config_file().
2010-02-25insmod: fix memory leakalan-cleanupsAlan Jenkins1-4/+9
insmod makes a half-successful attempt to clean up on failure. Let's make it clean up on all failures, and remember to clean up on success as well. This leaves modprobe as the only leaky program, at least for the code paths executed by the test suite. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2010-02-25modprobe: fix memory leak when built with zlib supportAlan Jenkins4-75/+5
We don't use posix file locks anymore, so we don't need to play games with fds, and we don't need to worry about dropping locks when we close fds. This allows us to simplify the code a bit and remove the intentional memory leak. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2010-02-25elfops: fix crash on grab_fd() failureAlan Jenkins1-5/+8
If we call release_elf_file() when grab_fd() fails, it will call release_file() with a NULL pointer and undefined length. This can cause a crash when zlib support is disabled and release_file() is implemented using munmap(). This is only theoretical at the moment. However it will allow grab_elf_file_fd() to be removed straightforwardly, without creating a more significant bug. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2010-02-25modprobe: fix potential memory leak on failure pathAlan Jenkins1-1/+1
Ensure release_elf_file() is called on a rare failure path. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2010-02-25modprobe: simplify insmod() calling convention - don't free optstringAlan Jenkins1-20/+24
There's no need to clobber optstring; we can afford to make a copy. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2010-02-25modprobe: clean up mit_ignore_loaded flag in rmmod()Alan Jenkins1-8/+8
handle_module() clears mit_ignore_loaded before calling rmmod(). So we didn't really want to set it in the first place! Also, rmmod() uses the flag to mean something which differs both from the name itself, and the way it is used in insmod(). Replace the mit_ignore_loaded in rmmod() with a new flag mit_quiet_inuse (it means not to complain if the module cannot be removed because it is in use). Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2010-02-24Fix SGML docs in module-init-tools-3.11Thomas Koeller1-2/+0
Hi Jon, there is a bug in module-init-tools-3.11 that leads to an error when building the man pages. The patch below fixes it. Signed-off-by: Jon Masters <jcm@modules.bos.jonmasters.org>
2010-02-24Fix depmod -e without -F or -E unterminated warningGilles Espinasse1-1/+1
Signed-off-by: Gilles Espinasse <g.esp@free.fr> Signed-off-by: Jon Masters <jcm@modules.bos.jonmasters.org>
2010-01-15pre-release: initial version for 3.12softdepsJon Masters1-1/+1
This is the initial release that will become 3.12. It has a few cleanups. I will next work on the softdep patches. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2010-01-15Merge branch 'master' of ../module-init-tools_alanJon Masters6-53/+326
2010-01-15depmod: use real regex matching on depmod "overrides" entriesJon Masters3-2/+33
We implement support for matching "override" entries in depmod config files to determine which module of several alternatives will be used. The existing implementation is a very poor "wildcard" match that does not use real regular expressions. This version uses the standard POSIX extended regular expressions, with backward compatibility to match on a single "*" kernel version as in the original (broken) design. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-11-25Bug#548841: module-init-tools: Modprobe -q should always return 0.Philipp Weis1-6/+6
On 2009-09-30 16:49, Alan Jenkins <sourcejedi.lkml@googlemail.com> wrote: > On 9/29/09, Alan Jenkins <sourcejedi.lkml@googlemail.com> wrote: > >> When calling modprobe -q with a non-existing module, it returns with > >> exit code 1. According to the manpage, modprobe "normally" will report > >> an error, and with -q shouldn't, so I believe the exist code should > >> always be 0, at least that seems to be the assumption in some init > >> scripts (e.g. binfmt-support). > > > > That part is ambiguous, but I guess "modprobe will simply ignore any > > bogus names" is pretty clear. > > > > > ... and comments in the git log imply we _used_ to get this right. > > > > "" > > > > Andreas, at first glance this regression is due to your commit > > 73bdf4ab. Care to submit a patch to revert the relevant lines? > > Sorry, I completely misread both the git log comments and Andreas' > code. This isn't a regression, it's more of a feature request. > > The manpage does say modprobe -q "will simply ignore any bogus names", > implying that modprobe should return success in this case. But > test-modprobe/19quiet.sh has always required "modprobe -q crap" to > return failure. > > So this is intentional at some level, we've always done it this way in > the past, and we need to consider the risk of breaking scripts which > expect the current behaviour. > > The binfmt-support initscript seems a bad example to me. It does this > > # comments added by me > > set -e # abort if any command fails > ... > modprobe -q binfmt_misc # this will cause an abort if > binfmt_misc.ko doesn't exist... > mount -t binfmt_misc ... # but so will this > > It's only a problem if binfmt_misc is built into the kernel. However, > this will be solved by the modules.builtin work. > > So I think we would need a better justification to change this. Ok, but then the manpage should be fixed. How about the attached patch? Philipp -- Philipp Weis Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-11-25ax_enable_builddir: improve quality of generated top-level MakefileAlan Jenkins1-2/+3
The top-level Makefile is generated by mangling rules, "a: b". We already avoid mangling "a := b". But we should also exclude "a = :". Apparently this was causing unbalanced parenthesis errors on some systems. Reported-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-11-05depmod: generate modules.softdepalan-softdepAndreas Robinson1-0/+30
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-21release: module-init-tools v3.11.1Jon Masters1-1/+1
Bump the release to 3.11.1 since the previous tarballs didn't have the correct generated documentation files present. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-10-16doc: add softdep commandAndreas Robinson1-0/+31
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-15release: module-init-tools v3.11Jon Masters1-1/+1
No major issues reported with the -rc1 so bump to v3.11 final and move on. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-10-15modprobe: change softdep --pre/--post to pre:/post:Andreas Robinson2-7/+7
"--" is modified by underscores(). This would have made the future implementation of softdep in .modinfo more complicated. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-10test: add softdep test, modprobe: fix simple bugs in do_softdepAndreas Robinson2-3/+70
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-04modprobe: add simple softdep loop detectorAndreas Robinson1-0/+14
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-04elfops: remove errfn_t from load_stringsAndreas Robinson5-11/+14
Commit 528db92ab1dd0d75dba415b9f3dc81f5a34773ce added an errfn_t parameter to elfops_core.c:load_strings. This was for the purpose of detecting missing terminators at the end of ELF-sections with strings in them, such as .modinfo. However, the committer (that'd be me) forgot to add any actual code to load_strings() and now the errfn_t parameter complicates the error handling when softdep is used. This commit removes that parameter and adds a non-fatal warning message. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-03modprobe: add softdep commandAndreas Robinson1-7/+152
Imlementation notes ------------------- * find_softdep()/do_softdep() mirrors find_command()/do_command() precisely. (And if they don't, that's a bug.) * Failures in the indirect modprobes, ie. those run by the softdep command, are ignored. This seems correct for removing, but I'm unsure what the proper action is when installing. An example - or how it's supposed to work ----------------------------------------- Configuration: softdep foo --pre pre1 pre2 --post post1 post2 Installing a module: $modprobe foo <CMDLINE_OPTS> yields modprobe pre1 modprobe pre2 modprobe --ignore-install foo <CMDLINE_OPTS> modprobe post1 modprobe post2 Likewiese, removing a module: $modprobe -r foo yields modprobe -r post2 modprobe -r post1 modprobe --ignore-remove -r foo modprobe -r pre2 modprobe -r pre1 Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-03modprobe: don't modify the modname string passed to do_modprobeAndreas Robinson1-9/+13
The function will work on a copy instead. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-03modprobe: enable calling do_modprobe from within handle_module,insmod,rmmodAndreas Robinson1-16/+38
A new function, do_softdep(), will be invoked from the same locations as do_command() as it eventually will replace it. do_softdep() in turn needs to call do_modprobe(). This commit adds some parameters to do_modprobe, handle_module, insmod and rmmod, needed to make this possible. The pathnames for "module.symbols" and "modules.alias" are now generated wherever they're needed, rather than in main(). Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-03modprobe: put configuration objects in a structAndreas Robinson1-83/+64
It is now possible to add or remove conf commands without rewriting the function declarations of e.g parse_config_*() every time. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-03modprobe: cleanup indentation change in conf parserAndreas Robinson1-23/+21
Follow up to the previous commit. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-03modprobe: reduce nesting in conf parserAndreas Robinson1-18/+20
Helps readability and will simplify the softdep command parser. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-10-01Merge branch 'master' into forkbombalanAlan Jenkins8-37/+163
Conflicts: modprobe.c
2009-10-01testsuite: re-add test for /proc/modules supportAlan Jenkins1-0/+103
Now we support /proc/modules as a fallback, we can revive the old 02proc.sh to provide testing coverage. (The setup required alteration to fit with the current test suite, but the body of the test remains unchanged). Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01testsuite: fix tests for install/remove commandsAlan Jenkins4-35/+103
install and remove commands for real modules will now refuse to run, if we don't provide a mockup of /sys/module. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01modprobe: ignore custom remove commands if module_in_kernel() doesnt workAlan Jenkins1-4/+14
If we're not sure whether a module is present, we can't be sure that it is safe to run its remove command. This patch follows logically from the previous two patches. It provides the same safeguard which has been added for install commands, in case /sys/module/<module>/initstate is not available. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01modprobe: don't run remove commands for modules which are not loadedAlan Jenkins1-3/+4
modprobe.d(5) strongly suggests you can use remove commands like this: remove snd-pcm /sbin/modprobe -r --ignore-remove snd-pcm-oss && \ /sbin/modprobe -r snd-pcm Unfortunately, given that snd-pcm-oss depends on snd-pcm, this causes an infinite fork-loop. The solution is an exact parallel of the approach taken for install commands. AFAIK no-one uses remove commands, but it's good to make the insmod() and rmmod() functions consistent. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01modprobe: Get module initstate from /proc/modules if not supported via sysfsAlan Jenkins1-3/+73
Apparently /sys/module/<module>/initstate only appeared in 2.6.20, which is still in use. Copy the original module_in_kernel() verbatim from the GIT archives, and use it as a fallback if module_in_sysfs() doesn't work. The original patch suggestion was shorter, but less obvious, adding more untested code, and turned out to be harder to test. References: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524940 Reported-by: Matthew J. Lockner <mlockner@iastate.edu> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01modprobe: Don't assume module absent if no /sys/module/<module>/initstateAlan Jenkins1-5/+17
/sys/module/<module>/initstate only appeared in 2.6.20. If it is not present, we cannot tell whether the module has finished loading succesfully. In this case module_in_kernel() should return -1 (undefined). Take care to to distinguish between "initstate disappeared because the module was just unloaded" and "initstate is absent but the module is still present". "Fork bombing" side effect of this bug is described in [1]. A followup patch will add a fallback to /proc/modules. 1. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524940 Thanks to Modestas Vainius <modestas@vainius.eu> for explaining the problem. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01modprobe: Ignore custom install commands if module_in_kernel() doesn't workAlan Jenkins1-6/+15
Custom install commands rely on a working module_in_kernel() to avoid an infinite fork-loop. This can fail if /sys/module/ is not available (i.e. before sysfs is mounted). For example: install snd-pcm /sbin/modprobe --ignore-install snd-pcm && \ { /sbin/modprobe --quiet snd-pcm-oss ; : ; } The snd-pcm-oss module depends on snd-pcm. If we can't tell that snd-pcm is already loaded when we load snd-pcm-oss, we end up running the entire install command again, ad infinitim. Thanks go to Modestas Vainius for the idea and original patch. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01module-init-tools v3.11-rc1Jon Masters1-1/+1
An initial round of patches for the 3.11 release, including support for "builtin" modules (those pre-compiled into the kernel image for which we have sysfs entries and perform module initcalls just like loadable ones). Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-10-01modprobe: handle built-in modules (v4, this time tested...)Michal Marek2-1/+78
The kernel installs a modules.builtin file listing all builtin modules. Let depmod generate a modules.builtin.bin file and use this in modprobe: If a module is not found in modules.dep or modules.alias, check if the module is builtin and either do nothing, or print "builtin <module>" if --show-depends was given. Trying to remove a builtin module returns an error, as does inserting a builtin module with --first-time. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-10-01depmod: change depfile functions to return intMichal Marek3-26/+50
If a function returns zero, the file won't be generated Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-10-01modprobe: add --resolve-alias optionThomas Bächler2-1/+20
The --resolve-alias option prints all module names that match the alias given on the commandline and exits. If no valid alias is specified, it does nothing.
2009-10-01logging: tell GCC to check calls to error() etcAlan Jenkins1-6/+12
This warns about the modinfo segfault which Ozan found. It doesn't find any other problems, which is good to know. It may also help avoid future errors. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-01modinfo: Fix segmentation fault due to the wrong parameterOzan Çağlayan1-1/+1
modinfo segfaults when called with a module which is just deleted from the filesystem without re-running depmod. Pass filename instead of the address of it to the error() function to fix the problem. Tested-by: Ozan Çağlayan <ozan@pardus.org.tr> Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
2009-07-16release: module-init-tools version 3.10Jon Masters1-1/+1
2009-06-27testsuite: rebuild all module data filesJon Masters70-0/+0
Rebuild all module data files using hornet (ppc64) and tonnant (x86_64). Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-27From: Michal Marek <mmarek@suse.cz>Jon Masters59-95/+32
testsuite: stop testing the old style EXPORT_SYMBOL macro The "new style" macro has been in use long enough (since 2.5.59 or so), so stop testing the old one. The next patch will remove support for the old macro. The modules were rebuilt on a x86 and ppc machine, using gcc 4.3.2. Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-06-27testsuite: add a Makefile to rebuild the test modulesMichal Marek2-0/+76
I haven't found a Makefile or script in the tree to do this, so I wrote one. jcm: Indeed, there was no such Makefile - these are rebuilt infrequently and I last time just did it by hand, but a Makefile is cleaner. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-27testsuite: add option to only test a given endianess / bitnessMichal Marek21-39/+82
To make it easier to test changes to the testsuite without a cross-compiler, add environment variables TEST_ENDIAN and TEST_BITS controlling which environment / bitness will be tested. All test run in all four modes. jcm: removed bad options handling test since it's no longer in testsuite. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-23git: ignore libmodtools.aJon Masters1-0/+1
Michal Marek pointed out that (following his previous .gitignore patch) that we were also not ignoring the output from building the new libmodtools.a. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-23Add cscope/ctags/etags files to .gitignoreMichal Marek1-0/+6
Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-23depmod: add ability to check symbol versionsJon Masters3-28/+209
Add a new option -E Module.symvers to read symbol versions from a Module.symvers files and modules and warn about mismatches if -e is given. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-23elfops: kill first argument of load_dep_syms()Michal Marek3-6/+5
The pathname is already in the elf_file struct. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-23elfops: clean up load_symbols()Michal Marek2-32/+3
__ksymtab_strings_gpl must have been a mistake, there has never been such section. __ksymtab_strings is present since 2.5.59, so get rid of the compatibility code. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-23doc: link depmod.d to depmod.conf alsoJon Masters1-0/+1
We created a link previously from depmod.conf to depmod.d (and it has to be done the way it is for now due to the XML utilities not handling the actual multiple file names we specify right in the source), so let's do the same for depmod.d documentation. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-06-23Merge branch 'modprobe_main' of ../module_init_tools_andr345Jon Masters2-360/+338
2009-06-23Merge branch 'modprobe_main' of git://github.com/andr345/module-init-tools ↵Jon Masters2-360/+338
into modprobe_main
2009-06-15modprobe: fix various simple style issues related to the option flagsAndreas Robinson1-38/+39
Changes suggested by Alan: * Rename ignore_inuse => ignore_loaded * Put the flags parameter last in handle_module/insmod/rmmod/do_modprobe function declarations. (The errfn was moved too, to just before the flags.) * Don't change more than one flag per statement, i.e flags |= (foo | bar); => flags |= foo; flags |= bar; Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-06-15doc: delete modprobe -w option documentationAndreas Robinson1-14/+0
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-06-15tests: remove depmod --unknown option testAlan Jenkins1-25/+0
depmod no longer handles unknown or malformed options itself. The error message is now generated by getopt, so we don't need to test for it. It turns out that different versions of getopt can generate slightly different error messages, so the test will do more harm than good. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-13modprobe: move modprobing from main() into separate function.Andreas Robinson1-69/+86
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-06-13modprobe: merge option flags into a single parameterAndreas Robinson1-94/+75
Also simplify how handle_module()'s return code is handled in main(): Before: if (handle_module()) failed = 1; After: failed |= handle_module(); Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-06-13modprobe: remove broken -w optionAndreas Robinson1-14/+7
This reverts commit 5a402b77821e76f318beffff3f544ad3c7250c21 dated 5 Sep 2007. The call to delete_module() is unaffected by the -w option and delete_module() (in 2.6.29) itself can not be made to block the way that is intended. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-06-13modprobe: rename some option variablesAndreas Robinson1-42/+42
ignore_proc => ignore_inuse optstring => cmdline_opts config => configname dump_only => dump_config modulearg => modname Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-06-13test-depmod: Fix error message mismatchAndreas Robinson1-11/+11
Did a glibc version change or something cause this?
2009-06-13modprobe: trivial code reorganizationAndreas Robinson1-203/+203
Move do_command, insmod and rmmod closer to handle_module. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-06-11modindex: simplify option handlingAlan Jenkins2-13/+9
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-11doc: modprobe --dumpversions needs a full filename, as opposed to a module nameAlan Jenkins1-1/+1
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-11depmod: simplify option error handlingAlan Jenkins2-24/+14
Backcompat is removed, so we can exit immediately if we don't recognise an option. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-11modprobe: --remove requires at least one module nameAlan Jenkins1-1/+1
This makes it consistent with --all. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-11modprobe: don't ignore --set-version when preceded by --dirnameAlan Jenkins1-7/+4
Fix this: strace -e trace=file build/modprobe --dirname / --set-version 2.6.99 foo ... open("///lib/modules/2.6.30-rc7/modules.alias", O_RDONLY) = 5 FATAL: Module foo not found. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-11depmod --warn doesn't has_argAlan Jenkins1-1/+1
Fix this: $ depmod --warn depmod: malformed/unrecognized option '--warn' ... $ depmod --warn dummy-arg $ Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-11Clean up missing optionsAlan Jenkins3-4/+3
modprobe -D (short version of --show-deps) doesn't work, remove it from the manpage. Don't try to pass "-D" to commands either ("--show-deps" sets dry_run, so we won't run any commands). modprobe -Q is not valid, remove 'Q' from the getopt string. In depmod, "r" was listed twice in the getopt string. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-06-11Re-order options to make the code easier to checkAlan Jenkins2-56/+57
options are listed in three places: 1. getopt (long) option array 2. getopt (short) option string 3. the switch statement which handles the options It's easier to check these lists for inconsistencies if all three lists are in the same order. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-05-27testsuite: rebuild all the 64-be|le data filesJon Masters54-0/+0
Rebuild all the test modules to make sure there's no bitrot. We haven't done this for big endian in a while, but I now have configured my home ppc64 box. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-27doc: make a link from modprobe.d.sgml to modprobe.conf.sgmlJon Masters1-0/+1
The previous hack for modprobe.d.5 happens because 'docbook2man' as shipped in at least one major distribution does not support '--solinks' to create automatic links for each of the refentrytitle entries. It will actually only make links for the last one. This is the other piece - for now, link sources. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-27build: remove elf_core.c from source dependenciesJon Masters1-1/+1
We killed elf_core.c. Don't use it any more e.g. during "make dist". Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-27release: module-init-tools v3.9Jon Masters1-1/+1
2009-05-27add configure option to disable creation of .static utilsMike Frysinger2-1/+9
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-27link modprobe.d(5) to modprobe.conf(5)Mike Frysinger2-1/+2
Some people expect to be able to do `man modprobe.d` and see the relevant content. Not surprising considering modprobe.conf(5) already documents that. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-27logging: remove unused warning counterAlan Jenkins2-7/+0
Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-27Merge branch 'elf_cleanup3' of ../module_init_tools_andr345Jon Masters11-82/+78
2009-05-27modindex: getopt_long returns int not char (fix ppc64 bug)Jon Masters1-1/+1
getopt_long returns an int and not a char. The existing code will fail a return test on ppc64 where the -1 comparison will never succeed, so instead garbage will exist in 'opt' at the end of the main while loop. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-21modprobe, tests: make modprobe fail noisily on non-ELF filesAndreas Robinson4-29/+17
Also remove fake placeholder modules in the test suite e.g "echo Test > foo.ko && modprobe foo". They don't work anymore. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-21read string sections such as .modinfo with load_strings()Andreas Robinson5-37/+50
Changes to load_strings(): * export in struct module_ops * avoid buffer overruns by looking for a string terminator at the end of a section. * new errfn_t parameter selects error message type. If load_strings fails on a missing string terminator, the module is probably broken. Therefore, modprobe and depmod sets errfn_t error = fatal. Modinfo on the other hand sets errfn_t error = error. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-21logging, modprobe: move errfn_t to logging.hAndreas Robinson2-2/+2
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-21elfops: clear struct module_tables with memset()Andreas Robinson1-9/+1
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-21elfops: fix potential crashing bug in load_symbols()Andreas Robinson1-1/+2
get_section() returned an undefined section size on failure, which could cause load_symbols() to crash if kernel symtables were missing from the module. get_section() will now return secsize == 0 if it fails. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-21fix minor strtbl_free and strtbl_add problemsAndreas Robinson4-4/+6
- add missing NOFAIL to strtbl_add() in load_dep_syms() - export strtbl_free() - free string tables with strtbl_free() - documentation fix Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-20modprobe: fix tab formatting of return statementJon Masters1-1/+1
Correct a problem with tabulation so the rc doesn't look like it's part of the "if" statement above it. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-19depmod: fix uninitialized value error in "depmod --warn" codeAlan Jenkins1-1/+1
==12690== Conditional jump or move depends on uninitialised value(s) ==12690== at 0x804A095: output_deps_bin (depmod.c:473) ==12690== by 0x804CD85: main (depmod.c:1364) ==12690== Uninitialised value was created by a stack allocation ==12690== at 0x80517D3: add_value (index.c:86) Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-19testsuite: add --valgrindAlan Jenkins13-32/+72
"valgrindme.sh" has been hanging around for a while without doing anything. The original idea seems to have been to run under valgrind automatically. But it is very slow, which discourages one from running the testsuite. Implement it as an option instead. In particular, this was useful while writing the binary index code. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-05-19Merge branch 'elf_cleanup2' of ../module_init_tools_andr345Jon Masters9-280/+305
2009-05-19Merge branch 'elf_cleanup' of ../module_init_tools_andr345Jon Masters15-484/+618
2009-05-15elfops: hide elf_ident(), no users outside elfopsAndreas Robinson2-3/+1
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modprobe, elfops: move most of dump_modversions() to elfopsAndreas Robinson4-53/+50
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modprobe, elfops: move strip_section() to elfops and refactor itAndreas Robinson3-44/+25
strip_section() now finds the section flags with get_section() and handles files of opposite endianness. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15elfops: use elf_file in, and return section header from, get_module()Andreas Robinson1-8/+11
Returning the section header allows invalidate/strip_section() to use get_section(). get_module() is more robust than strip_section()'s own section lookup. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15elfops: hide get_section() and rename its parametersAndreas Robinson3-35/+13
load_section() has replaced get_section() outside elfops. The new parameter names match the fields in struct elf_file. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modprobe: use elf_file in ELF-related functionsAndreas Robinson1-42/+41
The affected functions are replace_modname() rename_module() invalidate_section() strip_section() clear_magic() dump_modversions() Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modprobe: trivial indentation fix in dump_modversions()Andreas Robinson1-37/+37
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modprobe: load modules with grab_elf_file_fd()Andreas Robinson1-12/+24
In the old implementation, the loader didn't care about whether a file is an ELF-file or not, and let init_module() sort it out. In the new implementation, the loading fails with errno = ENOEXEC if the file isn't an ELF-file. However, the new logic does not pass the testing, specifically test-modprobe/10alias.sh. To work around this, the commit adds a hack that replicates the old way, when grab_elf_file_fd() does return errno = ENOEXEC. Obviously, this needs to be fixed. To replicate the problem, simply remove the hack. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modinfo: load modules with grab_elf_file()Andreas Robinson1-36/+31
Also, load module info with ops->get_modinfo() instead of get_section() This hides struct elf_file fields. load_strings() was originally planned to replace get_section(), but the code ended up less clear, so that idea is put on hold. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modinfo: use logging facility for oom-checks and error messagesAndreas Robinson2-13/+17
Also fix slightly broken nofail_asprintf() Side effects: Errors are printed with the "ERROR:" prefix. Testing for oom, quiets asprintf return-value warning. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15modinfo: clean up grab_module()Andreas Robinson1-30/+17
Reorganize pathname building and use asprintf and strndup instead of malloc, sprintf and memcpy. Module file names are now truncated *after* copying. It wastes a few bytes, but makes the code much easier to read. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15elfops, depmod: add elf_file grab/release functionsAndreas Robinson5-45/+111
This introduces constructor and destructor for struct elf_file, following the grab/release naming pattern used elsewhere. Care is taken to ensure the constructor returns a valid errno on failure. The first user is grab_module() in depmod.c Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15elfops: add strict bounds checking to get/load_section()Andreas Robinson1-5/+10
get_section() and load_section() now return NULL if a section header is corrupt and points to a block that lies partially or entirely outside the file data buffer. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-15elfops: export load_section(), hide load_strings()Andreas Robinson2-3/+3
load_strings() was planned to replace get_section() + next_string() e.g in modinfo. However it turns out there are no advantages in style and few in function. As it won't be used outside elfops, the export is removed. load_section() OTOH, will replace get_section() so we export it now. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-13install-with-care: Replace backticks with bracesRobby Workman1-1/+1
This seems to be the current "standard" (which is probably not the best word to use and will cause whining), so here's a patch. Feel free to ignore this one :-)
2009-05-13docs/support files: remove deprecated/obsolete back-compat stuffRobby Workman5-89/+18
FAQ - removed references to modprobe.conf, as it should not be needed in that context - used /etc/modprobe.d/sound.conf for the alsa example (perhaps this can go away completely now; I think alsa handles this automatically if needed) - trivial typo fix Makefile.am - removed references to modprobe.devfs (obsolete) NEWS - noted release of 3.7 and 3.8, but Jon will need to clarify their status with respect to maintenance and such - noted the deprecation of generate-modprobe.conf and the fact that it is no longer installed by default README - clarified note about backwards compatibility (requires a 2.6.x kernel, and no support at all for older modutils) - updated instructions to remove note about generate-modprobe.conf modprobe.defvs - removed completely from the repo; this is obsolete now
2009-05-13manpages: general cleanup and removal of backwards-compat notesRobby Workman9-183/+76
depmod.conf.sgml: -trivial cleanups -removed the deprecated "include" mentions depmod.sgml -trivial cleanups -removed the backward-compatibility mentions (will add a global note to the toplevel README in another commit) insmod.sgml -trivial cleanups -removed the backward-compatibility mentions lsmod.sgml -removed the backward-compatibility mentions modinfo.sgml -removed the backward-compatibility mentions -I left the old -{a,d,l,p,n} options untouched, even though they are documented as being for old modutils compatibility modprobe.conf.sgml -trivial cleanups -noted preference for /etc/modprobe.d/ over /etc/modprobe.conf (as modprobe.conf is deprecated and will be removed) -removed the deprecated "include" mentions -removed the backward-compatibility mentions modprobe.sgml -trivial cleanups -clarified the -C and -c options; perhaps they should go away later -removed the backward-compatibility mentions modules.dep.sgml -trivial cleanups -bring kernel version used in examples more up to date rmmod.sgml -trivial cleanups -removed the backward-compatibility mentions
2009-05-12util: document the rationale for the string tableAndreas Robinson1-0/+13
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12elfops: Fix symbol type (weak, undef) definitionsAndreas Robinson2-1/+5
Inline string literals might not have static lifetimes (C99 6.4.5). This corrects the assumption that they do, that was introduced in e35f9df6c1aa02a2f7aa0e319af4d0e70181a9ca Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12move ELF-related code into elfopsAndreas Robinson9-143/+149
Specifically depmod.h => elfops.h: struct module_tables and struct elf_file elfops.c => elfops_core.c: X-macros (eg PERBIT) elf_core.c => elfops_core.c: get_section() util.[ch] => elfops.[ch]: elf_ident() and get_section() Additionally, elf_core.c is deleted, being replaced by elfops_core.c Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12moduleops: rename to elfops and move to static libAndreas Robinson5-14/+14
Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12depmod: Introduce struct elf_fileAndreas Robinson5-45/+63
Remove the last remnants of struct module from moduleops*.[ch] Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12moduleops: Trivial code cleanupsAndreas Robinson1-41/+36
load_section(): * Pass struct module rather than module->data and module->conv. load_dep_syms() and fetch_tables() * Assign local variable conv = module->conv when used in many places. fetch_tables(): * Treat handle_register_symbols like the boolean it is. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12depmod: move tables from struct module into separate structAndreas Robinson5-92/+107
This is part of the work separating depmod and moduleops. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12moduleops: add load_strings() operationAndreas Robinson2-25/+28
load_string() treats the data in an ELF-file section as a collection of strings and builds a string table from those. It can be used to read .modinfo, __ksymtab_strings and similar sections. load_symbols() is updated to take advantage of the new function. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12depmod: separate symbol lookup and dependency calculationAndreas Robinson4-21/+48
The new load_dep_syms() operation in moduleops returns a string table of symbols on which a module depends. calculate_deps() is moved to depmod. Remaining depmod callbacks in moduleops are removed. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12depmod: rewrite load_symbols() to not use callbackAndreas Robinson4-11/+22
load_symbols() in moduleops no longer has to call add_symbol() in depmod. Data is now returned in a string table. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-05-12util: introduce new string table objectAndreas Robinson2-0/+42
load_symbols() and calculate_deps() in moduleops call functions in depmod as a way of passing multiple symbols back to depmod. This adds a string table to replace those callbacks. Signed-off-by: Andreas Robinson <andr345@gmail.com>
2009-04-30Add elf_core.c into the EXTRA_SOURCES for the static libraryJon Masters1-0/+2
We need this additional inclusion for "make dist" to work correctly. Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-04-30release: bump release to v3.8Jon Masters1-1/+1
Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-04-30Don't abort the build if docbook2man is missingMichal Marek1-1/+3
Instead of aborting the build, print a warning if neither docbook2man nor docbook-to-man is found. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Jon Masters <jcm@jonmasters.org>
2009-04-30Allow to link zlib dynamicallyMichal Marek1-0/+9
Add new configure option --enable-zlib-dynamic to allow linking zlib dynamically (e.g. opensuse installs libz.so.1 in /lib, so it's safe to do it there). Signed-off-by: Jon Masters <jcm@jonmasters.org>