Commit Graph

33 Commits

Author SHA1 Message Date
Lucas De Marchi b91a1c6d3d kmod_list: add helper kmod_list_insert_before() 2011-12-06 03:34:51 -02:00
Lucas De Marchi 86e8788572 kmod_list: add helper kmod_list_insert_after() 2011-12-06 03:34:51 -02:00
Lucas De Marchi 671d489424 kmod_module: parse dependencies on demand 2011-12-06 02:48:04 -02:00
Lucas De Marchi d2d648dfaf Fix missing parenthesis in macro 2011-12-06 02:48:03 -02:00
Gustavo Sverzut Barbieri 7db08652cd Add simple hash implementation 2011-12-05 19:24:06 -02:00
Lucas De Marchi cf91579b8d 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.
2011-12-05 11:33:15 -02:00
Gustavo Sverzut Barbieri f12ae3c438 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).
2011-12-04 17:24:08 -02:00
Gustavo Sverzut Barbieri 32c328d28e fix missing ")". 2011-12-04 15:34:43 -02:00
Lucas De Marchi e22c85f357 Add memdup() helper 2011-12-03 04:07:15 -02:00
Gustavo Sverzut Barbieri d13e606ff6 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.
2011-12-03 03:56:57 -02:00
Lucas De Marchi ad5555b272 Fix extra attribute
linenum can be NULL in case we are not interested in the number of lines
parsed.
2011-12-03 03:53:10 -02:00
Gustavo Sverzut Barbieri 12d9419d08 improve compiler warnings and checks for internal functions. 2011-12-03 03:52:35 -02:00
Gustavo Sverzut Barbieri 1ce08a563e 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.
2011-12-03 03:51:55 -02:00
Lucas De Marchi 7636e72b15 Add dependency list to kmod_module
Dependency list is created from line as defined in modules.dep.
2011-12-01 17:56:03 -02:00
Lucas De Marchi 49e61ca347 Lookup for alias in modules.alias.bin 2011-12-01 16:27:04 -02:00
Lucas De Marchi 64700e4747 Lookup modules from modules.dep.bin file 2011-12-01 15:58:12 -02:00
Lucas De Marchi 62be799554 Add kmod_list_remove_n_latest() 2011-12-01 15:34:12 -02:00
Lucas De Marchi 9ba6f57b5b 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
2011-11-30 20:32:53 -02:00
Lucas De Marchi 7e317da3c9 Add startswith() helper function 2011-11-30 19:20:19 -02:00
Lucas De Marchi 7f3eb0cced 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().
2011-11-30 19:03:41 -02:00
Lucas De Marchi 60aa4d8b48 Organize functions in private header 2011-11-30 18:57:38 -02:00
Lucas De Marchi b0ef19f7f5 Add getters for aliases 2011-11-30 18:18:13 -02:00
Lucas De Marchi 44a5460fea Add streq() to prettify code
It's needed for importing index handling from module-init-tools, and may
be useful for the project, too.
2011-11-30 14:36:46 -02:00
Lucas De Marchi 8185fc91e2 Add underscores() helper to replace - with _ 2011-11-30 02:14:33 -02:00
Lucas De Marchi 81cf2060e0 Parse blacklists in config files 2011-11-29 18:48:02 -02:00
Lucas De Marchi 7c2ab358fd Add support for parsing config files
Right now only alias keyword is treated.
2011-11-29 18:07:43 -02:00
Lucas De Marchi 4462c4ac60 Add getline_wrapped() to parse config files
Basically copied from module-init-tools
2011-11-29 18:05:43 -02:00
Lucas De Marchi ae6df84a3c Make log function uppercase
The worst case is the err() macro. Usually err is used as a variable,
which clashes with this macro.
2011-11-25 01:05:30 -02:00
Lucas De Marchi 221631d511 Accept dir where we should lookup for modules 2011-11-24 23:20:42 -02:00
Lucas De Marchi 88e9c12e4e Rename libkmod-util.h to macro.h 2011-11-23 16:08:04 -02:00
Lucas De Marchi f87081b4d1 Add some function attributes and use them 2011-11-23 16:08:04 -02:00
Lucas De Marchi 6924e47a8d Implement circular double-linked list 2011-11-23 05:15:21 -02:00
Lucas De Marchi 586fc304d8 Rename libabc to libkmod 2011-11-21 14:35:35 -02:00