History log of /external/kmod/tools/depmod.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
320078081333da8fc62e2db0bdcddfaebf30cf31 24-Feb-2017 Lucas De Marchi <lucas.demarchi@intel.com> depmod: fix leak on error path
/external/kmod/tools/depmod.c
c7ce9f0c80f3d561078a78205a14c5ba7663cfdd 22-Feb-2017 Yauheni Kaliuta <yauheni.kaliuta@redhat.com> depmod: handle nested loops

This is a rework of depmod report cycles logic to make it
tolerant to more complex loops.

The patch tries to remember own path for vertexes which makes it
possible to handle configurations with common edges and
non-cyclic modules.

It assumes that the previous dependency calculations can not give
as input something like

mod_a -> mod_b -> <loop>, but

<loop> -> mod_a -> mod_b should be fine.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
/external/kmod/tools/depmod.c
6b77f188969d72254f6bda291f4f2d9fd42f5ecc 08-Nov-2016 Mian Yousaf Kaukab <yousaf.kaukab@suse.com> depmod: ignore related modules in depmod_report_cycles

Only print actual cyclic dependencies. Print count of all the modules
in cyclic dependency at the end of the function so that dependent
modules which are not in cyclic chain can be ignored.

Printing dependent modules which are not in cyclic chain causes buffer
overflow as m->modnamesz is not included in buffer size calculations
(loop == m is never true). This buffer overflow causes kmod to crash.

Update depmod test to reflect the change as well.

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
/external/kmod/tools/depmod.c
cb51a641d6d4c777ed38855b29131b8a1e941175 10-Aug-2016 Lucas De Marchi <lucas.demarchi@intel.com> depmod: fix string overflow

Use scratchbuf to fix issue with strcpy that may overflow the buffer we
declared in the stack.
/external/kmod/tools/depmod.c
d46136bb59c46609ee8050636f0681f2831d2225 10-Jun-2016 Anton Blanchard <anton@samba.org> depmod: Ignore PowerPC64 ABIv2 .TOC. symbol

The .TOC. symbol on the PowerPC64 ABIv2 identifies the GOT
pointer, similar to how other architectures use _GLOBAL_OFFSET_TABLE_.

This is not a symbol that needs relocation, and should be ignored
by depmod.
/external/kmod/tools/depmod.c
4c30a11d5fa84ebfdd3a8f05fa4ba1c16c074f43 10-Jan-2016 Josh Triplett <josh@joshtriplett.org> depmod: Don't insert comment in modules.devname if otherwise empty

This allows tools to detect the file as empty, such as via systemd's
ConditionFileNotEmpty.
/external/kmod/tools/depmod.c
f3f62f5ec3b23823b2ce02e37bc707dc85c56461 29-Sep-2015 Laura Abbott <labbott@fedoraproject.org> depmod: Don't fall back to uname on bad version

Currently, if a value that doesn't match a kernel version
("%u.%u") is passed in, depmod silently falls back to
using uname. Rather than try and work around the caller passing
bad data, just exit out instead.
/external/kmod/tools/depmod.c
50f43ce2f66f02cec44968cac5aa5119ce5cbb81 29-Sep-2015 Laura Abbott <labbott@fedoraproject.org> depmod: Remove unprinted debug messages

In between the start of the program and the call to log_setup_kmod_log,
the only messages that will be printed are the ones at or above the
global default level. Debug messages in this range will never be printed
so remove them.
/external/kmod/tools/depmod.c
655de2751dec5594807cb0a613e80fb48b06bc59 07-Jun-2015 Lucas De Marchi <lucas.demarchi@intel.com> tools: display features in --version

Reviewed-by: Andreas Mohr <andim2@users.sf.net>
/external/kmod/tools/depmod.c
22df456760cf9e42302235c82125c2eb578050b2 28-Feb-2015 Lucas De Marchi <lucas.demarchi@intel.com> depmod: add asserts to ensure positive return from ftell()

Also ignore some errors that will later be returned by ferror().
/external/kmod/tools/depmod.c
a1bec0dfdb53774fbc9e0f082a85562a5a9b02e2 26-Feb-2015 Lucas De Marchi <lucas.demarchi@intel.com> depmod: fix leak in case of malloc(0)

