platform/upstream/kmod.git
12 years agokmod_module: parse dependencies on demand
Lucas De Marchi [Mon, 5 Dec 2011 22:23:05 +0000 (20:23 -0200)]
kmod_module: parse dependencies on demand

12 years agoSplit function to search moddep file
Lucas De Marchi [Mon, 5 Dec 2011 21:58:39 +0000 (19:58 -0200)]
Split function to search moddep file

12 years agokmod_module: return a new list and increase ref of dependencies
Lucas De Marchi [Mon, 5 Dec 2011 21:40:45 +0000 (19:40 -0200)]
kmod_module: return a new list and increase ref of dependencies

kmod_module_get_dependency is renamed to kmod_module_get_dependencies
since it's returning a list. To match other APIs, now it returns a new
list that user must free with kmod_module_unref_list().

12 years agoFix missing parenthesis in macro
Lucas De Marchi [Tue, 6 Dec 2011 03:44:08 +0000 (01:44 -0200)]
Fix missing parenthesis in macro

12 years agoAdd simple hash implementation
Gustavo Sverzut Barbieri [Mon, 5 Dec 2011 02:17:37 +0000 (00:17 -0200)]
Add simple hash implementation

12 years agokmod_module: inline name and make it always available
Lucas De Marchi [Mon, 5 Dec 2011 20:14:51 +0000 (18:14 -0200)]
kmod_module: inline name and make it always available

12 years agokmod_alias: reduce from 3 mallocs to a single one.
Gustavo Sverzut Barbieri [Sun, 4 Dec 2011 19:32:44 +0000 (17:32 -0200)]
kmod_alias: reduce from 3 mallocs to a single one.

12 years agoUse readdir_r in kmod_module_get_sections()
Lucas De Marchi [Mon, 5 Dec 2011 15:40:16 +0000 (13:40 -0200)]
Use readdir_r in kmod_module_get_sections()

readdir() is not thread-safe. Use readdir_r instead.

12 years agoUse readdir_r in kmod_module_get_holders()
Lucas De Marchi [Mon, 5 Dec 2011 15:24:23 +0000 (13:24 -0200)]
Use readdir_r in kmod_module_get_holders()

readdir() is not thread-safe. Use readdir_r instead.

12 years agoAdd padding to enum to make sure it's an int
Lucas De Marchi [Mon, 5 Dec 2011 13:42:12 +0000 (11:42 -0200)]
Add padding to enum to make sure it's an int

12 years agoInline foreach macro for internal usage
Lucas De Marchi [Mon, 5 Dec 2011 13:33:15 +0000 (11:33 -0200)]
Inline foreach macro for internal usage

Avoid calling _next() function because it's an exported function and
linker can not optimize it.

Thanks to "Gustavo Sverzut Barbieri <barbieri@profusion.mobi>" for
suggestion.

12 years agotests: release memory before error exits.
Gustavo Sverzut Barbieri [Sun, 4 Dec 2011 23:18:21 +0000 (21:18 -0200)]
tests: release memory before error exits.

this makes it easier to valgrind the error cases as well.

12 years agono more kmod_loaded and kmod_loaded_module.
Gustavo Sverzut Barbieri [Sun, 4 Dec 2011 16:02:30 +0000 (14:02 -0200)]
no more kmod_loaded and kmod_loaded_module.

kmod_loaded_get_list() now returns a regular list of kmod_modules, use
kmod_module_get_module(), kmod_module_unref() and
kmod_module_unref_list() to operate on it.

12 years agokmod_module: extended information gathering.
Gustavo Sverzut Barbieri [Sun, 4 Dec 2011 14:40:00 +0000 (12:40 -0200)]
kmod_module: extended information gathering.

provide means to get:
 * refcount
 * initstate
 * holders
 * sections

this can be used to individually query properties from modules,
similar to /proc/modules (kmod_loaded / kmod_loaded_module).

12 years agokmod_module_get_module: safety against NULL pointers
Gustavo Sverzut Barbieri [Sun, 4 Dec 2011 15:14:11 +0000 (13:14 -0200)]
kmod_module_get_module: safety against NULL pointers

12 years agomodule refcount should start at 1.
Gustavo Sverzut Barbieri [Sun, 4 Dec 2011 14:34:02 +0000 (12:34 -0200)]
module refcount should start at 1.

the current way was having the referenced modules to be released given
the unref comparison checking for "> 0".

12 years agofix missing ")".
Gustavo Sverzut Barbieri [Sun, 4 Dec 2011 16:18:19 +0000 (14:18 -0200)]
fix missing ")".

