Commit Graph

36 Commits

Author SHA1 Message Date
Lucas De Marchi
9c306bad2e util: Be OOM-safe and use _cleanup_free_ 2013-11-18 11:01:16 -02:00
Lucas De Marchi
b93d800640 util: use _cleanup_free_ on path_make_absolute_cwd() 2013-11-18 05:22:33 -02:00
Lucas De Marchi
fa6fc9f0b8 util: Add mkdir_parents()
Like mkdir_p, but discards the leaf, creating the parent directories.
2013-07-15 12:45:35 -03:00
Lucas De Marchi
c493b93750 util: Add len arg to mkdir_p() 2013-07-15 12:44:33 -03:00
Lucas De Marchi
85d02ebea3 util: Add mkdir_p implementation from testsuite 2013-07-15 12:44:33 -03:00
Lucas De Marchi
83b855a6ed Use "-internal" suffix instead of "-private" 2013-07-04 16:13:11 -03:00
Lucas De Marchi
e6b0e49b4e Update copyright notices 2013-01-16 11:27:45 -02:00
Lucas De Marchi
5d352563bd Use bool instead of int
Also change the last field initializer in array to be empty.
2012-11-28 14:25:50 -02:00
Aleksey Makarov
6f02b6fa7a fix is_module_filename()
modinfo fails if there is a ".ko" substring in the path to the module
2012-11-28 11:22:00 -02:00
Lucas De Marchi
535c541e60 libkmod-util: split function for usec conversion 2012-06-06 01:08:56 -03:00
Mike Frysinger
d30319e433 libkmod: move function to the only file using it
If we don't have --gc-sections support, linking kmod fails:
libkmod/.libs/libkmod-util.a(libkmod-util.o): In function 'underscores':
libkmod/libkmod-util.c:117: undefined reference to 'kmod_log'

This is because libkmod-util.la uses kmod_log(), that is in libkmod.la.
Move the function so we don't have a dependency loop while building the
libraries and it works with compilers with no support for --gc-sections.
2012-05-15 19:30:05 -03:00
Lucas De Marchi
9901cfe242 Partially fix parsing of alias with dots
Alias names may contain dots. However since kmod_module_from_alias()
still calls kmod_module_new_from_name(), the bug is not entirely fixed,
and will be completely corrected in a later patch.
2012-01-30 20:05:33 -02:00
Pedro Pedruzzi
647200fb5a libkmod: Fix handling of square brackets expressions in function alias_normalize 2012-01-28 12:19:25 -02:00
Lucas De Marchi
6068aaaea8 Check if struct stat has mtim member
Not all libc's have a mtim member in struct stat (dietlibc doesn't).
Change ts_usec() to receive a struct stat as parameter and implement it
accordingly for both cases.
2012-01-17 12:22:55 -02:00
Lucas De Marchi
f1cbf3cfe2 libkmod-util: add helper function to write to fd 2012-01-16 16:05:46 -02:00
Lucas De Marchi
7a973b0cb0 libkmod-util: adhere to coding style 2012-01-16 16:05:46 -02:00
Lucas De Marchi
a66a6a999f Update copyright 2012-01-09 00:41:07 -02:00
Lucas De Marchi
6daceb2f1f Replace NAME_MAX with PATH_MAX for module aliases
Module aliases can be bigger than NAME_MAX. So, replace with PATH_MAX
that is bigger enough to hold them.

Technically in some places NAME_MAX would be sufficient (those using
module names only), but they use functions that can be called with
alias. So increase the buffers in these cases to PATH_MAX too.
2012-01-08 01:02:29 -02:00
Gustavo Sverzut Barbieri
6717994157 utils/read_str_safe(): fix wrong behavior and bugs.
ouch, I did a mess in the original function, fix them:

 * on errors (read() < 0), continue reading after the done bytes, not
   at position 0.

 * read buflen - 1 bytes, so there is always room to store the
   trailing \0, as expected by user due behavior of snprintf(),
   fgets() and others.
2012-01-03 14:22:05 -02:00
Lucas De Marchi
0b29ef6f59 util: add helper function to compare timestamps 2012-01-01 06:17:54 -02:00
Leandro Pereira
1698456259 libkmod-util: getline_wrapped: return NULL when buffer allocation fails 2011-12-28 15:55:45 -02:00
Lucas De Marchi
0c010fae10 Move libkmod-util.c to convenience util lib
Share more code between tools and libkmod. underscores() in kmod-depmod
can not use the same function as in the lib, so rename it.
2011-12-28 13:33:26 -02:00
Lucas De Marchi
a4848e249f Move util functions to libkmod-util.c
These allow them to be later shared with tools.
2011-12-27 18:11:58 -02:00
Lucas De Marchi
b148b8606a Add helper alias_normalize() 2011-12-13 10:41:18 -02:00
Lucas De Marchi
cb451f35d9 Change licenses
libkmod is under LGPL 2.1 or later
tools/* are under GPL
2011-12-12 18:24:35 -02:00
Lucas De Marchi
28c175edd1 coding style: be consistent with blank lines 2011-12-12 11:52:59 -02:00
Gustavo Sverzut Barbieri
bf8cf1483f fix string replace.
configure files with this would fail:

options wl x=1

were being handled as " =1".
2011-12-11 20:58:21 -02:00
Lucas De Marchi
4eb2c0fca1 Fix abs path helper function 2011-12-08 11:15:24 -02:00
Lucas De Marchi
06363cc126 Add helper path_make_absolute_cwd() 2011-12-07 13:51:40 -02:00
Lucas De Marchi
3a468809b8 Add helper path_is_absolute() 2011-12-07 13:50:52 -02:00
Lucas De Marchi
afca78015b Add helper strchr_replace() 2011-12-07 10:59:44 -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
Lucas De Marchi
e22c85f357 Add memdup() helper 2011-12-03 04:07:15 -02:00
Lucas De Marchi
7e317da3c9 Add startswith() helper function 2011-11-30 19:20:19 -02:00
Lucas De Marchi
8185fc91e2 Add underscores() helper to replace - with _ 2011-11-30 02:14:33 -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