malloc(0) can return != NULL. We need to pass the pointer to free().
This happens if index__haschildren(node) returned true, but
child_count is set to 0.
/external/kmod/tools/depmod.c
a07ea0329ca9655531f624b46719984da4604fbc 25-Feb-2015 Lucas De Marchi <lucas.demarchi@intel.com> depmod: use cleanup attribute to simplify free on exit

Reusing the root variable was a bad idea. Doing so we could call free()
on a variable that was not allocated. For example: "depmod -b / -h".
Since we would jump to cmdline_failed, root would not be duplicated.

Instead of fighting the order in the options, just used the cleanup
attribute and remove the calls to free() on "config_paths" and "root".
/external/kmod/tools/depmod.c
0b3aef23b8e5cc935caaec6230782553c1a4ca95 25-Feb-2015 Colin Walters <walters@verbum.org> depmod: Fix crash in previous commit if root is not set

[This fixes http://build.gnome.org/continuous/buildmaster/builds/2015/02/25/31/build/output.txt ]

The variable we're reading here is "root", not "optarg" which is only
valid inside the getopt call.
/external/kmod/tools/depmod.c
e90f0704ea81c4e90663c4e8ea91e475f0b6aa36 25-Feb-2015 Lucas De Marchi <lucas.demarchi@intel.com> depmod: fix leaking root on exit
/external/kmod/tools/depmod.c
f357866d97995e30c0ad623880d28dc527ff6890 02-Jan-2015 Lucas De Marchi <lucas.demarchi@intel.com> 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').
/external/kmod/tools/depmod.c
778395e4e89b8f08ac735ccc0cb23de8002aba23 28-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> 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.
/external/kmod/tools/depmod.c
f4e8c16291c58b71dfc622c11f3e00c818dcaebb 09-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> Move remaining functions from libkmod-util to shared
/external/kmod/tools/depmod.c
3753ae16f5026767afcf05f6c3bafda9a7eed0f0 09-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> 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/.
/external/kmod/tools/depmod.c
b95506ff6141aa65a46eef80fa0f0b06f9896712 08-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> 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.
/external/kmod/tools/depmod.c
aafd38359adfd93b1f8c1e84b8bd7bc9e1b0b6cf 03-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> Rename getline_wrapped() to freadline_wrapped()
/external/kmod/tools/depmod.c
c2e4286bb98c6bec77575ac0c6f862e7ddf6394f 03-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> Reorder and reorganize header files

Let the includes in the following order:

< system headers >
< libkmod >
< tool >
< local headers >
/external/kmod/tools/depmod.c
0db718edcfca1bdaf1369d3cf3773b52fcea1406 03-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> Move hash implementation to shared directory
/external/kmod/tools/depmod.c
74d1df6682e9dab799e6da8ad032f61b15be57d2 03-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> Move array implementation to shared directory
/external/kmod/tools/depmod.c
96573a02208abebe4a884c0bbd0d6ecde9047f37 03-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> Move generic util functions to shared directory
/external/kmod/tools/depmod.c
576dd4393d0deb2f4e050c5d1b96eaafb03bcb2c 03-Oct-2014 Lucas De Marchi <lucas.demarchi@intel.com> 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.
/external/kmod/tools/depmod.c
c89d219884e3b5d9faa7052175964cc4a6a59dfa 30-May-2014 Lucas De Marchi <lucas.demarchi@intel.com> 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
/external/kmod/tools/depmod.c
a873f2350f15a7803780f473257dc2467df0a229 30-May-2014 Lucas De Marchi <lucas.demarchi@intel.com> 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).
/external/kmod/tools/depmod.c
c48b269d64e4c2e23194f0a7c20d27e7727cdf3d 09-May-2014 Lucas De Marchi <lucas.demarchi@intel.com> 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.
/external/kmod/tools/depmod.c
8240333b257e96e7dc2ac2522f8bb7fb2158fafc 31-Mar-2014 Tom Gundersen <teg@jklm.no> 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.
/external/kmod/tools/depmod.c
49b33c1f215d5d58838845cbbaefc007bd0f9ac7 19-Mar-2014 Anssi Hannula <anssi@mageia.org> depmod: do not allow partial matches with "search" directive

Currently e.g. "search foo foobar built-in" will cause unpredictable
results if baz.ko is in both foo/ and foobar/, since "foo" in search may
match both of those directories and the preferred module therefore
depends on processing order.

