]> git.ipfire.org Git - thirdparty/kmod.git/log
thirdparty/kmod.git
11 years agokmod 12 v12
Lucas De Marchi [Wed, 5 Dec 2012 03:39:17 +0000 (01:39 -0200)] 
kmod 12

11 years agodepmod: fix checking file extension
Lucas De Marchi [Wed, 28 Nov 2012 16:26:23 +0000 (14:26 -0200)] 
depmod: fix checking file extension

In depfile_up_to_date_dir() we need to check if name has a kmod
extension. "path" variable there will be the directory name, which
doesn't contain an extension.

Without this, "depmod -A" returns that the modules.dep is up to date,
even if it isn't.

In depmod_modules_search_file() it's pointless to compare the basename,
so pass only the name to be checked.

11 years agoUse bool instead of int
Lucas De Marchi [Wed, 28 Nov 2012 16:25:50 +0000 (14:25 -0200)] 
Use bool instead of int

Also change the last field initializer in array to be empty.

11 years agofix is_module_filename()
Aleksey Makarov [Wed, 28 Nov 2012 03:44:00 +0000 (10:44 +0700)] 
fix is_module_filename()

modinfo fails if there is a ".ko" substring in the path to the module

11 years agolibkmod-module: mangle the section header, not the section
Lucas De Marchi [Wed, 21 Nov 2012 22:17:25 +0000 (20:17 -0200)] 
libkmod-module: mangle the section header, not the section

When we are told to remove the "__versions" section we were mangling
that section instead of tweaking the SHF_ALLOC flag in its header.

11 years agolibkmod-module: Remove key+value vermagic from .modinfo section
Lucas De Marchi [Wed, 21 Nov 2012 20:34:50 +0000 (18:34 -0200)] 
libkmod-module: Remove key+value vermagic from .modinfo section

When told to force load a module, we were removing only the value of
vermagic instead of the complete entry.

Philippe De Swert (philippe.deswert@jollamobile.com) sent a patch that
was additionally mangling also the last two chars of the key
("vermagic="). Instead of creating an invalid entry in .modinfo section
like this, this patch removes the complete entry, key + value, by
zeroing the entire string.

Much thanks to Philippe who found the issue and pointed to the fix.

11 years agodepmod: fix asserting mod->kmod == NULL
Lucas De Marchi [Fri, 16 Nov 2012 14:05:42 +0000 (12:05 -0200)] 
depmod: fix asserting mod->kmod == NULL

If we are replacing a lower priority module (due to its location), we
already created a kmod_module, but didn't open the file for reading its
symbols. This means mod->kmod won't be NULL, and this is just ok. Since
all the functions freeing stuff below the previous assert already takes
NULL into consideration, it's safe to just unref mod->kmod and let the
right thing happens.

11 years agodepmod: fix hash lookup by relpath instead of uncrelpath
Lucas De Marchi [Fri, 16 Nov 2012 13:35:30 +0000 (11:35 -0200)] 
depmod: fix hash lookup by relpath instead of uncrelpath

We index modules in depmod by it's uncompressed relative path, not
relative path. We didn't notice this bug before since this function is
only triggered if we release a module to be replaced by one of higher
priority.

Also fix a leftover log message referring to relpath instead of
uncrelpath.

11 years agokmod 11 v11
Lucas De Marchi [Thu, 8 Nov 2012 04:30:21 +0000 (02:30 -0200)] 
kmod 11

11 years agoTODO: remove completed action
Lucas De Marchi [Thu, 8 Nov 2012 04:01:59 +0000 (02:01 -0200)] 
TODO: remove completed action

11 years agotools: use program_invocation_short_name provided by libc
Lucas De Marchi [Tue, 6 Nov 2012 21:20:09 +0000 (19:20 -0200)] 
tools: use program_invocation_short_name provided by libc

Thanks to Dave Reisner for pointing this out.

11 years agotools: staticize functions that are now only used in log.c
Lucas De Marchi [Tue, 6 Nov 2012 21:06:11 +0000 (19:06 -0200)] 
tools: staticize functions that are now only used in log.c

11 years agotools: share function for logging
Lucas De Marchi [Tue, 6 Nov 2012 21:01:59 +0000 (19:01 -0200)] 
tools: share function for logging

11 years agotools: share setting up libkmod log
Lucas De Marchi [Tue, 6 Nov 2012 20:26:34 +0000 (18:26 -0200)] 
tools: share setting up libkmod log