12 years agoTODO: update file
Lucas De Marchi [Sat, 3 Dec 2011 22:51:01 +0000 (20:51 -0200)]
TODO: update file

12 years agoLicense library as LGPL
Lucas De Marchi [Sat, 3 Dec 2011 06:30:41 +0000 (04:30 -0200)]
License library as LGPL

The only part under GPL was the index, that is now re-licensed. Switch
back to LGPL.

12 years agoindex: change license to LGPL
Lucas De Marchi [Sat, 3 Dec 2011 06:28:49 +0000 (04:28 -0200)]
index: change license to LGPL

I've got an explicit permit from index author to re-license it as LGPL.

12 years agoindex: update copyrignt
Lucas De Marchi [Fri, 2 Dec 2011 20:25:44 +0000 (18:25 -0200)]
index: update copyrignt

mmap implementation

12 years agoindex: mmap: add support for seaching with wildcards
Lucas De Marchi [Fri, 2 Dec 2011 20:23:36 +0000 (18:23 -0200)]
index: mmap: add support for seaching with wildcards

Almost a clean copy & paste from the previous implementation.

12 years agoindex: mmap: add support for searching
Lucas De Marchi [Fri, 2 Dec 2011 19:49:03 +0000 (17:49 -0200)]
index: mmap: add support for searching

Almost a clean copy & paste from the previous implementation.

12 years agoindex: mmap: add support for searching node
Lucas De Marchi [Fri, 2 Dec 2011 19:45:01 +0000 (17:45 -0200)]
index: mmap: add support for searching node

Almost a clean copy & paste from the previous implementation.

12 years agoindex: mmap: read child node
Lucas De Marchi [Fri, 2 Dec 2011 19:41:46 +0000 (17:41 -0200)]
index: mmap: read child node

12 years agoindex: mmap: read root node
Lucas De Marchi [Fri, 2 Dec 2011 19:41:30 +0000 (17:41 -0200)]
index: mmap: read root node

12 years agoindex: mmap: create and destroy node
Lucas De Marchi [Fri, 2 Dec 2011 19:27:52 +0000 (17:27 -0200)]
index: mmap: create and destroy node

12 years agoAdd memdup() helper
Lucas De Marchi [Fri, 2 Dec 2011 19:21:18 +0000 (17:21 -0200)]
Add memdup() helper

12 years agoindex: mmap: open and close file
Lucas De Marchi [Fri, 2 Dec 2011 01:14:20 +0000 (23:14 -0200)]
index: mmap: open and close file

12 years agoindex: use idx instead of index due to name clash
Lucas De Marchi [Fri, 2 Dec 2011 19:48:14 +0000 (17:48 -0200)]
index: use idx instead of index due to name clash

12 years agoFix some coding style issues
Lucas De Marchi [Sat, 3 Dec 2011 06:05:22 +0000 (04:05 -0200)]
Fix some coding style issues

12 years agoimprove kmod_config api.
Gustavo Sverzut Barbieri [Fri, 2 Dec 2011 23:40:22 +0000 (21:40 -0200)]
improve kmod_config api.

make the function names reflect the structure they are operating on.

the structure is now allocated and remembers the context it was
created, then no need to give the context in every function call.

12 years agoreorder struct fields to avoid holes, improving packing
Gustavo Sverzut Barbieri [Fri, 2 Dec 2011 23:10:24 +0000 (21:10 -0200)]
reorder struct fields to avoid holes, improving packing

12 years agoREADME with purpose and initial overview.
Gustavo Sverzut Barbieri [Fri, 2 Dec 2011 23:05:38 +0000 (21:05 -0200)]
README with purpose and initial overview.

12 years agoFix extra attribute
Lucas De Marchi [Sat, 3 Dec 2011 05:53:10 +0000 (03:53 -0200)]
Fix extra attribute

linenum can be NULL in case we are not interested in the number of lines
parsed.

12 years agoimprove compiler warnings and checks for internal functions.
Gustavo Sverzut Barbieri [Fri, 2 Dec 2011 22:34:58 +0000 (20:34 -0200)]
improve compiler warnings and checks for internal functions.

12 years agoimprove "const" keyword usage.
Gustavo Sverzut Barbieri [Fri, 2 Dec 2011 22:24:07 +0000 (20:24 -0200)]
improve "const" keyword usage.

functions that do not modify their parameters get them as const pointers.

special cases:
 * kmod_get_userdata/kmod_set_userdata: return as void* for user convenience.
 * kmod_list_append/kmod_list_prepend: take const void* for user convenience.

