Mike Frysinger [Tue, 15 May 2012 22:29:44 +0000 (19:29 -0300)]
libkmod: move function to the only file using it
If we don't have --gc-sections support, linking kmod fails:
libkmod/.libs/libkmod-util.a(libkmod-util.o): In function 'underscores':
libkmod/libkmod-util.c:117: undefined reference to 'kmod_log'
This is because libkmod-util.la uses kmod_log(), that is in libkmod.la.
Move the function so we don't have a dependency loop while building the
libraries and it works with compilers with no support for --gc-sections.
Dan McGee [Thu, 23 Feb 2012 05:56:59 +0000 (23:56 -0600)]
test-conversion: convert test-get-dependencies to new infrastructure
The test uses the ext4 module dependencies as the testcase, checking
both the number and the names of the returned modules.
Dan McGee [Thu, 23 Feb 2012 05:56:58 +0000 (23:56 -0600)]
test-conversion: convert test-blacklist to new infrastructure
Add a modprobe.conf with some blacklist entries in a test rootfs, and
then ensure our blacklist function actually cuts out the two listed
entries (and doesn't cut out the others).
Lucas De Marchi [Fri, 11 May 2012 03:04:59 +0000 (00:04 -0300)]
build-sys: copy rootfs to another directory
We can't use the rootfs directory because it breaks out-of-tree build
and in future we want to make modifications to the fake filesystem such
as adding and removing files.
We need to call "chmod -R +w" in the resulting directory because when we
distribute the source with make dist all files will be readonly.
Fix 'make distcheck'
Lucas De Marchi [Fri, 11 May 2012 02:42:41 +0000 (23:42 -0300)]
build-sys: distribute testsuite
Fix 'make dist'
Dan McGee [Fri, 3 Feb 2012 19:24:18 +0000 (13:24 -0600)]
testsuite: ship testsuite/rootfs unzipped
The current configuration is dumb in any number of ways:
1) If the rationale was for space savings, it works the opposite- the
git repo gets more bloated because we are adding binary compressed
blobs that share little in common with their parent, and anyone that
wants to run the test suite has to unzip it anyway.
2) It is a pain in the butt to add new tests, and not accidentally lose
any new rootfs you built in the directory.
3) `git status` won't help you if you are tweaking files in the rootfs
and don't know they have been changed, or if some test did that and
you couldn't detect it.
4) `git log` won't help you find out what is changing in the rootfs test
directory itself when changes are made to the binary blob, such as
new files being added or even existing files being tweaked.
5) The files just aren't that big anyway- 2.7MB unzipped.
Lucas De Marchi [Fri, 11 May 2012 00:11:27 +0000 (21:11 -0300)]
build: remove private symbol from linker script
There's no reason kmod_log should be exported, remove it from linker
script. This doesn't break the API/ABI because we are luck: since the
function had visibility=hidden it was not getting exported as a global
symbol.
Lucas De Marchi [Thu, 10 May 2012 23:58:46 +0000 (20:58 -0300)]
Revert "libkmod: make sure to export kmod_log"
This reverts commit
88a170dbd63965b8403b6b40b12ded4f82d89ccd.
There's no reason for users of the API to call this method, it's just
wrong to export it.
The bug that this patch fixed needs to be fixed another way, not
exporting this function.
Dave Reisner [Mon, 7 May 2012 23:41:42 +0000 (19:41 -0400)]
depmod: report failures in loading symbols
Previously, depmod would relegate failures of kmod_module_get_symbols()
to debug output, assuming the "error" was simply a lack of symbols.
Leave the ENOENT return to debug output, but report anything else as a
real error.
Dave Reisner [Mon, 7 May 2012 23:41:41 +0000 (19:41 -0400)]
libkmod-file: gracefully handle errors from zlib
zlib won't necessarily set the system errno, and this is particularly
evident on corrupted data (which results in a double free). Use zlib's
gzerror to detect the failure, returning a generic EINVAL when zlib
doesn't provide us with an errno.
Lucas De Marchi [Thu, 26 Apr 2012 14:42:27 +0000 (11:42 -0300)]
Remove dead increment
Lucas De Marchi [Thu, 26 Apr 2012 14:40:26 +0000 (11:40 -0300)]
Return error instead of always 0
Lucas De Marchi [Thu, 26 Apr 2012 14:39:54 +0000 (11:39 -0300)]
Remove dead assignment
Mike Frysinger [Sat, 21 Apr 2012 06:53:23 +0000 (02:53 -0400)]
libkmod: make sure to export kmod_log
If we don't have --gc-sections support, linking kmod fails:
libkmod/.libs/libkmod-util.a(libkmod-util.o): In function 'underscores':
libkmod/libkmod-util.c:117: undefined reference to 'kmod_log'
This is because kmod_log is missing the export define, even though it's
already listed in the exported symbol list.
Lucas De Marchi [Thu, 19 Apr 2012 14:21:00 +0000 (11:21 -0300)]
kmod 8
Lucas De Marchi [Thu, 19 Apr 2012 14:08:24 +0000 (11:08 -0300)]
doc: remove links to NULL going nowhere
Lucas De Marchi [Mon, 16 Apr 2012 23:20:48 +0000 (20:20 -0300)]
TODO: add item to implement actions in kmod
Dave Reisner [Mon, 16 Apr 2012 14:37:32 +0000 (10:37 -0400)]
modprobe: handle -ENOENT return from init_module
init_module returns -ENOENT when the module failed to load because of a
bad parameter or unknown symbol. Throw a more descriptive error message
than the generic "No such file or directory" to alert the user.
Fixes Debian bug 668216.
Kay Sievers [Sat, 14 Apr 2012 18:47:47 +0000 (20:47 +0200)]
doc: silent man page generation and fix gtk-doc warnings
Elan Ruusamäe [Thu, 22 Mar 2012 15:00:16 +0000 (12:00 -0300)]
modprobe: fix typo in config dump: option->options
kmod uses "option MODNAME", not "options MODNAME"
--- modprobe-sorted.kmod 2012-03-21 22:31:03.
751754042 +0200
+++ modprobe-sorted.module-init-tools 2012-03-21 22:30:49.
561753089 +0200
@@ -1,6 +1,23 @@
[...]
-option uvesafb mode_option=1024x786-32 mtrr=4 scroll=ywrap
+options uvesafb mode_option=1024x786-32 mtrr=4 scroll=ywrap
This breaks scripts that depend in modprobe -c output grepping
Lucas De Marchi [Thu, 22 Mar 2012 01:26:03 +0000 (22:26 -0300)]
README: note that there are more files to read
Lucas De Marchi [Mon, 19 Mar 2012 11:23:14 +0000 (08:23 -0300)]
kmod 7
Lucas De Marchi [Sat, 17 Mar 2012 18:12:44 +0000 (15:12 -0300)]
build-sys: don't set CFLAGS and LDFLAGS
These variables are supposed to be set by user. What we can do in
configure is to set another variable and AC_SUBST() it. Then in
Makefile.am we assign it to AM_{CFLAGS,LDFLAGS}. This way user can
always override their values, in configure or make phase.
Reference: http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
Lucas De Marchi [Sat, 17 Mar 2012 13:26:32 +0000 (10:26 -0300)]
build-sys: re-organize configure.ac
Randy Witt [Fri, 16 Mar 2012 05:01:18 +0000 (01:01 -0400)]
configure.ac: Move link only flags out of CFLAGS and into LDFLAGS.
On the ARM gcc 4.2.2 I'm using I get many
"--as-needed: linker input file unused because linking not done"
style errors when libtool is using compile mode.
In order to silence these warnings and be "correct", the flags that
only make sense for linking were moved into LDFLAGS.
Randy Witt [Fri, 16 Mar 2012 05:01:17 +0000 (01:01 -0400)]
Add CC_CHECK_LDFLAGS_APPEND m4 macro.
This is mostly just preparation for the next patch. But this macro is
used for flags that are only needed during linking but that don't
make sense for normal compilation.
I saw this exact type of patch online for systemd, but it never seems to
have actually been incorporated into their attributes.m4.
Lucas De Marchi [Thu, 15 Mar 2012 12:19:34 +0000 (09:19 -0300)]
config: use order /etc, /run, /lib
This matches the change in systemd and udev. Log message on udev's
change by Kay Sievers:
After long consideration we came to the conclusion that user
configuration in /etc should always override the (generally
computer generated) configuration in /run. User configuration
should always be what matters over anything else. Hence rearrange
the search orders accordingly. In general this should change
very little as overriding like this is seldomn done so far,
and the order between /etc and /usr stays the same.
Lucas De Marchi [Thu, 15 Mar 2012 04:11:10 +0000 (01:11 -0300)]
modprobe: set log prio to 0 if user passed -q arg
Lucas De Marchi [Thu, 15 Mar 2012 03:31:22 +0000 (00:31 -0300)]
Merge branch 'master' of git://code.falconindy.com/kmod
Lucas De Marchi [Thu, 15 Mar 2012 03:27:18 +0000 (00:27 -0300)]
modprobe: always try to remove all modules in command line
Lucas De Marchi [Thu, 15 Mar 2012 03:14:35 +0000 (00:14 -0300)]
modprobe: don't check if module builtin to decide if it's builtin
More or less confusing message, but if module is builtin in the live
system, it doesn't mean it's builtin in the target kernel.
Instead we now check if module has a path. It don't have a path only if
it's builtin in the target or if it doesn't exist at all. The latter
should not be a problem since this code is being called from inside the
library. Anyway, put an assert to make sure we get bug reports if any
case slipped in here.
Dave Reisner [Thu, 15 Mar 2012 02:15:21 +0000 (22:15 -0400)]
modprobe: fix error path in removing modules
We really haven't paid this code much attention, and it's somewhat
evident in our divergence in behavior from module-init-tools. This patch
asserts the following behavior on exit:
* modprobe -r realmod_notloaded => exit zero
* modprobe -r --first-time realmod_notloaded => exit non-zero
* modprobe -r bogusmod => exit non-zero
Lucas De Marchi [Sat, 3 Mar 2012 01:34:36 +0000 (22:34 -0300)]
kmod 6
Lucas De Marchi [Sat, 3 Mar 2012 01:28:38 +0000 (22:28 -0300)]
Use upper case after Deprecated in doc
Lucas De Marchi [Sat, 3 Mar 2012 01:18:33 +0000 (22:18 -0300)]
Add kmod_module_apply_filter() to doc-sections file
Lucas De Marchi [Sat, 3 Mar 2012 00:28:11 +0000 (21:28 -0300)]
Fix wrong printf format string
This fixes build in 32 bits machines.
Lucas De Marchi [Fri, 2 Mar 2012 23:33:26 +0000 (20:33 -0300)]
libkmod-index: do not pre-populate mmap
If we tell mmap to populate all the indexes and they are big, this will
impact load time. Let them be mapped as they are used.
Lucas De Marchi [Thu, 1 Mar 2012 17:04:29 +0000 (14:04 -0300)]
Downgrade log message: refcnt file may not exist
If kernel doesn't have support to unload modules,
/sys/module/<modname>/refcnt will not exist and that's ok.
Reported by: Sven Anders <anders@anduras.de>
Lucas De Marchi [Mon, 27 Feb 2012 23:35:12 +0000 (20:35 -0300)]
man: detail modprobe.blacklist in kcmdline
Lucas De Marchi [Mon, 27 Feb 2012 22:54:33 +0000 (19:54 -0300)]
libkmod-index: free node when we have only partial match
Dave Reisner [Mon, 27 Feb 2012 20:59:09 +0000 (15:59 -0500)]
modprobe: show builtin label on --show-depends
Previously, we didn't handle builtins very well, displaying things like:
$ modprobe -D btrfs
insmod /lib/modules/3.2.6-foo/kernel/crypto/crc32c.ko.gz
insmod (null)
insmod /lib/modules/3.2.6-foo/kernel/lib/libcrc32c.ko.gz
insmod /lib/modules/3.2.6-foo/kernel/lib/zlib_deflate/zlib_deflate.ko.gz
insmod /lib/modules/3.2.6-foo/kernel/fs/btrfs/btrfs.ko.gz
Follow module-init-tools and show builtins with the label 'builtin' and
their name:
$ modprobe -D btrfs
insmod /lib/modules/3.2.6-foo/kernel/crypto/crc32c.ko.gz
builtin intel_crc32c
insmod /lib/modules/3.2.6-foo/kernel/lib/libcrc32c.ko.gz
insmod /lib/modules/3.2.6-foo/kernel/lib/zlib_deflate/zlib_deflate.ko.gz
insmod /lib/modules/3.2.6-foo/kernel/fs/btrfs/btrfs.ko.gz
Lucas De Marchi [Mon, 27 Feb 2012 21:48:02 +0000 (18:48 -0300)]
libkmod-module: fill builtin's name
modules.builtin don't have any realname->value -- it follows the same
format of modules.dep, not the aliases ones.
Dave Reisner [Sat, 25 Feb 2012 04:02:06 +0000 (23:02 -0500)]
find builtins by property, not initstate
Dave Reisner [Fri, 24 Feb 2012 15:13:16 +0000 (10:13 -0500)]
modinfo: use new apply_filter method to avoid builtins
Dave Reisner [Fri, 24 Feb 2012 15:05:11 +0000 (10:05 -0500)]
libkmod/module: add kmod_module_apply_filter method
This is a more generic method of applying filters to module lists. This
deprecates kmod_module_get_filtered_blacklist() which now simply returns
a call to _apply_filter with the extra filter enum arg.
Lucas De Marchi [Fri, 24 Feb 2012 03:58:20 +0000 (01:58 -0200)]
Move repository to kernel.org
Lucas De Marchi [Thu, 23 Feb 2012 18:37:13 +0000 (16:37 -0200)]
libkmod-module: don't treat "coming" as in-kernel
Running two instances of modprobe with the same module should both
succeed or both fail:
modprobe foo&; modprobe foo;
Previously if foo failed to be inserted by the first call, the second one
could return 0 because it may have occurred while the first one was being
processed by kernel (thus marked as "coming").
Now we simply don't check by "coming" in order to decide if we need to
call init_module(). module-init-tools used to spin calling
usleep(100000), but calls to init_module() are already synchronous.
Therefore let kernel synchronize the calls.
Lucas De Marchi [Wed, 22 Feb 2012 15:07:13 +0000 (13:07 -0200)]
TODO: update and organize items
Lucas De Marchi [Sun, 19 Feb 2012 06:20:30 +0000 (04:20 -0200)]
libkmod-module: probe: check if module exists for install cmds
Mimic what module-init-tools was doing before running install commands:
check if a module with the same name is already loaded in kerne, and if
it is, bail out.
This fixes the issue with some install commands used in Debian with
alsa-base package:
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }
install snd_rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
install snd_emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }
install snd_pcm modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { modprobe --quiet snd-pcm-oss ; : ; }
install snd_mixer modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { modprobe --quiet snd-mixer-oss ; : ; }
install snd_seq modprobe --ignore-install snd-seq $CMDLINE_OPTS && { modprobe --quiet snd-seq-midi ; modprobe --quiet snd-seq-oss ; : ; }
Lucas De Marchi [Sat, 18 Feb 2012 05:56:21 +0000 (03:56 -0200)]
Add missing newlines
Checked with following semantic patch for the library:
// smpl
@a@
identifier virtual.func;
expression E1;
expression fmt;
position p1;
@@
func(E1, fmt@p1, ...)
@script:python b@
fmt << a.fmt;
p1 << a.p1;
@@
s = str(fmt)
if s.find("\\n") < 0:
print p1[0].file + ":" + p1[0].line
// smpl
For tools, just remove E1
Lucas De Marchi [Fri, 17 Feb 2012 07:00:09 +0000 (05:00 -0200)]
Downgrade log level when modules.dep{,.bin} don't exist
Lucas De Marchi [Thu, 16 Feb 2012 23:11:13 +0000 (21:11 -0200)]
testsuite: fix color of unexpected failure
Lucas De Marchi [Thu, 16 Feb 2012 22:43:16 +0000 (20:43 -0200)]
kmod-module: lookup: search modules.builtin file too
Search modules.builtin file before saying the module was not found.
Note: these "modules" should not appear as dependencies of other modules
(in modules.dep) even if they appear in modinfo. This fixes the return
code of modprobe with builtin modules.
Also fixes a small coding style issue in module_is_inkernel().
Lucas De Marchi [Thu, 16 Feb 2012 23:04:24 +0000 (21:04 -0200)]
testsuite: add test for builtins with modprobe
When user tries to load a module that is builtin in kernel, modprobe
should just return 0. This is not happening right now, so mark test as
expected_fail until it gets fixed.
Dave Reisner [Wed, 15 Feb 2012 02:49:26 +0000 (21:49 -0500)]
testsuite: add .path member to test struct
This allows us to prepend an arbitrary item to the PATH environment
variable, meaning we can favor the binaries we just built, rather than
relying on those in the filesystem.
Wouter van Kesteren [Thu, 16 Feb 2012 17:16:54 +0000 (18:16 +0100)]
Fix path.c's function pointer defenitions.
int isn't big enough to hold a FILE* / DIR* on some systems, this causes
segfaults in calls that try to use the resulting FILE* / DIR*:
TESTSUITE: ERR: 'testsuite_rootfs_fopen' [1176160] terminated by signal 11 (Segmentation fault)
TESTSUITE: ERR: FAILED: testsuite_rootfs_fopen
FAIL: testsuite/test-testsuite
...
TESTSUITE: ERR: 'loaded_1' [1176166] terminated by signal 11 (Segmentation fault)
TESTSUITE: ERR: FAILED: loaded_1
FAIL: testsuite/test-loaded
...
TESTSUITE: ERR: 'from_alias' [1176181] terminated by signal 11 (Segmentation fault)
TESTSUITE: ERR: FAILED: from_alias
FAIL: testsuite/test-new-module
For reference on my system:
sizeof(int) = 4
sizeof(long) = 8
sizeof(FILE*) = 8
sizeof(DIR*) = 8
Lucas De Marchi [Tue, 14 Feb 2012 23:57:35 +0000 (21:57 -0200)]
TODO: add tasks and bug fixes
Lucas De Marchi [Mon, 13 Feb 2012 23:58:36 +0000 (21:58 -0200)]
libkmod-index: don't print an error if index doesn't exist
It's ok not to have the index files, so just print a DBG message instead
of an ERR.
Lucas De Marchi [Sat, 11 Feb 2012 21:45:29 +0000 (19:45 -0200)]
libkmod-module: probe: fix infinite loop with softdeps
If a softdep depends on a module in the dependency list of the module
being inserted, we would enter and infinite loop.
Move the "mod->visited = true" assignment to the proper place, hoping it
didn't break other use cases. This is a bug that comes and goes every
now and then. Since we have a testsuite now, a test for this should be
written.
Lucas De Marchi [Thu, 9 Feb 2012 03:44:09 +0000 (01:44 -0200)]
test: remove test-state
This test is already covered by testsuite/test-loaded.
Lucas De Marchi [Wed, 8 Feb 2012 22:32:31 +0000 (20:32 -0200)]
Mark functions with attribute noreturn
Functions that always call exit() should be marked with attribute
noreturn. With glibc this is not necessary, but it fails to compile with
uClibc otherwise.
Lucas De Marchi [Wed, 8 Feb 2012 22:29:52 +0000 (20:29 -0200)]
Check if libc has __xstat
uClibc doesn't use __xstat. Check if it exists, otherwise don't export
the override function.
Lucas De Marchi [Wed, 8 Feb 2012 03:51:17 +0000 (01:51 -0200)]
build-sys: add rule to pack rootfs
Lucas De Marchi [Wed, 8 Feb 2012 03:40:00 +0000 (01:40 -0200)]
testsuite: add tests to modprobe --show-depends
test 1 - check whether modprobe outputs the right thing when
using --show-depends is used with already loaded modules.
test 2 - check whether modprobe outputs the right thing when
using --show-depends with modules not loaded yet
Lucas De Marchi [Tue, 7 Feb 2012 12:58:48 +0000 (10:58 -0200)]
testsuite: update README file
- Tell about TESTSUITE_MAIN and DEFINE_TEST macros
- Align item bodies and break on 80 chars
Lucas De Marchi [Tue, 7 Feb 2012 12:46:46 +0000 (10:46 -0200)]
testsuite: macronify test definitions
Lucas De Marchi [Tue, 7 Feb 2012 12:09:20 +0000 (10:09 -0200)]
testsuite: macronify main function
Dan McGee [Sat, 4 Feb 2012 02:29:09 +0000 (20:29 -0600)]
testsuite: libtestsuite depends on individual components
Ensure this dependency is explicit in the Makefile so rebuilding just
one test works correctly. Also reduce some repetition in the test LDADD
bits by adding a new TESTSUITE_LDADD variable.
Lucas De Marchi [Tue, 7 Feb 2012 11:48:59 +0000 (09:48 -0200)]
libkmod-module: probe: Fix ignore-loaded flag not being applied
Lucas De Marchi [Mon, 6 Feb 2012 22:34:33 +0000 (20:34 -0200)]
kmod 5
Dan McGee [Sat, 4 Feb 2012 02:25:00 +0000 (20:25 -0600)]
modinfo: handle arguments more carefully
A simple case of breakage before this commit:
$ touch aes
$ modinfo aes
filename: /tmp/aes
ERROR: could not get modinfo from 'aes': Invalid argument
Add a new is_module_filename() function that attempts to do more than
just check if the passed argument is a regular file. We look at the name
for a '.ko' string, and if that is found, ensure it is either at the end
of the string or followed by another '.' (for .gz and .xz modules, for
instance). We don't make this second option conditional on the way the
tools are built with compression support; the file is a module file
regardless and should always be treated that way.
When doing this, and noticed in the test suite output, we open the
system modules index unconditionally, even if it is never going to be
used during the modinfo call, which is the case when passing module
filenames directly. For only one module there's not much advantage in
pre-loading the index, so just remove the call to kmod_load_resources().
With-help-from: Dave Reisner <dreisner@archlinux.org>
[lucas.demarchi@profusion.mobi: remove call to kmod_load_resources()]
Lucas De Marchi [Mon, 6 Feb 2012 21:50:17 +0000 (19:50 -0200)]
Add WARNING file for test dir and improve testsuite README
Lucas De Marchi [Mon, 6 Feb 2012 18:50:54 +0000 (16:50 -0200)]
testsuite: add README
Lucas De Marchi [Mon, 6 Feb 2012 14:52:27 +0000 (12:52 -0200)]
libkmod-module: probe: return -EEXIST if told to do so
Commit "af9572c lib/module: check initstate before inserting module"
removed the check for "we should return -EEXIST" and moved it back to
the start of the function. The problem with this is the following
scenario:
- We check if module is in kernel -> no
- We insert the dependencies
<-- External program loads
the module
- We check if module is in kernel -> yes
- We return 0, when we should return -EEXIST
Lucas De Marchi [Mon, 6 Feb 2012 14:46:39 +0000 (12:46 -0200)]
libkmod-module: probe: rename flag to be more meaningful
Dan McGee [Sat, 4 Feb 2012 02:29:12 +0000 (20:29 -0600)]
test-conversion: remove test/test-{insmod,rmmod,rmmod2}
These are covered by the various test cases in testsuite/test-init.
Dan McGee [Sat, 4 Feb 2012 02:29:11 +0000 (20:29 -0600)]
test-conversion: remove test/test-init
This was already converted to testsuite/test-init.
Dan McGee [Sat, 4 Feb 2012 02:29:10 +0000 (20:29 -0600)]
test-conversion: remove test/test-loaded
This was already converted to testsuite/test-loaded.
Dan McGee [Sat, 4 Feb 2012 02:29:08 +0000 (20:29 -0600)]
Update .gitignore files
Add kmod-* prefixed tool names, add 'tags' in root directory (for ctags,
matches cscope.out ignore already in there), and prefix tools/ entries
with '/' so they are absolute ignores and don't apply to subdirectories.
Dan McGee [Sat, 4 Feb 2012 02:29:07 +0000 (20:29 -0600)]
Fix simple grammar issue
Ambroz Bizjak [Fri, 3 Feb 2012 20:15:01 +0000 (18:15 -0200)]
Fix unaligned memory access in hash function
Use a function to properly get an unsigned short from memory that is
possibly unaligned.
Note that it implicitly fixes a small bug in the hash function that
was introduced when modifying the eina code: the line "hash ^= key[2]
<< 18;" is supposed to be accessing the 3rd byte of the remainder of
the input, but when 'it' was introduced, 'key' ('data' in eina code)
was no longer incremented, so this ended up accessing the 3rd byte of
the input from the beginning. This is fixed by iterating over 'key',
like the eina code does.
Before this patch depmod was failing on ARMv5 and possibly others that
don't have unaligned access. They do not calculate correctly the
dependencies as shown below:
[root@alarm ~]# modinfo bridge
filename: /lib/modules/2.6.39.4/kernel/net/bridge/bridge.ko
version: 2.3
license: GPL
srcversion:
6B583530AE2B39C7E2317BF
depends: stp,llc
vermagic: 2.6.39.4 preempt mod_unload ARMv5
[root@alarm ~]# depmod
[root@alarm ~]# cat /lib/modules/2.6.39.4/modules.dep |grep bridge
kernel/net/bridge/bridge.ko:
[root@alarm ~]#
See how modinfo properly lists the dependencies, but modules.dep which
depmod generates does not contain them. As a result, most kernel
modules fail to load because their dependencies are not loaded by
modprobe.
Lucas De Marchi [Fri, 3 Feb 2012 20:11:53 +0000 (18:11 -0200)]
TODO: add task to write testsuite/README
Lucas De Marchi [Fri, 3 Feb 2012 18:33:36 +0000 (16:33 -0200)]
man: insmod: we don't handle modules from stdin
- Gah, kmod insmod can't load from stdin anymore. :/
- What's the use case?
- zcat module.ko.gz | insmod - (but the new insmod apparently can load .gz fine)
- yes... just insmod module.ko.gz
- and actually insmod(8) says it works. :)
Not anymore...
Khem Raj [Fri, 3 Feb 2012 07:09:59 +0000 (23:09 -0800)]
depmod: Dont use errno unconditionally
fopen() will not reset errno if it succeeds so we should
make sure that we only use errno in error cases.
Also fix the diagnostic messages to not use strerror
when there is no error since strerror will not return
anything useful in this case
Dave Reisner [Thu, 2 Feb 2012 22:24:03 +0000 (17:24 -0500)]
fix building and cleaning of manpages
- add modules.dep as an explicit dependency of modules.dep.bin to ensure
parallel builds don't fail
- add generated man pages to CLEANFILES
Dave Reisner [Fri, 3 Feb 2012 13:15:36 +0000 (08:15 -0500)]
modprobe: avoid breaking on insertion failure
Dave Reisner [Thu, 2 Feb 2012 16:07:33 +0000 (11:07 -0500)]
lib/module: check initstate before inserting module
This applies to both the high level probe_insert_module() and the
underlying insert_module() functions. By checking module initstate prior
to inserting a module, we can avoid a lot of needless work just to find
out that the init_module call fails with EEXIST.
This implements a helper function, module_is_inkernel, to return a
boolean value describing if a module is live, coming, or builtin.
Dave Reisner [Thu, 2 Feb 2012 20:05:57 +0000 (15:05 -0500)]
whitespace fix -- no logical code changes
Gustavo Sverzut Barbieri [Wed, 1 Feb 2012 00:16:47 +0000 (22:16 -0200)]
fix manpage build and install.
just build and install manpages if tools are enabled.
List stub modules.dep.bin in proper variable.
Gustavo Sverzut Barbieri [Sat, 7 Jan 2012 21:37:37 +0000 (19:37 -0200)]
improve logging to mention context.
Just printing the errno string such as "%m\n" is not enough to help
debug or users understand the problem.
Change to provide more context on the failing operation.
Gustavo Sverzut Barbieri [Sat, 7 Jan 2012 21:25:03 +0000 (19:25 -0200)]
improve log when debugging.
Some messages may happen more than once in the same function and
discovering the line is hard. Now we print the actual log priority
that exposed the message as well as filename and line.
NOTE: We should consider printing the log priority in the non-debug
version as well.
Lucas De Marchi [Tue, 31 Jan 2012 19:23:35 +0000 (17:23 -0200)]
libkmod: organize public header
Lucas De Marchi [Tue, 31 Jan 2012 18:05:02 +0000 (16:05 -0200)]
Prepare for API bump
Dave Reisner [Tue, 31 Jan 2012 01:57:36 +0000 (20:57 -0500)]
modprobe: properly handle errors from init_module
Effectively catch and the zero and non-zero cases and error out
appropriately. Note that -EEXIST will only ever be returned when
KMOD_PROBE_STOP_ON_ALREADY_LOADED is set as a probe_insert_module flag.
Lucas De Marchi [Tue, 31 Jan 2012 14:05:36 +0000 (12:05 -0200)]
libkmod-module: probe: remove useless KMOD_PROBE_STOP_ON_COMMAND
Lucas De Marchi [Tue, 31 Jan 2012 13:29:06 +0000 (11:29 -0200)]
libkmod-module: probe: return -EEXIST if told to stop on already loaded
Dave Reisner [Mon, 30 Jan 2012 22:52:25 +0000 (17:52 -0500)]
testsuite: allow for expected failure of tests
Adds a bool to the test struct called 'expected_fail' which can be set
to flip the logic used to determine success and failure. Messaging is
also changed to reflect an unexpected pass or expected fail. This can be
used to write tests which may represent functionality desirable for a
future release.
Dave Reisner [Mon, 30 Jan 2012 22:16:50 +0000 (17:16 -0500)]
modprobe: post-remove module deps with 0 refcnt
This commit looks shockingly similar to
0e9bd2d1 because SOMEONE decided
to remove it in a872bba in a glorious frenzy of refactoring.
Lucas De Marchi [Mon, 30 Jan 2012 21:01:24 +0000 (19:01 -0200)]
kmod-modprobe: migrate to kmod_module_probe_insert_module()
Lucas De Marchi [Mon, 30 Jan 2012 21:00:58 +0000 (19:00 -0200)]
libkmod-module: probe: add flag to dry-run