This also fixes a bug in "e6996c5 rmmod: route all messages to syslog if
told to" in which "+ verbose" was removed. Instead of letting verbose
add to kmod_get_log_priority(), let it be similar to the other programs
instead.

11 years agotools: use a single function for logging libkmod output
Lucas De Marchi [Tue, 6 Nov 2012 20:04:09 +0000 (18:04 -0200)] 
tools: use a single function for logging libkmod output

11 years agotools: make usage() messages go to stdout rather than stderr
Lucas De Marchi [Tue, 6 Nov 2012 19:32:41 +0000 (17:32 -0200)] 
tools: make usage() messages go to stdout rather than stderr

When user supplied --help/-h, program should output to stdout the usage,
not to stderr. It's the expected behavior, what the user asked for,
not something to log or an error.

11 years agotools: share function to convert prio to string
Lucas De Marchi [Tue, 6 Nov 2012 19:08:43 +0000 (17:08 -0200)] 
tools: share function to convert prio to string

No change is expected in the final binary since right now only an inline
function is shared. Later we expect to share more code.

11 years agotools: share getting program name from argv for all tools
Lucas De Marchi [Tue, 6 Nov 2012 18:54:17 +0000 (16:54 -0200)] 
tools: share getting program name from argv for all tools

11 years agormmod: route all messages to syslog if told to
Lucas De Marchi [Mon, 5 Nov 2012 20:32:05 +0000 (18:32 -0200)] 
rmmod: route all messages to syslog if told to

11 years agormmod: prefer ERR over plain fprintf
Lucas De Marchi [Mon, 5 Nov 2012 19:51:32 +0000 (17:51 -0200)] 
rmmod: prefer ERR over plain fprintf

11 years agomodinfo: prefer ERR over plain fprintf
Lucas De Marchi [Mon, 5 Nov 2012 19:58:57 +0000 (17:58 -0200)] 
modinfo: prefer ERR over plain fprintf

11 years agoinsmod: prefer ERR over plain fprintf
Lucas De Marchi [Mon, 5 Nov 2012 17:08:54 +0000 (15:08 -0200)] 
insmod: prefer ERR over plain fprintf

11 years agodepmod: add depmod prefix to log messages
Lucas De Marchi [Mon, 5 Nov 2012 04:07:09 +0000 (02:07 -0200)] 
depmod: add depmod prefix to log messages

11 years agodepmod: remove inline from _log
Lucas De Marchi [Mon, 5 Nov 2012 04:06:38 +0000 (02:06 -0200)] 
depmod: remove inline from _log

11 years agoTODO: update file with tasks
Lucas De Marchi [Mon, 5 Nov 2012 04:04:44 +0000 (02:04 -0200)] 
TODO: update file with tasks

11 years agodepmod: prefer ERR and WRN over plain fprintf
Lucas De Marchi [Mon, 5 Nov 2012 04:01:06 +0000 (02:01 -0200)] 
depmod: prefer ERR and WRN over plain fprintf

11 years agomodprobe: use ERR() instead of fprintf(stderr, ...)
Lucas De Marchi [Thu, 1 Nov 2012 15:02:10 +0000 (13:02 -0200)] 
modprobe: use ERR() instead of fprintf(stderr, ...)

11 years agomodprobe: prefix log messages to stderr with modprobe
Lucas De Marchi [Thu, 1 Nov 2012 14:45:23 +0000 (12:45 -0200)] 
modprobe: prefix log messages to stderr with modprobe

11 years agomodprobe: move log function
Lucas De Marchi [Thu, 1 Nov 2012 14:39:18 +0000 (12:39 -0200)] 
modprobe: move log function

11 years agomodprobe: prefix libkmod messages to stderr with modprobe:
Lucas De Marchi [Thu, 1 Nov 2012 14:24:58 +0000 (12:24 -0200)] 
modprobe: prefix libkmod messages to stderr with modprobe:

When we are logging to stderr we are previously relying on libkmod
sending it to the default location in case we are not asked to log to
syslog. The problem is that modprobe may be used in scripts that don't
want to log to syslog (since they are not daemons, like scripts to
generate initrd) and then it's difficult to know where the message comes
from.

This patch treats only the messages coming from libkmod.

11 years agomodprobe: use prio_to_str() helper
Lucas De Marchi [Thu, 1 Nov 2012 00:00:40 +0000 (22:00 -0200)] 
modprobe: use prio_to_str() helper

