Commit Graph

509 Commits

Author SHA1 Message Date
Lucas De Marchi
49a163759d modprobe: dump indexes as well 2012-01-16 16:05:47 -02:00
Lucas De Marchi
758428a75f libkmod: dump index files
Provide a function to dump the index files to a certain fd. It could be
more optimized (particularly the functions to dump the index that were
copied and pasted from m-i-t), but it seems like the only user of it is
'modprobe -c', used for debugging purposes. So, keep it as is.
2012-01-16 16:05:46 -02:00
Lucas De Marchi
f1cbf3cfe2 libkmod-util: add helper function to write to fd 2012-01-16 16:05:46 -02:00
Lucas De Marchi
7a973b0cb0 libkmod-util: adhere to coding style 2012-01-16 16:05:46 -02:00
Lucas De Marchi
b08314f7b7 libkmod: export enum kmod_index and rename members 2012-01-16 16:05:36 -02:00
Lucas De Marchi
63be91cbd5 libkmod: store prefix of each index
Prefix is useful when dumping the index (to be added later).
2012-01-16 16:04:32 -02:00
Lucas De Marchi
2f47c7fae9 Update documentation with recent changes 2012-01-14 12:16:48 -02:00
Lucas De Marchi
e15a56af85 depmod: deal with relative root dir
module paths coming from libkmod are absolute. Make sure we store the
absolute dirname to compare later.
2012-01-14 02:46:58 -02:00
Lucas De Marchi
2e092e19a7 kmod_new(): deal with relative paths for dirname 2012-01-14 02:32:25 -02:00
Lucas De Marchi
33557e8d69 depmod: fix idx calculation after postponed array creation
We need to set up each module's idx when the array is created. So,
postpone its initialization as well.
2012-01-14 02:07:14 -02:00
Lucas De Marchi
31f1d0d306 Reduce scope of counter variable 2012-01-14 02:04:31 -02:00
Lucas De Marchi
f6b838e1ba depmod: adhere to coding style 2012-01-14 02:03:21 -02:00
Lucas De Marchi
bc43496a87 modprobe: dump configuration 2012-01-13 11:12:41 -02:00
Lucas De Marchi
6b04ef324a config: let softdeps dump their data 2012-01-13 11:12:41 -02:00
Lucas De Marchi
0017862911 config: add exported iterator functions
Config iterators are useful to get each configuration list, remember its
type and how to get their key/value pair.

softdeps don't have the value yet, because they are stored as string
vectors.
2012-01-13 11:12:41 -02:00
Lucas De Marchi
8b5ee61872 libkmod-private: allow to get aliases from config 2012-01-13 11:12:41 -02:00
Lucas De Marchi
3bf8d4b056 build-sys: add script to bootstrap and configure 2012-01-12 18:33:05 -02:00
Lucas De Marchi
e5603189bc build-sys: rename autogen.sh to bootstrap and keep a symlink 2012-01-12 18:23:32 -02:00
Lucas De Marchi
d89d7cb46a TODO: add code unification to list of tasks 2012-01-12 18:14:32 -02:00
Lucas De Marchi
8b01376742 modprobe: abort on dependency loop that cannot be broken 2012-01-12 17:14:30 -02:00
Lucas De Marchi
e4e1e64ab0 modprobe: fix leak on error path 2012-01-12 15:37:57 -02:00
Lucas De Marchi
e85b6731f9 TODO: update tasks 2012-01-12 15:37:53 -02:00
Lucas De Marchi
a872bba22d modprobe: rework module removal without tree traversing
Just like the module insertion, module removal is remade.

The dependencies line that comes from modules.dep already contains all
the dependencies necessary to remove that module. Therefore modprobe
doesn't have to do the recursion between the modules in order to remove
it. All we have to do is to remove in order:

For the module being removed:
----------------------------

1. softdeps (in reverse order)
2. deps (in reverse order)
3. module
4. postdeps (in reverse order)

For any of the dependencies:
----------------------------

1. softdeps (in reverse order)
2. module
3. softdeps (in reverse order)
2012-01-12 15:23:51 -02:00
Lucas De Marchi
f564394f99 TODO: update differences with m-i-t 2012-01-12 14:45:11 -02:00
Lucas De Marchi
0cf2832a31 modprobe: rework module insertion without tree traversing
The dependencies line that comes from modules.dep already contains all
the dependencies necessary to insert that module. Therefore modprobe
doesn't have to do the recursion between the modules in order to load a
module. All we have to do is to load in order:

For the module being loaded:
----------------------------

1. softdeps
2. deps
3. module
4. postdeps

For any of the dependencies:
----------------------------