12 years agoautogen: use "$@" and exec last program
Jan Engelhardt [Sat, 3 Dec 2011 04:31:01 +0000 (02:31 -0200)]
autogen: use "$@" and exec last program

12 years agoDo not ship autogen.sh in the tarball
Lucas De Marchi [Fri, 2 Dec 2011 19:53:54 +0000 (17:53 -0200)]
Do not ship autogen.sh in the tarball

Copied from libabc.

12 years agoDrop configurations from /usr/local
Lucas De Marchi [Fri, 2 Dec 2011 17:02:50 +0000 (15:02 -0200)]
Drop configurations from /usr/local

12 years agoTODO: update tasks
Lucas De Marchi [Fri, 2 Dec 2011 16:49:57 +0000 (14:49 -0200)]
TODO: update tasks

12 years agoindex: follow libkmod coding style
Lucas De Marchi [Fri, 2 Dec 2011 12:27:15 +0000 (10:27 -0200)]
index: follow libkmod coding style

12 years agoRemove redundant comments
Lucas De Marchi [Fri, 2 Dec 2011 12:23:02 +0000 (10:23 -0200)]
Remove redundant comments

12 years agoindex: remove unused functions
Lucas De Marchi [Fri, 2 Dec 2011 12:21:42 +0000 (10:21 -0200)]
index: remove unused functions

12 years agoindex: re-order functions so prototypes are not needed
Lucas De Marchi [Fri, 2 Dec 2011 12:15:00 +0000 (10:15 -0200)]
index: re-order functions so prototypes are not needed

12 years agoRemove trailing whitespace
Lucas De Marchi [Fri, 2 Dec 2011 12:08:52 +0000 (10:08 -0200)]
Remove trailing whitespace

12 years agoFix 'redundant redeclaration' warnings
Lucas De Marchi [Fri, 2 Dec 2011 12:07:25 +0000 (10:07 -0200)]
Fix 'redundant redeclaration' warnings

12 years agoFix 'old style declaration' warnings
Lucas De Marchi [Fri, 2 Dec 2011 12:05:31 +0000 (10:05 -0200)]
Fix 'old style declaration' warnings

12 years agoFix missing return
Lucas De Marchi [Fri, 2 Dec 2011 12:03:34 +0000 (10:03 -0200)]
Fix missing return

12 years agoClean 'unused variable' warnings
Lucas De Marchi [Fri, 2 Dec 2011 12:02:05 +0000 (10:02 -0200)]
Clean 'unused variable' warnings

12 years agoClean 'shadowed declaration' warnings
Lucas De Marchi [Fri, 2 Dec 2011 12:00:03 +0000 (10:00 -0200)]
Clean 'shadowed declaration' warnings

12 years agoClean 'shadowed declaration' warnings
Lucas De Marchi [Fri, 2 Dec 2011 11:56:22 +0000 (09:56 -0200)]
Clean 'shadowed declaration' warnings

index is a function in string.h, so replace index with idx all over the
source code.

12 years agoClean 'no previous prototype' warning
Lucas De Marchi [Fri, 2 Dec 2011 11:53:31 +0000 (09:53 -0200)]
Clean 'no previous prototype' warning

12 years agoUse fstat() instead of stat() when possible
Lucas De Marchi [Fri, 2 Dec 2011 01:13:27 +0000 (23:13 -0200)]
Use fstat() instead of stat() when possible

12 years agoAdd fucntion to API to get dependencies
Lucas De Marchi [Thu, 1 Dec 2011 22:06:08 +0000 (20:06 -0200)]
Add fucntion to API to get dependencies

12 years agoUse strtok_r insteat of strtok
Lucas De Marchi [Thu, 1 Dec 2011 20:59:54 +0000 (18:59 -0200)]
Use strtok_r insteat of strtok

strtok is not thread-safe because it uses a static pointer to keep track
of position in the string. Using strtok_r solves the problem.

12 years agoAdd TODO file with a few items
Lucas De Marchi [Thu, 1 Dec 2011 20:23:47 +0000 (18:23 -0200)]
Add TODO file with a few items

12 years agoAdd dependencies when module is create by name lookup
Lucas De Marchi [Thu, 1 Dec 2011 19:57:07 +0000 (17:57 -0200)]
Add dependencies when module is create by name lookup

We already have the data needed to add the dependencies, so call
fucntion to transform it in a list and save in kmod_module structure.

12 years agoAdd dependency list to kmod_module
Lucas De Marchi [Thu, 1 Dec 2011 19:56:03 +0000 (17:56 -0200)]
Add dependency list to kmod_module