11 years agomodprobe: exit in one place
Lucas De Marchi [Wed, 31 Oct 2012 23:29:54 +0000 (21:29 -0200)] 
modprobe: exit in one place

11 years agodepmod: unref kmod_module once we don't need it anymore
Lucas De Marchi [Tue, 30 Oct 2012 05:46:12 +0000 (03:46 -0200)] 
depmod: unref kmod_module once we don't need it anymore

Once we read all we need from a module, unref it so any resource taken
by it (including the mmap to access the file in libkmod) will be
dropped. This drastically reduces the number of open file descriptors
and also the memory needed, with no performance penalties. Rather,
there's a small speedup of ~2.6%.

Running depmod in a laptop with 2973 modules and comparing the number of
open file descriptors for kmod-10, before and after the last patches to
depmod (caaf438cb681c5b5b5b3c32e5b6bd12e96993dd7 and HEAD) we have:

Before: 2980 simultaneously open fds
After: 7    simultaneously open fds
kmod-10: 7    simultaneously open fds

So now we have the speedup of caching the file in kmod_module without
the drawback of increasing the number of open file descriptors.

11 years agodepmod: use our copy of modname instead of calling libkmod
Lucas De Marchi [Tue, 30 Oct 2012 06:08:54 +0000 (04:08 -0200)] 
depmod: use our copy of modname instead of calling libkmod

In depmod_module_add() we already called kmod_module_get_name() and
copied the string to our struct. Use it instead of calling again and
again the libkmod function.

11 years agodepmod: cache dependency_symbol list in struct mod
Lucas De Marchi [Tue, 30 Oct 2012 05:16:10 +0000 (03:16 -0200)] 
depmod: cache dependency_symbol list in struct mod

The overall goal is to coalesce the accesses to a file that is the
backend of a module. This commit addresses the calls to
kmod_module_get_get_dependency_symbols(). Calling it earlier, while we
are iterating the modules allows us to free the struct kmod of each
module much sooner. We are still not freeing it since there are other
places that must be refactored first.

There's a performance penalty of ~2.5% from previous commit.

11 years agodepmod: cache info_list in struct mod
Lucas De Marchi [Tue, 30 Oct 2012 05:16:10 +0000 (03:16 -0200)] 
depmod: cache info_list in struct mod

The overall goal is to coalesce the accesses to a file that is the
backend of a module. This commit addresses the calls to
kmod_module_get_info(). Calling it earlier, while we are iterating the
modules allows us to free the struct kmod of each module much sooner. We
are still not freeing it since there are other places that must be
refactored first.

A nice side effect is that this commit reduces in ~33% the calls to
malloc(), giving a speedup of ~6% for cold caches (reproduced on only 1
laptop).

11 years agodepmod: do not create a hole in struct depmod
Lucas De Marchi [Tue, 30 Oct 2012 04:32:48 +0000 (02:32 -0200)] 
depmod: do not create a hole in struct depmod

11 years agobuild-sys: use AS_IF autoconf macro
Lucas De Marchi [Tue, 23 Oct 2012 12:45:10 +0000 (10:45 -0200)] 
build-sys: use AS_IF autoconf macro

Just for consistency with the rest.

11 years agobuild-sys: require xsltproc when manpages are enabled
Sami Kerola [Mon, 22 Oct 2012 17:40:02 +0000 (18:40 +0100)] 
build-sys: require xsltproc when manpages are enabled

Before this commit the build system failed at late state with
non-helpful message when xsltproc was not available.

Making all in man
  GEN      depmod.d.5
/bin/sh: --nonet: command not found
make[2]: *** [depmod.d.5] Error 127
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

11 years agolibkmod: cache open file for later access
Lucas De Marchi [Thu, 18 Oct 2012 04:36:33 +0000 (01:36 -0300)] 
libkmod: cache open file for later access

If we are accessing several times the modules and reading some sections
by sucessive calls to the functions below, we are incurring in a penalty
of having to open, parse the header and close the file. For each
function.

- kmod_module_get_info()
- kmod_module_get_versions()
- kmod_module_get_symbols()
- kmod_module_get_dependency_symbols()

