Lucas De Marchi
3f63505812
file: use log facilities
...
Don't clutter stderr with messages that might be useful in the log.
2012-01-04 08:49:23 -02:00
Lucas De Marchi
c68e92f731
file: take a weakref to ctx
2012-01-04 08:49:15 -02:00
Lucas De Marchi
29b69c0b98
config: take a weakref to ctx
...
Commit "b6a4dfb config: save list of config paths with their timestamps"
removed the weakref to ctx. Add it back.
2012-01-04 08:49:10 -02:00
Lucas De Marchi
7749bedbf7
Add missing static const
2012-01-04 08:00:45 -02:00
Gustavo Sverzut Barbieri
3db5bf9d38
kmod-depmod: fix replacement of existing modules.
...
We cannot create a kmod_module for existing module name, it will fail
due existing in the hash table "modules_by_name".
To avoid it, we first delete the existing module, if lower priority,
then add the new one.
kmod_module_new_from_path() is called only when the former module was
deleted or does not exist.
2012-01-03 16:14:57 -02:00
Gustavo Sverzut Barbieri
026c7b448d
kmod-depmod: fix comparison of module priority.
...
This code was never tested, my bad!
* the prefix should be ignored, as it is not stored in cfg_search/override.
* baselen should not include '/'.
* search length should not include '\0'.
* override path should not include cfg->dirname prefix.
2012-01-03 16:10:17 -02:00
Gustavo Sverzut Barbieri
79b656faeb
utils/array: add array_remove_at()
...
remove array element at given position, will be used by depmod.
2012-01-03 15:58:24 -02:00
Gustavo Sverzut Barbieri
8ea02fe056
kmod-depmod: fix incorrect math finding out end of dirname.
2012-01-03 15:11:58 -02:00
Gustavo Sverzut Barbieri
5988652597
kmod-depmod: document --config/-C in help output.
2012-01-03 15:06:08 -02:00
Gustavo Sverzut Barbieri
b0bcadd0ae
kmod-depmod: add missing trailing \n to log messages.
2012-01-03 15:04:34 -02:00
Gustavo Sverzut Barbieri
599a032467
elf: zero *array when count is zero.
2012-01-03 14:53:15 -02:00
Gustavo Sverzut Barbieri
db5d14cf24
libkmod-file: refactor code to avoid ifdef mess.
...
Refactor code to use pointer to functions, avoiding the previous
Now comp_types defines a magic header to be checked (size and bytes),
with the associated load() and unload() operations. If a header
matches, their operations are used. Otherwise the regular file
operations (mmap/munmap) are used.
File descriptor close is managed by the common code if it's valid
(>=0). If some code steals the file descriptor (eg: gzopen), then they
must change file->fd to -1.
This way the code should be easier to extend and avoid bugs.
2012-01-03 14:25:49 -02:00
Gustavo Sverzut Barbieri
6717994157
utils/read_str_safe(): fix wrong behavior and bugs.
...
ouch, I did a mess in the original function, fix them:
* on errors (read() < 0), continue reading after the done bytes, not
at position 0.
* read buflen - 1 bytes, so there is always room to store the
trailing \0, as expected by user due behavior of snprintf(),
fgets() and others.
2012-01-03 14:22:05 -02:00
Lucas De Marchi
657722dd9d
TODO: add task for providing man page
2012-01-01 06:18:16 -02:00
Lucas De Marchi
51e873d1b9
Add test to check kmod_validate_resources
2012-01-01 06:18:16 -02:00
Lucas De Marchi
c4dc3ca8a2
Add call to check if resources are valid
2012-01-01 06:18:16 -02:00
Lucas De Marchi
9fd58f30bf
index: save timestamp of each loaded index
2012-01-01 06:18:16 -02:00
Lucas De Marchi
b6a4dfb1b4
config: save list of config paths with their timestamps
...
Save a list of config paths with their timestamps so they can be checked
later.
2012-01-01 06:18:01 -02:00
Lucas De Marchi
0b29ef6f59
util: add helper function to compare timestamps
2012-01-01 06:17:54 -02:00
Lucas De Marchi
d8a6c0ccb8
kmod-modprobe: mimic modprobe when removing deps with usecount=0
2012-01-01 06:13:09 -02:00
Lucas De Marchi
c9a144481d
Fix leak of kmod_module and fix code style
2012-01-01 06:12:59 -02:00
Lucas De Marchi
5a96c5f1d5
TODO: add list of things that are different on kmod
2012-01-01 06:12:00 -02:00
Dave Reisner
0e9bd2d1ca
kmodprobe: post-remove module deps with 0 refcnt
2011-12-31 18:21:00 -05:00
Dave Reisner
d98880ad5c
modprobe: use lighter access call instead of stat
2011-12-31 18:02:30 -05:00
Dave Reisner
b09668cf64
modprobe: remove --list option
...
This was marked as deprecated in m-i-t's modprobe in favor of find and
basename.
2011-12-31 16:51:40 -05:00
Dave Reisner
9070b117ec
libkmod-config: remove warning for skipped config files
...
conf_files_filter_out() already skips these files, but writes to the log
to warn that they'll be ignored in the future.
2011-12-31 19:30:26 -02:00
Lucas De Marchi
2f76fda259
Use last enum value instead of ARRAY_SIZE
2011-12-31 19:30:09 -02:00
Lucas De Marchi
4926cb501d
Do not call exported function for mod->name
...
Name is always available and we don't neet to call a exported function
to get it.
2011-12-31 11:21:52 -02:00
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