Dependency list is created from line as defined in modules.dep.

12 years agoAdd missing newlines
Lucas De Marchi [Thu, 1 Dec 2011 19:47:49 +0000 (17:47 -0200)]
Add missing newlines

12 years agoAllow path_to_modname to operate locally withou alloc
Lucas De Marchi [Thu, 1 Dec 2011 19:18:24 +0000 (17:18 -0200)]
Allow path_to_modname to operate locally withou alloc

12 years agoLookup for alias in modules.alias.bin
Lucas De Marchi [Thu, 1 Dec 2011 18:27:04 +0000 (16:27 -0200)]
Lookup for alias in modules.alias.bin

12 years agoGeneralize function to be used by other lookups
Lucas De Marchi [Thu, 1 Dec 2011 18:25:37 +0000 (16:25 -0200)]
Generalize function to be used by other lookups

12 years agoLookup modules from modules.dep.bin file
Lucas De Marchi [Thu, 1 Dec 2011 17:57:53 +0000 (15:57 -0200)]
Lookup modules from modules.dep.bin file

12 years agoMake lookup functions return number of elements found
Lucas De Marchi [Thu, 1 Dec 2011 17:35:31 +0000 (15:35 -0200)]
Make lookup functions return number of elements found

12 years agoAdd kmod_list_remove_n_latest()
Lucas De Marchi [Thu, 1 Dec 2011 17:27:42 +0000 (15:27 -0200)]
Add kmod_list_remove_n_latest()

12 years agoAdd kmod_list_prev to exported functions
Lucas De Marchi [Thu, 1 Dec 2011 16:47:03 +0000 (14:47 -0200)]
Add kmod_list_prev to exported functions

12 years agoLookup modules.symbols.bin
Lucas De Marchi [Wed, 30 Nov 2011 22:31:45 +0000 (20:31 -0200)]
Lookup modules.symbols.bin

Test in my system:

./test/test-lookup symbol:sas_slave_destroy
libkmod version 0.1
Alias: 'symbol:sas_slave_destroy'
Modules matching:
libsas

12 years agoRemove dangling comment
Lucas De Marchi [Wed, 30 Nov 2011 22:30:39 +0000 (20:30 -0200)]
Remove dangling comment

12 years agoPrepare lookup function for more files to look after
Lucas De Marchi [Wed, 30 Nov 2011 22:29:51 +0000 (20:29 -0200)]
Prepare lookup function for more files to look after

12 years agoFix initialization of kernel modules dir
Lucas De Marchi [Wed, 30 Nov 2011 22:27:50 +0000 (20:27 -0200)]
Fix initialization of kernel modules dir

12 years agoAdd startswith() helper function
Lucas De Marchi [Wed, 30 Nov 2011 21:20:19 +0000 (19:20 -0200)]
Add startswith() helper function

12 years agoAdd test for lookup function
Lucas De Marchi [Wed, 30 Nov 2011 21:10:48 +0000 (19:10 -0200)]
Add test for lookup function

12 years agoAdd lookup to create modules list from alias
Lucas De Marchi [Wed, 30 Nov 2011 21:03:41 +0000 (19:03 -0200)]
Add lookup to create modules list from alias

We return a kmod_list when searching for an alias. Right now, it only
search for aliases in config files.

To use it, we create a list:
list = NULL;
kmod_module_new_from_lookup(..., &list);

And iterate over it to get the modules and their details:

kmod_list_foreach(l, list) {
struct kmod_mod *mod = kmod_module_get_module(l);
...
... kmod_module_get_name(mod);
... kmod_module_get_path(mod);
}

Aliases might contain globs and are match by using fnmatch().

12 years agoAdd name() and path() getters for kmod_module
Lucas De Marchi [Wed, 30 Nov 2011 21:01:01 +0000 (19:01 -0200)]
Add name() and path() getters for kmod_module

12 years agoOrganize functions in private header
Lucas De Marchi [Wed, 30 Nov 2011 20:57:38 +0000 (18:57 -0200)]
Organize functions in private header

12 years agoAdd getters for aliases
Lucas De Marchi [Wed, 30 Nov 2011 20:18:13 +0000 (18:18 -0200)]
Add getters for aliases

12 years agoFix misspellings by use of codespell
Lucas De Marchi [Wed, 30 Nov 2011 18:01:08 +0000 (16:01 -0200)]
Fix misspellings by use of codespell

12 years agoRemove trailing whitespaces
Lucas De Marchi [Wed, 30 Nov 2011 17:59:36 +0000 (15:59 -0200)]
Remove trailing whitespaces