These functions are particularly important to depmod. It calls all of
them, for each module. Moreover there's a huge bottleneck in the open
operation if we are using compression. Every time we open the module we
need to uncompress the file and after getting the information we need we
discard the result. This is clearly shown by profiling depmod with perf
(record + report), using compressed modules:

 64.07%  depmod  libz.so.1.2.7       [.] 0x00000000000074b8                                            ◆
 18.18%  depmod  libz.so.1.2.7       [.] crc32                                                         ▒
  2.42%  depmod  libz.so.1.2.7       [.] inflate                                                       ▒
  1.17%  depmod  libc-2.16.so        [.] __memcpy_ssse3_back                                           ▒
  0.96%  depmod  [kernel.kallsyms]   [k] copy_user_generic_string                                      ▒
  0.89%  depmod  libc-2.16.so        [.] __strcmp_sse42                                                ▒
  0.82%  depmod  [kernel.kallsyms]   [k] hrtimer_interrupt                                             ▒
  0.77%  depmod  libc-2.16.so        [.] _int_malloc                                                   ▒
  0.44%  depmod  kmod-nolib          [.] kmod_elf_get_strings                                          ▒
  0.41%  depmod  kmod-nolib          [.] kmod_elf_get_dependency_symbols                               ▒
  0.37%  depmod  kmod-nolib          [.] kmod_elf_get_section                                          ▒
  0.36%  depmod  kmod-nolib          [.] kmod_elf_get_symbols
  ...

Average of running depmod 5 times, dropping caches between them, in a
slow spinning disk:

Before:   12.25 +- 0.20
After:     8.20 +- 0.21
m-i-t:     9.62 +- 0.27

So this patch leads to an improvement of ~33% over unpatched version,
ending up with 15% speedup over module-init-tools.

11 years agormmod: Deprecate --wait option
Lucas De Marchi [Wed, 17 Oct 2012 21:32:56 +0000 (18:32 -0300)] 
rmmod: Deprecate --wait option

Remove --wait from usage() and give a message + sleep(10) if user is in
fact using it.

11 years agolibkmod-hash: Plug possible memory leak when free_value is defined
Leandro Pereira [Fri, 12 Oct 2012 15:28:56 +0000 (12:28 -0300)] 
libkmod-hash: Plug possible memory leak when free_value is defined

Although the hash table implementation allows passing a callback function
to free a value when it is removed from the hash table, hash_del() wasn't
freeing it if it was provided. Now it does.

As a bonus, it now checks if the callback is set in hash_add() as well.

11 years agolibkmod: Add support for '.' in module parameter on kcmdline
Lucas De Marchi [Mon, 8 Oct 2012 22:04:16 +0000 (19:04 -0300)] 
libkmod: Add support for '.' in module parameter on kcmdline

Otherwise we fail to parse arguments in kernel command line like
testmodule.testparam=1.5G

Suggested-by: Selim T. Erdogan <selim@alumni.cs.utexas.edu>
11 years agotestsuite: add depmod test for modules.alias
Lucas De Marchi [Thu, 4 Oct 2012 04:08:13 +0000 (01:08 -0300)] 
testsuite: add depmod test for modules.alias

Check if modules.alias is correctly generated from modules.order if we
have compressed modules.

11 years agotestsuite: allow to check generated files
Lucas De Marchi [Thu, 4 Oct 2012 03:21:52 +0000 (00:21 -0300)] 
testsuite: allow to check generated files

This gives the test cases the ability to supply files that must be
checked after the test is run, rather than just checking stdout/stderr.

This is intended to be used with tools that generate files, like depmod.
It includes a poor's man implementation of a "check for differences in
files". Not really optimized, but it's simple enough and does what it
proposes to.

11 years agodepmod: fix parsing of modules.order with compressed modules
Lucas De Marchi [Wed, 3 Oct 2012 19:28:24 +0000 (16:28 -0300)] 
depmod: fix parsing of modules.order with compressed modules

We now index the modules by uncompressed-relative-path instead of
relative-path. This is because the file modules.order, coming from
kernel, always comes with uncompressed paths. This fixes the issue of
not sorting the aliases correctly due to paths not matching when using
compressed modules.

11 years agobuild-sys: Remove --with-rootprefix option
Dave Reisner [Thu, 27 Sep 2012 15:00:42 +0000 (11:00 -0400)] 
build-sys: Remove --with-rootprefix option

This is a broken option that only leads to misery and incompatabilities
with other systems. Kbuild doesn't come close to supporting directories
other than /lib/modules with several targets simply failing without
hacky fixes. Simply remove the option and all traces of it, as it
doesn't make sense in today's world.

