]> git.ipfire.org Git - thirdparty/kmod.git/log
thirdparty/kmod.git
12 years agokmod 7 v7
Lucas De Marchi [Mon, 19 Mar 2012 11:23:14 +0000 (08:23 -0300)] 
kmod 7

12 years agobuild-sys: don't set CFLAGS and LDFLAGS
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

12 years agobuild-sys: re-organize configure.ac
Lucas De Marchi [Sat, 17 Mar 2012 13:26:32 +0000 (10:26 -0300)] 
build-sys: re-organize configure.ac

12 years agoconfigure.ac: Move link only flags out of CFLAGS and into LDFLAGS.
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.

12 years agoAdd CC_CHECK_LDFLAGS_APPEND m4 macro.
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.

12 years agoconfig: use order /etc, /run, /lib
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.

12 years agomodprobe: set log prio to 0 if user passed -q arg
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

12 years agoMerge branch 'master' of git://code.falconindy.com/kmod
Lucas De Marchi [Thu, 15 Mar 2012 03:31:22 +0000 (00:31 -0300)] 
Merge branch 'master' of git://code.falconindy.com/kmod

12 years agomodprobe: always try to remove all modules in command line
Lucas De Marchi [Thu, 15 Mar 2012 03:27:18 +0000 (00:27 -0300)] 
modprobe: always try to remove all modules in command line

12 years agomodprobe: don't check if module builtin to decide if it's builtin
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.

12 years agomodprobe: fix error path in removing modules
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

12 years agokmod 6 v6
Lucas De Marchi [Sat, 3 Mar 2012 01:34:36 +0000 (22:34 -0300)] 
kmod 6

12 years agoUse upper case after Deprecated in doc
Lucas De Marchi [Sat, 3 Mar 2012 01:28:38 +0000 (22:28 -0300)] 
Use upper case after Deprecated in doc

12 years agoAdd kmod_module_apply_filter() to doc-sections file
Lucas De Marchi [Sat, 3 Mar 2012 01:18:33 +0000 (22:18 -0300)] 
Add kmod_module_apply_filter() to doc-sections file

12 years agoFix wrong printf format string
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.

12 years agolibkmod-index: do not pre-populate mmap
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.

12 years agoDowngrade log message: refcnt file may not exist
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>

12 years agoman: detail modprobe.blacklist in kcmdline
Lucas De Marchi [Mon, 27 Feb 2012 23:35:12 +0000 (20:35 -0300)] 
man: detail modprobe.blacklist in kcmdline

12 years agolibkmod-index: free node when we have only partial match
Lucas De Marchi [Mon, 27 Feb 2012 22:54:33 +0000 (19:54 -0300)] 
libkmod-index: free node when we have only partial match

12 years agomodprobe: show builtin label on --show-depends
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

12 years agolibkmod-module: fill builtin's name
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.

12 years agofind builtins by property, not initstate
Dave Reisner [Sat, 25 Feb 2012 04:02:06 +0000 (23:02 -0500)] 
find builtins by property, not initstate

12 years agomodinfo: use new apply_filter method to avoid builtins
Dave Reisner [Fri, 24 Feb 2012 15:13:16 +0000 (10:13 -0500)] 
modinfo: use new apply_filter method to avoid builtins

12 years agolibkmod/module: add kmod_module_apply_filter method
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.

12 years agoMove repository to kernel.org
Lucas De Marchi [Fri, 24 Feb 2012 03:58:20 +0000 (01:58 -0200)] 
Move repository to kernel.org

12 years agolibkmod-module: don't treat "coming" as in-kernel
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.

12 years agoTODO: update and organize items
Lucas De Marchi [Wed, 22 Feb 2012 15:07:13 +0000 (13:07 -0200)] 
TODO: update and organize items

12 years agolibkmod-module: probe: check if module exists for install cmds
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 ; : ; }

12 years agoAdd missing newlines
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

12 years agoDowngrade log level when modules.dep{,.bin} don't exist
Lucas De Marchi [Fri, 17 Feb 2012 07:00:09 +0000 (05:00 -0200)] 
Downgrade log level when modules.dep{,.bin} don't exist

