Commit Graph

536 Commits

Author SHA1 Message Date
Lucas De Marchi 7fa8c2d2df testsuite: add trap to open() including tests 2012-01-26 16:05:04 -02:00
Lucas De Marchi 6afc9cd616 testsuite: add trap to fopen() including tests 2012-01-26 16:05:04 -02:00
Lucas De Marchi ab25311072 testsuite: fake kernel 4.0.20-kmod is out
Go get it while it's fresh :-). Test fake results of "uname -r" by
LD_PRELOAD'ing uname.so.
2012-01-26 16:05:04 -02:00
Lucas De Marchi 395478cbbb testsuite: export environment with flags and LD_PRELOAD
A certain config can add flags and each flag may be associated with a
lib to LD_PRELOAD. It's now done for uname(2), which requires uname.so
in order to trap the calls.

Other trap will be added in later commits.
2012-01-26 16:05:04 -02:00
Lucas De Marchi ed2df4e984 testsuite: move oneshot to inside the test struct 2012-01-26 16:05:04 -02:00
Lucas De Marchi 68cc449376 testsuite: trap calls to uname 2012-01-26 16:05:04 -02:00
Lucas De Marchi eebca81e94 testsuite: test libkmod initialization 2012-01-26 16:05:04 -02:00
Lucas De Marchi 80f9e02382 testsuite: add skeleton 2012-01-26 16:05:04 -02:00
Lucas De Marchi 3ef848b28b modprobe: fix build 'cause of excessive number of arguments 2012-01-26 16:03:47 -02:00
Dave Reisner cc98830ca4 modprobe: remove code referring to -t, --type
This was only useful with the --list function, which isn't implemented.
2012-01-26 15:07:09 -02:00
Lucas De Marchi 1b3cd9d09f README: add link to packages place
A lot of people trying to get latest package from cgit is not good.
They should get the package from the released versions instead.
2012-01-23 12:29:38 -02:00
Lucas De Marchi fe8b0671a0 build-sys: do not create symlinks by default
Distro packagers should create them instead. It's too much trouble to
create them in the build system and every distro wants a different path
for them.
2012-01-21 18:01:00 -02:00
Lucas De Marchi 569f1609bd modprobe: kill operations depending on path
It was not on module-init-tools and it doesn't make much sense. It will
deal with dependencies, but looking at modules in the index. This might
not be the module we want if we are loading another from outside of the
tree.

Dealing with paths causes this bug (supposing there's a module names
squashfs):

	# cd /
	# touch squashfs
	# modprobe squashfs

That is because it detects that squashfs exists as a file and it will
try to load it instead of the alias "squashfs".

If you need to load a module from a path, use insmod.

Thanks to Silvan Calarco <silvan.calarco@mambasoft.it> who reported the
bug and helped debugging it.
2012-01-21 02:47:08 -02:00
Lucas De Marchi a41b39fb69 TODO: system() should not be used inside a library 2012-01-20 13:04:43 -02:00
Lucas De Marchi 12fd9cd55c build-sys: forcefully create links
If link already existed we would fail. Really not important for
packagers (the link should not exist), but for those who manually install it.
2012-01-18 19:48:16 -02:00
Lucas De Marchi 1592b0efdf build-sys: move modprobe to sbindir 2012-01-18 19:48:16 -02:00
Lucas De Marchi 411d83c41e Add program to calculate the shortest relative path for symlinks 2012-01-18 19:48:16 -02:00
Lucas De Marchi 434f32ca8d libkmod-list: allow to append an empty list 2012-01-17 21:16:23 -02:00
Lucas De Marchi 7bbf52341f build-sys: create symlinks if we are installing tools 2012-01-17 19:33:32 -02:00
Thierry Vignaud eff917c0d2 WEXITSTATUS is defined in sys/wait.h
Fix compiling with dietlibc:

