Lucas De Marchi [Thu, 9 Oct 2014 04:14:16 +0000 (01:14 -0300)]
Move remaining functions from libkmod-util to shared
Lucas De Marchi [Thu, 9 Oct 2014 03:54:29 +0000 (00:54 -0300)]
depmod: use alias_normalize() from shared
Remove underscores2() function which is essentially the same as
alias_normalize() and the latter, which is now in shared/.
Lucas De Marchi [Thu, 9 Oct 2014 03:43:01 +0000 (00:43 -0300)]
Move alias_normalize() to shared
Lucas De Marchi [Thu, 9 Oct 2014 03:01:45 +0000 (00:01 -0300)]
Do not rely on prio_to_str() being always inline
This function was declared as always-inline so there was not really a
problem in returning prioname, that could possibly point to the local
buf[] variable.
However static analysis tools are often confused about this and being
always-inline was just a workaround to make it work.
So, let's move the buffer to the caller. We have only 2 callers so it
doesn't matter much. This always reduce the size of log.o, since now the
function is not inlined anymore. Below is the size for "-g -O2" with
gcc:
before:
text data bss dec hex filename
1325 4 1 1330 532 tools/log.o
after:
text data bss dec hex filename
1171 4 1 1176 498 tools/log.o
Lucas De Marchi [Wed, 8 Oct 2014 17:33:42 +0000 (14:33 -0300)]
Do not export array of kmod extensions
The only user outside of libkmod-util is depmod, which really only needs
to get the string for the extension of uncompressed modules. It doesn't
need to access the array itself.
Lucas De Marchi [Wed, 8 Oct 2014 04:12:15 +0000 (01:12 -0300)]
testsuite: add tests for array implementation
Lucas De Marchi [Wed, 8 Oct 2014 02:23:11 +0000 (23:23 -0300)]
Clarify what licences apply where
This doesn't change any license, just clarifies what's licensed under
LGPL and what's under GPL.
Lucas De Marchi [Fri, 3 Oct 2014 06:25:06 +0000 (03:25 -0300)]
Rename getline_wrapped() to freadline_wrapped()
Lucas De Marchi [Fri, 3 Oct 2014 05:03:55 +0000 (02:03 -0300)]
Prefer inttypes.h over stdint.h
Lucas De Marchi [Fri, 3 Oct 2014 04:41:42 +0000 (01:41 -0300)]
Reorder and reorganize header files
Let the includes in the following order:
< system headers >
< libkmod >
< tool >
< local headers >
Lucas De Marchi [Fri, 3 Oct 2014 03:29:18 +0000 (00:29 -0300)]
Move hash implementation to shared directory
Lucas De Marchi [Fri, 3 Oct 2014 03:22:36 +0000 (00:22 -0300)]
Move array implementation to shared directory
Lucas De Marchi [Fri, 3 Oct 2014 03:13:49 +0000 (00:13 -0300)]
build-sys: normalize line breaks
Break lines earlier, as it's already done in some places and use only 1
tab to avoid reaching the column limit.
Lucas De Marchi [Fri, 3 Oct 2014 03:01:35 +0000 (00:01 -0300)]
Move generic util functions to shared directory
Lucas De Marchi [Fri, 3 Oct 2014 01:08:47 +0000 (22:08 -0300)]
Move missing.h to shared directory
Lucas De Marchi [Fri, 3 Oct 2014 01:03:19 +0000 (22:03 -0300)]
Move macro.h to shared directory
It's not really related to libkmod, so move it to a directory in which
we keep common stuff.
Randy MacLeod [Mon, 29 Sep 2014 19:18:04 +0000 (21:18 +0200)]
Add back-up implementation of be32toh()
Older systems may not have the be32toh function defined. Check for this
and fall back to checking the endianness and calling bswap_32 directly
if needed. This works on both old and new systems.
[Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>:
address comments raised by Lucas De Marchi [1], update commit message]
[1] http://www.spinics.net/lists/linux-modules/msg01129.html
Lucas De Marchi [Tue, 23 Sep 2014 03:21:53 +0000 (00:21 -0300)]
Update TODO
Marco d'Itri [Wed, 17 Sep 2014 03:12:27 +0000 (05:12 +0200)]
Add the man page for kmod(8)
Marco d'Itri [Wed, 17 Sep 2014 03:12:26 +0000 (05:12 +0200)]
Document depmod --show in depmod(8)
Holger Obermaier [Thu, 4 Sep 2014 12:38:16 +0000 (14:38 +0200)]
libkmod-index.c: Fix error message
Cristian RodrÃguez [Thu, 19 Jun 2014 00:51:00 +0000 (20:51 -0400)]
Add missing O_CLOEXEC in kmod_module_get_size()
Lucas De Marchi [Sat, 14 Jun 2014 15:46:38 +0000 (12:46 -0300)]
kmod 18
Lucas De Marchi [Sat, 14 Jun 2014 14:14:58 +0000 (11:14 -0300)]
testsuite: Fix macro missing format string
Lucas De Marchi [Fri, 6 Jun 2014 05:22:43 +0000 (02:22 -0300)]
testsuite: Add basic tests for hash implementation
Far from complete, but already covers all internal APIs.
Lucas De Marchi [Fri, 6 Jun 2014 05:19:01 +0000 (02:19 -0300)]
testsuite: Add assert_return
Add assert_return to use in testcases instead of assert. The issues
with assert are:
1) It's disabled when NDEBUG is defined
2) Even if it's well supported by testsuite (the parent will
report the child died) it can't output any meaningful
error message
Lucas De Marchi [Thu, 5 Jun 2014 20:54:00 +0000 (17:54 -0300)]
testsuite: separate testcases on log
Lucas De Marchi [Fri, 30 May 2014 13:26:17 +0000 (10:26 -0300)]
testsuite: check for correct error message in detect-loop
Lucas De Marchi [Fri, 30 May 2014 13:23:05 +0000 (10:23 -0300)]
testsuite: Fix expected_fail parsing
If a test has expected_fail=true, it means the return code must be
different from 0 *and* the outputs must match. This way it's possible to
check if the error messages are printed as they should.
Lucas De Marchi [Fri, 30 May 2014 13:20:19 +0000 (10:20 -0300)]
testsuite: Add braces
Lucas De Marchi [Fri, 30 May 2014 12:38:26 +0000 (09:38 -0300)]
depmod: Add better error messages when facing loops
Since now depmod fails when there are module loops, let's at least give
better error messages, printing the loops we found. Since we may have
more than 1 loop, just printing the modules that are in loop is not
very clear.
Assuming as an example 2 independent loops, this is how the new messages
compare to the old ones:
Before:
depmod: ERROR: Found 5 modules in dependency cycles!
depmod: ERROR: /tmp/test-kmod//lib/modules/3.14.4-1-ARCH/kernel/moduleE.ko in dependency cycle!
depmod: ERROR: /tmp/test-kmod//lib/modules/3.14.4-1-ARCH/kernel/moduleB.ko in dependency cycle!
depmod: ERROR: /tmp/test-kmod//lib/modules/3.14.4-1-ARCH/kernel/moduleC.ko in dependency cycle!
depmod: ERROR: /tmp/test-kmod//lib/modules/3.14.4-1-ARCH/kernel/moduleD.ko in dependency cycle!
depmod: ERROR: /tmp/test-kmod//lib/modules/3.14.4-1-ARCH/kernel/moduleA.ko in dependency cycle!
After:
depmod: ERROR: Found 5 modules in dependency cycles!
depmod: ERROR: Cycle detected: moduleE -> moduleD -> moduleE
depmod: ERROR: Cycle detected: moduleB -> moduleC -> moduleA -> moduleB
Lucas De Marchi [Fri, 30 May 2014 12:36:21 +0000 (09:36 -0300)]
testsuite: add test to fail depmod on module loops
Lucas De Marchi [Fri, 30 May 2014 12:01:24 +0000 (09:01 -0300)]
depmod: Rename variable to clarify its meaning
In mod->modnamelen we were actually including the '\0', i.e.
strlen(modname) + 1. So rename it to modnamesz and add a comment in
depmod_module_is_higher_priority() to notice why it's correct since the
new one is really using strlen(modname).
Lukas Anzinger [Sun, 18 May 2014 16:40:19 +0000 (18:40 +0200)]
Fix use-after-free in hash implementation.
If a value is added to the hash under a key that already exists the new value
replaces the old value for that key. Since key can be a pointer to data that
is part of value and freed by hash->free_value(), the key must be also
replaced and not only the value. Otherwise key potentially points to freed data.
Leandro Pereira [Tue, 29 Apr 2014 00:04:48 +0000 (21:04 -0300)]
Close /sys/module/$NAME directory if opening /proc/module fails.
Leandro Pereira [Tue, 29 Apr 2014 00:02:45 +0000 (21:02 -0300)]
Free abspath if kmod_module_new_from_path() fails.
Leandro Pereira [Tue, 29 Apr 2014 00:01:48 +0000 (21:01 -0300)]
Free realnames if kmod_lookup_alias_from_alias_bin() fails
Leandro Pereira [Mon, 28 Apr 2014 23:47:49 +0000 (20:47 -0300)]
Ensure read_long() reads the correct number of bytes from the index
Leandro Pereira [Mon, 28 Apr 2014 23:44:14 +0000 (20:44 -0300)]
Bail out of index_mm_open() if fstat() fails
Lucas De Marchi [Fri, 9 May 2014 11:22:02 +0000 (08:22 -0300)]
depmod: Make dependency loops be fatal
Since the beginning depmod just warned about dependency loops and upon
creation of modules.dep{,.bin} it skipped the modules that were part of
a loop. However just skipping the modules may come as a surprise to
kernel module developers: they will need to try to load the module (or
to pay attention to the log messages) to notice thavt the module has not
been put in the index. Also, differently from module-init-tools we were
not skipping modules that depend on modules with dependency loops,
leading to a segfault in depmod.
So this is a summary of the change in behavior with this patch:
Loop 1)
A -> B -> C -
^ |
'------------
Before:
depmod: WARNING: found 3 modules in dependency cycles!
depmod: WARNING: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleB.ko in dependency cycle!
depmod: WARNING: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleC.ko in dependency cycle!
depmod: WARNING: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleA.ko in dependency cycle!
return code: 0
After:
depmod: ERROR: Found 3 modules in dependency cycles!
depmod: ERROR: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleB.ko in dependency cycle!
depmod: ERROR: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleC.ko in dependency cycle!
depmod: ERROR: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleA.ko in dependency cycle!
return code: 2
Loop 2)
A -> B -> C -
^ |
'-------
Before:
depmod: WARNING: found 2 modules in dependency cycles!
depmod: WARNING: /tmp/test-kmod//lib/modules/3.14.2-1-ARCH/kernel/moduleB.ko in dependency cycle!
depmod: WARNING: /tmp/test-kmod//lib/modules/3.14.2-1-ARCH/kernel/moduleC.ko in dependency cycle!
Segmentation fault (core dumped)
After:
depmod: ERROR: Found 2 modules in dependency cycles!
depmod: ERROR: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleB.ko in dependency cycle!
depmod: ERROR: /tmp/test-kmod/lib/modules/3.14.2-1-ARCH/kernel/moduleC.ko in dependency cycle!
return code: 2
The segfault above could be fixed, but let's just fail everything
because dependency cycles should be fixed in the modules rather than
just be skipped in the index.
Joe Lawrence [Tue, 13 May 2014 03:31:10 +0000 (23:31 -0400)]
man: fixup spacing/parens in modprobe.d(5)
Lucas De Marchi [Fri, 9 May 2014 11:43:05 +0000 (08:43 -0300)]
Add gitignore to module playground
Marco d'Itri [Sun, 4 May 2014 19:00:43 +0000 (21:00 +0200)]
Remove references to systemd from the bash completion file
And restore the original LGPL disclaimer text.
Lucas De Marchi [Fri, 2 May 2014 15:56:46 +0000 (12:56 -0300)]
testsuite: Add module playground dir
Lucas De Marchi [Mon, 7 Apr 2014 15:27:11 +0000 (12:27 -0300)]
Make sure there's NUL byte at the end of strndupa
Since strcpy() doesn't ensure we have a NUL byte in the resulting
string, use alloca() + memcpy(). Also make sure we don't evaluate "s"
twice.
Lucas De Marchi [Fri, 4 Apr 2014 11:19:00 +0000 (08:19 -0300)]
Add strndupa to missing.h
Lucas De Marchi [Mon, 7 Apr 2014 13:55:47 +0000 (10:55 -0300)]
Update .travis.yml
- Add cython to the dependencies, so it can compile the python bindings
- Remove unecessary -Wno-error since now we don't use -Werror anymore.
Lucas De Marchi [Sun, 6 Apr 2014 20:52:44 +0000 (17:52 -0300)]
kmod 17
Lucas De Marchi [Sun, 6 Apr 2014 20:43:19 +0000 (17:43 -0300)]
testsuite: Remove duplicate test
This partially reverts ad7f175 ("Add test for depmod using search dirs
with same prefix"). Testing it twice in the inverted order doesn't
ensure we get the bug with wrong ordering.
As put by Anssi Hannula <anssi@mageia.org>:
So the bug is triggered only if the shorter name is higher-prio _and_
shorter name is traversed first. If the long name is traversed first,
the bug don't trigger with either "search" directive order (and on my
"make check" runs this is the case).
Lucas De Marchi [Sun, 6 Apr 2014 20:14:23 +0000 (17:14 -0300)]
build-sys: enable python in bootstrap-configure
Michal Marek [Fri, 4 Apr 2014 09:30:07 +0000 (11:30 +0200)]
testsuite: Warn if sysconfdir is not /etc
Michal Marek [Fri, 4 Apr 2014 11:05:49 +0000 (13:05 +0200)]
testsuite: Do not run tests with *.ko.gz if zlib is not enabled
Michal Marek [Fri, 4 Apr 2014 10:32:16 +0000 (12:32 +0200)]
testsuite: Uncompress most modules
Only keep test-depmod/modules-order-compressed to test compressed module
support.
Tom Gundersen [Mon, 31 Mar 2014 13:18:51 +0000 (15:18 +0200)]
config: also parse softdeps from modules
This information can be found in /lib/modules/`uname -r`/modules.softdep, and
has only recently been exported by the kernel.
Also remove the advice about copying modules.softdep to /lib/modules as it is
not clear how to do this correctly with several kernels installed with
potentially conflicting soft dependencies.
Michal Marek [Mon, 31 Mar 2014 13:18:50 +0000 (15:18 +0200)]
libkmod: Ignore errors from softdeps
Before we had softdeps, the usual idiom was
install foo /sbin/modprobe bar; /sbin/modprobe --ignore-install foo
ignoring errors from the first modprobe invocation. This also matches
the behavior of module-init-tools' implementation of softdep.
Lucas De Marchi [Mon, 24 Mar 2014 11:27:19 +0000 (08:27 -0300)]
build-sys: add hooks to build python bindings
Add --enable-python configure switch so we build the python bindings. We
also pass version.py through SED_PROCESS macro, so the version is kept
in sync with kmod.
Acked-by: Andy Grover <agrover@redhat.com>
Lucas De Marchi [Thu, 20 Mar 2014 10:33:40 +0000 (07:33 -0300)]
python: Remove unused files from import
Acked-by: Andy Grover <agrover@redhat.com>
Lucas De Marchi [Mon, 10 Mar 2014 07:23:19 +0000 (04:23 -0300)]
Merge branch 'master' of python-kmod
This is python-kmod is found in git@github.com:agrover/kmod.git
d5b6f22639c077b86659828bcc78dcedc9daaa94
Its history has being rewritten to prepare for a merge:
- Every commit has been prefixed with "python: " in its commit
message
- s-o-b's have been removed
- Every file has been moved to libkmod/python directory
Some files don't make much sense anymore and are being removed
in this merge.
Acked-by: Andy Grover <agrover@redhat.com>
Guy Rozendorn [Tue, 2 Apr 2013 14:46:45 +0000 (17:46 +0300)]
python: Issue #15: resovled by using setuptools_cython
Guy Rozendorn [Tue, 2 Apr 2013 13:46:23 +0000 (16:46 +0300)]
python: Issue #15: Cython needs to be in setup_requires
We need Cython BEFORE installing kmod (done with setup_requires),
and AFTER installation - during runtime (done with install_requires)
Guy Rozendorn [Tue, 2 Apr 2013 08:00:22 +0000 (11:00 +0300)]
python: Issue #15 Cython is now a dependency
Andy Grover [Mon, 1 Apr 2013 22:24:41 +0000 (15:24 -0700)]
python: update version to 0.9.1
Guy Rozendorn [Sun, 31 Mar 2013 10:25:30 +0000 (13:25 +0300)]
python: Issue #13 skipping building extensions on non-Linux platforms
Andy Grover [Tue, 12 Feb 2013 00:55:11 +0000 (16:55 -0800)]
python: Make kmod.modprobe() raise an error if no modules found
Add 'quiet' option to override.
Add docstring.
Andy Grover [Tue, 18 Dec 2012 22:47:37 +0000 (14:47 -0800)]
python: Add self as maintainer to setup.py
Andy Grover [Tue, 18 Dec 2012 18:56:53 +0000 (10:56 -0800)]
python: Correct building for python 2.6
Reported-by: Oz Nahum Tiram <nahumoz@gmail.com>
Oz [Sun, 16 Dec 2012 22:27:09 +0000 (23:27 +0100)]
python: add docstring to insert and remove methods
Oz [Sun, 16 Dec 2012 22:23:31 +0000 (23:23 +0100)]
python: add docstring to rmmod
Andy Grover [Fri, 14 Dec 2012 17:34:25 +0000 (09:34 -0800)]
python: update version to 0.9
Andy Grover [Fri, 14 Dec 2012 17:27:36 +0000 (09:27 -0800)]
python: Update README
Last update changed API slightly:
* loaded_modules renamed to modules
* returns a module object instead of (name, size)
W. Trevor King [Sat, 20 Oct 2012 01:57:18 +0000 (21:57 -0400)]
python: MANIFEST.in: add AUTHORS to distibuted source files.
W. Trevor King [Sat, 20 Oct 2012 01:56:02 +0000 (21:56 -0400)]
python: Ran update-copyright.py.
W. Trevor King [Sat, 20 Oct 2012 01:54:20 +0000 (21:54 -0400)]
python: .update-copyright.conf: update to pipe separators.
This brings the config file up to speed with the following
update-copyright commit:
commit
3c68a1a48419d8b2bbc2ce0e7f1700b996ec30e9
Author: W. Trevor King <wking@tremily.us>
Date: Fri Oct 19 21:52:48 2012 -0400
project: for consistency, also separate ignored paths with pipes.
W. Trevor King [Sat, 20 Oct 2012 01:31:00 +0000 (21:31 -0400)]
python: .update-copyright.conf: add MANIFEST.in to ignored files.
W. Trevor King [Sat, 20 Oct 2012 01:25:46 +0000 (21:25 -0400)]
python: .update-copyright.conf: add Red Hat alias for Andy Grover.
He seems to be assigning copyright of files he writes to Red Hat.
Avoiding .mailmap so the git log will still attribute changes to him.
I'm not sure which name should go in the AUTHORS file.
W. Trevor King [Sat, 20 Oct 2012 01:22:33 +0000 (21:22 -0400)]
python: .update-copyright.conf: add README.rst to ignored files.
W. Trevor King [Sat, 20 Oct 2012 01:02:25 +0000 (21:02 -0400)]
python: .mailmap: consolidate Andy Grover email addresses.
W. Trevor King [Sat, 20 Oct 2012 00:16:21 +0000 (20:16 -0400)]
python: .update-copyright.conf: add copyright configuration.
Use my external update-copyright package to maintain copyright blurbs.
http://pypi.python.org/pypi/update-copyright/
W. Trevor King [Fri, 19 Oct 2012 13:10:53 +0000 (09:10 -0400)]
python: module: fix versions -> info typo in Module._info_get() error message.
W. Trevor King [Fri, 19 Oct 2012 11:49:16 +0000 (07:49 -0400)]
python: Initialize Kmod.mod_dir to None in __cinit__().
W. Trevor King [Fri, 19 Oct 2012 11:18:58 +0000 (07:18 -0400)]
python: Use an OrderedDict for Module.info (preserving modinfo ordering).
W. Trevor King [Fri, 19 Oct 2012 05:07:42 +0000 (01:07 -0400)]
python: Add Module.info attribute.
W. Trevor King [Fri, 19 Oct 2012 04:50:21 +0000 (00:50 -0400)]
python: Use Cython's libc.errno for EEXIST.
W. Trevor King [Fri, 19 Oct 2012 04:47:51 +0000 (00:47 -0400)]
python: Add Module.versions attribute.
W. Trevor King [Fri, 19 Oct 2012 04:20:31 +0000 (00:20 -0400)]
python: README.rst: add .rst symlink for GitHub.
W. Trevor King [Fri, 19 Oct 2012 04:11:17 +0000 (00:11 -0400)]
python: README: mention Cython dependency.
W. Trevor King [Fri, 19 Oct 2012 04:10:20 +0000 (00:10 -0400)]
python: README: cleanup reStructuredText syntax.
W. Trevor King [Fri, 19 Oct 2012 04:08:00 +0000 (00:08 -0400)]
python: Add missing copyright blurbs.
W. Trevor King [Fri, 19 Oct 2012 04:07:39 +0000 (00:07 -0400)]
python: Add docstrings to kmod.kmod and kmod.kmod.Kmod.
W. Trevor King [Fri, 19 Oct 2012 04:00:53 +0000 (00:00 -0400)]
python: MANIFEST.in: add missing source to the sdist tarball.
W. Trevor King [Fri, 19 Oct 2012 03:57:30 +0000 (23:57 -0400)]
python: Add additional out Module attributes (path, refcnt, ...).
W. Trevor King [Fri, 19 Oct 2012 03:30:30 +0000 (23:30 -0400)]
python: Convert to Cython.
With Cython we get easier memory handling and Python 3 compatibility.
Andy Grover [Tue, 17 Apr 2012 18:35:30 +0000 (11:35 -0700)]
python: update FSF address in COPYING and COPYING.LESSER
Please FSF, never move again.
Andy Grover [Mon, 19 Mar 2012 04:53:26 +0000 (21:53 -0700)]
python: whitespace
Andy Grover [Mon, 19 Mar 2012 04:49:07 +0000 (21:49 -0700)]
python: add proper error handling to loaded_modules()
We need to check the result of basically all Py* calls and cleanup
properly if they fail.
Andy Grover [Tue, 13 Mar 2012 22:06:37 +0000 (15:06 -0700)]
python: Improve README's description of kmod
Based on text from kmod's README.
Andy Grover [Tue, 13 Mar 2012 22:01:03 +0000 (15:01 -0700)]
python: Make setup.py version match version in .c
Andy Grover [Tue, 13 Mar 2012 22:00:37 +0000 (15:00 -0700)]
python: Add README
Andy Grover [Tue, 13 Mar 2012 07:42:22 +0000 (00:42 -0700)]
python: More cleanup and renaming of stuff. Add docstrings.
Andy Grover [Tue, 13 Mar 2012 06:16:35 +0000 (23:16 -0700)]
python: Add support for listing loaded modules, modprobe, rmmod
And other misc. cleanups and changes.