11 years agobuild-sys: Append -Werror when testing flags
Lucas De Marchi [Fri, 14 Sep 2012 14:18:41 +0000 (11:18 -0300)] 
build-sys: Append -Werror when testing flags

Clang doesn't treat unknown warnings flags as an error, but rather as a
warning. The result is that the detection for whic CFLAGS are supported
by this compiler will not work, since the compilation will succeed.

With this patch we now successfully detect clang doesn't support
-Wlogical-op, as opposed to previous behavior:

checking if clang supports flag -Wlogical-op in envvar CFLAGS... no

We use this macro only for LDFLAGS and CFLAGS, so it's safe to stash
-Werror there.

11 years agoNEWS: language corrections
Jan Engelhardt [Thu, 13 Sep 2012 23:55:54 +0000 (01:55 +0200)] 
NEWS: language corrections

11 years agomodinfo: clarify verbiage for field shortcuts
Dave Reisner [Sat, 8 Sep 2012 16:22:11 +0000 (12:22 -0400)] 
modinfo: clarify verbiage for field shortcuts

Cleanup the punctuation and grammar in this blurb, specifically pointing
out what these are shortcuts for.

11 years agoMakefile: remove redundant flags to $(RM)
Dave Reisner [Sat, 8 Sep 2012 15:43:54 +0000 (11:43 -0400)] 
Makefile: remove redundant flags to $(RM)

$(RM) will always expand to 'rm -f' which means we don't need to ignore
errors or pass this flag again.

11 years agoDefine rootfs as dependency of check-am
Dave Reisner [Sat, 8 Sep 2012 18:08:50 +0000 (14:08 -0400)] 
Define rootfs as dependency of check-am

This should actually fix the problem of ensuring that the rootfs is
created every time that 'make check' is run.

11 years agoRevert "build-sys: disable jobserver for rootfs target"
Dave Reisner [Sat, 8 Sep 2012 15:50:56 +0000 (11:50 -0400)] 
Revert "build-sys: disable jobserver for rootfs target"

This is bogus and does not work.

This reverts commit 4e7f0f204bc82ce749cad6613b066993f530cbe6.

11 years agotestsuite: Fix double definition of 64-bits variant
Lucas De Marchi [Fri, 7 Sep 2012 17:59:35 +0000 (14:59 -0300)] 
testsuite: Fix double definition of 64-bits variant

If _FILE_OFFSET_BITS is defined we should not be wrapping these 64
variants, since they are macros in libc.

11 years agokmod 10 v10
Lucas De Marchi [Thu, 6 Sep 2012 19:26:53 +0000 (16:26 -0300)] 
kmod 10

11 years agoRemove test directory
Lucas De Marchi [Fri, 31 Aug 2012 09:59:26 +0000 (06:59 -0300)] 
Remove test directory

All tests should be in testsuite. The remaining tests in this directory
are not relevant enough to be ported. git log can be consulted if in
future we decide to put them in testsuite.

11 years agoTODO: deprecate use of rmmod -w
Lucas De Marchi [Thu, 30 Aug 2012 17:10:47 +0000 (14:10 -0300)] 
TODO: deprecate use of rmmod -w

As discussed with Rusty Russel, it would be nice to remove the related
code from kernel. Deprecate its use on kmod, so people know they
shouldn't be using it.

11 years agomodprobe: Unconditionally use KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY
Lucas De Marchi [Fri, 17 Aug 2012 12:42:47 +0000 (09:42 -0300)] 
modprobe: Unconditionally use KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY

This fixes a change in behavior regarding kmod and module-init-tools:
when trying to load a module by alias, we should check if it's
blacklisted, regardless of the command line arguments passed.

This was reported by "Dmitry V. Levin <ldv@altlinux.org>".

11 years agolibkmod-module: Add KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY flag
Lucas De Marchi [Fri, 17 Aug 2012 12:38:05 +0000 (09:38 -0300)] 
libkmod-module: Add KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY flag

With this flag kmod_module_probe_insert_module() check if module is
blacklisted only if it's also an alias. This is needed in order to allow
blacklisting a module by name and effectively blacklisting all its
aliases as module-init-tools was doing.

Before this patch we could load pcspkr module as follows:

/etc/modprobe.d/test.conf:
alias yay pcspkr
blacklist pcspkr

$ modprobe yay