12 years agotestsuite: fix color of unexpected failure
Lucas De Marchi [Thu, 16 Feb 2012 23:11:13 +0000 (21:11 -0200)] 
testsuite: fix color of unexpected failure

12 years agokmod-module: lookup: search modules.builtin file too
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().

12 years agotestsuite: add test for builtins with modprobe
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.

12 years agotestsuite: add .path member to test struct
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.

12 years agoFix path.c's function pointer defenitions.
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

12 years agoTODO: add tasks and bug fixes
Lucas De Marchi [Tue, 14 Feb 2012 23:57:35 +0000 (21:57 -0200)] 
TODO: add tasks and bug fixes

12 years agolibkmod-index: don't print an error if index doesn't exist
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.

12 years agolibkmod-module: probe: fix infinite loop with softdeps
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.

12 years agotest: remove test-state
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.

12 years agoMark functions with attribute noreturn
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.

12 years agoCheck if libc has __xstat
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.

12 years agobuild-sys: add rule to pack rootfs
Lucas De Marchi [Wed, 8 Feb 2012 03:51:17 +0000 (01:51 -0200)] 
build-sys: add rule to pack rootfs

12 years agotestsuite: add tests to modprobe --show-depends
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

12 years agotestsuite: update README file
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

12 years agotestsuite: macronify test definitions
Lucas De Marchi [Tue, 7 Feb 2012 12:46:46 +0000 (10:46 -0200)] 
testsuite: macronify test definitions

12 years agotestsuite: macronify main function
Lucas De Marchi [Tue, 7 Feb 2012 12:09:20 +0000 (10:09 -0200)] 
testsuite: macronify main function

12 years agotestsuite: libtestsuite depends on individual components
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.

12 years agolibkmod-module: probe: Fix ignore-loaded flag not being applied
Lucas De Marchi [Tue, 7 Feb 2012 11:48:59 +0000 (09:48 -0200)] 
libkmod-module: probe: Fix ignore-loaded flag not being applied

12 years agokmod 5 v5
Lucas De Marchi [Mon, 6 Feb 2012 22:34:33 +0000 (20:34 -0200)] 
kmod 5

12 years agomodinfo: handle arguments more carefully
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()]

12 years agoAdd WARNING file for test dir and improve testsuite README
Lucas De Marchi [Mon, 6 Feb 2012 21:50:17 +0000 (19:50 -0200)] 
Add WARNING file for test dir and improve testsuite README

12 years agotestsuite: add README
Lucas De Marchi [Mon, 6 Feb 2012 18:50:54 +0000 (16:50 -0200)] 
testsuite: add README

12 years agolibkmod-module: probe: return -EEXIST if told to do so
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

12 years agolibkmod-module: probe: rename flag to be more meaningful
Lucas De Marchi [Mon, 6 Feb 2012 14:46:39 +0000 (12:46 -0200)] 
libkmod-module: probe: rename flag to be more meaningful

12 years agotest-conversion: remove test/test-{insmod,rmmod,rmmod2}
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.

12 years agotest-conversion: remove test/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.

12 years agotest-conversion: remove test/test-loaded
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.

12 years agoUpdate .gitignore files
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.

12 years agoFix simple grammar issue
Dan McGee [Sat, 4 Feb 2012 02:29:07 +0000 (20:29 -0600)] 
Fix simple grammar issue

12 years agoFix unaligned memory access in hash function
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.

12 years agoTODO: add task to write testsuite/README
Lucas De Marchi [Fri, 3 Feb 2012 20:11:53 +0000 (18:11 -0200)] 
TODO: add task to write testsuite/README

12 years agoman: insmod: we don't handle modules from stdin
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...

12 years agodepmod: Dont use errno unconditionally
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

12 years agofix building and cleaning of manpages
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

12 years agomodprobe: avoid breaking on insertion failure
Dave Reisner [Fri, 3 Feb 2012 13:15:36 +0000 (08:15 -0500)] 
modprobe: avoid breaking on insertion failure

12 years agolib/module: check initstate before inserting module
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.

