Commit Graph

998 Commits

Author SHA1 Message Date
Leandro Pereira 1faec2c134 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.
2012-10-12 12:34:27 -03:00
Lucas De Marchi 66f3228d17 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>
2012-10-09 09:56:50 -03:00
Lucas De Marchi b0c9fc85a2 testsuite: add depmod test for modules.alias
Check if modules.alias is correctly generated from modules.order if we
have compressed modules.
2012-10-04 01:08:13 -03:00
Lucas De Marchi 3e451bfefb 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.
2012-10-04 01:04:52 -03:00
Lucas De Marchi 88c247f7f1 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.
2012-10-03 16:29:36 -03:00
Dave Reisner c5b37dba89 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.
2012-10-02 00:27:31 -03:00
Lucas De Marchi 7812d88c95 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.
2012-09-14 11:37:29 -03:00
Jan Engelhardt a7fbae0315 NEWS: language corrections 2012-09-13 21:07:13 -03:00
Dave Reisner 1a3fa1a1a5 modinfo: clarify verbiage for field shortcuts
Cleanup the punctuation and grammar in this blurb, specifically pointing
out what these are shortcuts for.
2012-09-08 14:40:37 -04:00
Dave Reisner 86bbd05319 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.
2012-09-08 14:40:37 -04:00
Dave Reisner cf814054dd 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.
2012-09-08 14:40:37 -04:00
Dave Reisner 84afccb91d Revert "build-sys: disable jobserver for rootfs target"
This is bogus and does not work.

This reverts commit 4e7f0f204b.
2012-09-08 14:09:58 -04:00
Lucas De Marchi d642341777 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.
2012-09-07 15:12:12 -03:00
Lucas De Marchi 4075860264 kmod 10 2012-09-06 16:26:53 -03:00
Lucas De Marchi 85734b2446 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.
2012-08-31 06:59:26 -03:00
Lucas De Marchi 8447b865aa 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.
2012-08-30 14:10:47 -03:00
Lucas De Marchi 36ddee6562 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>".
2012-08-17 09:42:47 -03:00
Lucas De Marchi 6882017f80 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.
2012-08-17 09:42:15 -03:00
Martin Pitt 123e8278ed 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.
2012-08-01 20:44:27 -03:00
Lucas De Marchi f38e68a29c 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).
2012-07-31 09:58:21 -03:00
Lucas De Marchi 382de85c94 build-sys: add 'man' entry in summary 2012-07-31 09:51:48 -03:00
Colin Walters 8631552d3d 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.
2012-07-31 09:45:59 -03:00
Dave Reisner 2077017f11 man/rmmod: specify each option in separate <term> tag 2012-07-26 09:19:56 -03:00
Dave Reisner e3366d46bf man/depmod: specify each option in separate <term> tag 2012-07-26 09:19:53 -03:00
Dave Reisner 0e581357b6 man/modprobe: specify each option in separate <term> tag 2012-07-25 19:50:56 -04:00
Dave Reisner ffeccb511c 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.
2012-07-25 19:50:04 -04:00
Dave Reisner ff9909694b man/modinfo: document longopts for field shortcuts 2012-07-25 19:37:49 -04:00
Dave Reisner 072122f9dc 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.
2012-07-25 19:37:47 -04:00
Dave Reisner 465f2d6b7c 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.
2012-07-25 19:37:17 -04:00
Lucas De Marchi e8fd8fec23 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.
2012-07-18 10:31:50 -03:00
Dave Reisner 4e7f0f204b build-sys: disable jobserver for rootfs target
2588e3dff5 broke the distcheck target. Fix it by serializing the rootfs
(re)creation prior to running the testsuite.
2012-07-10 10:41:57 -03:00
Lucas De Marchi e1b1ab24ab testsuite: re-license under LGPL 2012-07-10 10:31:57 -03:00
Martin Pitt 4281cee076 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.
2012-07-10 10:31:40 -03:00
Dave Reisner 486f901392 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.
2012-06-29 13:04:41 -04:00
Dave Reisner 2588e3dff5 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.
2012-06-29 12:58:06 -04:00
Lucas De Marchi fca5b9bcd4 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)
2012-06-21 11:30:56 -03:00
Lucas De Marchi 62081c0f68 kmod 9 2012-06-19 19:46:53 -03:00
Lucas De Marchi 7896165922 build-sys: allow compressed modules in testsuite 2012-06-19 13:28:02 -03:00
Lucas De Marchi 33202e84f3 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.
2012-06-19 13:27:56 -03:00
Lucas De Marchi 3f376cd877 depmod: use ferror and fclose to check for error
Thanks to hpa for point this out.
2012-06-15 22:14:00 -03:00
Dave Reisner b7d830bcc8 bootstrap: remove unnecessary echo 2012-06-15 20:35:28 -04:00
Dave Reisner 563befdba6 bootstrap-configure: quote command line arg expansion 2012-06-15 20:35:28 -04:00
Lucas De Marchi a4fb97a71e 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
2012-06-15 21:31:05 -03:00
Lucas De Marchi 015946da0c depmod: fix coding-style issue in array declaration 2012-06-15 03:04:28 -03:00
Lucas De Marchi 80e49ad988 depmod: fail if any index could not be created 2012-06-15 02:42:39 -03:00
Lucas De Marchi c5db1a3fd2 depmod: don't return error if modules.builtin don't exist 2012-06-15 02:42:25 -03:00
Lucas De Marchi ccd6afa4f2 Remove ifdef for building tools not bundled
Current build system do not support to build separate tools anymore, so
just remove the ifdefs.
2012-06-15 00:40:14 -03:00
Lucas De Marchi fd0d806e40 build-sys: add missing header to fix distcheck 2012-06-14 16:58:46 -03:00
Lucas De Marchi ac78e109c3 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.
2012-06-14 16:29:28 -03:00
Lucas De Marchi e7fc2c868e 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
2012-06-12 01:43:46 -03:00