Commit Graph

1292 Commits

Author SHA1 Message Date
Lucas De Marchi f357866d97 Fix includes after change to build-sys
Make the includes be libkmod/libkmod.h for code outside of library. This
fixes the broken build after 1315123 ('build-sys: Don't add libkmod
subdirectory to include path').
2015-01-02 12:41:01 -02:00
Lucas De Marchi dea2dfee9b Remove FSF mailing address
It has changed in the past, and these days, anyone can get a copy of the
LGPL via the web rather than by post.

Like 657a122 (Remove FSF mailing address) in libabc by Josh Tripplet,
but let the FSF website in which the license can be found.
2014-12-25 23:41:34 -02:00
Lucas De Marchi 15cfa1d19c build-sys: set -e separately, rather than putting -e in the shebang line
Like a008d76 (autogen.sh: set -e separately, rather than putting -e in
the shebang line) in libabc by Josh Triplett.
2014-12-25 23:41:34 -02:00
Lucas De Marchi dd66ff3a14 build-sys: Don't define LIBEXECDIR
Like b2fd181 (Makefile.am: Don't define LIBEXECDIR) in libabc by Josh
Triplett.
2014-12-25 23:41:34 -02:00
Lucas De Marchi 1315123955 build-sys: Don't add libkmod subdirectory to include path
Like 05437b8 (Makefile.am: Don't add abc subdirectory to include path)
in libabc by Josh Triplett.
2014-12-25 23:41:34 -02:00
Mike Auty fd56638aed build: Do not force diagnostics-color flag
The -fdiagnostics-color flag is only available on GCC >= 4.9, for
older versions this could raise an error in certain circumstances
(such as when using ccache).  Instead, since -fdiagnostic-color=auto
by default  in gcc-4.9, simply set the required environment variable
to the default one if it's undefined.

Based mostly on the systemd commit f44541bc by Michal Schmidt.
2014-12-17 00:41:01 -02:00
Lucas De Marchi 1dd4ff56f6 README: move mailing list information to top
It seems people are missing the information about the mailing list, so
let's move it to the top in hope it's more visible.
2014-12-13 11:55:05 -02:00
Natanael Copa efb5bfaca9 util: fix build on systems missing strndupa
we need include shared/missing.h to be able to compile on sysmtes that
lacks strndupa.
2014-11-17 13:00:19 -02:00
Lucas De Marchi 3b058610b4 NEWS: Fix typos 2014-11-16 10:37:45 -02:00
Lucas De Marchi f9e2167b10 kmod 19 2014-11-16 10:24:50 -02:00
Lucas De Marchi bb72153d34 libkmod-index: move comment to include the includes 2014-11-15 11:18:54 -02:00
Lucas De Marchi a5852e3b36 libkmod-index: remove invalid comment 2014-11-15 11:18:54 -02:00
Lucas De Marchi 778395e4e8 depmod: point to documentation in libkmod
Instead of repeating all documentation, point to the documentation
available in libkmod-index.c

This also removes INDEX_PRIORITY_MIN that was not being used.
2014-11-15 11:18:46 -02:00
Lucas De Marchi c4cbdf8e17 libkmod-index: keep index and comments in .c
Just like other source files, keep the index and comments in the source
file rather than the header.

This also removes INDEX_PRIORITY_MIN that was never being used.
2014-10-29 11:58:12 -02:00
Tom Gundersen 27eceb2e4e static-nodes: indicate that creation of static nodes should only happen at boot
udev will only manage static nodes that exist at the time udev is started, so
creating static nodes later on will likely not behave as expected. In
particular, recreating the static nodes at run-time will reset any permissions
udev may have applied to the nodes at boot.

See <https://bugzilla.redhat.com/show_bug.cgi?id=1147248> and the discussion
following <http://permalink.gmane.org/gmane.comp.sysutils.systemd.devel/23795>.

Note that this requires (the yet to be released) systemd v217 or a backport
of systemd patch 8c94052ee543c3598a3c7b0c46688150aa2c6168.
2014-10-28 16:49:46 -02:00
Lucas De Marchi e62d8c725b strbuf: make strbuf_pushchars() a little less dumb
Do not push one char at a time. We have strlen() and memcpy() to rely
on.
2014-10-16 21:39:33 -03:00
Lucas De Marchi 8863154e44 strbuf: do not calculate next step in size on all calls
We only need to check if the new size is less or equal than the current
size. We don't really need to calculate the next step.
2014-10-16 21:22:32 -03:00
Lucas De Marchi 405b8927fe strbuf: reduce default buffer size
Using 2048 as buffer sizer for strbuf is a bit exaggerated. strbuf is
used much more when we are not using mmapped indexes, but it's used for
mmapped when for example searching for an alias. A quick and dirty hack
to output the size of our strbufs is to print buf->used inside
strbuf_str(). Doing this and creating some statistics with:

while read xxx alias xxx; do
    tools/modprobe -R "$alias" > /dev/null;
done < /lib/modules/$(uname -r)/modules.alias 2>&1 | \
	     Rscript -e 'summary (as.numeric (readLines ("stdin")))'

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
   1.00   29.00   31.00   31.55   38.00   92.00      26

So, reduce the step to 128, which is still greater than the maximum in
these cases. In the worst case this can only create a few calls to
realloc(), while keeping the memory footprint low for the common cases.
2014-10-16 21:02:13 -03:00
Lucas De Marchi 48e4d18191 testsuite: add tests for strbuf 2014-10-13 18:42:01 -03:00
Lucas De Marchi 15a7ae30b3 shared: rename prefixes of strbuf functions
Use strbuf_ prefix instead of buf_.
2014-10-11 13:25:51 -03:00
Lucas De Marchi b4d1f44af1 Move strbuf implementation to shared/
Just move the strbuf-like implementation to shared/. No renames were
made yet to avoid cluttering the diff. It will come in a separate patch.
2014-10-11 13:09:42 -03:00
Lucas De Marchi 4328982058 testsuite: remove now unused array of tests
Remove the arrays and let each test with a guaranteed unique name.
2014-10-09 14:29:04 -03:00
Lucas De Marchi c5798fea93 testsuite: use a section to put tests in instead of array
Intead of having to declare an array of tests, tweak the definition of
DEFINE_TEST and TESTSUITE_MAIN so they know the tests are put in a
particular section of the ELF file.

This avoids the mistake of adding a test and forgetting to add it to the
array. Now once a test is defined, it's ready to run, so one less step
to define new tests.

The removal of the arrays is left for another patch so not to clutter
the diff on this one.
2014-10-09 14:17:24 -03:00
Lucas De Marchi f1155c1574 Move static keyword to DEFINE_TEST macro 2014-10-09 13:00:30 -03:00
Lucas De Marchi eb6f9112cf libkmod: remove unused inline functions
libkmod/libkmod-list.c:39:33: warning: unused function 'list_node_next' [-Wunused-function]
static inline struct list_node *list_node_next(const struct list_node *node)
                                ^
libkmod/libkmod-list.c:47:33: warning: unused function 'list_node_prev' [-Wunused-function]
static inline struct list_node *list_node_prev(const struct list_node *node)
                                ^

It doesn't really matter in the end result since the compiler won't
generate any code for it. But let's keep it clean. It wasn't needed
until now, so probably it won't be anymore.
2014-10-09 11:11:29 -03:00
Lucas De Marchi 9a437531af Change parameter from int to char
It's a char not an int.
2014-10-09 11:03:29 -03:00
Lucas De Marchi 52c9c99056 Log error on failed underscores(), moving it to shared/
Move underscores() to shared/. It's the same as alias_normalize(), but
it rather operates in place, with the same string being passed.

The difference now that it's in shared/ is that it's a non-logging
function.

This makes us a little bit more verbose: we don't accept partially
correct module and aliases names in kcmdline and in configuration files.
We log an error instead.
2014-10-09 11:00:21 -03:00
Lucas De Marchi 2c5bc218be build-sys: rename libkmod-util convenience library
Now that all source code from libkmod-util has been moved to shared/
directory, rename also the convenience library to libshared.
2014-10-09 01:26:39 -03:00
Lucas De Marchi f4e8c16291 Move remaining functions from libkmod-util to shared 2014-10-09 01:26:39 -03:00
Lucas De Marchi 3753ae16f5 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/.
2014-10-09 01:26:39 -03:00
Lucas De Marchi 2b0104fe3c Move alias_normalize() to shared 2014-10-09 01:26:39 -03:00
Lucas De Marchi 66bf1a7ff9 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
2014-10-09 01:26:39 -03:00
Lucas De Marchi b95506ff61 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.
2014-10-09 01:26:39 -03:00
Lucas De Marchi fdafa6b655 testsuite: add tests for array implementation 2014-10-09 01:26:39 -03:00
Lucas De Marchi 1a07559af3 Clarify what licences apply where
This doesn't change any license, just clarifies what's licensed under
LGPL and what's under GPL.
2014-10-09 01:26:34 -03:00
Lucas De Marchi aafd38359a Rename getline_wrapped() to freadline_wrapped() 2014-10-03 03:25:06 -03:00
Lucas De Marchi b18979b770 Prefer inttypes.h over stdint.h 2014-10-03 02:03:55 -03:00
Lucas De Marchi c2e4286bb9 Reorder and reorganize header files
Let the includes in the following order:

< system headers >
< libkmod >
< tool >
< local headers >
2014-10-03 01:43:15 -03:00
Lucas De Marchi 0db718edcf Move hash implementation to shared directory 2014-10-03 00:40:11 -03:00
Lucas De Marchi 74d1df6682 Move array implementation to shared directory 2014-10-03 00:33:25 -03:00
Lucas De Marchi 8eded79c50 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.
2014-10-03 00:33:25 -03:00
Lucas De Marchi 96573a0220 Move generic util functions to shared directory 2014-10-03 00:33:25 -03:00
Lucas De Marchi 8b7189bc25 Move missing.h to shared directory 2014-10-03 00:31:10 -03:00
Lucas De Marchi 576dd4393d 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.
2014-10-02 22:03:19 -03:00
Randy MacLeod 9b34db1ae6 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
2014-09-29 17:13:26 -03:00
Lucas De Marchi 419b7003af Update TODO 2014-09-23 00:21:53 -03:00
Marco d'Itri 66f4f6804c Add the man page for kmod(8) 2014-09-22 08:52:47 -03:00
Marco d'Itri fde693c94f Document depmod --show in depmod(8) 2014-09-20 11:23:56 -03:00
Holger Obermaier 1a4aa7e2cb libkmod-index.c: Fix error message 2014-09-04 16:29:47 -03:00
Cristian Rodríguez 74c26943f1 Add missing O_CLOEXEC in kmod_module_get_size() 2014-06-19 18:01:37 -03:00