Commit Graph

392 Commits

Author SHA1 Message Date
Lucas De Marchi
0d46743ca5 Move function to the right place 2011-12-31 11:15:52 -02:00
Lucas De Marchi
e47c604525 Ignore "already loaded" error in module_probe_insert_module()
It also fixes a leak in the error path.
2011-12-30 14:16:15 -02:00
Lucas De Marchi
bbf59327e3 Use errno instead of return value of init_module()
Return -errno instead of the value returned by init_module(). We need to
differentiate between the several errors that might occur, e.g. "module
already loaded", access denied, etc.
2011-12-30 14:13:33 -02:00
Leandro Pereira
1698456259 libkmod-util: getline_wrapped: return NULL when buffer allocation fails 2011-12-28 15:55:45 -02:00
Leandro Pereira
40ee8dadca Do not forget parenthesis around if (streq(A, B)). 2011-12-28 15:54:38 -02:00
Lucas De Marchi
0c010fae10 Move libkmod-util.c to convenience util lib
Share more code between tools and libkmod. underscores() in kmod-depmod
can not use the same function as in the lib, so rename it.
2011-12-28 13:33:26 -02:00
Lucas De Marchi
6670c63344 Move array implementation from depmode to libkmod-util 2011-12-28 12:58:47 -02:00
Lucas De Marchi
f6cf14ce13 tools: kmod: bundle depmod together with the others 2011-12-27 19:56:33 -02:00
Lucas De Marchi
bcb812275e Fix header guard 2011-12-27 19:53:38 -02:00
Leandro Pereira
4783d69e48 kmod tool: don't keep iterating when command has been executed 2011-12-27 19:46:44 -02:00
Lucas De Marchi
a4848e249f Move util functions to libkmod-util.c
These allow them to be later shared with tools.
2011-12-27 18:11:58 -02:00
Lucas De Marchi
5cd13064ec kmod-depmod: use hash implementation from util lib 2011-12-27 18:11:58 -02:00
Lucas De Marchi
8d1278d03f hash: add iterator 2011-12-27 18:11:58 -02:00
Lucas De Marchi
529148ea70 build-sys: create libkmod-util.la convenience lib
Util functions can be shared betweeing libkmod and tools. Start with the
hash implementation.
2011-12-27 18:11:58 -02:00
Lucas De Marchi
d707380744 Copy missing hash functions from kmod-depmod to libkmod 2011-12-27 18:11:58 -02:00
Lucas De Marchi
822913d74c Remove kmod_ prefix from hash implementation
In a future commit, hash implementation will be shared between libkmod
and depmod. kmod_hash is not exported, so remove the namespace.
2011-12-27 18:11:58 -02:00
Lucas De Marchi
ebaa7beb0a Log paths if kmod_module_new_from_path() failed 2011-12-27 18:11:12 -02:00
Lucas De Marchi
3af535c97b TODO: format and add task 2011-12-27 17:32:55 -02:00
Lucas De Marchi
ea1b8c3702 kmod-depmod: Fix leak of dependency vector 2011-12-27 15:21:31 -02:00
Gustavo Sverzut Barbieri
a627c3f31a kmod-depmod: refactor extension matching array, support XZ.
move the extensions array match to global, conditionally add GZ and XZ
if the support is enabled.
2011-12-27 12:09:17 -02:00
Gustavo Sverzut Barbieri
18cd9da303 kmod-depmod: implement -A (--quick) 2011-12-27 12:09:17 -02:00
Gustavo Sverzut Barbieri
4a0e46dac2 kmod-depmod: implement -F and -E options.
Read System.map and Module.symvers from kernel built, then be able to
report unknown symbols.
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
009ed664d7 update TODO
depmod was done, and without map support
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
7436788ca0 kmod-depmod: dump modules.dep.bin 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
ec77abb918 kmod-depmod: dump modules.alias.bin 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
75a9723bb2 kmod-depmod: dump modules.symbols.bin 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
4b144e5fb4 kmod-depmod: dump modules.builtin.bin 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
92df661697 kmod-depmod: add utility functions to be used by binary dumps.
Binary dumps will use functions to convert alias to underscores and
paths to module names.
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
0de40463ba kmod-depmod: copy code from module-init-tools/index.c
Copy code from module-init-tools/index.c, the following copyright applies:

    Copyright (C) 2008  Alan Jenkins <alan-jenkins@tuffmail.co.uk>.
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
8e3505c504 kmod-depmod: dump deps. 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
0d13174578 kmod-depmod: dump aliases 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
8bc830efc5 kmod-depmod: dump softdeps. 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
9a14d0e989 kmod-depmod: dump modules.symbols
note that the hash algorithm is different thus the output order will
be different as well.