Fix the code to ensure that the match is performed on full pathname
components only.
/external/kmod/tools/depmod.c
27881f6fbcb0686463f747fbcb8523b20535236a 19-Mar-2014 Anssi Hannula <anssi@mageia.org> depmod: fix debug print parameter order
/external/kmod/tools/depmod.c
519d27de5a209e3b64453e982feb6882ffd839c8 04-Mar-2014 Michal Marek <mmarek@suse.cz> libkmod-config,depmod: Accept special files as configuration files, too

If we can open it and read it, it's good enough for us. Otherwise, we
cannot use -C /dev/null to skip the system configuration for instance:

$ ./tools/modprobe -C /dev/null -c
libkmod: ERROR libkmod/libkmod-config.c:821 conf_files_list: unsupported
file mode /dev/null: 0x21b6
...
/external/kmod/tools/depmod.c
6506ddf5a37849049509324eeff72697f94584e3 09-Sep-2013 Tom Gundersen <teg@jklm.no> depmod: warn on invalid devname specification

During the last merge window (3.12) a couple of modules gained devname
aliases, but without the necessary major and minor information. These were
then silently ignored when generating modules.devname.

Complain loudly to avoid such errors sneaking in undetected in the future:

depmod: ERROR: Module 'zram' has devname (zram) but lacks major and minor information. Ignoring.
depmod: ERROR: Module 'uhid' has devname (uhid) but lacks major and minor information. Ignoring.

Cc: Kay Sievers <kay@vrfy.org>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
/external/kmod/tools/depmod.c
7e0385c47ae7c313a59de3ea431af7b5d18807d7 28-Aug-2013 Lucas De Marchi <lucas.demarchi@intel.com> Fix usage of readdir_r()

With readdir_r() we should be providing enough space to store the dir
name. This could be accomplished by define an union like systemd does:

union dirent_storage {
struct dirent de;
uint8_t storage[offsetof(struct dirent, d_name) +
((NAME_MAX + 1 + sizeof(long)) & ~(sizeof(long) - 1))];
};

However in all places that we use readdir_r() we have no concerns about
reentrance nor we have problems with threads. Thus use the simpler
readdir() instead.

We also remove the error logging here (that could be added back by
checking errno), but it was not adding much value so it's gone.
/external/kmod/tools/depmod.c
c1170883b4b42eadaddf951b3334286c6dfdf6e5 07-Aug-2013 Jan Engelhardt <jengelh@inai.de> depmod: add missing "else" clause

It occurred to an openSUSE user that our mkinitrd would throw a
warning when used with kmod:

libkmod: conf_files_list: unsupported file mode /dev/null: 0x21b6

Grepping for the error message revealed that there might be a missing
"else" keyword here, since it is unusual to put an "if" directly after
closing brace.
/external/kmod/tools/depmod.c
1958af88a2078970cc0b4281cdfef16fe54071b6 21-Apr-2013 Lucas De Marchi <lucas.de.marchi@gmail.com> Add format attribute and fix issues

Add __attribute__((format)) to log_filep() and _show() functions, fixing
the bugs they found in the source code.

For functions that receive va_list instead of being variadic functions
we put 0 in the last argument, so at least the string is checked and we
get warnings of -Wformat-nonliteral type. So, it's better than adding a
pragma here to shut up the warning.
/external/kmod/tools/depmod.c
e6b0e49b4ea7937a98b16f23d621244ee1a3e588 16-Jan-2013 Lucas De Marchi <lucas.demarchi@profusion.mobi> Update copyright notices
/external/kmod/tools/depmod.c
572a2711e711edb1810c88b124b709fa58f80880 12-Dec-2012 Andrey Mazo <mazo@telum.ru> depmod: fix builtin symbols resolution when the prefix symbol is set

When the prefix symbol is set, take it into account while adding symbols
from System.map file by skipping it before "__ksymtab_" comparison.

Also, prevent inserted fake symbols (like "__this_module") from being
wrongly truncated from beginning.
/external/kmod/tools/depmod.c
c02a8e6f9b6c600514a6d9d2564eca3e45c4fe35 12-Dec-2012 Andrey Mazo <mazo@telum.ru> depmod: --symbol-prefix actually requires an argument

-P requires and uses an argument but its long counterpart --symbol-prefix does not:
depmod: option '--symbol-prefix' doesn't allow an argument
/external/kmod/tools/depmod.c
650f89cd2510820a71dfc1b004634a309f12ecf1 28-Nov-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> 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.
/external/kmod/tools/depmod.c
6f02b6fa7ac435017b8f63dc9a1c8ce62bba008b 28-Nov-2012 Aleksey Makarov <amakarov@dev.rtsoft.ru> fix is_module_filename()