12 years agowhitespace fix -- no logical code changes
Dave Reisner [Thu, 2 Feb 2012 20:05:57 +0000 (15:05 -0500)] 
whitespace fix -- no logical code changes

12 years agofix manpage build and install.
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.

12 years agoimprove logging to mention context.
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.

12 years agoimprove log when debugging.
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.

12 years agolibkmod: organize public header
Lucas De Marchi [Tue, 31 Jan 2012 19:23:35 +0000 (17:23 -0200)] 
libkmod: organize public header

12 years agoPrepare for API bump
Lucas De Marchi [Tue, 31 Jan 2012 18:05:02 +0000 (16:05 -0200)] 
Prepare for API bump

12 years agomodprobe: properly handle errors from init_module
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.

12 years agolibkmod-module: probe: remove useless KMOD_PROBE_STOP_ON_COMMAND
Lucas De Marchi [Tue, 31 Jan 2012 14:05:36 +0000 (12:05 -0200)] 
libkmod-module: probe: remove useless KMOD_PROBE_STOP_ON_COMMAND

12 years agolibkmod-module: probe: return -EEXIST if told to stop on already loaded
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

12 years agotestsuite: allow for expected failure of tests
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.

12 years agomodprobe: post-remove module deps with 0 refcnt
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.

12 years agokmod-modprobe: migrate to kmod_module_probe_insert_module()
Lucas De Marchi [Mon, 30 Jan 2012 21:01:24 +0000 (19:01 -0200)] 
kmod-modprobe: migrate to kmod_module_probe_insert_module()

12 years agolibkmod-module: probe: add flag to dry-run
Lucas De Marchi [Mon, 30 Jan 2012 21:00:58 +0000 (19:00 -0200)] 
libkmod-module: probe: add flag to dry-run

12 years agolibkmod-module: probe: add flag to ignore loaded modules
Lucas De Marchi [Mon, 30 Jan 2012 20:54:45 +0000 (18:54 -0200)] 
libkmod-module: probe: add flag to ignore loaded modules

We need a way to tell libkmod to ignore loaded modules, so modprobe can
tell it to dry-run and show dependencies. However there's a conflict
with two flags. KMOD_PROBE_STOP_ON_ALREADY_LOADED prevails if passed
together with KMOD_PROBE_IGNORE_LOADED.

12 years agolibkmod-module: probe: add print_action callback
Lucas De Marchi [Mon, 30 Jan 2012 19:02:06 +0000 (17:02 -0200)] 
libkmod-module: probe: add print_action callback

This allows to implement dry-run in modprobe without exporting
kmod_module_get_probe_list().

12 years agolibkmod-module: probe: add room in flags for future extension
Lucas De Marchi [Mon, 30 Jan 2012 18:37:57 +0000 (16:37 -0200)] 
libkmod-module: probe: add room in flags for future extension

Breaking flags is one of the reasons next version will need to bump ABI.
In future we don't want to bump it just because of this.

12 years agolibkmod-module: probe: ignore-command flag can't be used in return
Lucas De Marchi [Mon, 30 Jan 2012 18:33:37 +0000 (16:33 -0200)] 
libkmod-module: probe: ignore-command flag can't be used in return

12 years agolibkmod-module: probe: remove useless flag to stop on failure
Lucas De Marchi [Mon, 30 Jan 2012 18:30:12 +0000 (16:30 -0200)] 
libkmod-module: probe: remove useless flag to stop on failure

We always want to stop if module failed to loaded due to unknown reason.

12 years agolibkmod-module: probe: add flag to stop loading on already loaded
Lucas De Marchi [Mon, 30 Jan 2012 18:26:52 +0000 (16:26 -0200)] 
libkmod-module: probe: add flag to stop loading on already loaded

It's not as simple as tell user to check if the module is loaded before
calling this function. Due to race conditions, module might not be
loaded before the function call, but fail later because another process
inserted it.

12 years agotestsuite: check if dots are allowed in aliases
Lucas De Marchi [Sun, 29 Jan 2012 18:02:20 +0000 (16:02 -0200)] 
testsuite: check if dots are allowed in aliases