to compare the outputs, sort the files:

   depmod -n | grep '^alias symbol:' | sort > /tmp/orig
   kmod-depmod -n | grep '^alias symbol:' | sort > /tmp/new
   diff /tmp/orig /tmp/new
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
25c4151203 kmod-depmod: dump devname
first try to dump files: modules.devname.
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
64b8b586eb kmod-depmod: initial code (no files generated, untested)
this is the initial code for depmod, it should:
 * use configuration from /run/depmod.d, /etc/depmod.d, /lib/depmod.d
 * respect overrides and searches
 * resolve symbols and dependencies
 * break circular dependencies (dependency loops)
 * --errsyms: print out modules with unresolved symbols and incorrect crc
 * --symbol-prefix: respect architecture symbol prefix

it will not:
 * --quick: does not do quick mode
 * --warn: does not warn on duplicates
 * --filesyms: does not load symbols from map file
 * --symvers: does not load symbol versions from map file
 * dump files: does not dump any files at the moment.

it is highly untested, then I appreciate your help with real world
scenarios using overrides and searches. To get output run with -vvvvvv.

next version should fill in the gaps and at least generate the files
2011-12-27 12:09:16 -02:00
Lucas De Marchi
9190c8cda8 Add test for probe insert 2011-12-27 11:55:22 -02:00
Lucas De Marchi
ddbda02286 Add implementation of modprobe's insertion
Treat module insertion as modprobe does: look for (soft-)dependencies, run
install commands, apply blacklist.

The difference with the blacklist is that it's applied to all modules,
including the dependencies. If you want to apply a blacklist only on the
module it's better to call the filter function by yourself.

This implementation detects loops caused by poorly written
soft-dependencies and fail gracefully, printing the loop to the log.
2011-12-27 11:55:22 -02:00
Lucas De Marchi
2bd7cbf644 Do not cache softdeps list
This might include a circular dependency which would screw up the
refcounting because there's an internal reference.
2011-12-27 10:40:51 -02:00
Lucas De Marchi
b72f74b5dd Allow to internally get dependencies without copying list 2011-12-27 10:40:51 -02:00
Lucas De Marchi
9b0e5926fa build-sys: remove unneeded _SOURCES var 2011-12-27 02:49:46 -02:00
Lucas De Marchi
c1c9c44628 Add functions to get ctx blacklists 2011-12-27 02:49:46 -02:00
Lucas De Marchi
eb4ae531f7 Fix kmod_list_remove_n_latest()
It only worked because n was always 1. kmod_list_remove returns a
pointer to the next element, relative to the removed one. Therefore we
need to always get a pointer to the last.
2011-12-27 02:48:36 -02:00
Lucas De Marchi
b94a737935 Reverse order of dependency list
Dependency list in modules.dep is kept in reverse order. Prepend to
list so all the other places treat it in the right order.
2011-12-26 20:15:10 -02:00
Lucas De Marchi
088a6a83dc TODO: add task in modprobe's compatibility 2011-12-26 16:05:55 -02:00
Cristian Rodríguez
4088b27e21 index_file_open: fix another fd leak on error path. 2011-12-26 09:55:15 -02:00
Lucas De Marchi
ef4a349aaa Merge branch 'master' of git://dev.medozas.de/libkmod 2011-12-24 17:51:27 -02:00
Lucas De Marchi
7adfd2c36d Merge branch 'master' of git://dev.medozas.de/libkmod 2011-12-24 17:39:44 -02:00
Jan Engelhardt
c362171286 libkmod: remove external cflags from .pc file
Since the public header files of libkmod do not include header files
of liblzma or zlib, the flags need not be present.
2011-12-24 20:28:11 +01:00
Jan Engelhardt
b182f8fb5e Support for loading Xz-compressed modules 2011-12-24 20:26:22 +01:00
Jan Engelhardt
5a51a357a8 build: use AC_ARG_WITH for zlib
Since it selects an external dependency for inclusion, AC_ARG_WITH
is preferred (autoconf.info 15.2 "Working with external software").
2011-12-24 20:25:54 +01:00