../libkmod/libkmod-module.c:858:2: warning: implicit declaration of function 'WEXITSTATUS' [-Wimplicit-function-declaration]
../libkmod/libkmod-module.c:858:2: warning: nested extern declaration of 'WEXITSTATUS' [-Wnested-externs]
(...)
kmod-modprobe.c:(.text.command_do+0x157): undefined reference to `WEXITSTATUS'
2012-01-17 17:33:07 -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 09e9ae58b6 modprobe: flush stdout before dumping indexes
Index dump doesn't use stdio.h function and instead call write()
directly on STDOUT_FILENO file descriptor. Therefore we need to flush
stdio buffers before calling it, to be sure the configuration dump will
appear before index's.
2012-01-17 10:11:03 -02:00
Lucas De Marchi b8542a82b7 Fix common misspelling with codespell
-------8<-------
SUMMARY:
ommitted      1
2012-01-16 23:03:33 -02:00
Miklos Vajna 9be0162f9b man: spelling fixes 2012-01-16 23:01:36 -02:00
Lucas De Marchi b53b7e3282 kmod 4 2012-01-16 16:53:04 -02:00
Lucas De Marchi f4647b6329 build-sys: add release helpers 2012-01-16 16:52:25 -02:00
Lucas De Marchi 0224482e62 Add doc to kmod_dump_index 2012-01-16 16:44:25 -02:00
Lucas De Marchi 49a163759d modprobe: dump indexes as well 2012-01-16 16:05:47 -02:00
Lucas De Marchi 758428a75f libkmod: dump index files
Provide a function to dump the index files to a certain fd. It could be
more optimized (particularly the functions to dump the index that were
copied and pasted from m-i-t), but it seems like the only user of it is
'modprobe -c', used for debugging purposes. So, keep it as is.
2012-01-16 16:05:46 -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 b08314f7b7 libkmod: export enum kmod_index and rename members 2012-01-16 16:05:36 -02:00
Lucas De Marchi 63be91cbd5 libkmod: store prefix of each index
Prefix is useful when dumping the index (to be added later).
2012-01-16 16:04:32 -02:00
Lucas De Marchi 2f47c7fae9 Update documentation with recent changes 2012-01-14 12:16:48 -02:00
Lucas De Marchi e15a56af85 depmod: deal with relative root dir
module paths coming from libkmod are absolute. Make sure we store the
absolute dirname to compare later.
2012-01-14 02:46:58 -02:00
Lucas De Marchi 2e092e19a7 kmod_new(): deal with relative paths for dirname 2012-01-14 02:32:25 -02:00
Lucas De Marchi 33557e8d69 depmod: fix idx calculation after postponed array creation
We need to set up each module's idx when the array is created. So,
postpone its initialization as well.
2012-01-14 02:07:14 -02:00
Lucas De Marchi 31f1d0d306 Reduce scope of counter variable 2012-01-14 02:04:31 -02:00
Lucas De Marchi f6b838e1ba depmod: adhere to coding style 2012-01-14 02:03:21 -02:00
Lucas De Marchi bc43496a87 modprobe: dump configuration 2012-01-13 11:12:41 -02:00
Lucas De Marchi 6b04ef324a config: let softdeps dump their data 2012-01-13 11:12:41 -02:00
Lucas De Marchi 0017862911 config: add exported iterator functions
Config iterators are useful to get each configuration list, remember its
type and how to get their key/value pair.

softdeps don't have the value yet, because they are stored as string
vectors.
2012-01-13 11:12:41 -02:00
Lucas De Marchi 8b5ee61872 libkmod-private: allow to get aliases from config 2012-01-13 11:12:41 -02:00
Lucas De Marchi 3bf8d4b056 build-sys: add script to bootstrap and configure 2012-01-12 18:33:05 -02:00
Lucas De Marchi e5603189bc build-sys: rename autogen.sh to bootstrap and keep a symlink 2012-01-12 18:23:32 -02:00
Lucas De Marchi d89d7cb46a TODO: add code unification to list of tasks 2012-01-12 18:14:32 -02:00
Lucas De Marchi 8b01376742 modprobe: abort on dependency loop that cannot be broken 2012-01-12 17:14:30 -02:00
Lucas De Marchi e4e1e64ab0 modprobe: fix leak on error path 2012-01-12 15:37:57 -02:00
Lucas De Marchi e85b6731f9 TODO: update tasks 2012-01-12 15:37:53 -02:00
Lucas De Marchi a872bba22d modprobe: rework module removal without tree traversing
Just like the module insertion, module removal is remade.

The dependencies line that comes from modules.dep already contains all
the dependencies necessary to remove that module. Therefore modprobe
doesn't have to do the recursion between the modules in order to remove
it. All we have to do is to remove in order:

For the module being removed:
----------------------------

1. softdeps (in reverse order)
2. deps (in reverse order)
3. module
4. postdeps (in reverse order)

For any of the dependencies:
----------------------------

1. softdeps (in reverse order)
2. module
3. softdeps (in reverse order)
2012-01-12 15:23:51 -02:00