Now libkmod has support to blacklist "yay" because "pcspkr" is blacklisted.

11 years agotestsuite preload: Factorize into macros, add more stat and open variants
Martin Pitt [Wed, 1 Aug 2012 21:35:34 +0000 (23:35 +0200)] 
testsuite preload: Factorize into macros, add more stat and open variants

Instead of replicating the same code several times, define and use macros for
the various types of wrapped functions in the testsuite's path.c LD_PRELOAD
wrapper.

Add various __xstat() variants and open64(), which are being used when enabling
large file support.

11 years agoREADME: let people know they don't need to subscribe
Lucas De Marchi [Tue, 31 Jul 2012 12:58:21 +0000 (09:58 -0300)] 
README: let people know they don't need to subscribe

People are afraid to CC the mailing list because they think they need to
subscribe (and a lot of them are already subscribed to too many lists).

11 years agobuild-sys: add 'man' entry in summary
Lucas De Marchi [Tue, 31 Jul 2012 12:51:48 +0000 (09:51 -0300)] 
build-sys: add 'man' entry in summary

11 years agobuild-sys: Add --disable-manpages option
Colin Walters [Mon, 30 Jul 2012 16:27:10 +0000 (12:27 -0400)] 
build-sys: Add --disable-manpages option

1) Embedded systems often don't want man pages on the
   target; rather than pointlessly building them, then ignoring
   the result, allow just not building them at all
2) When bootstrapping an operating systems, documentation is the
   source of many cyclical dependencies, and allowing it to
   be explicitly disabled is useful for earlier build passes.

11 years agoman/rmmod: specify each option in separate <term> tag
Dave Reisner [Wed, 25 Jul 2012 23:52:20 +0000 (19:52 -0400)] 
man/rmmod: specify each option in separate <term> tag

11 years agoman/depmod: specify each option in separate <term> tag
Dave Reisner [Wed, 25 Jul 2012 23:49:00 +0000 (19:49 -0400)] 
man/depmod: specify each option in separate <term> tag

11 years agoman/modprobe: specify each option in separate <term> tag
Dave Reisner [Wed, 25 Jul 2012 23:45:46 +0000 (19:45 -0400)] 
man/modprobe: specify each option in separate <term> tag

11 years agoman/modinfo: specify each option in separate <term> tag
Dave Reisner [Wed, 25 Jul 2012 23:40:10 +0000 (19:40 -0400)] 
man/modinfo: specify each option in separate <term> tag

This has the end result of comma delimiting equivalent options in the
manpage, similar to many other manuals.

11 years agoman/modinfo: document longopts for field shortcuts
Dave Reisner [Wed, 25 Jul 2012 23:36:40 +0000 (19:36 -0400)] 
man/modinfo: document longopts for field shortcuts

11 years agoman/modinfo: document --basedir option
Dave Reisner [Wed, 25 Jul 2012 23:29:40 +0000 (19:29 -0400)] 
man/modinfo: document --basedir option

This was never documented in the manpage of module-init-tools either.
The flag is identical in function to modprobe's --dirname option, so use
the same language to describe it.

11 years agoman/modprobe: clarify --dirname option
Dave Reisner [Wed, 25 Jul 2012 23:30:19 +0000 (19:30 -0400)] 
man/modprobe: clarify --dirname option

The documentation for this flag leads one to believe that the full path
to the module directory is needed. In reality, this flag specifies only
the root of the module path.

11 years agoUse #pragma once instead of #ifndef
Lucas De Marchi [Wed, 18 Jul 2012 13:19:48 +0000 (10:19 -0300)] 
Use #pragma once instead of #ifndef

Only the public header maintains #ifndef in the header, together with
pragma. The other ones contain only pragma.

As reported by Shawn Landden on systemd mailing list this is compatible
with all major compilers and gcc has this since version 3.3.

11 years agobuild-sys: disable jobserver for rootfs target
Dave Reisner [Tue, 10 Jul 2012 13:32:12 +0000 (09:32 -0400)] 
build-sys: disable jobserver for rootfs target

2588e3dff5d broke the distcheck target. Fix it by serializing the rootfs
(re)creation prior to running the testsuite.

11 years agotestsuite: re-license under LGPL
Lucas De Marchi [Tue, 10 Jul 2012 12:42:24 +0000 (09:42 -0300)] 
testsuite: re-license under LGPL

