Commit Graph

214 Commits

Author SHA1 Message Date
Lucas De Marchi
1c250ec150 Fix "Dead assignments" as reported by llvm 2011-12-12 18:36:27 -02:00
Gustavo Sverzut Barbieri
973c80ba7c handle case where modname was not detected. 2011-12-12 18:28:52 -02:00
Lucas De Marchi
cb451f35d9 Change licenses
libkmod is under LGPL 2.1 or later
tools/* are under GPL
2011-12-12 18:24:35 -02:00
Lucas De Marchi
953653ab93 build-sys: enable debug by default in autogen.sh 2011-12-12 17:26:47 -02:00
Lucas De Marchi
927760641a build-sys: Set CFLAGS to "-O2 -Werror" in autogen.sh 2011-12-12 17:23:19 -02:00
Lucas De Marchi
45f2778174 Remove warnings: ‘err’ may be used uninitialized in this function 2011-12-12 17:23:04 -02:00
Lucas De Marchi
0283d6b666 build-sys: add version map file to build dependencies
Based on original patch from Jan Engelhardt <jengelh@medozas.de> to
libabc.
2011-12-12 17:06:15 -02:00
Lucas De Marchi
cb48c9b2e6 Rename project from libkmod to kmod 2011-12-12 16:54:18 -02:00
Lucas De Marchi
2411c07794 Do not use config if it's not needed/wanted 2011-12-12 15:41:02 -02:00
Lucas De Marchi
8f767e2dfa Use true/false for bool return 2011-12-12 15:27:57 -02:00
Lucas De Marchi
98c80f44c9 Directories inside config directories are not supported
This was failing silent, both in libkmod and module-init-tools. Give a
warning if we created a dir inside config directories.
2011-12-12 15:26:59 -02:00
Lucas De Marchi
4782396cc4 Do not stat() dir twice 2011-12-12 15:00:51 -02:00
Lucas De Marchi
016d619cd9 Fix leak of DIR 2011-12-12 14:39:35 -02:00
Lucas De Marchi
970ba8be9d Remove leftover comment
mod->path is always absolute: remove comment from previous behavior.
2011-12-12 14:01:39 -02:00
Lucas De Marchi
49ce6d0741 Remove libkmod-loaded.c and re-order functions in libkmod-module.c
It's not possible to move functions related to "live" modules to
libkmod-loaded.c because they depend on the definition of kmod_module.
Putting this structure in the private header is not a good idea, so let
all functions related to "live" information in the end of
libkmod-module.c, and move the sole function from libkmod-loaded.c to
this place. This way all functions get the right documentation
about their sections.
2011-12-12 13:56:47 -02:00
Lucas De Marchi
a102e262e6 Rename kmod_loaded_get_list() to kmod_module_new_from_loaded()
Be consistent with other similar functions already present and improve
documentation.
2011-12-12 13:50:19 -02:00
Lucas De Marchi
7c41c2dd8c build-sys: replace spaces with tabs 2011-12-12 13:39:07 -02:00
Lucas De Marchi
1dcac9112f build-sys: move remaining warning flags to configure 2011-12-12 13:37:13 -02:00
Lucas De Marchi
57a034ede4 build-sys: remove duplicated warning flags
"822ce23 beef compile flags" added warning flags to configure, but some
of them were already present in autogen.sh. Remove the flags from
autogen.sh.
2011-12-12 13:26:34 -02:00
Lucas De Marchi
28c175edd1 coding style: be consistent with blank lines 2011-12-12 11:52:59 -02:00
Lucas De Marchi
c35347f15c coding style: fix lines over 80 chars
Lines should not go over 80 chars with a few exceptions:
	- headers
	- function definitions with only 1 argument
	- long strings, otherwise we break grep

This should go later in a coding-style file
2011-12-12 10:54:19 -02:00
Lucas De Marchi
2fee2f13ce Merge branch 'use-mmap'
Conflicts:
	libkmod/libkmod.c
2011-12-12 10:30:01 -02:00
Gustavo Sverzut Barbieri
cb8d4d3e99 API-BREAK: kmod_new() takes a second parameter for configuration directory.
This is required by modprobe and also to help doing unit tests in future.
2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
c3d0a5f2ef tools: add modprobe
try to mimic original module-init-tools' modprobe as much as possible,
but this exposed some missing features in libkmod, these are now
listed in TODO.
2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
72c51a9e4d add lsmod, insmod and rmmod tools.
these tools are compatible with module-init-tools (except insmod does
not take data from stdin).
2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
d01c67e383 add missing newline to log messages. 2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
926f67a6d6 be less verbose on initstate for unexistent modules.
the module may be unloaded, in this case -NOENT is returned but it
should not present an error message
2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
822ce2344d beef compile flags.
Beef the compile flags by using the same set recommended by systemd,
it uses attribute.m4 from the xine project to check supported flags.
2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
3a721bbcf0 insmod: allows providing option to module. 2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
d917f2743e always normalize user-given alias. 2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
bd3f553526 export module's options and commands.
This will be required to implement modprobe later. The implementation
follows "man modprobe.conf" and allows options to be specified for
alias as well, thus the need for kmod_resolve_alias_options().

Example mod-a.conf:

    options mod-a a=1 b=2
    options mod-a c=3
    alias mymod-a mod-a
    options mymod-a d=4

Results in:
    options mod-a a=1 b=2 c=3
    options mymod-a a=1 b=2 c=3 d=4

Install commands are being concatenated with ";", but manpage is not
clean about this behavior.
2011-12-11 20:58:21 -02:00
Gustavo Sverzut Barbieri
b6a534f72c parse_depline may be called from libkmod.c
allow parse_depline to be called when already initialized as it may be
called from libkmod.c and at that point there is no way to check
mod->init.dep
2011-12-11 20:58:21 -02:00
Gustavo Sverzut Barbieri
bf8cf1483f fix string replace.
configure files with this would fail:

options wl x=1

were being handled as " =1".
2011-12-11 20:58:21 -02:00
Lucas De Marchi
54ba8b3416 kmod: Add documentation and format comments 2011-12-11 20:55:09 -02:00
Gustavo Sverzut Barbieri
7fe602b689 update TODO 2011-12-10 13:32:27 -02:00
Gustavo Sverzut Barbieri
27fdf63153 index: fix memleak for non-matchin aliases. 2011-12-10 13:28:18 -02:00
Gustavo Sverzut Barbieri
d091546448 index-mm: allocate values inline into node, strings points to mmap.
For mmap mode, we can avoid allocating and copying strings from the
mmap'ed memory.

With that we have fixed length "struct index_mm_value" that can be
allocated inline with "struct index_mm_node".
2011-12-10 13:04:43 -02:00
Gustavo Sverzut Barbieri
148226ed92 index: cleanup header, move as much as possible to libkmod-index.c 2011-12-10 11:53:51 -02:00
Gustavo Sverzut Barbieri
15c1c143f2 index-mm: no need to allocate prefix. 2011-12-10 11:44:31 -02:00
Gustavo Sverzut Barbieri
fc2d835df5 index-mm: fix memory access.
uint32_t reads must be aligned, they're not then use memcpy().

read_alloc_chars_mm() and read_chars_mm() were wrong, normalize all
address calculation using single byte pointer "addr" that is
incremented by the amount read, this will avoid further errors.
2011-12-10 11:36:35 -02:00
Gustavo Sverzut Barbieri
fe514b1ed0 test-lookup: allow loading resources for testing. 2011-12-10 10:28:11 -02:00
Gustavo Sverzut Barbieri
79d57fcb29 kmod_load_resources: use proper full path to binary files to be mmaped. 2011-12-10 10:27:27 -02:00
Gustavo Sverzut Barbieri
3e245be100 kmod_lookup_alias_from_alias_bin: debug message for mmap case. 2011-12-10 09:28:42 -02:00
Gustavo Sverzut Barbieri
85132101e4 kmod_search_moddep: reorder to avoid creating path when not required.
if we're using mmap'ed index, say so and avoid creating the path as it
won't be used.
2011-12-10 09:26:27 -02:00
Gustavo Sverzut Barbieri
3b2099595b fix snprintf usage.
snprintf() takes the full buffer size, including \0 and guarantees it
will be there.
2011-12-10 09:21:03 -02:00
Lucas De Marchi
f1e7e48f13 kmod: Add documentation and format comments 2011-12-09 16:42:14 -02:00
Lucas De Marchi
65a84f5591 Use alias/symbol index_mm if it's open 2011-12-09 16:11:42 -02:00
Lucas De Marchi
810803dbe8 Pass enum around instead of filename
This will allow us to later use the index to search these indexes.
2011-12-09 16:07:33 -02:00
Lucas De Marchi
d65d71ceff Use index_mm if it's open for moddep search 2011-12-09 15:55:30 -02:00
Lucas De Marchi
4272d08780 Do not allocate path for known places an close resource asap
This place is not supposed to exceed PATH_MAX. So, use snprintf instead
of asprintf.

Close the index before iterating the values.
2011-12-09 15:45:55 -02:00