12 years agoImport index handling from module-init-tools
Lucas De Marchi [Wed, 30 Nov 2011 17:23:28 +0000 (15:23 -0200)]
Import index handling from module-init-tools

This effectively makes the combined work be GPL. All other parts of this
library are still LGPL and if this part in future becomes
double-licensed, we can switch back to LGPL.

12 years agoAdd streq() to prettify code
Lucas De Marchi [Wed, 30 Nov 2011 16:36:46 +0000 (14:36 -0200)]
Add streq() to prettify code

It's needed for importing index handling from module-init-tools, and may
be useful for the project, too.

12 years agoDefine temporary macros for importing index
Lucas De Marchi [Wed, 30 Nov 2011 16:35:39 +0000 (14:35 -0200)]
Define temporary macros for importing index

12 years agoUse underscores() in module names and aliases
Lucas De Marchi [Wed, 30 Nov 2011 04:14:57 +0000 (02:14 -0200)]
Use underscores() in module names and aliases

12 years agoAdd underscores() helper to replace - with _
Lucas De Marchi [Wed, 30 Nov 2011 04:14:33 +0000 (02:14 -0200)]
Add underscores() helper to replace - with _

12 years agoParse blacklists in config files
Lucas De Marchi [Tue, 29 Nov 2011 20:48:02 +0000 (18:48 -0200)]
Parse blacklists in config files

12 years agoAdd support for parsing config files
Lucas De Marchi [Tue, 29 Nov 2011 20:07:43 +0000 (18:07 -0200)]
Add support for parsing config files

Right now only alias keyword is treated.

12 years agoAdd getline_wrapped() to parse config files
Lucas De Marchi [Tue, 29 Nov 2011 20:05:43 +0000 (18:05 -0200)]
Add getline_wrapped() to parse config files

Basically copied from module-init-tools

12 years agoAdd macro to safely derive the size of an array
Lucas De Marchi [Tue, 29 Nov 2011 19:59:58 +0000 (17:59 -0200)]
Add macro to safely derive the size of an array

12 years agoFix wrong copyright
Lucas De Marchi [Mon, 28 Nov 2011 18:58:23 +0000 (16:58 -0200)]
Fix wrong copyright

I'm the author, not the copyright owner.

12 years agoMove down the ifdef for c++
Lucas De Marchi [Mon, 28 Nov 2011 14:03:17 +0000 (12:03 -0200)]
Move down the ifdef for c++

12 years agoBack to logging without \n
Lucas De Marchi [Fri, 25 Nov 2011 03:28:39 +0000 (01:28 -0200)]
Back to logging without \n

It possibly breaks when not logging to stderr

12 years agoAdd test-insmod to insert modules
Lucas De Marchi [Fri, 25 Nov 2011 03:25:18 +0000 (01:25 -0200)]
Add test-insmod to insert modules

Insmod is supported only with file names yet.

12 years agoAdd test-rmmod2
Lucas De Marchi [Fri, 25 Nov 2011 03:24:16 +0000 (01:24 -0200)]
Add test-rmmod2

Remove module without dealing with the loaded modules first.

12 years agoAdd functions to operate on modules
Lucas De Marchi [Fri, 25 Nov 2011 03:22:56 +0000 (01:22 -0200)]
Add functions to operate on modules

12 years agoFix check_PROGRAMS in autofoo
Lucas De Marchi [Fri, 25 Nov 2011 03:21:47 +0000 (01:21 -0200)]
Fix check_PROGRAMS in autofoo

12 years agoWhen logging to stderr, put a \n by default
Lucas De Marchi [Fri, 25 Nov 2011 03:07:04 +0000 (01:07 -0200)]
When logging to stderr, put a \n by default

12 years agoMake log function uppercase
Lucas De Marchi [Fri, 25 Nov 2011 03:05:30 +0000 (01:05 -0200)]
Make log function uppercase

The worst case is the err() macro. Usually err is used as a variable,
which clashes with this macro.

12 years agoAdd cscope.out and .swp files to gitignore
Lucas De Marchi [Fri, 25 Nov 2011 01:31:25 +0000 (23:31 -0200)]
Add cscope.out and .swp files to gitignore

12 years agoAccept dir where we should lookup for modules
Lucas De Marchi [Thu, 24 Nov 2011 18:41:01 +0000 (16:41 -0200)]
Accept dir where we should lookup for modules

12 years agoFormat enum
Lucas De Marchi [Thu, 24 Nov 2011 17:42:16 +0000 (15:42 -0200)]
Format enum