11 years agotestsuite: path wrapper: Fix open() with 3 arguments
Martin Pitt [Tue, 10 Jul 2012 07:19:50 +0000 (09:19 +0200)] 
testsuite: path wrapper: Fix open() with 3 arguments

Properly return the original libc return value in the case that open() is
called with 3 arguments.

11 years agomodule: support reading coresize from /sys if supported
Dave Reisner [Thu, 28 Jun 2012 13:09:48 +0000 (09:09 -0400)] 
module: support reading coresize from /sys if supported

Linux 3.3 introduced the coresize attribute in /sys/module/*. When
available, use this instead of parsing some portion of /proc/modules.

11 years agoImplicitly run 'make rootfs' with 'make check'
Dave Reisner [Thu, 28 Jun 2012 15:16:36 +0000 (11:16 -0400)] 
Implicitly run 'make rootfs' with 'make check'

Avoid the need for the user to run this manually after a run of the
testsuite by adding it.

11 years agotestsuite: use right offset for module name
Lucas De Marchi [Thu, 21 Jun 2012 14:30:56 +0000 (11:30 -0300)] 
testsuite: use right offset for module name

We need to cope with the case in which a 32 bits machine is opening a 64
bits kernel module and vice-versa. The offset in `struct module' are
different and do not depend on the architecture we are running, but
rather on the architecture they were created for.

This fixes `make check' in 32 bits machines (since we are shipping 64
bits modules for testing)

11 years agokmod 9 v9
Lucas De Marchi [Tue, 19 Jun 2012 22:46:53 +0000 (19:46 -0300)] 
kmod 9

11 years agobuild-sys: allow compressed modules in testsuite
Lucas De Marchi [Tue, 19 Jun 2012 16:27:17 +0000 (13:27 -0300)] 
build-sys: allow compressed modules in testsuite

11 years agobuild-sys: Make dirs writable on rootfs creation
Lucas De Marchi [Tue, 19 Jun 2012 16:09:23 +0000 (13:09 -0300)] 
build-sys: Make dirs writable on rootfs creation

Autofoo make the dist dir as readonly. If we copy it, tools needing to
create sysfs entries will not be able to do so, because they can't
create the needed directories/files.

It would be much better if autofoo allowed to let the files as is
instead of converting them to read-only.

11 years agodepmod: use ferror and fclose to check for error
Lucas De Marchi [Sat, 16 Jun 2012 01:14:00 +0000 (22:14 -0300)] 
depmod: use ferror and fclose to check for error

Thanks to hpa for point this out.

11 years agobootstrap: remove unnecessary echo
Dave Reisner [Fri, 8 Jun 2012 17:17:28 +0000 (13:17 -0400)] 
bootstrap: remove unnecessary echo

11 years agobootstrap-configure: quote command line arg expansion
Dave Reisner [Thu, 7 Jun 2012 23:49:16 +0000 (19:49 -0400)] 
bootstrap-configure: quote command line arg expansion

11 years agodepmod: return error when index is truncated due to ENOSPC
Lucas De Marchi [Fri, 15 Jun 2012 23:13:31 +0000 (20:13 -0300)] 
depmod: return error when index is truncated due to ENOSPC

Before:
=======
[lucas@vader kmod]$ sudo depmod
[lucas@vader kmod]$ echo $?
0
[lucas@vader kmod]$ ls -l /lib/modules/$(uname -r)
total 12
drwxr-xr-x 8 root root   160 Jun 13 11:05 kernel
-rw-r--r-- 1 root root 12288 Jun 15 21:29 modules.alias
-rw-r--r-- 1 root root     0 Jun 15 21:29 modules.alias.bin
-rw-r--r-- 1 root root     0 Jun 15 21:29 modules.dep
-rw-r--r-- 1 root root     0 Jun 15 21:29 modules.dep.bin
-rw-r--r-- 1 root root     0 Jun 15 21:29 modules.devname
-rw-r--r-- 1 root root     0 Jun 15 21:29 modules.softdep
-rw-r--r-- 1 root root     0 Jun 15 21:29 modules.symbols
-rw-r--r-- 1 root root     0 Jun 15 21:29 modules.symbols.bin

Note that modules.alias is truncated and the other have size == 0

After:
======

[lucas@vader kmod]$ sudo ./tools/depmod
WARNING: could not open /lib/modules/3.5.0-rc2-demarchi-00028-g94fa83c/modules.order: No such file or directory
ERROR: Could not create index: output truncated: No space left on device
[lucas@vader kmod]$ echo $?
1

11 years agodepmod: fix coding-style issue in array declaration
Lucas De Marchi [Fri, 15 Jun 2012 04:10:14 +0000 (01:10 -0300)] 
depmod: fix coding-style issue in array declaration

11 years agodepmod: fail if any index could not be created
Lucas De Marchi [Fri, 15 Jun 2012 04:08:17 +0000 (01:08 -0300)] 
depmod: fail if any index could not be created

11 years agodepmod: don't return error if modules.builtin don't exist
Lucas De Marchi [Fri, 15 Jun 2012 05:39:34 +0000 (02:39 -0300)] 
depmod: don't return error if modules.builtin don't exist

11 years agoRemove ifdef for building tools not bundled
Lucas De Marchi [Fri, 15 Jun 2012 03:38:19 +0000 (00:38 -0300)] 
Remove ifdef for building tools not bundled

Current build system do not support to build separate tools anymore, so
just remove the ifdefs.

11 years agobuild-sys: add missing header to fix distcheck
Lucas De Marchi [Thu, 14 Jun 2012 19:58:46 +0000 (16:58 -0300)] 
build-sys: add missing header to fix distcheck

11 years agotools: rename source files
Lucas De Marchi [Thu, 14 Jun 2012 19:29:28 +0000 (16:29 -0300)] 
tools: rename source files

There's no point anymore in having "kmod-" prefix. This is a historical
thing when we started implementation of these tools.

11 years agolibkmod-config: refactor functions to get config
Lucas De Marchi [Tue, 12 Jun 2012 04:43:46 +0000 (01:43 -0300)] 
libkmod-config: refactor functions to get config

It makes more sense to have libkmod-config.c deal with the configuration
directly and the others get the config from ctx. As a bonus point we get
a smaller binary. Following numbers are for x86-64, libkmod + kmod:

Before:
   text    data     bss     dec     hex filename
 128840    1496     104  130440   1fd88 tools/modprobe

After:
   text    data     bss     dec     hex filename
 128392    1496     104  129992   1fbc8 tools/modprobe

11 years agoTODO: update tasks
Lucas De Marchi [Mon, 11 Jun 2012 15:00:19 +0000 (12:00 -0300)] 
TODO: update tasks

 - Remove dependency loop with install commands, since it's done
 - Add reasoning behind API refactor

11 years agotestsuite: Fix test description
Lucas De Marchi [Wed, 6 Jun 2012 13:49:04 +0000 (10:49 -0300)] 
testsuite: Fix test description

11 years agolibkmod-index: protect ourselves from corrupted indexes
Lucas De Marchi [Wed, 6 Jun 2012 12:36:29 +0000 (09:36 -0300)] 
libkmod-index: protect ourselves from corrupted indexes

If index is shorter than 12 bytes, we couldn't even read its header. Go
to error handling in this case.

11 years agotestsuite: add test for install-commands loop
Lucas De Marchi [Wed, 6 Jun 2012 04:44:23 +0000 (01:44 -0300)] 
testsuite: add test for install-commands loop

This loop is similar to the one that comes with install rules of
alsa-utils package. It can be easily verified by reverting commit
abd5557 and running the testsuite.

11 years agotestsuite: allow to export custom env vars
Lucas De Marchi [Wed, 6 Jun 2012 04:42:30 +0000 (01:42 -0300)] 
testsuite: allow to export custom env vars

11 years agotestsuite: add timeout for each test
Lucas De Marchi [Wed, 6 Jun 2012 04:03:15 +0000 (01:03 -0300)] 
testsuite: add timeout for each test

Each test must run under 2 seconds. Ideally they should run in much less
than this; just give an arbitrary number so we don't wait forever in
case we reached an infinite loop somewhere.

11 years agotestsuite: create additional pipe to monitor child
Lucas De Marchi [Wed, 6 Jun 2012 03:39:43 +0000 (00:39 -0300)] 
testsuite: create additional pipe to monitor child

11 years agolibkmod-util: split function for usec conversion
Lucas De Marchi [Wed, 6 Jun 2012 00:02:11 +0000 (21:02 -0300)] 
libkmod-util: split function for usec conversion

11 years agotestsuite: add test for softdep loops
Lucas De Marchi [Mon, 4 Jun 2012 23:45:24 +0000 (20:45 -0300)] 
testsuite: add test for softdep loops