modinfo fails if there is a ".ko" substring in the path to the module
/external/kmod/tools/depmod.c
02c64df3c2b33880b18d3f4aba9fa8e48e5ca904 16-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> 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.
/external/kmod/tools/depmod.c
06294621a944e4611e15ce8201df80870e052e7d 16-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> 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.
/external/kmod/tools/depmod.c
7c04aeee40e9cced2656e286b2dc4bfbe8008a9f 06-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> tools: use program_invocation_short_name provided by libc

Thanks to Dave Reisner for pointing this out.
/external/kmod/tools/depmod.c
fcb0ce9475509f22031e77456c1075c891cbcd2e 06-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> tools: share function for logging
/external/kmod/tools/depmod.c
52a50fe2e548d3a3c112074e9c4e89237c257161 06-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> 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.
/external/kmod/tools/depmod.c
34e06bfb545f7a4cce6773b96b602db8329d4009 06-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> 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.
/external/kmod/tools/depmod.c
84341fbe013bca49038174b03e95c2943a8e184c 06-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> 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.
/external/kmod/tools/depmod.c
4a2e20dfb3f94b0c5f0b8269b0dd84974a5dac56 06-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> tools: share getting program name from argv for all tools
/external/kmod/tools/depmod.c
96b50d362349d78b3dd452e80221ab6ed0563002 05-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> depmod: add depmod prefix to log messages
/external/kmod/tools/depmod.c
a3f16ff70481e41796316115576f4a3875c98363 05-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> depmod: remove inline from _log
/external/kmod/tools/depmod.c
61c48db360c2147b54b92163152c5e4b931d4ff5 05-Nov-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> depmod: prefer ERR and WRN over plain fprintf
/external/kmod/tools/depmod.c
e4a7352ad3c16f0b4b658218d9997e3570a70772 30-Oct-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> 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.
/external/kmod/tools/depmod.c
447eed8c489258552942afbba8ea042f99c838e6 30-Oct-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> 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.
/external/kmod/tools/depmod.c
ec587f298cf172cf89382881bdb45f096376da1d 30-Oct-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> 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.
/external/kmod/tools/depmod.c
7062eca38b02af4e80c8409e6296678f07e9937c 30-Oct-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> 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).
/external/kmod/tools/depmod.c
b51ac407c2320cea4c588ee0bf10332a340a027a 30-Oct-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> depmod: do not create a hole in struct depmod
/external/kmod/tools/depmod.c
88c247f7f18ac25181ddcaff97fbbecbd3a29f57 03-Oct-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> 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.
/external/kmod/tools/depmod.c
c5b37dba8956dd8f82c54b9f97dc5dca07940db5 27-Sep-2012 Dave Reisner <dreisner@archlinux.org> 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.
/external/kmod/tools/depmod.c
3f376cd87742246f00fe552596975a00ec5d60b1 16-Jun-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> depmod: use ferror and fclose to check for error

Thanks to hpa for point this out.
/external/kmod/tools/depmod.c
a4fb97a71e336394e1a497c2b75ea42907937d1e 16-Jun-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> 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
/external/kmod/tools/depmod.c
015946da0ce8b25b854644bbc61dfa22cfcf912e 15-Jun-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> depmod: fix coding-style issue in array declaration
/external/kmod/tools/depmod.c
80e49ad9883b596310b6b2240e810511bd89d790 15-Jun-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> depmod: fail if any index could not be created
/external/kmod/tools/depmod.c
c5db1a3fd21a53a4592ee4e8c25efde01e6e2286 15-Jun-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> depmod: don't return error if modules.builtin don't exist
/external/kmod/tools/depmod.c
ccd6afa4f250776b46e0a5eb3e3b64fed700b76a 15-Jun-2012 Lucas De Marchi <lucas.de.marchi@gmail.com> Remove ifdef for building tools not bundled

Current build system do not support to build separate tools anymore, so
just remove the ifdefs.
/external/kmod/tools/depmod.c
ac78e109c37c2d1a075ee75f48cf86edfc516462 14-Jun-2012 Lucas De Marchi <lucas.demarchi@profusion.mobi> 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.
/external/kmod/tools/depmod.c