1. softdeps
2. module
3. softdeps
2012-01-12 14:34:19 -02:00
Lucas De Marchi
9f11c43d8d man: build modinfo man page 2012-01-12 14:33:05 -02:00
Lucas De Marchi
f57497cc9a man: build modprobe man page 2012-01-12 14:33:05 -02:00
Lucas De Marchi
dfcb8aa651 man: build rmmod man page 2012-01-12 14:33:05 -02:00
Lucas De Marchi
26df21009d man: build lsmod man page 2012-01-12 14:33:04 -02:00
Lucas De Marchi
d5578ee0db man: build insmod man page 2012-01-12 14:33:04 -02:00
Lucas De Marchi
6d96056303 man: build depmod man page 2012-01-12 14:33:04 -02:00
Lucas De Marchi
c0bcb67059 man: build modules.dep{,.bin} man pages 2012-01-12 14:33:04 -02:00
Lucas De Marchi
5173e8e842 man: build modprobe.d man page 2012-01-12 14:21:22 -02:00
Lucas De Marchi
904b57d022 build-sys: build man pages 2012-01-12 14:21:22 -02:00
Lucas De Marchi
5b24df2ffc man: convert depmod.d.sgml to xml and update it 2012-01-12 14:21:22 -02:00
Lucas De Marchi
e3ebcff7a4 build-sys: fix clean rule removing tracked files 2012-01-12 14:21:22 -02:00
Lucas De Marchi
cb8547c98f rename doc dir to man 2012-01-12 10:05:25 -02:00
Robby Workman
43042306cb doc/modprobe.sgml: Various updates wrt inclusion with kmod
* TODO: document "--remove-dependencies" flag
2012-01-12 00:07:44 -06:00
Robby Workman
2b3f9c7430 doc/depmod.sgml: Remove references to legacy map files 2012-01-12 00:07:37 -06:00
Robby Workman
e4f17fdc32 doc/depmod.sgml: Remove refs to depmod.conf 2012-01-12 00:07:20 -06:00
Robby Workman
c5570980e8 doc/depmod.d.sgml: Various touchups; mostly s/depmod.conf/depmod.d/g 2012-01-12 00:07:18 -06:00
Robby Workman
092a948850 doc/modprobe.d.sgml: Various touchups
* change references to "kmod" instead of "module-init-tools"
* remove references to modprobe.conf
2012-01-12 00:06:27 -06:00
Robby Workman
923590709d doc: Import sgml manpages from module-init-tools repo 2012-01-12 00:04:57 -06:00
Lucas De Marchi
92122614b2 modprobe: show if module is in kernel
Now with './tools/modprobe --show-depends ahci' (ahci is builtin) we have the following
output:

$ ./tools/modprobe --show-depends ahci
builtin ahci

Just like modprobe from m-i-t. Previously we had:

$ ./tools/modprobe --show-depends ahci
FATAL: Module ahci not found.
2012-01-11 21:54:25 -02:00
Lucas De Marchi
efd2cec66e test: add check of module's state 2012-01-11 21:22:21 -02:00
Jan Alexander Steffens (heftig)
00bd319113 depmod: Postpone creation of module array
Deleting modules (we have found replacements) invalidates the indices
because the array collapses removed elements, hitting the assertion.

Since we don't make use of the array until the sorting step, build it from
the modules_by_name hash instead.
2012-01-11 20:35:18 -02:00
Lucas De Marchi
af0ff2f22a modprobe: break dependency loop by checking if module is loaded
modprobe doesn't have support for handling dependency loop. That happens
with poorly written softdeps that can introduce a loop. We must deal
with them like it's being done in libkmod.

However, we can break a dependency loop when the dependency was already
inserted. This commit fixes this issue, that happens in the following
scenario:

dependencies:
-------------

modA:
modB: modA
modC: modA

config:

softdep modA post: modB modC

This creates the following loop:

modA
    inserted ok
    handle post-soft-deps of modA -> modB modC
        modB
            handle dependencies of modB -> modA
                modA is already inserted
                    handle post-soft-deps of modA -> modB modC

And so on and so forth.

Now we break the loop by checking if module is already inserted, before
handling it. Thus this gives us:

modA
    inserted ok
    handle post-soft-deps of modA -> modB modC
        modB
            handle dependencies of modB -> modA
                modA is already inserted
            inserted ok
        modC
            handle dependencies of modC -> modA
                modA is already inserted
            inserted ok
2012-01-11 18:29:55 -02:00
Lucas De Marchi
21e14d36f1 autogen.sh: configure with 3-clicks + paste 2012-01-11 17:54:05 -02:00
Lucas De Marchi
8f1922101e modprobe: adhere do coding style 2012-01-11 15:48:20 -02:00
Dave Reisner
6da9cdf1f7 rmmod: behavior more like m-i-t's rmmod
In line with m-i-t's behavior, we should check to see if each module is:

- loaded
- has any holders
- has a 0 refcnt

Detecting any of these lets us provide a more useful message than the
kernel's EPERM response to delete_module(2).

Additionally, alter the main loop behavior to avoid exiting early on the
first error.
2012-01-10 22:35:18 -05:00