12 years agotestsuite: add test for kmod_module_new_from_name()
Lucas De Marchi [Sun, 29 Jan 2012 17:43:19 +0000 (15:43 -0200)] 
testsuite: add test for kmod_module_new_from_name()

Check if module names are being correctly normalized.

12 years agolibkmod-module: split creation of new modules to share code
Lucas De Marchi [Sun, 29 Jan 2012 17:40:58 +0000 (15:40 -0200)] 
libkmod-module: split creation of new modules to share code

Share code of module creation among the several new functions. With this
we let the alias/modname/path parsing to the separate functions, and the
rest with the common one.

This fixes the issue of alias names not being able to contain dots.

12 years agoPartially fix parsing of alias with dots
Lucas De Marchi [Sun, 29 Jan 2012 17:22:09 +0000 (15:22 -0200)] 
Partially fix parsing of alias with dots

Alias names may contain dots. However since kmod_module_from_alias()
still calls kmod_module_new_from_name(), the bug is not entirely fixed,
and will be completely corrected in a later patch.

12 years agolibkmod-module: probe: add flag to ignore commands
Lucas De Marchi [Sun, 29 Jan 2012 04:35:46 +0000 (02:35 -0200)] 
libkmod-module: probe: add flag to ignore commands

12 years agolibkmod-module: probe: change insertion to cover more use cases
Lucas De Marchi [Sun, 29 Jan 2012 03:49:09 +0000 (01:49 -0200)] 
libkmod-module: probe: change insertion to cover more use cases

Split kmod_module_probe_insert_module() in 2:
1) Get list of modules to be loaded
2) Iterate the list, loading the module

With this in future we will be able to cover use cases of modprobe,
that has a logic a bit more complicated.

With this we also change the logic to detect dependency loops: instead
of checking the recursion every STEP times, we now keep a field in
kmod_module, marking it as visited. We simply ignore already visited
modules and thus we break loops.

12 years agolibkmod-module: add visited field
Lucas De Marchi [Wed, 18 Jan 2012 03:26:44 +0000 (01:26 -0200)] 
libkmod-module: add visited field

This field can be used to iterate the modules, controlling whether we
are revisiting a certain module. A function to clear the values in all
modules is needed since when we are iterating, we don't know if the
module is created anew or if it's picked from the pool. Therefore we
can't know if the field is true because of a previous iteration or if
the module was indeed already visited.

12 years agobuild-sys: fix make dist
Lucas De Marchi [Sun, 29 Jan 2012 18:09:59 +0000 (16:09 -0200)] 
build-sys: fix make dist

12 years agobuild-sys: declare rootfs.tar.xz as dep of rootfs/
Dave Reisner [Sun, 29 Jan 2012 18:22:59 +0000 (13:22 -0500)] 
build-sys: declare rootfs.tar.xz as dep of rootfs/

This forces make to re-extract the tarball when it's changed

12 years agotestsuite: let stat.h take care of stat64
Lucas De Marchi [Mon, 30 Jan 2012 15:45:55 +0000 (13:45 -0200)] 
testsuite: let stat.h take care of stat64

This fixes testsuite build in 32 bits machines.

12 years agoUse %zu for size_t
Lucas De Marchi [Mon, 30 Jan 2012 15:29:17 +0000 (13:29 -0200)] 
Use %zu for size_t

Remove warning on 32 bits systems.

12 years agotestsuite: remove unneeded call to memset()
Lucas De Marchi [Sat, 28 Jan 2012 23:30:57 +0000 (21:30 -0200)] 
testsuite: remove unneeded call to memset()

12 years agolibkmod: Fix handling of square brackets expressions in function alias_normalize
Pedro Pedruzzi [Sat, 28 Jan 2012 05:26:32 +0000 (03:26 -0200)] 
libkmod: Fix handling of square brackets expressions in function alias_normalize

12 years agotestsuite: add test for function alias_normalize
Pedro Pedruzzi [Sat, 28 Jan 2012 05:22:47 +0000 (03:22 -0200)] 
testsuite: add test for function alias_normalize

12 years agomodprobe: print end of configuration files
Lucas De Marchi [Sat, 28 Jan 2012 01:56:46 +0000 (23:56 -0200)] 
modprobe: print end of configuration files