summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Gomes <tiago.gomes@codethink.co.uk>2013-07-01 20:16:34 +0000
committerTiago Gomes <tiago.gomes@codethink.co.uk>2013-07-01 20:16:34 +0000
commitb0982258a9fb1c7714e79bd0a7356c6211785b4d (patch)
treea4e4a14a273ceb884334b87f80a385beb80db2ad
parentc29425dc9180e571158313904d28d3b6589b9d59 (diff)
downloadkmod-b0982258a9fb1c7714e79bd0a7356c6211785b4d.tar.gz
Revert "Merge remote-tracking branch 'origin/master' into baserock/morph"
This reverts commit 64e277a1bbe8ace86e159fb2d81e77629b9f9a42, reversing changes made to 47fddef72fdd6c0e6a192026b673305fb67dc361.
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml17
-rw-r--r--CODING-STYLE9
-rw-r--r--Makefile.am103
-rw-r--r--NEWS148
-rw-r--r--README5
-rw-r--r--TODO46
-rwxr-xr-xbootstrap2
-rwxr-xr-xbootstrap-configure2
-rw-r--r--configure.ac194
-rw-r--r--libkmod/docs/libkmod-docs.xml13
-rw-r--r--libkmod/docs/libkmod-sections.txt1
-rw-r--r--libkmod/libkmod-array.c2
-rw-r--r--libkmod/libkmod-array.h5
-rw-r--r--libkmod/libkmod-config.c64
-rw-r--r--libkmod/libkmod-elf.c76
-rw-r--r--libkmod/libkmod-file.c39
-rw-r--r--libkmod/libkmod-hash.c26
-rw-r--r--libkmod/libkmod-hash.h5
-rw-r--r--libkmod/libkmod-index.c63
-rw-r--r--libkmod/libkmod-index.h9
-rw-r--r--libkmod/libkmod-list.c2
-rw-r--r--libkmod/libkmod-module.c395
-rw-r--r--libkmod/libkmod-private.h79
-rw-r--r--libkmod/libkmod-signature.c141
-rw-r--r--libkmod/libkmod-util.c67
-rw-r--r--libkmod/libkmod-util.h44
-rw-r--r--libkmod/libkmod.c113
-rw-r--r--libkmod/libkmod.h4
-rw-r--r--libkmod/libkmod.sym1
-rw-r--r--libkmod/macro.h53
-rw-r--r--libkmod/missing.h34
-rw-r--r--m4/attributes.m485
-rw-r--r--man/Makefile.am7
-rw-r--r--man/depmod.xml68
-rw-r--r--man/modinfo.xml42
-rw-r--r--man/modprobe.d.xml2
-rw-r--r--man/modprobe.xml90
-rw-r--r--man/rmmod.xml18
-rw-r--r--test/WARNING3
-rw-r--r--test/test-blacklist.c76
-rw-r--r--test/test-elf.c106
-rw-r--r--test/test-get-dependencies.c52
-rw-r--r--test/test-invalidate-config.c49
-rw-r--r--test/test-lookup.c184
-rw-r--r--test/test-mod-double-ref.c78
-rw-r--r--test/test-path-from-name.c48
-rw-r--r--test/test-probe.c118
-rw-r--r--test/test.conf (renamed from testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.builtin)0
-rw-r--r--testsuite/.gitignore26
-rw-r--r--testsuite/COPYING504
-rw-r--r--testsuite/delete_module.c19
-rw-r--r--testsuite/init_module.c211
-rw-r--r--testsuite/mkdir.c70
-rw-r--r--testsuite/mkdir.h24
-rw-r--r--testsuite/path.c224
-rw-r--r--testsuite/rootfs-pristine/test-alias/correct.txt25
-rw-r--r--testsuite/rootfs-pristine/test-blacklist/etc/modprobe.d/modprobe.conf2
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/jbd2/jbd2.kobin159175 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/mbcache.kobin18431 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/crc16.kobin4374 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias1
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias.binbin12 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.builtin.binbin12 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep4
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep.binbin265 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.devname1
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.order7
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.softdep2
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols58
-rw-r--r--testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols.binbin2584 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/correct-modules.alias37
-rw-r--r--testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/block/cciss.ko.gzbin33491 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/hpsa.ko.gzbin32672 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gzbin81188 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.builtin0
-rw-r--r--testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.order7
-rw-r--r--testsuite/rootfs-pristine/test-init/correct.txt28
-rw-r--r--testsuite/rootfs-pristine/test-init/ext4-i686.kobin437788 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-init/ext4-ppc64.kobin704776 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-init/ext4-s390x.kobin773856 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-init/ext4-x86_64.kobin627040 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-loaded/correct.txt2
-rw-r--r--testsuite/rootfs-pristine/test-loaded/proc/modules1
l---------testsuite/rootfs-pristine/test-loaded/sys/module/btusb/drivers/usb:btusb1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/holders/.gitignore0
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/initstate1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/notes/.note.gnu.build-idbin36 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/disable_scofix1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/force_scofix1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_csr1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_dga1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_sniffer1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/reset1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/refcnt1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.bss1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.data1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.exit.text1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.gnu.linkonce.this_module1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.init.text1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.note.gnu.build-id1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.11
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.81
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.smp_locks1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.strtab1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.symtab1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.text1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/__param1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/srcversion1
-rw-r--r--testsuite/rootfs-pristine/test-loaded/sys/module/btusb/version1
-rw-r--r--testsuite/rootfs-pristine/test-modinfo/correct.txt52
-rw-r--r--testsuite/rootfs-pristine/test-modinfo/ext4-i686.kobin437788 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modinfo/ext4-ppc64.kobin704776 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modinfo/ext4-s390x.kobin773856 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha1.kobin729451 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha256.kobin729451 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modinfo/ext4-x86_64.kobin627040 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/correct-psmouse.txt0
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/etc/modprobe.d/bogus.conf1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.kobin95649 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias3
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias.binbin101 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.builtin.bin0
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep.binbin72 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.devname1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.softdep2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols.binbin12 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/alias-to-none/proc/modules0
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias.binbin12 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin.binbin31 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep0
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep.binbin12 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.devname1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.softdep2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols.binbin12 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/etc/modprobe.d/dumb-instal-loop.conf1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd-pcm.ko.gzbin46263 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd.ko.gzbin38351 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias.binbin46 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep.binbin137 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.devname1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.softdep2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols133
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols.binbin6131 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/correct-psmouse.txt1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/correct.txt2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.kobin28134 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.kobin95649 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.kobin284834 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias21
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias.binbin1227 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep3
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep.binbin298 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.devname1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.softdep2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols45
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols.binbin2390 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/proc/modules2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/coresize1
l---------testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/holders/btusb1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initsize1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initstate1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/notes/.note.gnu.build-idbin36 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_ertm1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_esco1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_hs1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_le1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_mgmt1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/refcnt1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.bss1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.data1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.exit.text1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.gnu.linkonce.this_module1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.init.text1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.note.gnu.build-id1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.11
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.81
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.smp_locks1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.strtab1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.symtab1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text.unlikely1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__bug_table1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__jump_table1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab_gpl1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_gpl1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_strings1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__param1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/srcversion1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/taint1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/version1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/coresize1
l---------testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/drivers/usb:btusb1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/holders/.gitignore0
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initsize1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initstate1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/notes/.note.gnu.build-idbin36 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/disable_scofix1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/force_scofix1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_csr1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_dga1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_sniffer1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/reset1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/refcnt1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.bss1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.data1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.exit.text1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.gnu.linkonce.this_module1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.init.text1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.note.gnu.build-id1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.11
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.81
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.smp_locks1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.strtab1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.symtab1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.text1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/__param1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/srcversion1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/taint1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/version1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/etc/modprobe.d/dumb-softdep.conf1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.kobin28134 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.kobin95649 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.kobin284834 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias21
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias.binbin1227 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep3
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep.binbin298 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.devname1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.softdep2
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols45
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols.binbin2390 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-new-module/from_alias/correct.txt2
-rw-r--r--testsuite/rootfs-pristine/test-new-module/from_alias/etc/modprobe.d/modprobe.conf1
-rw-r--r--testsuite/rootfs-pristine/test-new-module/from_name/correct.txt6
-rw-r--r--testsuite/rootfs-pristine/test-remove/correct.txt28
-rw-r--r--testsuite/rootfs-pristine/test-remove/ext4-i686.kobin437788 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-remove/ext4-ppc64.kobin704776 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-remove/ext4-s390x.kobin773856 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-remove/ext4-x86_64.kobin627040 -> 0 bytes
-rw-r--r--testsuite/rootfs-pristine/test-rootfs/lib/modules/a1
-rw-r--r--testsuite/rootfs-pristine/test-rootfs/testdir/.gitignore0
-rw-r--r--testsuite/rootfs.tar.xzbin0 -> 661752 bytes
-rw-r--r--testsuite/stripped-module.h8
-rw-r--r--testsuite/test-alias.c19
-rw-r--r--testsuite/test-blacklist.c109
-rw-r--r--testsuite/test-dependencies.c93
-rw-r--r--testsuite/test-depmod.c63
-rw-r--r--testsuite/test-init.c23
-rw-r--r--testsuite/test-loaded.c19
-rw-r--r--testsuite/test-modinfo.c22
-rw-r--r--testsuite/test-modprobe.c92
-rw-r--r--testsuite/test-new-module.c19
-rw-r--r--testsuite/test-testsuite.c19
-rw-r--r--testsuite/testsuite.c224
-rw-r--r--testsuite/testsuite.h38
-rw-r--r--testsuite/uname.c19
-rw-r--r--tools/kmod-depmod.c (renamed from tools/depmod.c)432
-rw-r--r--tools/kmod-insmod.c (renamed from tools/insmod.c)43
-rw-r--r--tools/kmod-lsmod.c (renamed from tools/lsmod.c)14
-rw-r--r--tools/kmod-modinfo.c (renamed from tools/modinfo.c)65
-rw-r--r--tools/kmod-modprobe.c (renamed from tools/modprobe.c)248
-rw-r--r--tools/kmod-rmmod.c (renamed from tools/rmmod.c)128
-rw-r--r--tools/kmod.c6
-rw-r--r--tools/kmod.h9
-rw-r--r--tools/log.c143
-rw-r--r--tools/log.h37
-rw-r--r--tools/static-nodes.c263
280 files changed, 2260 insertions, 4421 deletions
diff --git a/.gitignore b/.gitignore
index 5bfab9a..8d7c74a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,7 +16,6 @@ Makefile.in
/configure
/libtool
/stamp-h1
-/test-suite.log
*~
.*.swp
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 262a1c5..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-language: c
-compiler:
- - gcc
- - clang
-before_install:
- - sudo apt-get update
- - sudo apt-get install -qq liblzma-dev
- - sudo apt-get install -qq zlib1g-dev
- - sudo apt-get install -qq xsltproc docbook-xsl
-# Change this to your needs
-script: ./bootstrap-configure && make CFLAGS="-Wno-error" && make CFLAGS="-Wno-error" check
-notifications:
- irc:
- channels:
- - "irc.freenode.org#kmod"
- template:
- - "%{commit}: %{author} - %{message}"
diff --git a/CODING-STYLE b/CODING-STYLE
index 865252e..e60df9e 100644
--- a/CODING-STYLE
+++ b/CODING-STYLE
@@ -15,12 +15,10 @@ them is actually an error. In certain circumstances one can ignore the 80
character per line limit. This is generally only allowed if the alternative
would make the code even less readable.
-Besides the kernel coding style above, kmod coding style is heavily based on
+Besides the kernel coding style above, kmod coding style is havily based on
oFono's and BlueZ's. Below some basic rules:
-1) Wrap line at 80 char limit.
-
-There are a few exceptions:
+1) Wrap line at 80 char limit. There are a few exceptions:
- Headers may or may not wrap
- If it's a string that is hitting the limit, it's preferred not to break
in order to be able to grep for that string. E.g:
@@ -31,9 +29,6 @@ There are a few exceptions:
- If there's only one argument to the function, don't put it alone in a
new line.
-Align the wrapped line either with tabs (BlueZ, oFono, etc) or tab + spaces
-(kernel), at your discretion. Kernel's is preferred.
-
2) It's better to return/exit early in a function than having a really long
"if (...) { }". Example:
diff --git a/Makefile.am b/Makefile.am
index b1bfd59..6d0cbe4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,4 @@
-SUBDIRS = . libkmod/docs
-
-if BUILD_MANPAGES
-SUBDIRS += man
-endif
+SUBDIRS = . libkmod/docs man
DISTCLEAN_LOCAL_HOOKS =
EXTRA_DIST =
@@ -13,12 +9,19 @@ AM_MAKEFLAGS = --no-print-directory
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-I$(top_srcdir)/libkmod \
+ -DROOTPREFIX=\""$(rootprefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
${zlib_CFLAGS}
-AM_CFLAGS = $(WARNINGFLAGS)
-AM_LDFLAGS = $(GCLDFLAGS)
+AM_CFLAGS = \
+ -fvisibility=hidden \
+ -ffunction-sections \
+ -fdata-sections
+
+AM_LDFLAGS = \
+ -Wl,--gc-sections \
+ -Wl,--as-needed
SED_PROCESS = \
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
@@ -36,9 +39,9 @@ SED_PROCESS = \
%.pc: %.pc.in Makefile
$(SED_PROCESS)
-LIBKMOD_CURRENT=4
-LIBKMOD_REVISION=3
-LIBKMOD_AGE=2
+LIBKMOD_CURRENT=2
+LIBKMOD_REVISION=0
+LIBKMOD_AGE=0
noinst_LTLIBRARIES = libkmod/libkmod-util.la
libkmod_libkmod_util_la_SOURCES = libkmod/libkmod-hash.c \
@@ -55,7 +58,6 @@ libkmod_libkmod_la_SOURCES =\
libkmod/libkmod.h \
libkmod/libkmod-private.h \
libkmod/macro.h \
- libkmod/missing.h \
libkmod/libkmod.c \
libkmod/libkmod-list.c \
libkmod/libkmod-config.c \
@@ -63,11 +65,10 @@ libkmod_libkmod_la_SOURCES =\
libkmod/libkmod-index.h \
libkmod/libkmod-module.c \
libkmod/libkmod-file.c \
- libkmod/libkmod-elf.c \
- libkmod/libkmod-signature.c
+ libkmod/libkmod-elf.c
EXTRA_DIST += libkmod/libkmod.sym
-EXTRA_DIST += libkmod/README libkmod/COPYING testsuite/COPYING COPYING
+EXTRA_DIST += libkmod/COPYING libkmod/README
libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
-version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
@@ -107,16 +108,19 @@ bin_PROGRAMS = tools/kmod
noinst_SCRIPTS = tools/insmod tools/rmmod tools/lsmod \
tools/modprobe tools/modinfo tools/depmod
-tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/lsmod.c \
- tools/rmmod.c tools/insmod.c \
- tools/modinfo.c tools/modprobe.c \
- tools/depmod.c tools/log.h tools/log.c \
- tools/static-nodes.c
+tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/kmod-lsmod.c \
+ tools/kmod-rmmod.c tools/kmod-insmod.c \
+ tools/kmod-modinfo.c tools/kmod-modprobe.c \
+ tools/kmod-depmod.c
+tools_kmod_CPPFLAGS = $(AM_CPPFLAGS) -DKMOD_BUNDLE_TOOL=1
+tools_kmod_CFLAGS = $(AM_CFLAGS)
tools_kmod_LDADD = libkmod/libkmod-util.la \
libkmod/libkmod.la
noinst_PROGRAMS = tools/kmod-nolib
tools_kmod_nolib_SOURCES = $(tools_kmod_SOURCES)
+tools_kmod_nolib_CPPFLAGS = $(tools_kmod_CPPFLAGS)
+tools_kmod_nolib_CFLAGS = $(tools_kmod_CFLAGS)
tools_kmod_nolib_LDADD = libkmod/libkmod-util.la \
libkmod/libkmod-private.la
@@ -129,19 +133,9 @@ endif
# TESTSUITE
# ------------------------------------------------------------------------------
-ROOTFS = testsuite/rootfs
-ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
-CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && \
- cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
- touch testsuite/stamp-rootfs && \
- find $(ROOTFS) -type d -exec chmod +w {} \; )
-
-rootfs:
- $(CREATE_ROOTFS)
-.PHONY: rootfs
-
-$(ROOTFS): $(ROOTFS_PRISTINE)
- $(CREATE_ROOTFS)
+testsuite/rootfs: $(top_srcdir)/testsuite/rootfs.tar.xz
+ $(AM_V_GEN) tar -C testsuite/ \
+ -xJf $(top_srcdir)/testsuite/rootfs.tar.xz
TESTSUITE_OVERRIDE_LIBS = testsuite/uname.la testsuite/path.la \
testsuite/init_module.la \
@@ -149,8 +143,6 @@ TESTSUITE_OVERRIDE_LIBS = testsuite/uname.la testsuite/path.la \
TESTSUITE_OVERRIDE_LIBS_LDFLAGS = avoid-version -module -shared -export-dynamic \
-rpath /nowhere -ldl
-check-am: rootfs
-
check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
@@ -159,33 +151,39 @@ testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
testsuite_init_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
testsuite_init_module_la_SOURCES = testsuite/init_module.c \
- testsuite/mkdir.c testsuite/mkdir.h \
testsuite/stripped-module.h
testsuite_init_module_la_LIBADD = libkmod/libkmod-private.la
+testsuite-distclean:
+ -rm -rf testsuite/rootfs
+
+testsuite-pack-rootfs:
+ $(AM_V_GEN) ( cd testsuite && tar -cJf \
+ $(abs_top_srcdir)/testsuite/rootfs.tar.xz \
+ rootfs )
+
+DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
+EXTRA_DIST += testsuite/rootfs.tar.xz
+
TESTSUITE_CPPFLAGS = $(AM_CPPFLAGS) \
- -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/$(ROOTFS)/\" \
+ -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/testsuite/rootfs/\" \
-DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
-TESTSUITE_LDADD = testsuite/libtestsuite.la libkmod/libkmod-private.la \
- libkmod/libkmod-util.la
+TESTSUITE_LDADD = testsuite/libtestsuite.la libkmod/libkmod-private.la
check_LTLIBRARIES += testsuite/libtestsuite.la
testsuite_libtestsuite_la_SOURCES = testsuite/testsuite.c \
testsuite/testsuite.h
-testsuite_libtestsuite_la_DEPENDENCIES = $(ROOTFS) \
- $(TESTSUITE_OVERRIDE_LIBS)
+testsuite_libtestsuite_la_DEPENDENCIES = testsuite/rootfs \
+ $(TESTSUITE_OVERRIDE_LIBS)
testsuite_libtestsuite_la_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
-testsuite_libtestsuite_la_LIBADD = -lrt
TESTSUITE = testsuite/test-init testsuite/test-testsuite testsuite/test-loaded \
testsuite/test-modinfo testsuite/test-alias testsuite/test-new-module \
- testsuite/test-modprobe testsuite/test-blacklist \
- testsuite/test-dependencies testsuite/test-depmod
-
+ testsuite/test-modprobe
check_PROGRAMS = $(TESTSUITE)
TESTS = $(TESTSUITE)
-testsuite_test_testsuite_LDADD = testsuite/libtestsuite.la libkmod/libkmod-util.la
+testsuite_test_testsuite_LDADD = testsuite/libtestsuite.la
testsuite_test_testsuite_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
testsuite_test_init_LDADD = $(TESTSUITE_LDADD)
testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
@@ -199,21 +197,8 @@ testsuite_test_new_module_LDADD = $(TESTSUITE_LDADD)
testsuite_test_new_module_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
testsuite_test_modprobe_LDADD = $(TESTSUITE_LDADD)
testsuite_test_modprobe_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
-testsuite_test_blacklist_LDADD = $(TESTSUITE_LDADD)
-testsuite_test_blacklist_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
-testsuite_test_dependencies_LDADD = $(TESTSUITE_LDADD)
-testsuite_test_dependencies_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
-testsuite_test_depmod_LDADD = $(TESTSUITE_LDADD)
-testsuite_test_depmod_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
-
-testsuite-distclean:
- $(RM) -r $(ROOTFS)
- $(RM) testsuite/stamp-rootfs
-
-DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
-EXTRA_DIST += testsuite/rootfs-pristine
-DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --sysconfdir=/etc --with-zlib
+DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
diff --git a/NEWS b/NEWS
index 5324934..4181097 100644
--- a/NEWS
+++ b/NEWS
@@ -1,151 +1,3 @@
-kmod 13
-=======
-
-- Bug fixes:
- - Add the long option --symbol-prefix option to depmod (it was absent)
- and fix its behavior
- - Don't abort if there's a bogus line in configuration file like "alias
- psmouse off". Some distros are carrying this since the days of
- modutils
-
-- New features:
- - Add support for finit_module(2). If the module is load straight from
- the disk and without compression we use finit_module() syscall when
- available, falling back to init_module() otherwise
- - kmod_module_get_info() also returns the signature if the module is
- signed and modinfo uses it
- - Use secure_getenv if available
- - rmmod understands builtin modules, just like modprobe does
- - Improve compatibility with musl-libc
- - Test cases exit with success when receiving a signal if they are
- xfail tests
-
-kmod 12
-=======
-
-- Bug fixes:
- - Fix removing vermagic from module when told to force load a module
- - Fix removing __versions section when told to force load a module: we
- need to mangle the section header, not the section.
- - modinfo no longer fails while loading a module from file when path
- contains ".ko" substring
-
-kmod 11
-=======
-
-- Improvements to testsuite:
- - Fix testsuite defining symbols twice on 32 bit systems
- - Allow to check generated files against correct ones
-
-- New features:
- - libkmod now keeps a file opened after the first call to
- kmod_module_get_{info,versions,symbols,dependency_symbols}. This
- reduces signficantly the amount of time depmod tool takes to
- execute. Particularly if compressed modules are used.
- - Remove --with-rootprefix from build system. It was not a great idea
- after all and should not be use since it causes more harm then
- benefits.
- - Hide --wait option on rmmod. This feature is being targeted for
- removal from kernel. rmmod still accepts this option, but it's hidden
- now: man page and usage() says nothing about it and if it's used,
- user will get a 10s sleep. This way we can check and help if anyone
- is using this feature.
- - Refactor message logging on all tools, giving proper prefix, routing
- everything to syslog when asked for, etc.
-
-- Bug fixes:
- - Fix parsing of modules.order when using compressed modules
- - Usage messages go to stdout instead of stderr
- - Fix memory leak in hash implementation
-
-kmod 10
-=======
-
-- New features:
- - Read coresize from /sys if supported
-
- - Add flag to kmod_module_probe_insert() to apply blacklisting during
- probe only if mod is an alias. Now modprobe uses this flag by default.
- This is needed to fix a change in behavior regarding module-init-tools
- and ultimately makes us loading a blacklisted module.
-
-- Better formatting in man pages
-
-- Add option to disable building man pages at build time
-
-- Fixes in the testsuite and refactoring of LDPRELOAD'ed libraries
-
-- Re-licensing testsuite as LGPL
-
-kmod 9
-======
-
-- Improvements to the testsuite:
- - Check for correct handling of softdep loops
- - Check for correct handling of install command loops
-
-- Bug fixes:
- - Fix build with compilers that don't support --gc-sections
- - Handle errors when dealing with gzipped modules
- - depmod now handles errors while writing indices, so it doesn't end up
- with a corrupted index without telling the user
-
-kmod 8
-======
-
-- No new features, small bug fixes only.
- - Fix a bug in "modprobe -c" output: be compatible with
- module-init-tools
-
- - Give a useful error message when init_module fails due to bad
- parameter or unknown symbols
-
- - Fix doc generation
-
-kmod 7
-======
-
-- Re-order dirs for configuration files to match the change in systemd and
- udev: now the priority is:
- 1. /etc/modprobe.d
- 2. /run/modprobe.d
- 3. /lib/modprobe.d
-
-- Fix setting CFLAGS/LDFLAGS in build system. This prevented us from not
- allowing the user to set his preferences.
-
-- Bug fixes:
- - Return same error codes of module-init-tools when removing modules
- with modprobe
- - Fix builtin output in "--show-depends" when target kernel is not the
- same of the running kernel
- - 'modprobe -r' always look at all command line arguments
- - Fix '-q' usage in modprobe
-
-kmod 6
-======
-
-- New API in libkmod:
- - kmod_module_apply_filter(): a generic function to apply filters in a
- list of modules. This deprecates the use of
- kmod_module_get_filtered_blacklist()
-
-- More tests in testsuite
-
-- Add compatibility with uClibc again
-
-- Lookup modules.builtin.bin to decide if a module is built in kernel
-
-- Downgrade some log messages so we don't annoy people with useless messages
-
-- Bug fixes:
- - Flag --ignore-loaded was not being properly handled
- - Infinite loop with softdeps
- - Infinite loop with dumb user configuration with install commands
- - Fix leak in index when there's a partial match
-
-- Move repository and tarballs to kernel.org
-
kmod 5
======
diff --git a/README b/README
index 65499cc..2ce8a2b 100644
--- a/README
+++ b/README
@@ -37,8 +37,7 @@ Hacking
Run 'bootstrap' script before configure. If you want to accept the recommended
flags, you just need to run 'bootstrap-configure'.
-Make sure to read the CODING-STYLE file and the other READMEs: libkmod/README
-and testsuite/README.
+Make sure to read the CODING-STYLE file.
Information
===========
@@ -47,7 +46,7 @@ Signed packages:
http://www.kernel.org/pub/linux/utils/kernel/kmod/
Mailing list:
- linux-modules@vger.kernel.org (no subscription needed)
+ linux-modules@vger.kernel.org
Git:
git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
diff --git a/TODO b/TODO
index e3f81d1..f9e3b55 100644
--- a/TODO
+++ b/TODO
@@ -1,26 +1,21 @@
Features:
=========
-* Add command for signing modules
- - There is a script to sign modules in kernel tree, but we should be able to
- sign modules by ourselves
-
-* Stop using NOFAIL() and fatal()
-
-* Protect index against OOM
-
-* Implement actions in kmod tool like 'insert', 'remove', 'info', etc
-
* testsuite:
+ - when fake init_module() succeeds, create an entry in /sys/module
- when fake delete_module() succeeds, remove its entry from /sys/module
-
-* Stop using system() inside the library and use fork + exec instead
-
-* config: configs that do not need to be matched by fnmatch() could be using a
- vector instead of a list. This way we could search in it by calling
- bsearch().
-
-* review API, maybe unify all of these getters:
+ - add test for dependency loop _with install commands_ relying on module
+ already been loaded in order to succeed. E.g.: alsa install rules on
+ debian:
+
+ install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }
+ install snd_rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
+ install snd_emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }
+ install snd_pcm modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { modprobe --quiet snd-pcm-oss ; : ; }
+ install snd_mixer modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { modprobe --quiet snd-mixer-oss ; : ; }
+ install snd_seq modprobe --ignore-install snd-seq $CMDLINE_OPTS && { modprobe --quiet snd-seq-midi ; modprobe --quiet snd-seq-oss ; : ; }
+
+* review API, maybe unify all of these setters:
- kmod_module_version_get_symbol()
- kmod_module_version_get_crc()
- kmod_module_symbol_get_symbol()
@@ -31,12 +26,14 @@ Features:
- kmod_module_symbols_free_list()
- kmod_module_dependency_symbols_free_list()
-* index: drop the "open(), seek(), read()" implementation and use another one
- with mmap(). When lookup() is called and the file is not mmaped, mmap it.
+* Stop using system() inside the library and use fork + exec instead
-* Finish removal of "rmmod -w" when it's gone from kernel.
+* config: configs that do not need to be matched by fnmatch() could be using a
+ vector instead of a list. This way we could search in it by calling
+ bsearch().
-* Deprecate not using KMOD_REMOVE_NOWAIT on libkmod.
+* index: drop the "open(), seek(), read()" implementation and use another one
+ with mmap(). When lookup() is called and the file is not mmaped, mmap it.
Things to be added/removed in kernel (check what is really needed):
===================================================================
@@ -45,11 +42,12 @@ Things to be added/removed in kernel (check what is really needed):
- readdir() in /sys/modules: dir without a 'initstate' file means the
module is builtin.
+* module's size should be available under /sys
+ - DONE in 3.3: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=cca3e707301862ca9b9327e6a732463982f8cd1b
+
* kill /proc/modules ?
- Unlikely, given other tools might depend on it
-
-
Things that are different from module-init-tools on purpose (!TODO)
===================================================================
diff --git a/bootstrap b/bootstrap
index 5163aa0..6c73d4e 100755
--- a/bootstrap
+++ b/bootstrap
@@ -4,7 +4,7 @@ gtkdocize --docdir libkmod/docs || touch libkmod/docs/gtk-doc.make
autoreconf --install --symlink
libdir() {
- (cd "$1/$(gcc -print-multi-os-directory)"; pwd)
+ echo $(cd $1/$(gcc -print-multi-os-directory); pwd)
}
args="--prefix=/usr \
diff --git a/bootstrap-configure b/bootstrap-configure
index 857745e..2bcd788 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -1,4 +1,4 @@
#!/bin/sh
. ./bootstrap && \
- exec ./configure CFLAGS="-g -O2 -Werror" $args $hackargs "$@"
+ exec ./configure CFLAGS="-g -O2 -Werror" $args $hackargs $*
diff --git a/configure.ac b/configure.ac
index 929eb7f..af70820 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
AC_PREREQ(2.60)
AC_INIT([kmod],
- [13],
+ [5],
[linux-modules@vger.kernel.org],
[kmod],
[http://git.kernel.org/?p=utils/kernel/kmod/kmod.git])
@@ -8,7 +8,7 @@ AC_INIT([kmod],
AC_CONFIG_SRCDIR([libkmod/libkmod.c])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules
- tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
+ tar-pax no-dist-gzip dist-xz subdir-objects color-tests])
AC_PROG_CC_STDC
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
@@ -18,14 +18,6 @@ AM_SILENT_RULES([yes])
LT_INIT([disable-static pic-only])
AC_PREFIX_DEFAULT([/usr])
-AS_IF([test "x$enable_static" = "xyes"],
- [AC_MSG_ERROR([--enable-static is not supported by kmod])])
-
-
-#####################################################################
-# Program checks and configurations
-#####################################################################
-
AC_PROG_CC
AC_PROG_CC_C99
AC_C_TYPEOF
@@ -35,33 +27,33 @@ AC_C_BIGENDIAN
AC_PROG_SED
AC_PROG_MKDIR_P
+AC_PATH_PROG([XSLTPROC], [xsltproc])
PKG_PROG_PKG_CONFIG
-
-#####################################################################
-# Function and structure checks
-#####################################################################
-
AC_CHECK_FUNCS_ONCE(__xstat)
-AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv])
-AC_CHECK_FUNCS_ONCE([finit_module])
-# dietlibc doesn't have st.st_mtim struct member
-AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
-
-# Check kernel headers
-AC_CHECK_HEADERS_ONCE([linux/module.h])
-
-
-#####################################################################
-# --with-
-#####################################################################
+AC_ARG_WITH([rootprefix],
+ AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
+ [], [with_rootprefix=""])
+AC_SUBST([rootprefix], [$with_rootprefix])
AC_ARG_WITH([rootlibdir],
AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
[], [with_rootlibdir=$libdir])
AC_SUBST([rootlibdir], [$with_rootlibdir])
+AC_ARG_ENABLE([tools],
+ AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
+ [], enable_tools=yes)
+AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
+
+AC_ARG_ENABLE([logging],
+ AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
+ [], enable_logging=yes)
+AS_IF([test "x$enable_logging" = "xyes"], [
+ AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
+])
+
AC_ARG_WITH([xz],
AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
[], [with_xz=no])
@@ -82,32 +74,6 @@ AS_IF([test "x$with_zlib" != "xno"], [
AC_MSG_NOTICE([zlib support not requested])
])
-
-#####################################################################
-# --enable-
-#####################################################################
-
-AC_ARG_ENABLE([tools],
- AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
- [], enable_tools=yes)
-AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
-
-AC_ARG_ENABLE([manpages],
- AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]),
- [], enable_manpages=yes)
-AM_CONDITIONAL([BUILD_MANPAGES], [test "x$enable_manpages" = "xyes"])
-AC_PATH_PROG([XSLTPROC], [xsltproc], [no])
-AS_IF([test "x$XSLTPROC" = "xno" && test "x$enable_manpages" = "xyes"], [
- AC_MSG_ERROR([xsltproc command not found, try ./configure --disable-manpages])
-])
-
-AC_ARG_ENABLE([logging],
- AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
- [], enable_logging=yes)
-AS_IF([test "x$enable_logging" = "xyes"], [
- AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
-])
-
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
[], [enable_debug=no])
@@ -115,70 +81,54 @@ AS_IF([test "x$enable_debug" = "xyes"], [
AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
])
-m4_ifdef([GTK_DOC_CHECK], [
-GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
-], [
-AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
-
+# dietlibc doesn't have st.st_mtim struct member
+AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
-#####################################################################
-# Default CFLAGS and LDFLAGS
-#####################################################################
-
-CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
- -pipe \
- -DANOTHER_BRICK_IN_THE \
- -Wall \
- -W \
- -Wextra \
- -Wno-inline \
- -Wvla \
- -Wundef \
- -Wformat=2 \
- -Wlogical-op \
- -Wsign-compare \
- -Wformat-security \
- -Wmissing-include-dirs \
- -Wformat-nonliteral \
- -Wold-style-definition \
- -Wpointer-arith \
- -Winit-self \
- -Wdeclaration-after-statement \
- -Wfloat-equal \
- -Wmissing-prototypes \
- -Wstrict-prototypes \
- -Wredundant-decls \
- -Wmissing-declarations \
- -Wmissing-noreturn \
- -Wshadow \
- -Wendif-labels \
- -Wstrict-aliasing=2 \
- -Wwrite-strings \
- -Wno-long-long \
- -Wno-overlength-strings \
- -Wno-unused-parameter \
- -Wno-missing-field-initializers \
- -Wno-unused-result \
- -Wnested-externs \
- -Wchar-subscripts \
- -Wtype-limits \
- -Wuninitialized \
- -fno-common \
- -fdiagnostics-show-option \
- -fvisibility=hidden \
- -ffunction-sections \
- -fdata-sections])
-AC_SUBST([WARNINGFLAGS], $with_cflags)
-
-
-CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
- -Wl,--as-needed \
- -Wl,--gc-sections])
-AC_SUBST([GCLDFLAGS], $with_ldflags)
-
-#####################################################################
-# Generate files from *.in
-#####################################################################
+CC_CHECK_CFLAGS_APPEND([ \
+ -pipe \
+ -DANOTHER_BRICK_IN_THE \
+ -Wall \
+ -W \
+ -Wextra \
+ -Wno-inline \
+ -Wvla \
+ -Wundef \
+ -Wformat=2 \
+ -Wlogical-op \
+ -Wsign-compare \
+ -Wformat-security \
+ -Wmissing-include-dirs \
+ -Wformat-nonliteral \
+ -Wold-style-definition \
+ -Wpointer-arith \
+ -Winit-self \
+ -Wdeclaration-after-statement \
+ -Wfloat-equal \
+ -Wmissing-prototypes \
+ -Wstrict-prototypes \
+ -Wredundant-decls \
+ -Wmissing-declarations \
+ -Wmissing-noreturn \
+ -Wshadow \
+ -Wendif-labels \
+ -Wstrict-aliasing=2 \
+ -Wwrite-strings \
+ -Wno-long-long \
+ -Wno-overlength-strings \
+ -Wno-unused-parameter \
+ -Wno-missing-field-initializers \
+ -Wno-unused-result \
+ -Wnested-externs \
+ -Wchar-subscripts \
+ -Wtype-limits \
+ -Wuninitialized \
+ -fno-common \
+ -fdiagnostics-show-option \
+ -fvisibility=hidden \
+ -ffunction-sections \
+ -fdata-sections \
+ -Wl,--as-needed \
+ -Wl,--gc-sections])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_FILES([
@@ -188,8 +138,10 @@ AC_CONFIG_FILES([
libkmod/docs/version.xml
])
-
-#####################################################################
+m4_ifdef([GTK_DOC_CHECK], [
+GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
+], [
+AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
AC_OUTPUT
AC_MSG_RESULT([
@@ -197,6 +149,7 @@ AC_MSG_RESULT([
======
prefix: ${prefix}
+ rootprefix: ${rootprefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
rootlibdir: ${rootlibdir}
@@ -204,13 +157,12 @@ AC_MSG_RESULT([
bindir: ${bindir}
compiler: ${CC}
- cflags: ${with_cflags} ${CFLAGS}
- ldflags: ${with_ldflags} ${LDFLAGS}
+ cflags: ${CFLAGS}
+ ldflags: ${LDFLAGS}
tools: ${enable_tools}
logging: ${enable_logging}
compression: xz=${with_xz} zlib=${with_zlib}
debug: ${enable_debug}
doc: ${enable_gtk_doc}
- man: ${enable_manpages}
])
diff --git a/libkmod/docs/libkmod-docs.xml b/libkmod/docs/libkmod-docs.xml
index fd17506..8a8f139 100644
--- a/libkmod/docs/libkmod-docs.xml
+++ b/libkmod/docs/libkmod-docs.xml
@@ -3,7 +3,6 @@
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
- <!ENTITY version SYSTEM "version.xml">
]>
<book id="index">
<bookinfo>
@@ -18,10 +17,20 @@
<xi:include href="xml/libkmod-config.xml"/>
<xi:include href="xml/libkmod-module.xml"/>
<xi:include href="xml/libkmod-loaded.xml"/>
- </chapter>
+ </chapter>
+ <chapter id="object-tree">
+ <title>Object Hierarchy</title>
+ <xi:include href="xml/tree_index.sgml"/>
+ </chapter>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
+ <index id="deprecated-api-index" role="deprecated">
+ <title>Index of deprecated API</title>
+ <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
+ </index>
+
+ <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>
diff --git a/libkmod/docs/libkmod-sections.txt b/libkmod/docs/libkmod-sections.txt
index e59ab7a..1a5a5fd 100644
--- a/libkmod/docs/libkmod-sections.txt
+++ b/libkmod/docs/libkmod-sections.txt
@@ -60,7 +60,6 @@ kmod_module_remove_module
kmod_module_get_module
kmod_module_get_dependencies
kmod_module_get_softdeps
-kmod_module_apply_filter
kmod_module_get_filtered_blacklist
kmod_module_get_install_commands
kmod_module_get_remove_commands
diff --git a/libkmod/libkmod-array.c b/libkmod/libkmod-array.c
index 8417f9a..f9ca5cf 100644
--- a/libkmod/libkmod-array.c
+++ b/libkmod/libkmod-array.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libkmod/libkmod-array.h b/libkmod/libkmod-array.h
index dd2ba55..6400993 100644
--- a/libkmod/libkmod-array.h
+++ b/libkmod/libkmod-array.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef _LIBKMOD_ARRAY_H_
+#define _LIBKMOD_ARRAY_H_
/*
* Declaration of struct array is in header because we may want to embed the
@@ -18,3 +19,5 @@ void array_pop(struct array *array);
void array_free_array(struct array *array);
void array_sort(struct array *array, int (*cmp)(const void *a, const void *b));
int array_remove_at(struct array *array, unsigned int pos);
+
+#endif
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 11b1f3d..f2ad4b4 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -108,37 +108,6 @@ const char * const *kmod_softdep_get_post(const struct kmod_list *l, unsigned in
return dep->post;
}
-/*
- * Replace dashes with underscores.
- * Dashes inside character range patterns (e.g. [0-9]) are left unchanged.
- */
-static char *underscores(struct kmod_ctx *ctx, char *s)
-{
- unsigned int i;
-
- if (!s)
- return NULL;
-
- for (i = 0; s[i]; i++) {
- switch (s[i]) {
- case '-':
- s[i] = '_';
- break;
-
- case ']':
- INFO(ctx, "Unmatched bracket in %s\n", s);
- break;
-
- case '[':
- i += strcspn(&s[i], "]");
- if (!s[i])
- INFO(ctx, "Unmatched bracket in %s\n", s);
- break;
- }
- }
- return s;
-}
-
static int kmod_config_add_command(struct kmod_config *config,
const char *modname,
const char *command,
@@ -567,10 +536,8 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
modname = p + 1;
break;
case '.':
- if (param == NULL) {
- *p = '\0';
- param = p + 1;
- }
+ *p = '\0';
+ param = p + 1;
break;
case '=':
if (param != NULL)
@@ -977,7 +944,6 @@ static struct kmod_config_iter *kmod_config_iter_new(const struct kmod_ctx* ctx,
enum config_type type)
{
struct kmod_config_iter *iter = calloc(1, sizeof(*iter));
- const struct kmod_config *config = kmod_get_config(ctx);
if (iter == NULL)
return NULL;
@@ -986,31 +952,31 @@ static struct kmod_config_iter *kmod_config_iter_new(const struct kmod_ctx* ctx,
switch (type) {
case CONFIG_TYPE_BLACKLIST:
- iter->list = config->blacklists;
+ iter->list = kmod_get_blacklists(ctx);
iter->get_key = kmod_blacklist_get_modname;
break;
case CONFIG_TYPE_INSTALL:
- iter->list = config->install_commands;
+ iter->list = kmod_get_install_commands(ctx);
iter->get_key = kmod_command_get_modname;
iter->get_value = kmod_command_get_command;
break;
case CONFIG_TYPE_REMOVE:
- iter->list = config->remove_commands;
+ iter->list = kmod_get_remove_commands(ctx);
iter->get_key = kmod_command_get_modname;
iter->get_value = kmod_command_get_command;
break;
case CONFIG_TYPE_ALIAS:
- iter->list = config->aliases;
+ iter->list = kmod_get_aliases(ctx);
iter->get_key = kmod_alias_get_name;
iter->get_value = kmod_alias_get_modname;
break;
case CONFIG_TYPE_OPTION:
- iter->list = config->options;
+ iter->list = kmod_get_options(ctx);
iter->get_key = kmod_option_get_modname;
iter->get_value = kmod_option_get_options;
break;
case CONFIG_TYPE_SOFTDEP:
- iter->list = config->softdeps;
+ iter->list = kmod_get_softdeps(ctx);
iter->get_key = kmod_softdep_get_name;
iter->get_value = softdep_get_plain_softdep;
iter->intermediate = true;
@@ -1034,7 +1000,7 @@ static struct kmod_config_iter *kmod_config_iter_new(const struct kmod_ctx* ctx,
* kmod_config_iter_next(). At least one call to kmod_config_iter_next() must
* be made to initialize the iterator and check if it's valid.
*
- * Returns: a new iterator over the blacklists or NULL on failure. Free it
+ * Returns: a new iterator over the blacklists or %NULL on failure. Free it
* with kmod_config_iter_free_iter().
*/
KMOD_EXPORT struct kmod_config_iter *kmod_config_get_blacklists(const struct kmod_ctx *ctx)
@@ -1054,7 +1020,7 @@ KMOD_EXPORT struct kmod_config_iter *kmod_config_get_blacklists(const struct kmo
* kmod_config_iter_next(). At least one call to kmod_config_iter_next() must
* be made to initialize the iterator and check if it's valid.
*
- * Returns: a new iterator over the install commands or NULL on failure. Free
+ * Returns: a new iterator over the install commands or %NULL on failure. Free
* it with kmod_config_iter_free_iter().
*/
KMOD_EXPORT struct kmod_config_iter *kmod_config_get_install_commands(const struct kmod_ctx *ctx)
@@ -1074,7 +1040,7 @@ KMOD_EXPORT struct kmod_config_iter *kmod_config_get_install_commands(const stru
* kmod_config_iter_next(). At least one call to kmod_config_iter_next() must
* be made to initialize the iterator and check if it's valid.
*
- * Returns: a new iterator over the remove commands or NULL on failure. Free
+ * Returns: a new iterator over the remove commands or %NULL on failure. Free
* it with kmod_config_iter_free_iter().
*/
KMOD_EXPORT struct kmod_config_iter *kmod_config_get_remove_commands(const struct kmod_ctx *ctx)
@@ -1094,7 +1060,7 @@ KMOD_EXPORT struct kmod_config_iter *kmod_config_get_remove_commands(const struc
* kmod_config_iter_next(). At least one call to kmod_config_iter_next() must
* be made to initialize the iterator and check if it's valid.
*
- * Returns: a new iterator over the aliases or NULL on failure. Free it with
+ * Returns: a new iterator over the aliases or %NULL on failure. Free it with
* kmod_config_iter_free_iter().
*/
KMOD_EXPORT struct kmod_config_iter *kmod_config_get_aliases(const struct kmod_ctx *ctx)
@@ -1114,7 +1080,7 @@ KMOD_EXPORT struct kmod_config_iter *kmod_config_get_aliases(const struct kmod_c
* kmod_config_iter_next(). At least one call to kmod_config_iter_next() must
* be made to initialize the iterator and check if it's valid.
*
- * Returns: a new iterator over the options or NULL on failure. Free it with
+ * Returns: a new iterator over the options or %NULL on failure. Free it with
* kmod_config_iter_free_iter().
*/
KMOD_EXPORT struct kmod_config_iter *kmod_config_get_options(const struct kmod_ctx *ctx)
@@ -1134,7 +1100,7 @@ KMOD_EXPORT struct kmod_config_iter *kmod_config_get_options(const struct kmod_c
* kmod_config_iter_next(). At least one call to kmod_config_iter_next() must
* be made to initialize the iterator and check if it's valid.
*
- * Returns: a new iterator over the softdeps or NULL on failure. Free it with
+ * Returns: a new iterator over the softdeps or %NULL on failure. Free it with
* kmod_config_iter_free_iter().
*/
KMOD_EXPORT struct kmod_config_iter *kmod_config_get_softdeps(const struct kmod_ctx *ctx)
diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c
index 7207ac2..1f47e07 100644
--- a/libkmod/libkmod-elf.c
+++ b/libkmod/libkmod-elf.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -243,12 +243,12 @@ static inline int elf_get_section_info(const struct kmod_elf *elf, uint16_t idx,
elf_get_uint(elf, off + offsetof(typeof(*hdr), field), sizeof(hdr->field))
if (elf->class & KMOD_ELF_32) {
- const Elf32_Shdr *hdr _unused_ = (const Elf32_Shdr *)p;
+ const Elf32_Shdr *hdr = (const Elf32_Shdr *)p;
*size = READV(sh_size);
*offset = READV(sh_offset);
*nameoff = READV(sh_name);
} else {
- const Elf64_Shdr *hdr _unused_ = (const Elf64_Shdr *)p;
+ const Elf64_Shdr *hdr = (const Elf64_Shdr *)p;
*size = READV(sh_size);
*offset = READV(sh_offset);
*nameoff = READV(sh_name);
@@ -280,10 +280,10 @@ struct kmod_elf *kmod_elf_new(const void *memory, off_t size)
size_t hdr_size, shdr_size, min_size;
int class;
- assert_cc(sizeof(uint16_t) == sizeof(Elf32_Half));
- assert_cc(sizeof(uint16_t) == sizeof(Elf64_Half));
- assert_cc(sizeof(uint32_t) == sizeof(Elf32_Word));
- assert_cc(sizeof(uint32_t) == sizeof(Elf64_Word));
+ assert(sizeof(uint16_t) == sizeof(Elf32_Half));
+ assert(sizeof(uint16_t) == sizeof(Elf64_Half));
+ assert(sizeof(uint32_t) == sizeof(Elf32_Word));
+ assert(sizeof(uint32_t) == sizeof(Elf64_Word));
class = elf_identify(memory, size);
if (class < 0) {
@@ -311,12 +311,12 @@ struct kmod_elf *kmod_elf_new(const void *memory, off_t size)
elf->header.strings.section = READV(e_shstrndx); \
elf->header.machine = READV(e_machine)
if (elf->class & KMOD_ELF_32) {
- const Elf32_Ehdr *hdr _unused_ = elf_get_mem(elf, 0);
+ const Elf32_Ehdr *hdr = elf_get_mem(elf, 0);
LOAD_HEADER;
hdr_size = sizeof(Elf32_Ehdr);
shdr_size = sizeof(Elf32_Shdr);
} else {
- const Elf64_Ehdr *hdr _unused_ = elf_get_mem(elf, 0);
+ const Elf64_Ehdr *hdr = elf_get_mem(elf, 0);
LOAD_HEADER;
hdr_size = sizeof(Elf64_Ehdr);
shdr_size = sizeof(Elf64_Shdr);
@@ -375,31 +375,6 @@ const void *kmod_elf_get_memory(const struct kmod_elf *elf)
return elf->memory;
}
-static int elf_find_section(const struct kmod_elf *elf, const char *section)
-{
- uint64_t nameslen;
- const char *names = elf_get_strings_section(elf, &nameslen);
- uint16_t i;
-
- for (i = 1; i < elf->header.section.count; i++) {
- uint64_t off, size;
- uint32_t nameoff;
- const char *n;
- int err = elf_get_section_info(elf, i, &off, &size, &nameoff);
- if (err < 0)
- continue;
- if (nameoff >= nameslen)
- continue;
- n = names + nameoff;
- if (!streq(section, n))
- continue;
-
- return i;
- }
-
- return -ENOENT;
-}
-
int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const void **buf, uint64_t *buf_size)
{
uint64_t nameslen;
@@ -513,7 +488,7 @@ int kmod_elf_get_modversions(const struct kmod_elf *elf, struct kmod_modversion
int i, count, err;
#define MODVERSION_SEC_SIZE (sizeof(struct kmod_modversion64))
- assert_cc(sizeof(struct kmod_modversion64) ==
+ assert(sizeof(struct kmod_modversion64) ==
sizeof(struct kmod_modversion32));
if (elf->class == KMOD_ELF_32)
@@ -575,29 +550,26 @@ int kmod_elf_get_modversions(const struct kmod_elf *elf, struct kmod_modversion
int kmod_elf_strip_section(struct kmod_elf *elf, const char *section)
{
- uint64_t off, size;
+ uint64_t size, off;
const void *buf;
- int idx = elf_find_section(elf, section);
- uint64_t val;
-
- if (idx < 0)
- return idx;
+ int err = kmod_elf_get_section(elf, section, &buf, &size);
+ if (err < 0)
+ return err;
- buf = elf_get_section_header(elf, idx);
off = (const uint8_t *)buf - elf->memory;
+#define WRITEV(field, value) \
+ elf_set_uint(elf, off + offsetof(typeof(*hdr), field), sizeof(hdr->field), value)
if (elf->class & KMOD_ELF_32) {
- off += offsetof(Elf32_Shdr, sh_flags);
- size = sizeof(((Elf32_Shdr *)buf)->sh_flags);
+ const Elf32_Shdr *hdr = buf;
+ uint32_t val = ~(uint32_t)SHF_ALLOC;
+ return WRITEV(sh_flags, val);
} else {
- off += offsetof(Elf64_Shdr, sh_flags);
- size = sizeof(((Elf64_Shdr *)buf)->sh_flags);
+ const Elf64_Shdr *hdr = buf;
+ uint64_t val = ~(uint64_t)SHF_ALLOC;
+ return WRITEV(sh_flags, val);
}
-
- val = elf_get_uint(elf, off, size);
- val &= ~(uint64_t)SHF_ALLOC;
-
- return elf_set_uint(elf, off, size, val);
+#undef WRITEV
}
int kmod_elf_strip_vermagic(struct kmod_elf *elf)
@@ -639,6 +611,7 @@ int kmod_elf_strip_vermagic(struct kmod_elf *elf)
i += strlen(s);
continue;
}
+ s += len;
off = (const uint8_t *)s - elf->memory;
if (elf->changed == NULL) {
@@ -732,6 +705,7 @@ static int kmod_elf_get_symbols_symtab(const struct kmod_elf *elf, struct kmod_m
a[count].symbol = itr;
memcpy(itr, strings + last, slen);
itr[slen] = '\0';
+ itr += slen + 1;
count++;
}
diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c
index 5313796..46ad8d9 100644
--- a/libkmod/libkmod-file.c
+++ b/libkmod/libkmod-file.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -52,12 +52,10 @@ struct kmod_file {
gzFile gzf;
#endif
int fd;
- bool direct;
off_t size;
void *memory;
const struct file_ops *ops;
const struct kmod_ctx *ctx;
- struct kmod_elf *elf;
};
#ifdef ENABLE_XZ
@@ -201,13 +199,7 @@ static int load_zlib(struct kmod_file *file)
if (r == 0)
break;
else if (r < 0) {
- int gzerr;
- const char *gz_errmsg = gzerror(file->gzf, &gzerr);
-
- ERR(file->ctx, "gzip: %s\n", gz_errmsg);
-
- /* gzip might not set errno here */
- err = gzerr == Z_ERRNO ? -errno : -EINVAL;
+ err = -errno;
goto error;
}
did += r;
@@ -255,11 +247,9 @@ static int load_reg(struct kmod_file *file)
return -errno;
file->size = st.st_size;
- file->memory = mmap(NULL, file->size, PROT_READ, MAP_PRIVATE,
- file->fd, 0);
+ file->memory = mmap(0, file->size, PROT_READ, MAP_PRIVATE, file->fd, 0);
if (file->memory == MAP_FAILED)
return -errno;
- file->direct = true;
return 0;
}
@@ -272,15 +262,6 @@ static const struct file_ops reg_ops = {
load_reg, unload_reg
};
-struct kmod_elf *kmod_file_get_elf(struct kmod_file *file)
-{
- if (file->elf)
- return file->elf;
-
- file->elf = kmod_elf_new(file->memory, file->size);
- return file->elf;
-}
-
struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx,
const char *filename)
{
@@ -303,7 +284,6 @@ struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx,
magic_size_max = itr->magic_size;
}
- file->direct = false;
if (magic_size_max > 0) {
char *buf = alloca(magic_size_max + 1);
ssize_t sz;
@@ -357,21 +337,8 @@ off_t kmod_file_get_size(const struct kmod_file *file)
return file->size;
}
-bool kmod_file_get_direct(const struct kmod_file *file)
-{
- return file->direct;
-}
-
-int kmod_file_get_fd(const struct kmod_file *file)
-{
- return file->fd;
-}
-
void kmod_file_unref(struct kmod_file *file)
{
- if (file->elf)
- kmod_elf_unref(file->elf);
-
file->ops->unload(file);
if (file->fd >= 0)
close(file->fd);
diff --git a/libkmod/libkmod-hash.c b/libkmod/libkmod-hash.c
index 57f475c..3a6c8bf 100644
--- a/libkmod/libkmod-hash.c
+++ b/libkmod/libkmod-hash.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,6 @@
#include "libkmod.h"
#include "libkmod-hash.h"
-#include "libkmod-util.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@@ -84,6 +83,15 @@ void hash_free(struct hash *hash)
free(hash);
}
+struct unaligned_short {
+ unsigned short v;
+} __attribute__((packed));
+
+static inline unsigned short get16bits(const char *ptr)
+{
+ return ((struct unaligned_short *)ptr)->v;
+}
+
static inline unsigned int hash_superfast(const char *key, unsigned int len)
{
/* Paul Hsieh (http://www.azillionmonkeys.com/qed/hash.html)
@@ -96,8 +104,8 @@ static inline unsigned int hash_superfast(const char *key, unsigned int len)
/* Main loop */
for (; len > 0; len--) {
- hash += get_unaligned((uint16_t *) key);
- tmp = (get_unaligned((uint16_t *)(key + 2)) << 11) ^ hash;
+ hash += get16bits(key);
+ tmp = (get16bits(key + 2) << 11) ^ hash;
hash = (hash << 16) ^ tmp;
key += 4;
hash += hash >> 11;
@@ -106,14 +114,14 @@ static inline unsigned int hash_superfast(const char *key, unsigned int len)
/* Handle end cases */
switch (rem) {
case 3:
- hash += get_unaligned((uint16_t *) key);
+ hash += get16bits(key);
hash ^= hash << 16;
hash ^= key[2] << 18;
hash += hash >> 11;
break;
case 2:
- hash += get_unaligned((uint16_t *) key);
+ hash += get16bits(key);
hash ^= hash << 11;
hash += hash >> 17;
break;
@@ -164,8 +172,7 @@ int hash_add(struct hash *hash, const char *key, const void *value)
for (; entry < entry_end; entry++) {
int c = strcmp(key, entry->key);
if (c == 0) {
- if (hash->free_value)
- hash->free_value((void *)entry->value);
+ hash->free_value((void *)entry->value);
entry->value = value;
return 0;
} else if (c < 0) {
@@ -264,9 +271,6 @@ int hash_del(struct hash *hash, const char *key)
if (entry == NULL)
return -ENOENT;
- if (hash->free_value)
- hash->free_value((void *)entry->value);
-
entry_end = bucket->entries + bucket->used;
memmove(entry, entry + 1,
(entry_end - entry) * sizeof(struct hash_entry));
diff --git a/libkmod/libkmod-hash.h b/libkmod/libkmod-hash.h
index ca0af05..8f20b8f 100644
--- a/libkmod/libkmod-hash.h
+++ b/libkmod/libkmod-hash.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef _LIBKMOD_HASH_H_
+#define _LIBKMOD_HASH_H_
#include <stdbool.h>
@@ -20,3 +21,5 @@ unsigned int hash_get_count(const struct hash *hash);
void hash_iter_init(const struct hash *hash, struct hash_iter *iter);
bool hash_iter_next(struct hash_iter *iter, const char **key,
const void **value);
+
+#endif
diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c
index 0f94059..2a5a26e 100644
--- a/libkmod/libkmod-index.c
+++ b/libkmod/libkmod-index.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -25,7 +25,6 @@
#include <errno.h>
#include <fnmatch.h>
#include <assert.h>
-#include <inttypes.h>
#include "libkmod-private.h"
#include "libkmod-index.h"
@@ -432,12 +431,9 @@ void index_dump(struct index_file *in, int fd, const char *prefix)
struct index_node_f *root;
struct buffer buf;
- root = index_readroot(in);
- if (root == NULL)
- return;
-
buf_init(&buf);
buf_pushchars(&buf, prefix);
+ root = index_readroot(in);
index_dump_node(root, &buf, fd);
buf_release(&buf);
}
@@ -462,12 +458,13 @@ static char *index_search__node(struct index_node_f *node, const char *key, int
i += j;
if (key[i] == '\0') {
- value = node->values != NULL
- ? strdup(node->values[0].value)
- : NULL;
-
- index_close(node);
- return value;
+ if (node->values) {
+ value = strdup(node->values[0].value);
+ index_close(node);
+ return value;
+ } else {
+ return NULL;
+ }
}
child = index_readchild(node, key[i]);
@@ -488,7 +485,6 @@ static char *index_search__node(struct index_node_f *node, const char *key, int
*/
char *index_search(struct index_file *in, const char *key)
{
-// FIXME: return value by reference instead of strdup
struct index_node_f *root;
char *value;
@@ -678,7 +674,7 @@ static inline uint32_t read_long_mm(void **p)
uint32_t v;
/* addr may be unalined to uint32_t */
- v = get_unaligned((uint32_t *) addr);
+ memcpy(&v, addr, sizeof(uint32_t));
*p = addr + sizeof(uint32_t);
return ntohl(v);
@@ -775,9 +771,10 @@ static void index_mm_free_node(struct index_mm_node *node)
}
struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
- unsigned long long *stamp)
+ bool populate, unsigned long long *stamp)
{
int fd;
+ int flags;
struct stat st;
struct index_mm *idx;
struct {
@@ -801,14 +798,15 @@ struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
}
fstat(fd, &st);
- if ((size_t) st.st_size < sizeof(hdr))
- goto fail_nommap;
+ flags = MAP_PRIVATE;
+ if (populate)
+ flags |= MAP_POPULATE;
- if ((idx->mm = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0))
+ if ((idx->mm = mmap(0, st.st_size, PROT_READ, flags, fd, 0))
== MAP_FAILED) {
- ERR(ctx, "mmap(NULL, %"PRIu64", PROT_READ, %d, MAP_PRIVATE, 0): %m\n",
- st.st_size, fd);
- goto fail_nommap;
+ ERR(ctx, "mmap(0, %zd, PROT_READ, %d, %d, 0): %m\n",
+ (size_t)st.st_size, flags, fd);
+ goto fail;
}
p = idx->mm;
@@ -838,9 +836,9 @@ struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
return idx;
fail:
- munmap(idx->mm, st.st_size);
-fail_nommap:
close(fd);
+ if (idx->mm != MAP_FAILED)
+ munmap(idx->mm, st.st_size);
fail_open:
free(idx);
return NULL;
@@ -905,12 +903,9 @@ void index_mm_dump(struct index_mm *idx, int fd, const char *prefix)
struct index_mm_node *root;
struct buffer buf;
- root = index_mm_readroot(idx);
- if (root == NULL)
- return;
-
buf_init(&buf);
buf_pushchars(&buf, prefix);
+ root = index_mm_readroot(idx);
index_mm_dump_node(root, &buf, fd);
buf_release(&buf);
}
@@ -936,12 +931,13 @@ static char *index_mm_search_node(struct index_mm_node *node, const char *key,
i += j;
if (key[i] == '\0') {
- value = node->values.len > 0
- ? strdup(node->values.values[0].value)
- : NULL;
-
- index_mm_free_node(node);
- return value;
+ if (node->values.len > 0) {
+ value = strdup(node->values.values[0].value);
+ index_mm_free_node(node);
+ return value;
+ } else {
+ return NULL;
+ }
}
child = index_mm_readchild(node, key[i]);
@@ -962,7 +958,6 @@ static char *index_mm_search_node(struct index_mm_node *node, const char *key,
*/
char *index_mm_search(struct index_mm *idx, const char *key)
{
-// FIXME: return value by reference instead of strdup
struct index_mm_node *root;
char *value;
diff --git a/libkmod/libkmod-index.h b/libkmod/libkmod-index.h
index ad63e15..0134ac5 100644
--- a/libkmod/libkmod-index.h
+++ b/libkmod/libkmod-index.h
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#pragma once
+#ifndef _LIBKMOD_INDEX_H
+#define _LIBKMOD_INDEX_H
#include <stdint.h>
@@ -121,8 +122,10 @@ void index_values_free(struct index_value *values);
/* Implementation using mmap */
struct index_mm;
struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
- unsigned long long *stamp);
+ bool populate, unsigned long long *stamp);
void index_mm_close(struct index_mm *index);
char *index_mm_search(struct index_mm *idx, const char *key);
struct index_value *index_mm_searchwild(struct index_mm *idx, const char *key);
void index_mm_dump(struct index_mm *idx, int fd, const char *prefix);
+
+#endif
diff --git a/libkmod/libkmod-list.c b/libkmod/libkmod-list.c
index 54c994c..982c4ab 100644
--- a/libkmod/libkmod-list.c
+++ b/libkmod/libkmod-list.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index cc2c076..9f33531 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,15 +33,10 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
-#include <sys/syscall.h>
#include <sys/wait.h>
#include <string.h>
#include <fnmatch.h>
-#ifdef HAVE_LINUX_MODULE_H
-#include <linux/module.h>
-#endif
-
#include "libkmod.h"
#include "libkmod-private.h"
@@ -65,7 +60,6 @@ struct kmod_module {
const char *install_commands; /* owned by kmod_config */
const char *remove_commands; /* owned by kmod_config */
char *alias; /* only set if this module was created from an alias */
- struct kmod_file *file;
int n_dep;
int refcount;
struct {
@@ -442,10 +436,6 @@ KMOD_EXPORT struct kmod_module *kmod_module_unref(struct kmod_module *mod)
kmod_pool_del_module(mod->ctx, mod, mod->hashkey);
kmod_module_unref_list(mod->dep);
-
- if (mod->file)
- kmod_file_unref(mod->file);
-
kmod_unref(mod->ctx);
free(mod->options);
free(mod->path);
@@ -570,7 +560,8 @@ fail:
* Drop a reference of each kmod module in @list and releases the resources
* taken by the list itself.
*
- * Returns: 0
+ * Returns: NULL if @mod is NULL or if the module was released. Otherwise it
+ * returns the passed @mod with its refcount decremented.
*/
KMOD_EXPORT int kmod_module_unref_list(struct kmod_list *list)
{
@@ -586,7 +577,7 @@ KMOD_EXPORT int kmod_module_unref_list(struct kmod_list *list)
* @input: list of kmod_module to be filtered with blacklist
* @output: where to save the new list
*
- * This function should not be used. Use kmod_module_apply_filter instead.
+ * Deprecated: use kmod_module_apply_filter instead.
*
* Given a list @input, this function filter it out with config's blacklist
* and save it in @output.
@@ -628,8 +619,9 @@ static const struct kmod_list *module_get_dependencies_noref(const struct kmod_m
* The result is cached in @mod, so subsequent calls to this function will
* return the already searched list of modules.
*
- * Returns: NULL on failure. Otherwise it returns a list of kmod modules
- * that can be released by calling kmod_module_unref_list().
+ * Returns: NULL on failure or if there are any dependencies. Otherwise it
+ * returns a list of kmod modules that can be released by calling
+ * kmod_module_unref_list().
*/
KMOD_EXPORT struct kmod_list *kmod_module_get_dependencies(const struct kmod_module *mod)
{
@@ -738,15 +730,7 @@ extern long delete_module(const char *name, unsigned int flags);
/**
* kmod_module_remove_module:
* @mod: kmod module
- * @flags: flags to pass to Linux kernel when removing the module, valid flags are
- * KMOD_REMOVE_FORCE: force remove module regardless if it's still in
- * use by a kernel subsystem or other process;
- * KMOD_REMOVE_NOWAIT: return immediately. It will fail if the module
- * is in using and KMOD_REMOVE_FORCE is not specified.
- * If this module is in use by any kernel subsystem or process, not using
- * this flag will cause the call to block indefinitely, until the module
- * is not in use anymore. Always use this flag, it's deprecated not using
- * it and the default behavior might change in future to always set it.
+ * @flags: flags to pass to Linux kernel when removing the module
*
* Remove a module from Linux kernel.
*
@@ -778,9 +762,7 @@ extern long init_module(const void *mem, unsigned long len, const char *args);
* kmod_module_insert_module:
* @mod: kmod module
* @flags: flags are not passed to Linux Kernel, but instead they dictate the
- * behavior of this function, valid flags are
- * KMOD_INSERT_FORCE_VERMAGIC: ignore kernel version magic;
- * KMOD_INSERT_FORCE_MODVERSION: ignore symbol version hashes.
+ * behavior of this function.
* @options: module's options to pass to Linux Kernel.
*
* Insert a module in Linux kernel. It opens the file pointed by @mod,
@@ -816,19 +798,6 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
return err;
}
- if (kmod_file_get_direct(file)) {
- unsigned int kernel_flags = 0;
-
- if (flags & KMOD_INSERT_FORCE_VERMAGIC)
- kernel_flags |= MODULE_INIT_IGNORE_VERMAGIC;
- if (flags & KMOD_INSERT_FORCE_MODVERSION)
- kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS;
-
- err = finit_module(kmod_file_get_fd(file), args, kernel_flags);
- if (err == 0 || errno != ENOSYS)
- goto init_finished;
- }
-
size = kmod_file_get_size(file);
mem = kmod_file_get_contents(file);
@@ -855,7 +824,6 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
}
err = init_module(mem, size, args);
-init_finished:
if (err < 0) {
err = -errno;
INFO(mod->ctx, "Failed to insert module '%s': %m\n", path);
@@ -872,8 +840,7 @@ elf_failed:
static bool module_is_blacklisted(struct kmod_module *mod)
{
struct kmod_ctx *ctx = mod->ctx;
- const struct kmod_config *config = kmod_get_config(ctx);
- const struct kmod_list *bl = config->blacklists;
+ const struct kmod_list *bl = kmod_get_blacklists(ctx);
const struct kmod_list *l;
kmod_list_foreach(l, bl) {
@@ -889,9 +856,7 @@ static bool module_is_blacklisted(struct kmod_module *mod)
/**
* kmod_module_apply_filter
* @ctx: kmod library context
- * @filter_type: bitmask to filter modules out, valid types are
- * KMOD_FILTER_BLACKLIST: filter modules in blacklist out;
- * KMOD_FILTER_BUILTIN: filter builtin modules out.
+ * @filter_type: bitmask to filter modules on
* @input: list of kmod_module to be filtered
* @output: where to save the new list
*
@@ -923,7 +888,8 @@ KMOD_EXPORT int kmod_module_apply_filter(const struct kmod_ctx *ctx,
module_is_blacklisted(mod))
continue;
- if ((filter_type & KMOD_FILTER_BUILTIN) && mod->builtin)
+ if ((filter_type & KMOD_FILTER_BUILTIN) &&
+ kmod_module_get_initstate(mod) == KMOD_MODULE_BUILTIN)
continue;
node = kmod_list_append(*output, mod);
@@ -1162,25 +1128,7 @@ static int kmod_module_get_probe_list(struct kmod_module *mod,
* kmod_module_probe_insert_module:
* @mod: kmod module
* @flags: flags are not passed to Linux Kernel, but instead they dictate the
- * behavior of this function, valid flags are
- * KMOD_PROBE_FORCE_VERMAGIC: ignore kernel version magic;
- * KMOD_PROBE_FORCE_MODVERSION: ignore symbol version hashes;
- * KMOD_PROBE_IGNORE_COMMAND: whether the probe should ignore install
- * commands and softdeps configured in the system;
- * KMOD_PROBE_IGNORE_LOADED: do not check whether the module is already
- * live in kernel or not;
- * KMOD_PROBE_DRY_RUN: dry run, do not insert module, just call the
- * associated callback function;
- * KMOD_PROBE_FAIL_ON_LOADED: if KMOD_PROBE_IGNORE_LOADED is not specified
- * and the module is already live in kernel, the function will fail if this
- * flag is specified;
- * KMOD_PROBE_APPLY_BLACKLIST_ALL: probe will apply KMOD_FILTER_BLACKLIST
- * filter to this module and its dependencies. If any of the dependencies (or
- * the module) is blacklisted, the probe will fail, unless the blacklisted
- * module is already live in kernel;
- * KMOD_PROBE_APPLY_BLACKLIST: probe will fail if the module is blacklisted;
- * KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY: probe will fail if the module is an
- * alias and is blacklisted.
+ * behavior of this function.
* @extra_options: module's options to pass to Linux Kernel. It applies only
* to @mod, not to its dependencies.
* @run_install: function to run when @mod is backed by an install command.
@@ -1224,15 +1172,9 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
return 0;
}
- /*
- * Ugly assignement + check. We need to check if we were told to check
- * blacklist and also return the reason why we failed.
- * KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY will take effect only if the
- * module is an alias, so we also need to check it
- */
- if ((mod->alias != NULL && ((err = flags & KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY)))
- || (err = flags & KMOD_PROBE_APPLY_BLACKLIST_ALL)
- || (err = flags & KMOD_PROBE_APPLY_BLACKLIST)) {
+ err = flags & (KMOD_PROBE_APPLY_BLACKLIST |
+ KMOD_PROBE_APPLY_BLACKLIST_ALL);
+ if (err != 0) {
if (module_is_blacklisted(mod))
return err;
}
@@ -1339,14 +1281,13 @@ KMOD_EXPORT const char *kmod_module_get_options(const struct kmod_module *mod)
if (!mod->init.options) {
/* lazy init */
struct kmod_module *m = (struct kmod_module *)mod;
- const struct kmod_list *l;
- const struct kmod_config *config;
+ const struct kmod_list *l, *ctx_options;
char *opts = NULL;
size_t optslen = 0;
- config = kmod_get_config(mod->ctx);
+ ctx_options = kmod_get_options(mod->ctx);
- kmod_list_foreach(l, config->options) {
+ kmod_list_foreach(l, ctx_options) {
const char *modname = kmod_option_get_modname(l);
const char *str;
size_t len;
@@ -1414,12 +1355,11 @@ KMOD_EXPORT const char *kmod_module_get_install_commands(const struct kmod_modul
if (!mod->init.install_commands) {
/* lazy init */
struct kmod_module *m = (struct kmod_module *)mod;
- const struct kmod_list *l;
- const struct kmod_config *config;
+ const struct kmod_list *l, *ctx_install_commands;
- config = kmod_get_config(mod->ctx);
+ ctx_install_commands = kmod_get_install_commands(mod->ctx);
- kmod_list_foreach(l, config->install_commands) {
+ kmod_list_foreach(l, ctx_install_commands) {
const char *modname = kmod_command_get_modname(l);
if (fnmatch(modname, mod->name, 0) != 0)
@@ -1487,8 +1427,7 @@ KMOD_EXPORT int kmod_module_get_softdeps(const struct kmod_module *mod,
struct kmod_list **pre,
struct kmod_list **post)
{
- const struct kmod_list *l;
- const struct kmod_config *config;
+ const struct kmod_list *l, *ctx_softdeps;
if (mod == NULL || pre == NULL || post == NULL)
return -ENOENT;
@@ -1496,9 +1435,9 @@ KMOD_EXPORT int kmod_module_get_softdeps(const struct kmod_module *mod,
assert(*pre == NULL);
assert(*post == NULL);
- config = kmod_get_config(mod->ctx);
+ ctx_softdeps = kmod_get_softdeps(mod->ctx);
- kmod_list_foreach(l, config->softdeps) {
+ kmod_list_foreach(l, ctx_softdeps) {
const char *modname = kmod_softdep_get_name(l);
const char * const *array;
unsigned count;
@@ -1543,12 +1482,11 @@ KMOD_EXPORT const char *kmod_module_get_remove_commands(const struct kmod_module
if (!mod->init.remove_commands) {
/* lazy init */
struct kmod_module *m = (struct kmod_module *)mod;
- const struct kmod_list *l;
- const struct kmod_config *config;
+ const struct kmod_list *l, *ctx_remove_commands;
- config = kmod_get_config(mod->ctx);
+ ctx_remove_commands = kmod_get_remove_commands(mod->ctx);
- kmod_list_foreach(l, config->remove_commands) {
+ kmod_list_foreach(l, ctx_remove_commands) {
const char *modname = kmod_command_get_modname(l);
if (fnmatch(modname, mod->name, 0) != 0)
@@ -1592,7 +1530,7 @@ void kmod_module_set_remove_commands(struct kmod_module *mod, const char *cmd)
* Create a new list of kmod modules with all modules currently loaded in
* kernel. It uses /proc/modules to get the names of loaded modules and to
* create kmod modules by calling kmod_module_new_from_name() in each of them.
- * They are put in @list in no particular order.
+ * They are put are put in @list in no particular order.
*
* The initial refcount is 1, and needs to be decremented to release the
* resources of the kmod_module. The returned @list must be released by
@@ -1680,11 +1618,7 @@ KMOD_EXPORT const char *kmod_module_initstate_str(enum kmod_module_initstate sta
* Get the initstate of this @mod, as returned by Linux Kernel, by reading
* /sys filesystem.
*
- * Returns: < 0 on error or module state if module is found in kernel, valid states are
- * KMOD_MODULE_BUILTIN: module is builtin;
- * KMOD_MODULE_LIVE: module is live in kernel;
- * KMOD_MODULE_COMING: module is being loaded;
- * KMOD_MODULE_GOING: module is being unloaded.
+ * Returns: < 0 on error or enum kmod_initstate if module is found in kernel.
*/
KMOD_EXPORT int kmod_module_get_initstate(const struct kmod_module *mod)
{
@@ -1741,43 +1675,22 @@ KMOD_EXPORT int kmod_module_get_initstate(const struct kmod_module *mod)
* kmod_module_get_size:
* @mod: kmod module
*
- * Get the size of this kmod module as returned by Linux kernel. If supported,
- * the size is read from the coresize attribute in /sys/module. For older
- * kernels, this falls back on /proc/modules and searches for the specified
- * module to get its size.
+ * Get the size of this kmod module as returned by Linux kernel. It reads the
+ * file /proc/modules to search for this module and get its size.
*
* Returns: the size of this kmod module.
*/
KMOD_EXPORT long kmod_module_get_size(const struct kmod_module *mod)
{
+ // FIXME TODO: this should be available from /sys/module/foo
FILE *fp;
char line[4096];
int lineno = 0;
long size = -ENOENT;
- int dfd, cfd;
if (mod == NULL)
return -ENOENT;
- /* try to open the module dir in /sys. If this fails, don't
- * bother trying to find the size as we know the module isn't
- * loaded.
- */
- snprintf(line, sizeof(line), "/sys/module/%s", mod->name);
- dfd = open(line, O_RDONLY);
- if (dfd < 0)
- return -errno;
-
- /* available as of linux 3.3.x */
- cfd = openat(dfd, "coresize", O_RDONLY|O_CLOEXEC);
- if (cfd >= 0) {
- if (read_str_long(cfd, &size, 10) < 0)
- ERR(mod->ctx, "failed to read coresize from %s\n", line);
- close(cfd);
- goto done;
- }
-
- /* fall back on parsing /proc/modules */
fp = fopen("/proc/modules", "re");
if (fp == NULL) {
int err = -errno;
@@ -1812,9 +1725,6 @@ KMOD_EXPORT long kmod_module_get_size(const struct kmod_module *mod)
break;
}
fclose(fp);
-
-done:
- close(dfd);
return size;
}
@@ -1840,7 +1750,7 @@ KMOD_EXPORT int kmod_module_get_refcnt(const struct kmod_module *mod)
fd = open(path, O_RDONLY|O_CLOEXEC);
if (fd < 0) {
err = -errno;
- DBG(mod->ctx, "could not open '%s': %s\n",
+ ERR(mod->ctx, "could not open '%s': %s\n",
path, strerror(errno));
return err;
}
@@ -1871,7 +1781,7 @@ KMOD_EXPORT struct kmod_list *kmod_module_get_holders(const struct kmod_module *
struct kmod_list *list = NULL;
DIR *d;
- if (mod == NULL || mod->ctx == NULL)
+ if (mod == NULL)
return NULL;
snprintf(dname, sizeof(dname), "/sys/module/%s/holders", mod->name);
@@ -2099,25 +2009,6 @@ KMOD_EXPORT void kmod_module_section_free_list(struct kmod_list *list)
}
}
-static struct kmod_elf *kmod_module_get_elf(const struct kmod_module *mod)
-{
- if (mod->file == NULL) {
- const char *path = kmod_module_get_path(mod);
-
- if (path == NULL) {
- errno = ENOENT;
- return NULL;
- }
-
- ((struct kmod_module *)mod)->file = kmod_file_open(mod->ctx,
- path);
- if (mod->file == NULL)
- return NULL;
- }
-
- return kmod_file_get_elf(mod->file);
-}
-
struct kmod_module_info {
char *key;
char value[];
@@ -2132,7 +2023,7 @@ static struct kmod_module_info *kmod_module_info_new(const char *key, size_t key
return NULL;
info->key = (char *)info + sizeof(struct kmod_module_info)
- + valuelen + 1;
+ + valuelen + 1;
memcpy(info->key, key, keylen);
info->key[keylen] = '\0';
memcpy(info->value, value, valuelen);
@@ -2145,22 +2036,6 @@ static void kmod_module_info_free(struct kmod_module_info *info)
free(info);
}
-static struct kmod_list *kmod_module_info_append(struct kmod_list **list, const char *key, size_t keylen, const char *value, size_t valuelen)
-{
- struct kmod_module_info *info;
- struct kmod_list *n;
-
- info = kmod_module_info_new(key, keylen, value, valuelen);
- if (info == NULL)
- return NULL;
- n = kmod_list_append(*list, info);
- if (n != NULL)
- *list = n;
- else
- kmod_module_info_free(info);
- return n;
-}
-
/**
* kmod_module_get_info:
* @mod: kmod module
@@ -2171,9 +2046,7 @@ static struct kmod_list *kmod_module_info_append(struct kmod_list **list, const
*
* Get a list of entries in ELF section ".modinfo", these contain
* alias, license, depends, vermagic and other keys with respective
- * values. If the module is signed (CONFIG_MODULE_SIG), information
- * about the module signature is included as well: signer,
- * sig_key and sig_hashalgo.
+ * values.
*
* After use, free the @list by calling kmod_module_info_free_list().
*
@@ -2181,25 +2054,44 @@ static struct kmod_list *kmod_module_info_append(struct kmod_list **list, const
*/
KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_list **list)
{
+ struct kmod_file *file;
struct kmod_elf *elf;
+ const char *path;
+ const void *mem;
char **strings;
- int i, count, ret = -ENOMEM;
- struct kmod_signature_info sig_info;
+ size_t size;
+ int i, count, ret = 0;
if (mod == NULL || list == NULL)
return -ENOENT;
assert(*list == NULL);
- elf = kmod_module_get_elf(mod);
- if (elf == NULL)
+ path = kmod_module_get_path(mod);
+ if (path == NULL)
+ return -ENOENT;
+
+ file = kmod_file_open(mod->ctx, path);
+ if (file == NULL)
return -errno;
+ size = kmod_file_get_size(file);
+ mem = kmod_file_get_contents(file);
+
+ elf = kmod_elf_new(mem, size);
+ if (elf == NULL) {
+ ret = -errno;
+ goto elf_open_error;
+ }
+
count = kmod_elf_get_strings(elf, ".modinfo", &strings);
- if (count < 0)
- return count;
+ if (count < 0) {
+ ret = count;
+ goto get_strings_error;
+ }
for (i = 0; i < count; i++) {
+ struct kmod_module_info *info;
struct kmod_list *n;
const char *key, *value;
size_t keylen, valuelen;
@@ -2209,65 +2101,40 @@ KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_
if (value == NULL) {
keylen = strlen(key);
valuelen = 0;
- value = key;
} else {
keylen = value - key;
value++;
valuelen = strlen(value);
}
- n = kmod_module_info_append(list, key, keylen, value, valuelen);
- if (n == NULL)
- goto list_error;
- }
-
- if (kmod_module_signature_info(mod->file, &sig_info)) {
- struct kmod_list *n;
- char *key_hex;
-
- n = kmod_module_info_append(list, "signer", strlen("signer"),
- sig_info.signer, sig_info.signer_len);
- if (n == NULL)
- goto list_error;
- count++;
-
- /* Display the key id as 01:12:DE:AD:BE:EF:... */
- key_hex = malloc(sig_info.key_id_len * 3);
- if (key_hex == NULL)
+ info = kmod_module_info_new(key, keylen, value, valuelen);
+ if (info == NULL) {
+ ret = -errno;
+ kmod_module_info_free_list(*list);
+ *list = NULL;
goto list_error;
- for (i = 0; i < (int)sig_info.key_id_len; i++) {
- sprintf(key_hex + i * 3, "%02X",
- (unsigned char)sig_info.key_id[i]);
- if (i < (int)sig_info.key_id_len - 1)
- key_hex[i * 3 + 2] = ':';
}
- n = kmod_module_info_append(list, "sig_key", strlen("sig_key"),
- key_hex, sig_info.key_id_len * 3 - 1);
- free(key_hex);
- if (n == NULL)
- goto list_error;
- count++;
- n = kmod_module_info_append(list,
- "sig_hashalgo", strlen("sig_hashalgo"),
- sig_info.hash_algo, strlen(sig_info.hash_algo));
- if (n == NULL)
+ n = kmod_list_append(*list, info);
+ if (n != NULL)
+ *list = n;
+ else {
+ kmod_module_info_free(info);
+ kmod_module_info_free_list(*list);
+ *list = NULL;
+ ret = -ENOMEM;
goto list_error;
- count++;
-
- /*
- * Omit sig_info.id_type and sig_info.algo for now, as these
- * are currently constant.
- */
+ }
}
ret = count;
list_error:
- if (ret < 0) {
- kmod_module_info_free_list(*list);
- *list = NULL;
- }
free(strings);
+get_strings_error:
+ kmod_elf_unref(elf);
+elf_open_error:
+ kmod_file_unref(file);
+
return ret;
}
@@ -2365,8 +2232,12 @@ static void kmod_module_version_free(struct kmod_module_version *version)
*/
KMOD_EXPORT int kmod_module_get_versions(const struct kmod_module *mod, struct kmod_list **list)
{
+ struct kmod_file *file;
struct kmod_elf *elf;
+ const char *path;
+ const void *mem;
struct kmod_modversion *versions;
+ size_t size;
int i, count, ret = 0;
if (mod == NULL || list == NULL)
@@ -2374,13 +2245,28 @@ KMOD_EXPORT int kmod_module_get_versions(const struct kmod_module *mod, struct k
assert(*list == NULL);
- elf = kmod_module_get_elf(mod);
- if (elf == NULL)
+ path = kmod_module_get_path(mod);
+ if (path == NULL)
+ return -ENOENT;
+
+ file = kmod_file_open(mod->ctx, path);
+ if (file == NULL)
return -errno;
+ size = kmod_file_get_size(file);
+ mem = kmod_file_get_contents(file);
+
+ elf = kmod_elf_new(mem, size);
+ if (elf == NULL) {
+ ret = -errno;
+ goto elf_open_error;
+ }
+
count = kmod_elf_get_modversions(elf, &versions);
- if (count < 0)
- return count;
+ if (count < 0) {
+ ret = count;
+ goto get_strings_error;
+ }
for (i = 0; i < count; i++) {
struct kmod_module_version *mv;
@@ -2409,11 +2295,16 @@ KMOD_EXPORT int kmod_module_get_versions(const struct kmod_module *mod, struct k
list_error:
free(versions);
+get_strings_error:
+ kmod_elf_unref(elf);
+elf_open_error:
+ kmod_file_unref(file);
+
return ret;
}
/**
- * kmod_module_version_get_symbol:
+ * kmod_module_versions_get_symbol:
* @entry: a list entry representing a kmod module versions
*
* Get the symbol of a kmod module versions.
@@ -2506,8 +2397,12 @@ static void kmod_module_symbol_free(struct kmod_module_symbol *symbol)
*/
KMOD_EXPORT int kmod_module_get_symbols(const struct kmod_module *mod, struct kmod_list **list)
{
+ struct kmod_file *file;
struct kmod_elf *elf;
+ const char *path;
+ const void *mem;
struct kmod_modversion *symbols;
+ size_t size;
int i, count, ret = 0;
if (mod == NULL || list == NULL)
@@ -2515,13 +2410,28 @@ KMOD_EXPORT int kmod_module_get_symbols(const struct kmod_module *mod, struct km
assert(*list == NULL);
- elf = kmod_module_get_elf(mod);
- if (elf == NULL)
+ path = kmod_module_get_path(mod);
+ if (path == NULL)
+ return -ENOENT;
+
+ file = kmod_file_open(mod->ctx, path);
+ if (file == NULL)
return -errno;
+ size = kmod_file_get_size(file);
+ mem = kmod_file_get_contents(file);
+
+ elf = kmod_elf_new(mem, size);
+ if (elf == NULL) {
+ ret = -errno;
+ goto elf_open_error;
+ }
+
count = kmod_elf_get_symbols(elf, &symbols);
- if (count < 0)
- return count;
+ if (count < 0) {
+ ret = count;
+ goto get_strings_error;
+ }
for (i = 0; i < count; i++) {
struct kmod_module_symbol *mv;
@@ -2550,6 +2460,11 @@ KMOD_EXPORT int kmod_module_get_symbols(const struct kmod_module *mod, struct km
list_error:
free(symbols);
+get_strings_error:
+ kmod_elf_unref(elf);
+elf_open_error:
+ kmod_file_unref(file);
+
return ret;
}
@@ -2650,8 +2565,12 @@ static void kmod_module_dependency_symbol_free(struct kmod_module_dependency_sym
*/
KMOD_EXPORT int kmod_module_get_dependency_symbols(const struct kmod_module *mod, struct kmod_list **list)
{
+ struct kmod_file *file;
struct kmod_elf *elf;
+ const char *path;
+ const void *mem;
struct kmod_modversion *symbols;
+ size_t size;
int i, count, ret = 0;
if (mod == NULL || list == NULL)
@@ -2659,13 +2578,28 @@ KMOD_EXPORT int kmod_module_get_dependency_symbols(const struct kmod_module *mod
assert(*list == NULL);
- elf = kmod_module_get_elf(mod);
- if (elf == NULL)
+ path = kmod_module_get_path(mod);
+ if (path == NULL)
+ return -ENOENT;
+
+ file = kmod_file_open(mod->ctx, path);
+ if (file == NULL)
return -errno;
+ size = kmod_file_get_size(file);
+ mem = kmod_file_get_contents(file);
+
+ elf = kmod_elf_new(mem, size);
+ if (elf == NULL) {
+ ret = -errno;
+ goto elf_open_error;
+ }
+
count = kmod_elf_get_dependency_symbols(elf, &symbols);
- if (count < 0)
- return count;
+ if (count < 0) {
+ ret = count;
+ goto get_strings_error;
+ }
for (i = 0; i < count; i++) {
struct kmod_module_dependency_symbol *mv;
@@ -2696,6 +2630,11 @@ KMOD_EXPORT int kmod_module_get_dependency_symbols(const struct kmod_module *mod
list_error:
free(symbols);
+get_strings_error:
+ kmod_elf_unref(elf);
+elf_open_error:
+ kmod_file_unref(file);
+
return ret;
}
diff --git a/libkmod/libkmod-private.h b/libkmod/libkmod-private.h
index 0180124..ebda945 100644
--- a/libkmod/libkmod-private.h
+++ b/libkmod/libkmod-private.h
@@ -1,15 +1,15 @@
-#pragma once
+#ifndef _LIBKMOD_PRIVATE_H_
+#define _LIBKMOD_PRIVATE_H_
#include <stdbool.h>
#include <stdio.h>
#include <syslog.h>
#include <limits.h>
-#include "missing.h"
#include "macro.h"
#include "libkmod.h"
-static _always_inline_ _printf_format_(2, 3) void
+static __always_inline __printf_format(2, 3) void
kmod_log_null(struct kmod_ctx *ctx, const char *format, ...) {}
#define kmod_log_cond(ctx, prio, arg...) \
@@ -36,15 +36,6 @@ static _always_inline_ _printf_format_(2, 3) void
#define KCMD_LINE_SIZE 4096
-#ifndef HAVE_SECURE_GETENV
-# ifdef HAVE___SECURE_GETENV
-# define secure_getenv __secure_getenv
-# else
-# warning neither secure_getenv nor __secure_getenv is available
-# define secure_getenv getenv
-# endif
-#endif
-
void kmod_log(const struct kmod_ctx *ctx,
int priority, const char *file, int line, const char *fn,
const char *format, ...) __attribute__((format(printf, 6, 7))) __attribute__((nonnull(1, 3, 5)));
@@ -58,16 +49,16 @@ struct kmod_list {
void *data;
};
-struct kmod_list *kmod_list_append(struct kmod_list *list, const void *data) _must_check_ __attribute__((nonnull(2)));
-struct kmod_list *kmod_list_prepend(struct kmod_list *list, const void *data) _must_check_ __attribute__((nonnull(2)));
-struct kmod_list *kmod_list_remove(struct kmod_list *list) _must_check_;
+struct kmod_list *kmod_list_append(struct kmod_list *list, const void *data) __must_check __attribute__((nonnull(2)));
+struct kmod_list *kmod_list_prepend(struct kmod_list *list, const void *data) __must_check __attribute__((nonnull(2)));
+struct kmod_list *kmod_list_remove(struct kmod_list *list) __must_check;
struct kmod_list *kmod_list_remove_data(struct kmod_list *list,
- const void *data) _must_check_ __attribute__((nonnull(2)));
+ const void *data) __must_check __attribute__((nonnull(2)));
struct kmod_list *kmod_list_remove_n_latest(struct kmod_list *list,
- unsigned int n) _must_check_;
+ unsigned int n) __must_check;
struct kmod_list *kmod_list_insert_after(struct kmod_list *list, const void *data) __attribute__((nonnull(2)));
struct kmod_list *kmod_list_insert_before(struct kmod_list *list, const void *data) __attribute__((nonnull(2)));
-struct kmod_list *kmod_list_append_list(struct kmod_list *list1, struct kmod_list *list2) _must_check_;
+struct kmod_list *kmod_list_append_list(struct kmod_list *list1, struct kmod_list *list2) __must_check;
#undef kmod_list_foreach
#define kmod_list_foreach(list_entry, first_entry) \
@@ -97,10 +88,16 @@ void kmod_set_modules_visited(struct kmod_ctx *ctx, bool visited) __attribute__(
char *kmod_search_moddep(struct kmod_ctx *ctx, const char *name) __attribute__((nonnull(1,2)));
struct kmod_module *kmod_pool_get_module(struct kmod_ctx *ctx, const char *key) __attribute__((nonnull(1,2)));
-void kmod_pool_add_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1, 2, 3)));
-void kmod_pool_del_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1, 2, 3)));
+void kmod_pool_add_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1,2, 3)));
+void kmod_pool_del_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1,2, 3)));
+
+const struct kmod_list *kmod_get_blacklists(const struct kmod_ctx *ctx) __must_check __attribute__((nonnull(1)));
+const struct kmod_list *kmod_get_options(const struct kmod_ctx *ctx) __must_check __attribute__((nonnull(1)));
+const struct kmod_list *kmod_get_install_commands(const struct kmod_ctx *ctx) __must_check __attribute__((nonnull(1)));
+const struct kmod_list *kmod_get_remove_commands(const struct kmod_ctx *ctx) __must_check __attribute__((nonnull(1)));
+const struct kmod_list *kmod_get_softdeps(const struct kmod_ctx *ctx) __must_check __attribute__((nonnull(1)));
+const struct kmod_list *kmod_get_aliases(const struct kmod_ctx *ctx) __must_check __attribute__((nonnull(1)));
-const struct kmod_config *kmod_get_config(const struct kmod_ctx *ctx) __attribute__((nonnull(1)));
/* libkmod-config.c */
struct kmod_config_path {
@@ -148,12 +145,9 @@ void kmod_module_set_builtin(struct kmod_module *mod, bool builtin) __attribute_
#include "libkmod-hash.h"
/* libkmod-file.c */
-struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx, const char *filename) _must_check_ __attribute__((nonnull(1,2)));
-struct kmod_elf *kmod_file_get_elf(struct kmod_file *file) __attribute__((nonnull(1)));
-void *kmod_file_get_contents(const struct kmod_file *file) _must_check_ __attribute__((nonnull(1)));
-off_t kmod_file_get_size(const struct kmod_file *file) _must_check_ __attribute__((nonnull(1)));
-bool kmod_file_get_direct(const struct kmod_file *file) _must_check_ __attribute__((nonnull(1)));
-int kmod_file_get_fd(const struct kmod_file *file) _must_check_ __attribute__((nonnull(1)));
+struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx, const char *filename) __must_check __attribute__((nonnull(1,2)));
+void *kmod_file_get_contents(const struct kmod_file *file) __must_check __attribute__((nonnull(1)));
+off_t kmod_file_get_size(const struct kmod_file *file) __must_check __attribute__((nonnull(1)));
void kmod_file_unref(struct kmod_file *file) __attribute__((nonnull(1)));
/* libkmod-elf.c */
@@ -164,30 +158,23 @@ struct kmod_modversion {
char *symbol;
};
-struct kmod_elf *kmod_elf_new(const void *memory, off_t size) _must_check_ __attribute__((nonnull(1)));
+struct kmod_elf *kmod_elf_new(const void *memory, off_t size) __must_check __attribute__((nonnull(1)));
void kmod_elf_unref(struct kmod_elf *elf) __attribute__((nonnull(1)));
-const void *kmod_elf_get_memory(const struct kmod_elf *elf) _must_check_ __attribute__((nonnull(1)));
-int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char ***array) _must_check_ __attribute__((nonnull(1,2,3)));
-int kmod_elf_get_modversions(const struct kmod_elf *elf, struct kmod_modversion **array) _must_check_ __attribute__((nonnull(1,2)));
-int kmod_elf_get_symbols(const struct kmod_elf *elf, struct kmod_modversion **array) _must_check_ __attribute__((nonnull(1,2)));
-int kmod_elf_get_dependency_symbols(const struct kmod_elf *elf, struct kmod_modversion **array) _must_check_ __attribute__((nonnull(1,2)));
-int kmod_elf_strip_section(struct kmod_elf *elf, const char *section) _must_check_ __attribute__((nonnull(1,2)));
-int kmod_elf_strip_vermagic(struct kmod_elf *elf) _must_check_ __attribute__((nonnull(1)));
+const void *kmod_elf_get_memory(const struct kmod_elf *elf) __must_check __attribute__((nonnull(1)));
+int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char ***array) __must_check __attribute__((nonnull(1,2,3)));
+int kmod_elf_get_modversions(const struct kmod_elf *elf, struct kmod_modversion **array) __must_check __attribute__((nonnull(1,2)));
+int kmod_elf_get_symbols(const struct kmod_elf *elf, struct kmod_modversion **array) __must_check __attribute__((nonnull(1,2)));
+int kmod_elf_get_dependency_symbols(const struct kmod_elf *elf, struct kmod_modversion **array) __must_check __attribute__((nonnull(1,2)));
+int kmod_elf_strip_section(struct kmod_elf *elf, const char *section) __must_check __attribute__((nonnull(1,2)));
+int kmod_elf_strip_vermagic(struct kmod_elf *elf) __must_check __attribute__((nonnull(1)));
/*
* Debug mock lib need to find section ".gnu.linkonce.this_module" in order to
* get modname
*/
-int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const void **buf, uint64_t *buf_size) _must_check_ __attribute__((nonnull(1,2,3,4)));
-
-/* libkmod-signature.c */
-struct kmod_signature_info {
- const char *signer;
- size_t signer_len;
- const char *key_id;
- size_t key_id_len;
- const char *algo, *hash_algo, *id_type;
-};
-bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signature_info *sig_info) _must_check_ __attribute__((nonnull(1, 2)));
+int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const void **buf, uint64_t *buf_size) __must_check __attribute__((nonnull(1,2,3,4)));
+
/* util functions */
#include "libkmod-util.h"
+
+#endif
diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
deleted file mode 100644
index 6b80caa..0000000
--- a/libkmod/libkmod-signature.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * libkmod - module signature display
- *
- * Copyright (C) 2013 Michal Marek, SUSE
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <endian.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "libkmod-private.h"
-
-/* These types and tables were copied from the 3.7 kernel sources.
- * As this is just description of the signature format, it should not be
- * considered derived work (so libkmod can use the LGPL license).
- */
-enum pkey_algo {
- PKEY_ALGO_DSA,
- PKEY_ALGO_RSA,
- PKEY_ALGO__LAST
-};
-
-static const char *const pkey_algo[PKEY_ALGO__LAST] = {
- [PKEY_ALGO_DSA] = "DSA",
- [PKEY_ALGO_RSA] = "RSA",
-};
-
-enum pkey_hash_algo {
- PKEY_HASH_MD4,
- PKEY_HASH_MD5,
- PKEY_HASH_SHA1,
- PKEY_HASH_RIPE_MD_160,
- PKEY_HASH_SHA256,
- PKEY_HASH_SHA384,
- PKEY_HASH_SHA512,
- PKEY_HASH_SHA224,
- PKEY_HASH__LAST
-};
-
-const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
- [PKEY_HASH_MD4] = "md4",
- [PKEY_HASH_MD5] = "md5",
- [PKEY_HASH_SHA1] = "sha1",
- [PKEY_HASH_RIPE_MD_160] = "rmd160",
- [PKEY_HASH_SHA256] = "sha256",
- [PKEY_HASH_SHA384] = "sha384",
- [PKEY_HASH_SHA512] = "sha512",
- [PKEY_HASH_SHA224] = "sha224",
-};
-
-enum pkey_id_type {
- PKEY_ID_PGP, /* OpenPGP generated key ID */
- PKEY_ID_X509, /* X.509 arbitrary subjectKeyIdentifier */
- PKEY_ID_TYPE__LAST
-};
-
-const char *const pkey_id_type[PKEY_ID_TYPE__LAST] = {
- [PKEY_ID_PGP] = "PGP",
- [PKEY_ID_X509] = "X509",
-};
-
-/*
- * Module signature information block.
- *
- * The constituents of the signature section are, in order:
- *
- * - Signer's name
- * - Key identifier
- * - Signature data
- * - Information block
- */
-struct module_signature {
- uint8_t algo; /* Public-key crypto algorithm [enum pkey_algo] */
- uint8_t hash; /* Digest algorithm [enum pkey_hash_algo] */
- uint8_t id_type; /* Key identifier type [enum pkey_id_type] */
- uint8_t signer_len; /* Length of signer's name */
- uint8_t key_id_len; /* Length of key identifier */
- uint8_t __pad[3];
- uint32_t sig_len; /* Length of signature data (big endian) */
-};
-
-#define SIG_MAGIC "~Module signature appended~\n"
-
-bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signature_info *sig_info)
-{
- const char *mem;
- off_t size;
- const struct module_signature *modsig;
- size_t sig_len;
-
-
- size = kmod_file_get_size(file);
- mem = kmod_file_get_contents(file);
- if (size < (off_t)strlen(SIG_MAGIC))
- return false;
- size -= strlen(SIG_MAGIC);
- if (memcmp(SIG_MAGIC, mem + size, strlen(SIG_MAGIC)) != 0)
- return false;
-
- if (size < (off_t)sizeof(struct module_signature))
- return false;
- size -= sizeof(struct module_signature);
- modsig = (struct module_signature *)(mem + size);
- if (modsig->algo >= PKEY_ALGO__LAST ||
- modsig->hash >= PKEY_HASH__LAST ||
- modsig->id_type >= PKEY_ID_TYPE__LAST)
- return false;
- sig_len = be32toh(modsig->sig_len);
- if (size < (off_t)(modsig->signer_len + modsig->key_id_len + sig_len))
- return false;
-
- size -= modsig->key_id_len + sig_len;
- sig_info->key_id = mem + size;
- sig_info->key_id_len = modsig->key_id_len;
-
- size -= modsig->signer_len;
- sig_info->signer = mem + size;
- sig_info->signer_len = modsig->signer_len;
-
- sig_info->algo = pkey_algo[modsig->algo];
- sig_info->hash_algo = pkey_hash_algo[modsig->hash];
- sig_info->id_type = pkey_id_type[modsig->id_type];
-
- return true;
-}
diff --git a/libkmod/libkmod-util.c b/libkmod/libkmod-util.c
index d1475e7..f499578 100644
--- a/libkmod/libkmod-util.c
+++ b/libkmod/libkmod-util.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -90,6 +90,37 @@ char *getline_wrapped(FILE *fp, unsigned int *linenum)
}
}
+/*
+ * Replace dashes with underscores.
+ * Dashes inside character range patterns (e.g. [0-9]) are left unchanged.
+ */
+char *underscores(struct kmod_ctx *ctx, char *s)
+{
+ unsigned int i;
+
+ if (!s)
+ return NULL;
+
+ for (i = 0; s[i]; i++) {
+ switch (s[i]) {
+ case '-':
+ s[i] = '_';
+ break;
+
+ case ']':
+ INFO(ctx, "Unmatched bracket in %s\n", s);
+ break;
+
+ case '[':
+ i += strcspn(&s[i], "]");
+ if (!s[i])
+ INFO(ctx, "Unmatched bracket in %s\n", s);
+ break;
+ }
+ }
+ return s;
+}
+
inline int alias_normalize(const char *alias, char buf[PATH_MAX], size_t *len)
{
size_t s;
@@ -308,43 +339,13 @@ char *path_make_absolute_cwd(const char *p)
return r;
}
-const struct kmod_ext kmod_exts[] = {
- {".ko", sizeof(".ko") - 1},
-#ifdef ENABLE_ZLIB
- {".ko.gz", sizeof(".ko.gz") - 1},
-#endif
-#ifdef ENABLE_XZ
- {".ko.xz", sizeof(".ko.xz") - 1},
-#endif
- { }
-};
-
-bool path_ends_with_kmod_ext(const char *path, size_t len)
-{
- const struct kmod_ext *eitr;
-
- for (eitr = kmod_exts; eitr->ext != NULL; eitr++) {
- if (len <= eitr->len)
- continue;
- if (streq(path + len - eitr->len, eitr->ext))
- return true;
- }
-
- return false;
-}
-
#define USEC_PER_SEC 1000000ULL
#define NSEC_PER_USEC 1000ULL
-unsigned long long ts_usec(const struct timespec *ts)
-{
- return (unsigned long long) ts->tv_sec * USEC_PER_SEC +
- (unsigned long long) ts->tv_nsec / NSEC_PER_USEC;
-}
-
unsigned long long stat_mstamp(const struct stat *st)
{
#ifdef HAVE_STRUCT_STAT_ST_MTIM
- return ts_usec(&st->st_mtim);
+ return (unsigned long long) st->st_mtim.tv_sec * USEC_PER_SEC +
+ (unsigned long long) st->st_mtim.tv_nsec / NSEC_PER_USEC;
#else
return (unsigned long long) st->st_mtime;
#endif
diff --git a/libkmod/libkmod-util.h b/libkmod/libkmod-util.h
index 17f8801..317b2f7 100644
--- a/libkmod/libkmod-util.h
+++ b/libkmod/libkmod-util.h
@@ -1,51 +1,29 @@
-#pragma once
+#ifndef _LIBKMOD_UTIL_H_
+#define _LIBKMOD_UTIL_H_
+
#include "macro.h"
#include <limits.h>
-#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
-#include <sys/stat.h>
char *getline_wrapped(FILE *fp, unsigned int *linenum) __attribute__((nonnull(1)));
+char *underscores(struct kmod_ctx *ctx, char *s) __attribute__((nonnull(1, 2)));
#define streq(a, b) (strcmp((a), (b)) == 0)
#define strstartswith(a, b) (strncmp(a, b, strlen(b)) == 0)
void *memdup(const void *p, size_t n) __attribute__((nonnull(1)));
-ssize_t read_str_safe(int fd, char *buf, size_t buflen) _must_check_ __attribute__((nonnull(2)));
+ssize_t read_str_safe(int fd, char *buf, size_t buflen) __must_check __attribute__((nonnull(2)));
ssize_t write_str_safe(int fd, const char *buf, size_t buflen) __attribute__((nonnull(2)));
-int read_str_long(int fd, long *value, int base) _must_check_ __attribute__((nonnull(2)));
-int read_str_ulong(int fd, unsigned long *value, int base) _must_check_ __attribute__((nonnull(2)));
+int read_str_long(int fd, long *value, int base) __must_check __attribute__((nonnull(2)));
+int read_str_ulong(int fd, unsigned long *value, int base) __must_check __attribute__((nonnull(2)));
char *strchr_replace(char *s, int c, char r);
-bool path_is_absolute(const char *p) _must_check_ __attribute__((nonnull(1)));
-char *path_make_absolute_cwd(const char *p) _must_check_ __attribute__((nonnull(1)));
-int alias_normalize(const char *alias, char buf[PATH_MAX], size_t *len) _must_check_ __attribute__((nonnull(1,2)));
+bool path_is_absolute(const char *p) __must_check __attribute__((nonnull(1)));
+char *path_make_absolute_cwd(const char *p) __must_check __attribute__((nonnull(1)));
+int alias_normalize(const char *alias, char buf[PATH_MAX], size_t *len) __must_check __attribute__((nonnull(1,2)));
char *modname_normalize(const char *modname, char buf[PATH_MAX], size_t *len) __attribute__((nonnull(1, 2)));
char *path_to_modname(const char *path, char buf[PATH_MAX], size_t *len) __attribute__((nonnull(2)));
-
-extern const struct kmod_ext {
- const char *ext;
- size_t len;
-} kmod_exts[];
-#define KMOD_EXT_UNC 0
-bool path_ends_with_kmod_ext(const char *path, size_t len) __attribute__((nonnull(1)));
-
unsigned long long stat_mstamp(const struct stat *st);
-unsigned long long ts_usec(const struct timespec *ts);
-
-#define get_unaligned(ptr) \
-({ \
- struct __attribute__((packed)) { \
- typeof(*(ptr)) __v; \
- } *__p = (typeof(__p)) (ptr); \
- __p->__v; \
-})
-#define put_unaligned(val, ptr) \
-do { \
- struct __attribute__((packed)) { \
- typeof(*(ptr)) __v; \
- } *__p = (typeof(__p)) (ptr); \
- __p->__v = (val); \
-} while(0)
+#endif
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 788676c..8c91a7c 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -59,9 +58,9 @@ static struct _index_files {
};
static const char *default_config_paths[] = {
- SYSCONFDIR "/modprobe.d",
"/run/modprobe.d",
- "/lib/modprobe.d",
+ SYSCONFDIR "/modprobe.d",
+ ROOTPREFIX "/lib/modprobe.d",
NULL
};
@@ -99,7 +98,6 @@ void kmod_log(const struct kmod_ctx *ctx,
va_end(args);
}
-_printf_format_(6, 0)
static void log_filep(void *data,
int priority, const char *file, int line,
const char *fn, const char *format, va_list args)
@@ -196,7 +194,7 @@ static int log_priority(const char *priority)
return 0;
}
-static const char *dirname_default_prefix = "/lib/modules";
+static const char *dirname_default_prefix = ROOTPREFIX "/lib/modules";
static char *get_kernel_release(const char *dirname)
{
@@ -218,15 +216,16 @@ static char *get_kernel_release(const char *dirname)
/**
* kmod_new:
* @dirname: what to consider as linux module's directory, if NULL
- * defaults to /lib/modules/`uname -r`. If it's relative,
- * it's treated as relative to the current working directory.
- * Otherwise, give an absolute dirname.
+ * defaults to $rootprefix/lib/modules/`uname -r`. If it's relative,
+ * it's treated as relative to current the current working
+ * directory. Otherwise, give an absolute dirname.
* @config_paths: ordered array of paths (directories or files) where
* to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If
* NULL defaults to /run/modprobe.d, /etc/modprobe.d and
- * /lib/modprobe.d. Give an empty vector if configuration should
- * not be read. This array must be null terminated.
+ * $rootprefix/lib/modprobe.d. Give an empty vector if
+ * configuration should not be read. This array must be null
+ * terminated.
*
* Create kmod library context. This reads the kmod configuration
* and fills in the default values.
@@ -255,7 +254,7 @@ KMOD_EXPORT struct kmod_ctx *kmod_new(const char *dirname,
ctx->dirname = get_kernel_release(dirname);
/* environment overwrites config */
- env = secure_getenv("KMOD_LOG");
+ env = getenv("KMOD_LOG");
if (env != NULL)
kmod_set_log_priority(ctx, log_priority(env));
@@ -307,8 +306,6 @@ KMOD_EXPORT struct kmod_ctx *kmod_ref(struct kmod_ctx *ctx)
*
* Drop a reference of the kmod library context. If the refcount
* reaches zero, the resources of the context will be released.
- *
- * Returns: the passed kmod library context or NULL if it's freed
*/
KMOD_EXPORT struct kmod_ctx *kmod_unref(struct kmod_ctx *ctx)
{
@@ -483,53 +480,18 @@ int kmod_lookup_alias_from_aliases_file(struct kmod_ctx *ctx, const char *name,
int kmod_lookup_alias_from_builtin_file(struct kmod_ctx *ctx, const char *name,
struct kmod_list **list)
{
- char *line = NULL;
- int err = 0;
-
- assert(*list == NULL);
-
- if (ctx->indexes[KMOD_INDEX_MODULES_BUILTIN]) {
- DBG(ctx, "use mmaped index '%s' modname=%s\n",
- index_files[KMOD_INDEX_MODULES_BUILTIN].fn,
- name);
- line = index_mm_search(ctx->indexes[KMOD_INDEX_MODULES_BUILTIN],
- name);
- } else {
- struct index_file *idx;
- char fn[PATH_MAX];
-
- snprintf(fn, sizeof(fn), "%s/%s.bin", ctx->dirname,
- index_files[KMOD_INDEX_MODULES_BUILTIN].fn);
- DBG(ctx, "file=%s modname=%s\n", fn, name);
-
- idx = index_file_open(fn);
- if (idx == NULL) {
- DBG(ctx, "could not open builtin file '%s'\n", fn);
- goto finish;
- }
-
- line = index_search(idx, name);
- index_file_close(idx);
- }
-
- if (line != NULL) {
- struct kmod_module *mod;
+ const struct kmod_list *l;
- err = kmod_module_new_from_name(ctx, name, &mod);
- if (err < 0) {
- ERR(ctx, "Could not create module from name %s: %s\n",
- name, strerror(-err));
- goto finish;
- }
+ int err = kmod_lookup_alias_from_alias_bin(ctx,
+ KMOD_INDEX_MODULES_BUILTIN, name, list);
+ if (err < 0)
+ return err;
- kmod_module_set_builtin(mod, true);
- *list = kmod_list_append(*list, mod);
- if (*list == NULL)
- err = -ENOMEM;
+ kmod_list_foreach(l, *list) {
+ struct kmod_module *m = l->data;
+ kmod_module_set_builtin(m, true);
}
-finish:
- free(line);
return err;
}
@@ -809,7 +771,7 @@ KMOD_EXPORT int kmod_load_resources(struct kmod_ctx *ctx)
snprintf(path, sizeof(path), "%s/%s.bin", ctx->dirname,
index_files[i].fn);
- ctx->indexes[i] = index_mm_open(ctx, path,
+ ctx->indexes[i] = index_mm_open(ctx, path, true,
&ctx->indexes_stamp[i]);
if (ctx->indexes[i] == NULL)
goto fail;
@@ -856,11 +818,7 @@ KMOD_EXPORT void kmod_unload_resources(struct kmod_ctx *ctx)
/**
* kmod_dump_index:
* @ctx: kmod library context
- * @type: index to dump, valid indexes are
- * KMOD_INDEX_MODULES_DEP: index of module dependencies;
- * KMOD_INDEX_MODULES_ALIAS: index of module aliases;
- * KMOD_INDEX_MODULES_SYMBOL: index of symbol aliases;
- * KMOD_INDEX_MODULES_BUILTIN: index of builtin module.
+ * @type: index to dump
* @fd: file descriptor to dump index to
*
* Dump index to file descriptor. Note that this function doesn't use stdio.h
@@ -902,7 +860,32 @@ KMOD_EXPORT int kmod_dump_index(struct kmod_ctx *ctx, enum kmod_index type,
return 0;
}
-const struct kmod_config *kmod_get_config(const struct kmod_ctx *ctx)
+const struct kmod_list *kmod_get_blacklists(const struct kmod_ctx *ctx)
+{
+ return ctx->config->blacklists;
+}
+
+const struct kmod_list *kmod_get_options(const struct kmod_ctx *ctx)
+{
+ return ctx->config->options;
+}
+
+const struct kmod_list *kmod_get_install_commands(const struct kmod_ctx *ctx)
+{
+ return ctx->config->install_commands;
+}
+
+const struct kmod_list *kmod_get_remove_commands(const struct kmod_ctx *ctx)
+{
+ return ctx->config->remove_commands;
+}
+
+const struct kmod_list *kmod_get_softdeps(const struct kmod_ctx *ctx)
+{
+ return ctx->config->softdeps;
+}
+
+const struct kmod_list *kmod_get_aliases(const struct kmod_ctx *ctx)
{
- return ctx->config;
+ return ctx->config->aliases;
}
diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
index 3397f87..f907e1d 100644
--- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#pragma once
#ifndef _LIBKMOD_H_
#define _LIBKMOD_H_
@@ -161,7 +160,6 @@ enum kmod_probe {
/* codes below can be used in return value, too */
KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000,
KMOD_PROBE_APPLY_BLACKLIST = 0x20000,
- KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY = 0x40000,
};
/* Flags to kmod_module_apply_filter() */
diff --git a/libkmod/libkmod.sym b/libkmod/libkmod.sym
index 854d257..cebb8d2 100644
--- a/libkmod/libkmod.sym
+++ b/libkmod/libkmod.sym
@@ -2,6 +2,7 @@ LIBKMOD_5 {
global:
kmod_get_log_priority;
kmod_get_userdata;
+ kmod_log;
kmod_new;
kmod_ref;
kmod_set_log_fn;
diff --git a/libkmod/macro.h b/libkmod/macro.h
index c6ba855..06300df 100644
--- a/libkmod/macro.h
+++ b/libkmod/macro.h
@@ -1,7 +1,7 @@
/*
* libkmod - interface to kernel module operations
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,20 +17,31 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#pragma once
+
+#ifndef _LIBKMOD_MACRO_H_
+#define _LIBKMOD_MACRO_H_
#include <stddef.h>
-#define assert_cc(expr) \
- _Static_assert((expr), #expr)
+#define BUILD_ASSERT(cond) \
+ do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
+
+#define EXPR_BUILD_ASSERT(cond) \
+ (sizeof(char [1 - 2*!(cond)]) - 1)
#if HAVE_TYPEOF
+#define check_type(expr, type) \
+ ((typeof(expr) *)0 != (type *)0)
+
#define check_types_match(expr1, expr2) \
((typeof(expr1) *)0 != (typeof(expr2) *)0)
#else
/* Without typeof, we can only test the sizes. */
+#define check_type(expr, type) \
+ EXPR_BUILD_ASSERT(sizeof(expr) == sizeof(type))
+
#define check_types_match(expr1, expr2) \
- assert_cc(sizeof(expr1) == sizeof(expr2))
+ EXPR_BUILD_ASSERT(sizeof(expr1) == sizeof(expr2))
#endif /* HAVE_TYPEOF */
#define container_of(member_ptr, containing_type, member) \
@@ -38,13 +49,26 @@
((char *)(member_ptr) - offsetof(containing_type, member)) \
- check_types_match(*(member_ptr), ((containing_type *)0)->member))
+/*
+ * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.
+ * @cond: the compile-time condition which must be true.
+ *
+ * Your compile will fail if the condition isn't true, or can't be evaluated
+ * by the compiler. This can be used in an expression: its value is "0".
+ *
+ * Example:
+ * #define foo_to_char(foo) \
+ * ((char *)(foo) \
+ * + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0))
+ */
+#define BUILD_ASSERT_OR_ZERO(cond) \
+ (sizeof(char [1 - 2*!(cond)]) - 1)
/* Two gcc extensions.
* &a[0] degrades to a pointer: a different type from an array */
-#define _array_size_chk(arr) ({ \
- assert_cc(!__builtin_types_compatible_p(typeof(arr), typeof(&(arr)[0]))); \
- 0; \
- })
+#define _array_size_chk(arr) \
+ BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(arr), \
+ typeof(&(arr)[0])))
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + _array_size_chk(arr))
@@ -54,7 +78,10 @@
/* Attributes */
-#define _must_check_ __attribute__((warn_unused_result))
-#define _printf_format_(a,b) __attribute__((format (printf, a, b)))
-#define _unused_ __attribute__((unused))
-#define _always_inline_ __inline__ __attribute__((always_inline))
+#define __must_check __attribute__((warn_unused_result))
+#define __printf_format(a,b) __attribute__((format (printf, a, b)))
+#if !defined(__always_inline)
+#define __always_inline __inline__ __attribute__((always_inline))
+#endif
+
+#endif
diff --git a/libkmod/missing.h b/libkmod/missing.h
deleted file mode 100644
index b45bbe2..0000000
--- a/libkmod/missing.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#pragma once
-
-#include <unistd.h>
-#include <sys/syscall.h>
-
-#ifdef HAVE_LINUX_MODULE_H
-#include <linux/module.h>
-#endif
-
-#ifndef MODULE_INIT_IGNORE_MODVERSIONS
-# define MODULE_INIT_IGNORE_MODVERSIONS 1
-#endif
-
-#ifndef MODULE_INIT_IGNORE_VERMAGIC
-# define MODULE_INIT_IGNORE_VERMAGIC 2
-#endif
-
-#ifndef __NR_finit_module
-# define __NR_finit_module -1
-#endif
-
-#ifndef HAVE_FINIT_MODULE
-#include <errno.h>
-
-static inline int finit_module(int fd, const char *uargs, int flags)
-{
- if (__NR_finit_module == -1) {
- errno = ENOSYS;
- return -1;
- }
-
- return syscall(__NR_finit_module, fd, uargs, flags);
-}
-#endif
diff --git a/m4/attributes.m4 b/m4/attributes.m4
index e822197..9d561c2 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -1,7 +1,6 @@
dnl Macros to check the presence of generic (non-typed) symbols.
dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
dnl Copyright (c) 2006-2008 xine project
-dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -33,56 +32,68 @@ dnl distribute a modified version of the Autoconf Macro, you may extend
dnl this special exception to the GPL to apply to your modified version as
dnl well.
-dnl Check if flag in a envvar is supported by compiler and append
-dnl "backup" variable
-dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG])
-AC_DEFUN([CC_CHECK_FLAG_APPEND], [
- AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
- AS_TR_SH([cc_cv_$2_$3]),
- [eval "AS_TR_SH([cc_save_$2])='${$2}'"
- eval "AS_TR_SH([$2])='-Werror $3'"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])],
- [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
- [eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
- eval "AS_TR_SH([$2])='$cc_save_$2'"])
-
- AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
- [eval "$1='${$1} $3'"])
-])
+dnl Check if the flag is supported by compiler
+dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
-dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
-AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
- for flag in $3; do
- CC_CHECK_FLAG_APPEND($1, $2, $flag)
- done
-])
+AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
+ AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])],
+ [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [$2], [$3])
+])
+dnl Check if the flag is supported by compiler (cacheable)
+dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
-dnl Check if the flag is supported by linker
-dnl CC_CHECK_LDFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
-AC_DEFUN([CC_CHECK_LDFLAGS_SILENT], [
- AC_CACHE_VAL(AS_TR_SH([cc_cv_ldflags_$1]),
- [ac_save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $1"
- AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
- [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
- [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
- LDFLAGS="$ac_save_LDFLAGS"
- ])
+AC_DEFUN([CC_CHECK_CFLAGS], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_cflags_$1]),
+ CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
+ )
- AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
[$2], [$3])
])
+dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found])
+dnl Check for CFLAG and appends them to CFLAGS if supported
+AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_cflags_$1]),
+ CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
+ )
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3])
+])
+
+dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])
+AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [
+ for flag in $1; do
+ CC_CHECK_CFLAG_APPEND($flag, [$2], [$3])
+ done
+])
+
dnl Check if the flag is supported by linker (cacheable)
dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
AC_DEFUN([CC_CHECK_LDFLAGS], [
AC_CACHE_CHECK([if $CC supports $1 flag],
AS_TR_SH([cc_cv_ldflags_$1]),
- CC_CHECK_LDFLAGS_SILENT([$1]) dnl Don't execute actions here!
- )
+ [ac_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $1"
+ AC_LINK_IFELSE([int main() { return 1; }],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
+ LDFLAGS="$ac_save_LDFLAGS"
+ ])
AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
[$2], [$3])
diff --git a/man/Makefile.am b/man/Makefile.am
index 12870bd..772ff7f 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -2,10 +2,6 @@ MAN5 = depmod.d.5 modprobe.d.5 modules.dep.5
MAN8 = depmod.8 insmod.8 lsmod.8 rmmod.8 modprobe.8 modinfo.8
MAN_STUB = modules.dep.bin.5
-AM_V_XSLT = $(AM_V_XSLT_$(V))
-AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
-AM_V_XSLT_0 = @echo " XSLT " $@;
-
if BUILD_TOOLS
dist_man_MANS = $(MAN5) $(MAN8) $(MAN_STUB)
modules.dep.bin.5: modules.dep.5
@@ -15,11 +11,10 @@ EXTRA_DIST = $(MAN5:%.5=%.xml) $(MAN8:%.8=%.xml)
XSLTPROC_FLAGS = \
--nonet \
- --stringparam man.output.quietly 1 \
--param funcsynopsis.style "'ansi'"
CLEANFILES = $(dist_man_MANS)
%.5 %.8: %.xml
- $(AM_V_XSLT)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+ $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
diff --git a/man/depmod.xml b/man/depmod.xml
index 5f71802..789f40d 100644
--- a/man/depmod.xml
+++ b/man/depmod.xml
@@ -101,11 +101,7 @@
<refsect1><title>OPTIONS</title>
<variablelist>
<varlistentry>
- <term>
- <option>-a</option>
- </term>
- <term>
- <option>--all</option>
+ <term><option>-a</option> <option>--all</option>
</term>
<listitem>
<para>
@@ -115,11 +111,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-A</option>
- </term>
- <term>
- <option>--quick</option>
+ <term><option>-A</option> <option>--quick</option>
</term>
<listitem>
<para>
@@ -132,8 +124,6 @@
<varlistentry>
<term>
<option>-b <replaceable>basedir</replaceable></option>
- </term>
- <term>
<option>--basedir <replaceable>basedir</replaceable></option>
</term>
<listitem>
@@ -151,11 +141,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-C</option>
- </term>
- <term>
- <option>--config <replaceable>file or directory</replaceable></option>
+ <term><option>-C</option> <option>--config <replaceable>file or directory</replaceable></option>
</term>
<listitem>
<para>
@@ -165,11 +151,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-e</option>
- </term>
- <term>
- <option>--errsyms</option>
+ <term><option>-e</option> <option>--errsyms</option>
</term>
<listitem>
<para>
@@ -184,11 +166,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-E</option>
- </term>
- <term>
- <option>--symvers</option>
+ <term><option>-E</option> <option>--symvers</option>
</term>
<listitem>
<para>
@@ -201,11 +179,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-F</option>
- </term>
- <term>
- <option>--filesyms <replaceable>System.map</replaceable></option>
+ <term><option>-F</option> <option>--filesyms <replaceable>System.map</replaceable></option>
</term>
<listitem>
<para>
@@ -217,11 +191,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-h</option>
- </term>
- <term>
- <option>--help</option>
+ <term><option>-h</option> <option>--help</option>
</term>
<listitem>
<para>
@@ -230,11 +200,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-n</option>
- </term>
- <term>
- <option>--dry-run</option>
+ <term><option>-n</option> <option>--dry-run</option>
</term>
<listitem>
<para>
@@ -244,8 +210,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-P</option>
+ <term><option>-P</option>
</term>
<listitem>
<para>
@@ -255,11 +220,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-v</option>
- </term>
- <term>
- <option>--verbose</option>
+ <term><option>-v</option> <option>--verbose</option>
</term>
<listitem>
<para>
@@ -270,11 +231,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-V</option>
- </term>
- <term>
- <option>--version</option>
+ <term><option>-V</option> <option>--version</option>
</term>
<listitem>
<para>
@@ -284,8 +241,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-w</option>
+ <term><option>-w</option>
</term>
<listitem>
<para>
diff --git a/man/modinfo.xml b/man/modinfo.xml
index 2a37852..f444e42 100644
--- a/man/modinfo.xml
+++ b/man/modinfo.xml
@@ -76,8 +76,6 @@
<varlistentry>
<term>
<option>-V</option>
- </term>
- <term>
<option>--version</option>
</term>
<listitem>
@@ -89,8 +87,6 @@
<varlistentry>
<term>
<option>-F</option>
- </term>
- <term>
<option>--field</option>
</term>
<listitem>
@@ -109,19 +105,6 @@
</varlistentry>
<varlistentry>
<term>
- <option>-b <replaceable>basedir</replaceable></option>
- </term>
- <term>
- <option>--basedir <replaceable>basedir</replaceable></option>
- </term>
- <listitem>
- <para>
- Root directory for modules, <filename>/</filename> by default.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
<option>-k <replaceable>kernel</replaceable></option>
</term>
<listitem>
@@ -138,8 +121,6 @@
<varlistentry>
<term>
<option>-0</option>
- </term>
- <term>
<option>--null</option>
</term>
<listitem>
@@ -153,31 +134,18 @@
<varlistentry>
<term>
<option>-a</option>
- <option>--author</option>
- </term>
- <term>
<option>-d</option>
- <option>--description</option>
- </term>
- <term>
<option>-l</option>
- <option>--license</option>
- </term>
- <term>
<option>-p</option>
- <option>--parameters</option>
- </term>
- <term>
<option>-n</option>
- <option>--filename</option>
</term>
<listitem>
<para>
- These are shortcuts for the <option>--field</option> flag's
- <literal>author</literal>, <literal>description</literal>,
- <literal>license</literal>, <literal>parm</literal> and
- <literal>filename</literal> arguments, to ease the transition
- from the old modutils <command>modinfo</command>.
+ These are shortcuts for <literal>author</literal>,
+ <literal>description</literal>, <literal>license</literal>.
+ <literal>parm</literal> and <literal>filename</literal>
+ respectively, to ease the transition from the old modutils
+ <command>modinfo</command>.
</para>
</listitem>
</varlistentry>
diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
index 7b0c298..dc19b23 100644
--- a/man/modprobe.d.xml
+++ b/man/modprobe.d.xml
@@ -40,7 +40,7 @@
</refnamediv>
<refsynopsisdiv>
- <para><filename>/lib/modprobe.d/*.conf</filename></para>
+ <para><filename>/usr/lib/modprobe.d/*.conf</filename></para>
<para><filename>/etc/modprobe.d/*.conf</filename></para>
<para><filename>/run/modprobe.d/*.conf</filename></para>
</refsynopsisdiv>
diff --git a/man/modprobe.xml b/man/modprobe.xml
index 5abb948..0b3b01d 100644
--- a/man/modprobe.xml
+++ b/man/modprobe.xml
@@ -80,14 +80,13 @@
<command>modprobe</command> looks in the module directory
<filename>/lib/modules/`uname -r`</filename> for all
the modules and other files, except for the optional
- configuration files in the
+ <filename>/etc/modprobe.conf</filename> configuration file and
<filename>/etc/modprobe.d</filename> directory
(see <citerefentry>
- <refentrytitle>modprobe.d</refentrytitle><manvolnum>5</manvolnum>
+ <refentrytitle>modprobe.conf</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>). <command>modprobe</command> will also use module
options specified on the kernel command line in the form of
- &lt;module&gt;.&lt;option&gt; and blacklists in the form of
- modprobe.blacklist=&lt;module&gt;.
+ &lt;module&gt;.&lt;option&gt;.
</para>
<para>
Note that unlike in 2.4 series Linux kernels (which are not supported
@@ -121,23 +120,13 @@
<refsect1><title>OPTIONS</title>
<variablelist>
<varlistentry>
- <term>
- <option>-a</option>
- </term>
- <term>
- <option>--all</option>
- </term>
+ <term><option>-a</option> <option>--all</option></term>
<listitem>
<para>Insert all module names on the command line.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-b</option>
- </term>
- <term>
- <option>--use-blacklist</option>
- </term>
+ <term><option>-b</option> <option>--use-blacklist</option></term>
<listitem>
<para>
This option causes <command>modprobe</command> to apply the
@@ -150,12 +139,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-C</option>
- </term>
- <term>
- <option>--config</option>
- </term>
+ <term><option>-C</option> <option>--config</option></term>
<listitem>
<para>This option overrides the default configuration directory
(<filename>/etc/modprobe.d</filename>).
@@ -169,12 +153,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-c</option>
- </term>
- <term>
- <option>--showconfig</option>
- </term>
+ <term><option>-c</option> <option>--showconfig</option></term>
<listitem>
<para>
Dump out the effective configuration from the config directory and
@@ -183,8 +162,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>--dump-modversions</option>
+ <term><option>--dump-modversions</option>
</term>
<listitem>
<para>
@@ -195,22 +173,17 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-d</option>
- </term>
- <term>
- <option>--dirname</option>
- </term>
+ <term><option>-d</option> <option>--dirname</option></term>
<listitem>
<para>
- Root directory for modules, <filename>/</filename> by default.
+ Directory where modules can be found,
+ <filename>/lib/modules/<replaceable>RELEASE</replaceable></filename>
+ by default.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>--first-time</option>
- </term>
+ <term><option>--first-time</option></term>
<listitem>
<para>
Normally, <command>modprobe</command> will succeed (and do
@@ -224,9 +197,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>--force-vermagic</option>
- </term>
+ <term><option>--force-vermagic</option></term>
<listitem>
<para>
Every module contains a small string containing important
@@ -243,9 +214,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>--force-modversion</option>
- </term>
+ <term><option>--force-modversion</option></term>
<listitem>
<para>
When modules are compiled with CONFIG_MODVERSIONS set, a section
@@ -264,12 +233,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-f</option>
- </term>
- <term>
- <option>--force</option>
- </term>
+ <term><option>-f</option> <option>--force</option></term>
<listitem>
<para>
Try to strip any versioning information from the module which might
@@ -288,11 +252,7 @@
<varlistentry>
<term>
<option>-i</option>
- </term>
- <term>
<option>--ignore-install</option>
- </term>
- <term>
<option>--ignore-remove</option>
</term>
<listitem>
@@ -315,11 +275,7 @@
<varlistentry>
<term>
<option>-n</option>
- </term>
- <term>
<option>--dry-run</option>
- </term>
- <term>
<option>--show</option>
</term>
<listitem>
@@ -336,8 +292,6 @@
<varlistentry>
<term>
<option>-q</option>
- </term>
- <term>
<option>--quiet</option>
</term>
<listitem>
@@ -355,8 +309,6 @@
<varlistentry>
<term>
<option>-R</option>
- </term>
- <term>
<option>--resolve-alias</option>
</term>
<listitem>
@@ -369,8 +321,6 @@
<varlistentry>
<term>
<option>-r</option>
- </term>
- <term>
<option>--remove</option>
</term>
<listitem>
@@ -392,8 +342,6 @@
<varlistentry>
<term>
<option>-S</option>
- </term>
- <term>
<option>--set-version</option>
</term>
<listitem>
@@ -427,8 +375,6 @@
<varlistentry>
<term>
<option>-s</option>
- </term>
- <term>
<option>--syslog</option>
</term>
<listitem>
@@ -449,8 +395,6 @@
<varlistentry>
<term>
<option>-V</option>
- </term>
- <term>
<option>--version</option>
</term>
<listitem>
@@ -460,8 +404,6 @@
<varlistentry>
<term>
<option>-v</option>
- </term>
- <term>
<option>--verbose</option>
</term>
<listitem>
diff --git a/man/rmmod.xml b/man/rmmod.xml
index 3605068..2dfe971 100644
--- a/man/rmmod.xml
+++ b/man/rmmod.xml
@@ -60,11 +60,7 @@
<refsect1><title>OPTIONS</title>
<variablelist>
<varlistentry>
- <term>
- <option>-v</option>
- </term>
- <term>
- <option>--verbose</option>
+ <term><option>-v</option> <option>--verbose</option>
</term>
<listitem>
<para>
@@ -75,11 +71,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-f</option>
- </term>
- <term>
- <option>--force</option>
+ <term><option>-f</option> <option>--force</option>
</term>
<listitem>
<para>
@@ -110,11 +102,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>
- <option>-s</option>
- </term>
- <term>
- <option>--syslog</option>
+ <term><option>-s</option> <option>--syslog</option>
</term>
<listitem>
<para>
diff --git a/test/WARNING b/test/WARNING
new file mode 100644
index 0000000..c5cfece
--- /dev/null
+++ b/test/WARNING
@@ -0,0 +1,3 @@
+Don't add new tests here. They are not built anymore on purpose and are being
+slowly migrated to testsuite dir. See testsuite/README in order to add new test
+cases.
diff --git a/test/test-blacklist.c b/test/test-blacklist.c
new file mode 100644
index 0000000..a53c902
--- /dev/null
+++ b/test/test-blacklist.c
@@ -0,0 +1,76 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+
+
+int main(int argc, char *argv[])
+{
+ const char *alias;
+ struct kmod_ctx *ctx;
+ struct kmod_list *list = NULL, *l;
+ int err;
+
+ printf("libkmod version %s\n", VERSION);
+
+ if (argc < 2) {
+ fprintf(stderr, "ERR: Provide an alias name\n");
+ return EXIT_FAILURE;
+ }
+
+ alias = argv[1];
+
+ ctx = kmod_new(NULL, NULL);
+ if (ctx == NULL)
+ exit(EXIT_FAILURE);
+
+ err = kmod_module_new_from_lookup(ctx, alias, &list);
+ if (err < 0)
+ goto fail_lookup;
+
+ if (list == NULL)
+ printf("No module matches '%s'\n", alias);
+ else
+ printf("Alias: '%s'\nModules matching:\n", alias);
+
+ kmod_list_foreach(l, list) {
+ struct kmod_module *mod = kmod_module_get_module(l);
+ printf("\t%s\n", kmod_module_get_name(mod));
+ kmod_module_unref(mod);
+ }
+
+ if (list != NULL) {
+ struct kmod_list *filtered;
+ err = kmod_module_get_filtered_blacklist(ctx, list, &filtered);
+ if (err < 0) {
+ printf("Could not filter: %s\n", strerror(-err));
+ goto fail;
+ }
+ if (filtered == NULL)
+ printf("All modules were filtered out!\n");
+ else
+ printf("Modules remaining after filter:\n");
+
+ kmod_list_foreach(l, filtered) {
+ struct kmod_module *mod = kmod_module_get_module(l);
+ printf("\t%s\n", kmod_module_get_name(mod));
+ kmod_module_unref(mod);
+ }
+ kmod_module_unref_list(filtered);
+ }
+
+ kmod_module_unref_list(list);
+ kmod_unref(ctx);
+
+ return EXIT_SUCCESS;
+
+fail:
+ kmod_module_unref_list(list);
+fail_lookup:
+ kmod_unref(ctx);
+ return EXIT_FAILURE;
+}
diff --git a/test/test-elf.c b/test/test-elf.c
new file mode 100644
index 0000000..23dd1fd
--- /dev/null
+++ b/test/test-elf.c
@@ -0,0 +1,106 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+#include <getopt.h>
+
+int main(int argc, char *argv[])
+{
+ struct kmod_ctx *ctx;
+ struct kmod_module *mod;
+ struct kmod_list *list, *l;
+ int err;
+
+ printf("libkmod version %s\n", VERSION);
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage:\n\t%s <module-path.ko>\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ ctx = kmod_new(NULL, NULL);
+ if (ctx == NULL)
+ return EXIT_FAILURE;
+
+ err = kmod_module_new_from_path(ctx, argv[1], &mod);
+ if (err < 0) {
+ fprintf(stderr, "ERROR: could not load %s: %s\n",
+ argv[1], strerror(-errno));
+ goto module_error;
+ }
+
+ list = NULL;
+ err = kmod_module_get_info(mod, &list);
+ if (err <= 0)
+ printf("no information! (%s)\n", strerror(-err));
+ else {
+ puts("info:");
+ kmod_list_foreach(l, list) {
+ const char *key, *val;
+ key = kmod_module_info_get_key(l);
+ val = kmod_module_info_get_value(l);
+ printf("\t%s: %s\n", key, val ? val : "");
+ }
+ kmod_module_info_free_list(list);
+ }
+
+ list = NULL;
+ err = kmod_module_get_versions(mod, &list);
+ if (err <= 0)
+ printf("no modversions! (%s)\n", strerror(-err));
+ else {
+ puts("modversions:");
+ kmod_list_foreach(l, list) {
+ const char *symbol;
+ uint64_t crc;
+ symbol = kmod_module_version_get_symbol(l);
+ crc = kmod_module_version_get_crc(l);
+ printf("\t%s: %#"PRIx64"\n", symbol, crc);
+ }
+ kmod_module_versions_free_list(list);
+ }
+
+ list = NULL;
+ err = kmod_module_get_symbols(mod, &list);
+ if (err <= 0)
+ printf("no symbols! (%s)\n", strerror(-err));
+ else {
+ puts("symbols:");
+ kmod_list_foreach(l, list) {
+ const char *symbol;
+ uint64_t crc;
+ symbol = kmod_module_symbol_get_symbol(l);
+ crc = kmod_module_symbol_get_crc(l);
+ printf("\t%s: %#"PRIx64"\n", symbol, crc);
+ }
+ kmod_module_symbols_free_list(list);
+ }
+
+ list = NULL;
+ err = kmod_module_get_dependency_symbols(mod, &list);
+ if (err <= 0)
+ printf("no dependency symbols! (%s)\n", strerror(-err));
+ else {
+ puts("dependency symbols:");
+ kmod_list_foreach(l, list) {
+ const char *symbol;
+ uint8_t bind;
+ uint64_t crc;
+ symbol = kmod_module_dependency_symbol_get_symbol(l);
+ bind = kmod_module_dependency_symbol_get_bind(l);
+ crc = kmod_module_dependency_symbol_get_crc(l);
+ printf("\t%s %c: %#"PRIx64"\n", symbol, bind, crc);
+ }
+ kmod_module_dependency_symbols_free_list(list);
+ }
+
+ kmod_module_unref(mod);
+module_error:
+ kmod_unref(ctx);
+
+ return (err < 0) ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/test/test-get-dependencies.c b/test/test-get-dependencies.c
new file mode 100644
index 0000000..3a7bbf2
--- /dev/null
+++ b/test/test-get-dependencies.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+
+
+int main(int argc, char *argv[])
+{
+ const char *name;
+ struct kmod_ctx *ctx;
+ struct kmod_module *mod;
+ struct kmod_list *list, *l;
+ int err;
+
+ printf("libkmod version %s\n", VERSION);
+
+ if (argc < 2) {
+ fprintf(stderr, "ERR: Provide a module name\n");
+ return EXIT_FAILURE;
+ }
+
+ name = argv[1];
+
+ ctx = kmod_new(NULL, NULL);
+ if (ctx == NULL)
+ exit(EXIT_FAILURE);
+
+ err = kmod_module_new_from_name(ctx, name, &mod);
+ if (err < 0) {
+ kmod_unref(ctx);
+ exit(EXIT_FAILURE);
+ }
+
+ list = kmod_module_get_dependencies(mod);
+ printf("Module: %s\nDependency list:\n", name);
+
+ kmod_list_foreach(l, list) {
+ struct kmod_module *m = kmod_module_get_module(l);
+ printf("\t%s\n", kmod_module_get_name(m));
+ kmod_module_unref(m);
+ }
+
+ kmod_module_unref_list(list);
+ kmod_module_unref(mod);
+ kmod_unref(ctx);
+
+ return EXIT_SUCCESS;
+}
diff --git a/test/test-invalidate-config.c b/test/test-invalidate-config.c
new file mode 100644
index 0000000..52370c8
--- /dev/null
+++ b/test/test-invalidate-config.c
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+
+static const char *config[] = {
+ NULL,
+ NULL,
+};
+
+int main(int argc, char *argv[])
+{
+ struct kmod_ctx *ctx;
+ int r;
+ char cmd[4096];
+
+ if (argc < 2) {
+ fprintf(stderr, "Provide a path to config\n");
+ return EXIT_FAILURE;
+ }
+
+ config[0] = argv[1];
+
+ ctx = kmod_new(NULL, config);
+ if (ctx == NULL)
+ exit(EXIT_FAILURE);
+
+ r = kmod_validate_resources(ctx);
+ if (r != KMOD_RESOURCES_OK) {
+ fprintf(stderr, "ERR: return should be 'resources ok'\n");
+ return EXIT_FAILURE;
+ }
+
+ snprintf(cmd, sizeof(cmd), "touch %s", config[0]);
+ system(cmd);
+ r = kmod_validate_resources(ctx);
+ if (r != KMOD_RESOURCES_MUST_RECREATE) {
+ fprintf(stderr, "ERR: return should be 'must recreate'\n");
+ return EXIT_FAILURE;
+ }
+
+ kmod_unref(ctx);
+
+ return EXIT_SUCCESS;
+}
diff --git a/test/test-lookup.c b/test/test-lookup.c
new file mode 100644
index 0000000..70cdb5c
--- /dev/null
+++ b/test/test-lookup.c
@@ -0,0 +1,184 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+#include <getopt.h>
+
+static const char cmdoptions_short[] = "lh";
+static const struct option cmdoptions[] = {
+ {"load-resources", no_argument, 0, 'l'},
+ {"help", no_argument, 0, 'h'},
+ {NULL, 0, 0, 0}
+};
+
+static void help(const char *progname)
+{
+ const struct option *itr_opt;
+ const char *itr_short;
+ printf("Usage:\n"
+ "\t%s [options] <name-to-lookup>\n"
+ "Options:\n",
+ progname);
+ for (itr_opt = cmdoptions, itr_short = cmdoptions_short;
+ itr_opt->name != NULL; itr_opt++, itr_short++)
+ printf("\t-%c, --%s\n", *itr_short, itr_opt->name);
+}
+
+int main(int argc, char *argv[])
+{
+ const char *alias = NULL;
+ struct kmod_ctx *ctx;
+ struct kmod_list *list = NULL, *l;
+ int load_resources = 0;
+ int err;
+
+ printf("libkmod version %s\n", VERSION);
+
+ for (;;) {
+ int c, idx = 0;
+ c = getopt_long(argc, argv, cmdoptions_short, cmdoptions, &idx);
+ if (c == -1)
+ break;
+ switch (c) {
+ case 'l':
+ load_resources = 1;
+ break;
+ case 'h':
+ help(argv[0]);
+ return 0;
+ case '?':
+ return -1;
+ default:
+ fprintf(stderr,
+ "ERR: unexpected getopt_long() value %c\n", c);
+ return -1;
+ }
+ }
+
+ if (optind >= argc) {
+ fprintf(stderr, "ERR: Provide an alias name\n");
+ return EXIT_FAILURE;
+ }
+
+ alias = argv[optind];
+
+ ctx = kmod_new(NULL, NULL);
+ if (ctx == NULL) {
+ kmod_unref(ctx);
+ exit(EXIT_FAILURE);
+ }
+
+ if (load_resources) {
+ err = kmod_load_resources(ctx);
+ if (err < 0) {
+ printf("Could not load resources: %s\n",
+ strerror(-err));
+ kmod_unref(ctx);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ err = kmod_module_new_from_lookup(ctx, alias, &list);
+ if (err < 0)
+ exit(EXIT_FAILURE);
+
+ if (list == NULL)
+ printf("No module matches '%s'\n", alias);
+ else
+ printf("Alias: '%s'\nModules matching:\n", alias);
+
+ kmod_list_foreach(l, list) {
+ struct kmod_list *d, *pre = NULL, *post = NULL;
+ struct kmod_module *mod = kmod_module_get_module(l);
+ const char *str;
+
+ printf("\t%s\n", kmod_module_get_name(mod));
+ str = kmod_module_get_options(mod);
+ if (str)
+ printf("\t\toptions: '%s'\n", str);
+ str = kmod_module_get_install_commands(mod);
+ if (str)
+ printf("\t\tinstall commands: '%s'\n", str);
+ str = kmod_module_get_remove_commands(mod);
+ if (str)
+ printf("\t\tremove commands: '%s'\n", str);
+
+ err = kmod_module_get_softdeps(mod, &pre, &post);
+ if (err == 0) {
+ if (pre != NULL || post != NULL)
+ puts("\t\tsoft dependencies:");
+ if (pre != NULL) {
+ fputs("\t\t\tpre:", stdout);
+ kmod_list_foreach(d, pre) {
+ struct kmod_module *dm = kmod_module_get_module(d);
+ printf(" %s", kmod_module_get_name(dm));
+ kmod_module_unref(dm);
+ }
+ putchar('\n');
+ kmod_module_unref_list(pre);
+ }
+ if (post != NULL) {
+ fputs("\t\t\tpost:", stdout);
+ kmod_list_foreach(d, post) {
+ struct kmod_module *dm = kmod_module_get_module(d);
+ printf(" %s", kmod_module_get_name(dm));
+ kmod_module_unref(dm);
+ }
+ putchar('\n');
+ kmod_module_unref_list(post);
+ }
+ }
+
+ pre = NULL;
+ err = kmod_module_get_info(mod, &pre);
+ if (err > 0) {
+ puts("\t\tmodinfo:");
+ kmod_list_foreach(d, pre) {
+ const char *key, *val;
+ key = kmod_module_info_get_key(d);
+ val = kmod_module_info_get_value(d);
+ printf("\t\t\t%s: %s\n", key, val ? val : "");
+ }
+ kmod_module_info_free_list(pre);
+ }
+
+ pre = NULL;
+ err = kmod_module_get_versions(mod, &pre);
+ if (err > 0) {
+ puts("\t\tmodversions:");
+ kmod_list_foreach(d, pre) {
+ const char *symbol;
+ uint64_t crc;
+ symbol = kmod_module_version_get_symbol(d);
+ crc = kmod_module_version_get_crc(d);
+ printf("\t\t\t%s: %#"PRIx64"\n", symbol, crc);
+ }
+ kmod_module_versions_free_list(pre);
+ }
+
+ pre = NULL;
+ err = kmod_module_get_symbols(mod, &pre);
+ if (err > 0) {
+ puts("\t\tsymbols:");
+ kmod_list_foreach(d, pre) {
+ const char *symbol;
+ uint64_t crc;
+ symbol = kmod_module_symbol_get_symbol(d);
+ crc = kmod_module_symbol_get_crc(d);
+ printf("\t\t\t%s: %#"PRIx64"\n", symbol, crc);
+ }
+ kmod_module_symbols_free_list(pre);
+ }
+
+ kmod_module_unref(mod);
+ }
+
+ kmod_module_unref_list(list);
+ kmod_unref(ctx);
+
+ return EXIT_SUCCESS;
+}
diff --git a/test/test-mod-double-ref.c b/test/test-mod-double-ref.c
new file mode 100644
index 0000000..9033247
--- /dev/null
+++ b/test/test-mod-double-ref.c
@@ -0,0 +1,78 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+
+
+int main(int argc, char *argv[])
+{
+ struct kmod_ctx *ctx;
+ struct kmod_module *mod1, *mod2;
+ const char *modname;
+ int err;
+
+ if (argc < 2) {
+ fprintf(stderr, "ERR: Provide an alias name\n");
+ return EXIT_FAILURE;
+ }
+
+ modname = argv[1];
+
+ ctx = kmod_new(NULL, NULL);
+ if (ctx == NULL)
+ exit(EXIT_FAILURE);
+
+ printf("libkmod version %s\n", VERSION);
+
+ err = kmod_module_new_from_name(ctx, modname, &mod1);
+ if (err < 0) {
+ fprintf(stderr, "error creating module: '%s'\n", strerror(-err));
+ goto fail;
+ }
+
+ printf("modname='%s' obj=%p\n", modname, mod1);
+
+ err = kmod_module_new_from_name(ctx, modname, &mod2);
+ if (err < 0) {
+ fprintf(stderr, "error creating module: '%s'\n", strerror(-err));
+ goto fail;
+ }
+
+ printf("modname='%s' obj=%p\n", modname, mod2);
+
+ kmod_module_unref(mod1);
+ kmod_module_unref(mod2);
+
+ /* same thing, but now unref the first module */
+
+ err = kmod_module_new_from_name(ctx, modname, &mod1);
+ if (err < 0) {
+ fprintf(stderr, "error creating module: '%s'\n", strerror(-err));
+ goto fail;
+ }
+
+ printf("modname='%s' obj=%p\n", modname, mod1);
+
+ kmod_module_unref(mod1);
+
+ err = kmod_module_new_from_name(ctx, modname, &mod2);
+ if (err < 0) {
+ fprintf(stderr, "error creating module: '%s'\n", strerror(-err));
+ goto fail;
+ }
+
+ printf("modname='%s' obj=%p\n", modname, mod2);
+
+ kmod_module_unref(mod2);
+ kmod_unref(ctx);
+
+ return EXIT_SUCCESS;
+
+fail:
+ kmod_unref(ctx);
+ return EXIT_FAILURE;
+}
diff --git a/test/test-path-from-name.c b/test/test-path-from-name.c
new file mode 100644
index 0000000..3f3d568
--- /dev/null
+++ b/test/test-path-from-name.c
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+
+
+int main(int argc, char *argv[])
+{
+ struct kmod_ctx *ctx;
+ struct kmod_module *mod;
+ const char *path, *modname;
+ int err;
+
+ if (argc < 2) {
+ fprintf(stderr, "ERR: Provide an alias name\n");
+ return EXIT_FAILURE;
+ }
+
+ modname = argv[1];
+
+ ctx = kmod_new(NULL, NULL);
+ if (ctx == NULL)
+ exit(EXIT_FAILURE);
+
+ printf("libkmod version %s\n", VERSION);
+
+ err = kmod_module_new_from_name(ctx, modname, &mod);
+ if (err < 0) {
+ fprintf(stderr, "error creating module: '%s'\n", strerror(-err));
+ goto fail;
+ }
+
+ path = kmod_module_get_path(mod);
+
+ printf("modname: '%s' path: '%s'\n", modname, path);
+ kmod_module_unref(mod);
+ kmod_unref(ctx);
+
+ return EXIT_SUCCESS;
+
+fail:
+ kmod_unref(ctx);
+ return EXIT_FAILURE;
+}
diff --git a/test/test-probe.c b/test/test-probe.c
new file mode 100644
index 0000000..c68a783
--- /dev/null
+++ b/test/test-probe.c
@@ -0,0 +1,118 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <libkmod.h>
+#include <getopt.h>
+
+static const char cmdoptions_short[] = "lh";
+static const struct option cmdoptions[] = {
+ {"load-resources", no_argument, 0, 'l'},
+ {"help", no_argument, 0, 'h'},
+ {NULL, 0, 0, 0}
+};
+
+static void help(const char *progname)
+{
+ const struct option *itr_opt;
+ const char *itr_short;
+ printf("Usage:\n"
+ "\t%s [options] <module> [ module_options ]\n"
+ "Options:\n",
+ progname);
+ for (itr_opt = cmdoptions, itr_short = cmdoptions_short;
+ itr_opt->name != NULL; itr_opt++, itr_short++)
+ printf("\t-%c, --%s\n", *itr_short, itr_opt->name);
+}
+
+int main(int argc, char *argv[])
+{
+ const char *alias;
+ const char *opt;
+ struct kmod_ctx *ctx;
+ struct kmod_list *list = NULL, *l;
+ int load_resources = 0;
+ int err;
+
+ printf("libkmod version %s\n", VERSION);
+
+ for (;;) {
+ int c, idx = 0;
+ c = getopt_long(argc, argv, cmdoptions_short, cmdoptions, &idx);
+ if (c == -1)
+ break;
+ switch (c) {
+ case 'l':
+ load_resources = 1;
+ break;
+ case 'h':
+ help(argv[0]);
+ return 0;
+ case '?':
+ return -1;
+ default:
+ fprintf(stderr,
+ "ERR: unexpected getopt_long() value %c\n", c);
+ return -1;
+ }
+ }
+
+ if (optind >= argc) {
+ fprintf(stderr, "ERR: Provide an alias name\n");
+ return EXIT_FAILURE;
+ }
+
+ alias = argv[optind++];
+
+ if (optind < argc)
+ opt = argv[optind];
+ else
+ opt = NULL;
+
+ ctx = kmod_new(NULL, NULL);
+ if (ctx == NULL) {
+ kmod_unref(ctx);
+ exit(EXIT_FAILURE);
+ }
+
+ if (load_resources) {
+ err = kmod_load_resources(ctx);
+ if (err < 0) {
+ printf("Could not load resources: %s\n",
+ strerror(-err));
+ kmod_unref(ctx);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ err = kmod_module_new_from_lookup(ctx, alias, &list);
+ if (err < 0)
+ exit(EXIT_FAILURE);
+
+ if (list == NULL)
+ printf("No module matches '%s'\n", alias);
+ else
+ printf("Alias: '%s'\nModules matching:\n", alias);
+
+ kmod_list_foreach(l, list) {
+ struct kmod_module *mod = kmod_module_get_module(l);
+
+ printf("\t%s", kmod_module_get_name(mod));
+
+ err = kmod_module_probe_insert_module(mod, 0, opt, NULL, NULL);
+ if (err >=0 )
+ printf(": inserted ok\n");
+ else
+ printf(": failed to insert\n");
+
+ kmod_module_unref(mod);
+ }
+
+ kmod_module_unref_list(list);
+ kmod_unref(ctx);
+
+ return EXIT_SUCCESS;
+}
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.builtin b/test/test.conf
index e69de29..e69de29 100644
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.builtin
+++ b/test/test.conf
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 71f34cc..7b71048 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -2,35 +2,11 @@
*.la
*.so
/.dirstamp
+/rootfs/
/test-alias
-/test-blacklist
-/test-dependencies
-/test-depmod
/test-init
/test-loaded
/test-modinfo
/test-new-module
/test-testsuite
/test-modprobe
-/rootfs
-/stamp-rootfs
-/test-alias.log
-/test-alias.trs
-/test-blacklist.log
-/test-blacklist.trs
-/test-dependencies.log
-/test-dependencies.trs
-/test-depmod.log
-/test-depmod.trs
-/test-init.log
-/test-init.trs
-/test-loaded.log
-/test-loaded.trs
-/test-modinfo.log
-/test-modinfo.trs
-/test-modprobe.log
-/test-modprobe.trs
-/test-new-module.log
-/test-new-module.trs
-/test-testsuite.log
-/test-testsuite.trs
diff --git a/testsuite/COPYING b/testsuite/COPYING
deleted file mode 100644
index 8add30a..0000000
--- a/testsuite/COPYING
+++ /dev/null
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/testsuite/delete_module.c b/testsuite/delete_module.c
index 9718894..9e4fba4 100644
--- a/testsuite/delete_module.c
+++ b/testsuite/delete_module.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
diff --git a/testsuite/init_module.c b/testsuite/init_module.c
index dad66e5..7141566 100644
--- a/testsuite/init_module.c
+++ b/testsuite/init_module.c
@@ -1,28 +1,21 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
- * Copyright (C) 2012-2013 Lucas De Marchi <lucas.de.marchi@gmail.com>
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef HAVE_FINIT_MODULE
-#define HAVE_FINIT_MODULE 1
-#endif
-
#include <assert.h>
-#include <elf.h>
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
@@ -33,10 +26,8 @@
#include <stddef.h>
#include <string.h>
#include <stdio.h>
-#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/syscall.h>
#include <unistd.h>
/* kmod_elf_get_section() is not exported, we need the private header */
@@ -44,7 +35,6 @@
/* FIXME: hack, change name so we don't clash */
#undef ERR
-#include "mkdir.h"
#include "testsuite.h"
#include "stripped-module.h"
@@ -57,7 +47,6 @@ struct mod {
static struct mod *modules;
static bool need_init = true;
-static struct kmod_ctx *ctx;
static void parse_retcodes(struct mod *_modules, const char *s)
{
@@ -113,61 +102,12 @@ static void parse_retcodes(struct mod *_modules, const char *s)
}
}
-static int write_one_line_file(const char *fn, const char *line, int len)
-{
- FILE *f;
- int r;
-
- assert(fn);
- assert(line);
-
- f = fopen(fn, "we");
- if (!f)
- return -errno;
-
- errno = 0;
- if (fputs(line, f) < 0) {
- r = -errno;
- goto finish;
- }
-
- fflush(f);
-
- if (ferror(f)) {
- if (errno != 0)
- r = -errno;
- else
- r = -EIO;
- } else
- r = 0;
-
-finish:
- fclose(f);
- return r;
-}
-
-static int create_sysfs_files(const char *modname)
-{
- char buf[PATH_MAX];
- const char *sysfsmod = "/sys/module/";
- int len = strlen(sysfsmod);
-
- memcpy(buf, sysfsmod, len);
- strcpy(buf + len, modname);
- len += strlen(modname);
-
- assert(mkdir_p(buf, 0755) >= 0);
-
- strcpy(buf + len, "/initstate");
- return write_one_line_file(buf, "live\n", strlen("live\n"));
-}
-
static struct mod *find_module(struct mod *_modules, const char *modname)
{
struct mod *mod;
for (mod = _modules; mod != NULL; mod = mod->next) {
- if (strcmp(mod->name, modname) == 0)
+ if (strcmp(mod->name, modname))
return mod;
}
@@ -188,49 +128,16 @@ static void init_retcodes(void)
S_TC_INIT_MODULE_RETCODES);
}
- ctx = kmod_new(NULL, NULL);
-
parse_retcodes(modules, s);
}
-static inline bool module_is_inkernel(const char *modname)
-{
- struct kmod_module *mod;
- int state;
- bool ret;
-
- if (kmod_module_new_from_name(ctx, modname, &mod) < 0)
- return false;
-
- state = kmod_module_get_initstate(mod);
-
- if (state == KMOD_MODULE_LIVE ||
- state == KMOD_MODULE_BUILTIN)
- ret = true;
- else
- ret = false;
-
- kmod_module_unref(mod);
-
- return ret;
-}
-
-static uint8_t elf_identify(void *mem)
-{
- uint8_t *p = mem;
- return p[EI_CLASS];
-}
-
TS_EXPORT long init_module(void *mem, unsigned long len, const char *args);
/*
- * Default behavior is to try to mimic init_module behavior inside the kernel.
- * If it is a simple test that you know the error code, set the return code
- * in TESTSUITE_INIT_MODULE_RETCODES env var instead.
+ * FIXME: change /sys/module/<modname> to fake-insert a module
*
- * The exception is when the module name is not find in the memory passed.
- * This is because we want to be able to pass dummy modules (and not real
- * ones) and it still work.
+ * Default behavior is to exit successfully. If this is not the intended
+ * behavior, set TESTSUITE_INIT_MODULE_RETCODES env var.
*/
long init_module(void *mem, unsigned long len, const char *args)
{
@@ -240,8 +147,6 @@ long init_module(void *mem, unsigned long len, const char *args)
const void *buf;
uint64_t bufsize;
int err;
- uint8_t class;
- off_t offset;
init_retcodes();
@@ -253,89 +158,20 @@ long init_module(void *mem, unsigned long len, const char *args)
&bufsize);
kmod_elf_unref(elf);
- /* We couldn't parse the ELF file. Just exit as if it was successful */
+ /*
+ * We couldn't find the module's name inside the ELF file. Just exit
+ * as if it was successful
+ */
if (err < 0)
return 0;
- /* We need to open both 32 and 64 bits module - hack! */
- class = elf_identify(mem);
- if (class == ELFCLASS64)
- offset = MODULE_NAME_OFFSET_64;
- else
- offset = MODULE_NAME_OFFSET_32;
-
- modname = (char *)buf + offset;
+ modname = (char *)buf + offsetof(struct module, name);
mod = find_module(modules, modname);
- if (mod != NULL) {
- errno = mod->errcode;
- err = mod->ret;
- } else if (module_is_inkernel(modname)) {
- err = -1;
- errno = EEXIST;
- } else
- err = 0;
-
- if (err == 0)
- create_sysfs_files(modname);
-
- return err;
-}
-
-TS_EXPORT int finit_module(const int fd, const char *args, const int flags);
-
-int finit_module(const int fd, const char *args, const int flags)
-{
- int err;
- void *mem;
- unsigned long len;
- struct stat st;
-
- if (fstat(fd, &st) < 0)
- return -1;
-
- len = st.st_size;
- mem = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
- if (mem == MAP_FAILED)
- return -1;
-
- err = init_module(mem, len, args);
- munmap(mem, len);
-
- return err;
-}
-
-TS_EXPORT long int syscall(long int __sysno, ...)
-{
- va_list ap;
- long ret;
-
- if (__sysno == -1) {
- errno = ENOSYS;
- return -1;
- }
-
- if (__sysno == __NR_finit_module) {
- const char *args;
- int flags;
- int fd;
-
- va_start(ap, __sysno);
-
- fd = va_arg(ap, int);
- args = va_arg(ap, const char *);
- flags = va_arg(ap, int);
-
- ret = finit_module(fd, args, flags);
-
- va_end(ap);
- return ret;
- }
+ if (mod == NULL)
+ return 0;
- /*
- * FIXME: no way to call the libc function - let's hope there are no
- * other users.
- */
- abort();
+ errno = mod->errcode;
+ return mod->ret;
}
/* the test is going away anyway, but lets keep valgrind happy */
@@ -347,7 +183,4 @@ void free_resources(void)
free(modules);
modules = mod;
}
-
- if (ctx)
- kmod_unref(ctx);
}
diff --git a/testsuite/mkdir.c b/testsuite/mkdir.c
deleted file mode 100644
index 0a7de69..0000000
--- a/testsuite/mkdir.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "mkdir.h"
-#include "testsuite.h"
-
-TS_EXPORT int mkdir_p(const char *path, mode_t mode)
-{
- char *start = strdupa(path);
- int len = strlen(path);
- char *end = start + len;
- struct stat st;
-
- /*
- * scan backwards, replacing '/' with '\0' while the component doesn't
- * exist
- */
- for (;;) {
- if (stat(start, &st) >= 0) {
- if (S_ISDIR(st.st_mode))
- break;
- return -ENOTDIR;
- }
-
- /* Find the next component, backwards, discarding extra '/'*/
- for (; end != start && *end != '/'; end--)
- ;
-
- for (; end != start - 1 && *end == '/'; end--)
- ;
-
- end++;
- if (end == start)
- break;
-
- *end = '\0';
- }
-
- if (end == start + len)
- return 0;
-
- for (; end < start + len;) {
- *end = '/';
- end += strlen(end);
-
- if (mkdir(start, mode) < 0)
- return -errno;
- }
-
- return 0;
-}
diff --git a/testsuite/mkdir.h b/testsuite/mkdir.h
deleted file mode 100644
index 35f6a1d..0000000
--- a/testsuite/mkdir.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#pragma once
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-int mkdir_p(const char *path, mode_t mode);
diff --git a/testsuite/path.c b/testsuite/path.c
index f87f5c5..60df4a0 100644
--- a/testsuite/path.c
+++ b/testsuite/path.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
@@ -95,109 +94,122 @@ static void *get_libc_func(const char *f)
return fp;
}
-/* wrapper template for a function with one "const char* path" argument */
-#define WRAP_1ARG(rettype, failret, name) \
-TS_EXPORT rettype name(const char *path) \
-{ \
- const char *p; \
- char buf[PATH_MAX * 2]; \
- static rettype (*_fn)(const char*); \
- \
- if (!get_rootpath(__func__)) \
- return failret; \
- _fn = get_libc_func(#name); \
- p = trap_path(path, buf); \
- if (p == NULL) \
- return failret; \
- return (*_fn)(p); \
-}
+TS_EXPORT FILE *fopen(const char *path, const char *mode)
+{
+ const char *p;
+ char buf[PATH_MAX * 2];
+ static FILE* (*_fopen)(const char *path, const char *mode);
-/* wrapper template for a function with "const char* path" and another argument */
-#define WRAP_2ARGS(rettype, failret, name, arg2t) \
-TS_EXPORT rettype name(const char *path, arg2t arg2) \
-{ \
- const char *p; \
- char buf[PATH_MAX * 2]; \
- static rettype (*_fn)(const char*, arg2t arg2); \
- \
- if (!get_rootpath(__func__)) \
- return failret; \
- _fn = get_libc_func(#name); \
- p = trap_path(path, buf); \
- if (p == NULL) \
- return failret; \
- return (*_fn)(p, arg2); \
-}
+ if (!get_rootpath(__func__))
+ return NULL;
+
+ _fopen = get_libc_func("fopen");
-/* wrapper template for open family */
-#define WRAP_OPEN(suffix) \
-TS_EXPORT int open ## suffix (const char *path, int flags, ...) \
-{ \
- const char *p; \
- char buf[PATH_MAX * 2]; \
- static int (*_fn)(const char *path, int flags, ...); \
- \
- if (!get_rootpath(__func__)) \
- return -1; \
- _fn = get_libc_func("open" #suffix); \
- p = trap_path(path, buf); \
- if (p == NULL) \
- return -1; \
- \
- if (flags & O_CREAT) { \
- mode_t mode; \
- va_list ap; \
- \
- va_start(ap, flags); \
- mode = va_arg(ap, mode_t); \
- va_end(ap); \
- return _fn(p, flags, mode); \
- } \
- \
- return _fn(p, flags); \
+ p = trap_path(path, buf);
+ if (p == NULL)
+ return NULL;
+
+ return (*_fopen)(p, mode);
}
-/* wrapper template for __xstat family */
-#define WRAP_VERSTAT(prefix, suffix) \
-TS_EXPORT int prefix ## stat ## suffix (int ver, \
- const char *path, \
- struct stat ## suffix *st) \
-{ \
- const char *p; \
- char buf[PATH_MAX * 2]; \
- static int (*_fn)(int ver, const char *path, \
- struct stat ## suffix *); \
- _fn = get_libc_func(#prefix "stat" #suffix); \
- \
- if (!get_rootpath(__func__)) \
- return -1; \
- p = trap_path(path, buf); \
- if (p == NULL) \
- return -1; \
- \
- return _fn(ver, p, st); \
+TS_EXPORT int open(const char *path, int flags, ...)
+{
+ const char *p;
+ char buf[PATH_MAX * 2];
+ static int (*_open)(const char *path, int flags, ...);
+
+ if (!get_rootpath(__func__))
+ return -1;
+
+ _open = get_libc_func("open");
+ p = trap_path(path, buf);
+ if (p == NULL)
+ return -1;
+
+ if (flags & O_CREAT) {
+ mode_t mode;
+ va_list ap;
+
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+ _open(p, flags, mode);
+ }
+
+ return _open(p, flags);
}
-WRAP_1ARG(DIR*, NULL, opendir);
-
-WRAP_2ARGS(FILE*, NULL, fopen, const char*);
-WRAP_2ARGS(int, -1, mkdir, mode_t);
-WRAP_2ARGS(int, -1, access, int);
-WRAP_2ARGS(int, -1, stat, struct stat*);
-WRAP_2ARGS(int, -1, lstat, struct stat*);
-#ifndef _FILE_OFFSET_BITS
-WRAP_2ARGS(int, -1, stat64, struct stat64*);
-WRAP_2ARGS(int, -1, lstat64, struct stat64*);
-WRAP_OPEN(64);
-#endif
+TS_EXPORT int stat(const char *path, struct stat *st)
+{
+ const char *p;
+ char buf[PATH_MAX * 2];
+ static int (*_stat)(const char *path, struct stat *buf);
+
+ if (!get_rootpath(__func__))
+ return -1;
+
+ _stat = get_libc_func("stat");
+
+ p = trap_path(path, buf);
+ if (p == NULL)
+ return -1;
-WRAP_OPEN();
+ return _stat(p, st);
+}
#ifdef HAVE___XSTAT
-WRAP_VERSTAT(__x,);
-WRAP_VERSTAT(__lx,);
-#ifndef _FILE_OFFSET_BITS
-WRAP_VERSTAT(__x,64);
-WRAP_VERSTAT(__lx,64);
-#endif
+TS_EXPORT int __xstat(int ver, const char *path, struct stat *st)
+{
+ const char *p;
+ char buf[PATH_MAX * 2];
+ static int (*_xstat)(int __ver, const char *__filename,
+ struct stat *__stat_buf);
+
+ if (!get_rootpath(__func__))
+ return -1;
+
+ _xstat = get_libc_func("__xstat");
+
+ p = trap_path(path, buf);
+ if (p == NULL)
+ return -1;
+
+ return _xstat(ver, p, st);
+}
#endif
+
+TS_EXPORT int access(const char *path, int mode)
+{
+ const char *p;
+ char buf[PATH_MAX * 2];
+ static int (*_access)(const char *path, int mode);
+
+ if (!get_rootpath(__func__))
+ return -1;
+
+ _access = get_libc_func("access");
+
+ p = trap_path(path, buf);
+ if (p == NULL)
+ return -1;
+
+ return _access(p, mode);
+}
+
+TS_EXPORT DIR *opendir(const char *path)
+{
+ const char *p;
+ char buf[PATH_MAX * 2];
+ static DIR* (*_opendir)(const char *path);
+
+ if (!get_rootpath(__func__))
+ return NULL;
+
+ _opendir = get_libc_func("opendir");
+
+ p = trap_path(path, buf);
+ if (p == NULL)
+ return NULL;
+
+ return (*_opendir)(p);
+}
diff --git a/testsuite/rootfs-pristine/test-alias/correct.txt b/testsuite/rootfs-pristine/test-alias/correct.txt
deleted file mode 100644
index 86d0304..0000000
--- a/testsuite/rootfs-pristine/test-alias/correct.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-input test1234
-return 0
-len 8
-output test1234
-
-input test[abcfoobar]2211
-return 0
-len 19
-output test[abcfoobar]2211
-
-input bar[aaa][bbbb]sss
-return 0
-len 17
-output bar[aaa][bbbb]sss
-
-input kmod[p.b]lib
-return 0
-len 12
-output kmod[p.b]lib
-
-input [az]1234[AZ]
-return 0
-len 12
-output [az]1234[AZ]
-
diff --git a/testsuite/rootfs-pristine/test-blacklist/etc/modprobe.d/modprobe.conf b/testsuite/rootfs-pristine/test-blacklist/etc/modprobe.d/modprobe.conf
deleted file mode 100644
index 126612f..0000000
--- a/testsuite/rootfs-pristine/test-blacklist/etc/modprobe.d/modprobe.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-blacklist floppy
-blacklist pcspkr
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/jbd2/jbd2.ko b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/jbd2/jbd2.ko
deleted file mode 100644
index 521c214..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/jbd2/jbd2.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/mbcache.ko b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/mbcache.ko
deleted file mode 100644
index 5849fa7..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/mbcache.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/crc16.ko b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/crc16.ko
deleted file mode 100644
index 2fffdb7..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/crc16.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias
deleted file mode 100644
index ba76e18..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias
+++ /dev/null
@@ -1 +0,0 @@
-# Aliases extracted from modules themselves.
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias.bin b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias.bin
deleted file mode 100644
index 7075435..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.alias.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.builtin.bin b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.builtin.bin
deleted file mode 100644
index 7075435..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.builtin.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep
deleted file mode 100644
index c4e2516..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep
+++ /dev/null
@@ -1,4 +0,0 @@
-kernel/fs/mbcache.ko:
-kernel/fs/ext4/ext4.ko: kernel/lib/crc16.ko kernel/fs/jbd2/jbd2.ko kernel/fs/mbcache.ko
-kernel/fs/jbd2/jbd2.ko:
-kernel/lib/crc16.ko:
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep.bin b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep.bin
deleted file mode 100644
index 2e89d91..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.dep.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.devname b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.devname
deleted file mode 100644
index 58f6d6d..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.devname
+++ /dev/null
@@ -1 +0,0 @@
-# Device nodes to trigger on-demand module loading.
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.order b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.order
deleted file mode 100644
index 85f2778..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.order
+++ /dev/null
@@ -1,7 +0,0 @@
-kernel/fs/mbcache.ko
-kernel/fs/ext3/ext3.ko
-kernel/fs/ext2/ext2.ko
-kernel/fs/ext4/ext4.ko
-kernel/fs/jbd/jbd.ko
-kernel/fs/jbd2/jbd2.ko
-kernel/lib/crc16.ko
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.softdep b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.softdep
deleted file mode 100644
index 3cc0512..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.softdep
+++ /dev/null
@@ -1,2 +0,0 @@
-# Soft dependencies extracted from modules themselves.
-# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols
deleted file mode 100644
index 0f0d88c..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols
+++ /dev/null
@@ -1,58 +0,0 @@
-# Aliases for symbols, used by symbol_request().
-alias symbol:jbd2_journal_invalidatepage jbd2
-alias symbol:jbd2_journal_release_buffer jbd2
-alias symbol:jbd2_journal_init_inode jbd2
-alias symbol:jbd2__journal_restart jbd2
-alias symbol:mb_cache_entry_find_next mbcache
-alias symbol:crc16 crc16
-alias symbol:mb_cache_entry_insert mbcache
-alias symbol:jbd2_journal_destroy jbd2
-alias symbol:jbd2_journal_lock_updates jbd2
-alias symbol:mb_cache_entry_free mbcache
-alias symbol:jbd2_log_start_commit jbd2
-alias symbol:mb_cache_entry_find_first mbcache
-alias symbol:mb_cache_destroy mbcache
-alias symbol:jbd2_journal_extend jbd2
-alias symbol:jbd2_journal_begin_ordered_truncate jbd2
-alias symbol:jbd2_journal_revoke jbd2
-alias symbol:jbd2_journal_get_write_access jbd2
-alias symbol:jbd2_inode_cache jbd2
-alias symbol:jbd2_journal_ack_err jbd2
-alias symbol:mb_cache_create mbcache
-alias symbol:jbd2_journal_flush jbd2
-alias symbol:jbd2_journal_init_jbd_inode jbd2
-alias symbol:mb_cache_entry_alloc mbcache
-alias symbol:jbd2_journal_get_undo_access jbd2
-alias symbol:jbd2_journal_get_create_access jbd2
-alias symbol:jbd2_journal_update_format jbd2
-alias symbol:crc16_table crc16
-alias symbol:jbd2_journal_wipe jbd2
-alias symbol:jbd2_journal_check_used_features jbd2
-alias symbol:mb_cache_entry_get mbcache
-alias symbol:jbd2_journal_force_commit_nested jbd2
-alias symbol:jbd2_log_wait_commit jbd2
-alias symbol:jbd2_journal_stop jbd2
-alias symbol:jbd2_journal_set_triggers jbd2
-alias symbol:jbd2_journal_release_jbd_inode jbd2
-alias symbol:jbd2_journal_unlock_updates jbd2
-alias symbol:jbd2_journal_start_commit jbd2
-alias symbol:jbd2_journal_dirty_metadata jbd2
-alias symbol:jbd2_journal_force_commit jbd2
-alias symbol:mb_cache_entry_release mbcache
-alias symbol:jbd2_journal_init_dev jbd2
-alias symbol:jbd2_journal_forget jbd2
-alias symbol:jbd2_journal_set_features jbd2
-alias symbol:jbd2_journal_start jbd2
-alias symbol:jbd2_journal_clear_features jbd2
-alias symbol:jbd2__journal_start jbd2
-alias symbol:mb_cache_shrink mbcache
-alias symbol:jbd2_journal_clear_err jbd2
-alias symbol:jbd2_journal_file_inode jbd2
-alias symbol:jbd2_journal_restart jbd2
-alias symbol:jbd2_journal_load jbd2
-alias symbol:jbd2_journal_check_available_features jbd2
-alias symbol:jbd2_journal_abort jbd2
-alias symbol:jbd2_journal_blocks_per_page jbd2
-alias symbol:jbd2_journal_try_to_free_buffers jbd2
-alias symbol:jbd2_trans_will_send_data_barrier jbd2
-alias symbol:jbd2_journal_errno jbd2
diff --git a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols.bin b/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols.bin
deleted file mode 100644
index aa8cfc8..0000000
--- a/testsuite/rootfs-pristine/test-dependencies/lib/modules/4.0.20-kmod/modules.symbols.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/correct-modules.alias b/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/correct-modules.alias
deleted file mode 100644
index 5675329..0000000
--- a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/correct-modules.alias
+++ /dev/null
@@ -1,37 +0,0 @@
-# Aliases extracted from modules themselves.
-alias pci:v0000103Cd00003230sv0000103Csd0000323Dbc*sc*i* cciss
-alias pci:v0000103Cd00003230sv0000103Csd00003237bc*sc*i* cciss
-alias pci:v0000103Cd00003238sv0000103Csd00003215bc*sc*i* cciss
-alias pci:v0000103Cd00003238sv0000103Csd00003214bc*sc*i* cciss
-alias pci:v0000103Cd00003238sv0000103Csd00003213bc*sc*i* cciss
-alias pci:v0000103Cd00003238sv0000103Csd00003212bc*sc*i* cciss
-alias pci:v0000103Cd00003238sv0000103Csd00003211bc*sc*i* cciss
-alias pci:v0000103Cd00003230sv0000103Csd00003235bc*sc*i* cciss
-alias pci:v0000103Cd00003230sv0000103Csd00003234bc*sc*i* cciss
-alias pci:v0000103Cd00003230sv0000103Csd00003223bc*sc*i* cciss
-alias pci:v0000103Cd00003220sv0000103Csd00003225bc*sc*i* cciss
-alias pci:v00000E11d00000046sv00000E11sd0000409Dbc*sc*i* cciss
-alias pci:v00000E11d00000046sv00000E11sd0000409Cbc*sc*i* cciss
-alias pci:v00000E11d00000046sv00000E11sd0000409Bbc*sc*i* cciss
-alias pci:v00000E11d00000046sv00000E11sd0000409Abc*sc*i* cciss
-alias pci:v00000E11d00000046sv00000E11sd00004091bc*sc*i* cciss
-alias pci:v00000E11d0000B178sv00000E11sd00004083bc*sc*i* cciss
-alias pci:v00000E11d0000B178sv00000E11sd00004082bc*sc*i* cciss
-alias pci:v00000E11d0000B178sv00000E11sd00004080bc*sc*i* cciss
-alias pci:v00000E11d0000B060sv00000E11sd00004070bc*sc*i* cciss
-alias pci:v0000103Cd*sv*sd*bc01sc04i* hpsa
-alias pci:v0000103Cd0000323Bsv0000103Csd00003356bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Bsv0000103Csd00003355bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Bsv0000103Csd00003354bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Bsv0000103Csd00003353bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Bsv0000103Csd00003352bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Bsv0000103Csd00003351bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Bsv0000103Csd00003350bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd00003233bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd0000324Bbc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd0000324Abc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd00003249bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd00003247bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd00003245bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd00003243bc*sc*i* hpsa
-alias pci:v0000103Cd0000323Asv0000103Csd00003241bc*sc*i* hpsa
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/block/cciss.ko.gz b/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/block/cciss.ko.gz
deleted file mode 100644
index 0684dc1..0000000
--- a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/block/cciss.ko.gz
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/hpsa.ko.gz b/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/hpsa.ko.gz
deleted file mode 100644
index 403d6fb..0000000
--- a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/hpsa.ko.gz
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gz b/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gz
deleted file mode 100644
index 2306bb1..0000000
--- a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gz
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.builtin b/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.builtin
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.builtin
+++ /dev/null
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.order b/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.order
deleted file mode 100644
index 4b64309..0000000
--- a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.order
+++ /dev/null
@@ -1,7 +0,0 @@
-#336
-kernel/drivers/block/cciss.ko
-#2094
-kernel/drivers/scsi/scsi_mod.ko
-#2137
-kernel/drivers/scsi/hpsa.ko
-
diff --git a/testsuite/rootfs-pristine/test-init/correct.txt b/testsuite/rootfs-pristine/test-init/correct.txt
deleted file mode 100644
index 1682154..0000000
--- a/testsuite/rootfs-pristine/test-init/correct.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-filename: /ext4-i686.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: A80608676B83D55514B450E
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.i686 SMP mod_unload modversions 686
-filename: /ext4-ppc64.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: 670806A855D5836BE150B41
-depends: jbd2,mbcache
-vermagic: 2.6.32-220.el6.ppc64 SMP mod_unload modversions
-filename: /ext4-s390x.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: 670806A855D5836BE150B41
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.s390x SMP mod_unload modversions
-filename: /ext4-x86_64.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: A80608676B83D55514B450E
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.x86_64 SMP mod_unload modversions
diff --git a/testsuite/rootfs-pristine/test-init/ext4-i686.ko b/testsuite/rootfs-pristine/test-init/ext4-i686.ko
deleted file mode 100644
index e5d2fb7..0000000
--- a/testsuite/rootfs-pristine/test-init/ext4-i686.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-init/ext4-ppc64.ko b/testsuite/rootfs-pristine/test-init/ext4-ppc64.ko
deleted file mode 100644
index cb02ed4..0000000
--- a/testsuite/rootfs-pristine/test-init/ext4-ppc64.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-init/ext4-s390x.ko b/testsuite/rootfs-pristine/test-init/ext4-s390x.ko
deleted file mode 100644
index 74c3799..0000000
--- a/testsuite/rootfs-pristine/test-init/ext4-s390x.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-init/ext4-x86_64.ko b/testsuite/rootfs-pristine/test-init/ext4-x86_64.ko
deleted file mode 100644
index ae96eef..0000000
--- a/testsuite/rootfs-pristine/test-init/ext4-x86_64.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-loaded/correct.txt b/testsuite/rootfs-pristine/test-loaded/correct.txt
deleted file mode 100644
index 71c5f7f..0000000
--- a/testsuite/rootfs-pristine/test-loaded/correct.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Module Size Used by
-btusb 11216 0
diff --git a/testsuite/rootfs-pristine/test-loaded/proc/modules b/testsuite/rootfs-pristine/test-loaded/proc/modules
deleted file mode 100644
index ce468c0..0000000
--- a/testsuite/rootfs-pristine/test-loaded/proc/modules
+++ /dev/null
@@ -1 +0,0 @@
-btusb 11216 0 - Live 0xffffffffa014a000
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/drivers/usb:btusb b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/drivers/usb:btusb
deleted file mode 120000
index c173837..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/drivers/usb:btusb
+++ /dev/null
@@ -1 +0,0 @@
-../../../bus/usb/drivers/btusb \ No newline at end of file
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/holders/.gitignore b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/holders/.gitignore
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/holders/.gitignore
+++ /dev/null
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/initstate b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/initstate
deleted file mode 100644
index e23fe64..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/initstate
+++ /dev/null
@@ -1 +0,0 @@
-live
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/notes/.note.gnu.build-id b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/notes/.note.gnu.build-id
deleted file mode 100644
index 0758558..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/notes/.note.gnu.build-id
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/disable_scofix b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/disable_scofix
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/disable_scofix
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/force_scofix b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/force_scofix
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/force_scofix
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_csr b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_csr
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_csr
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_dga b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_dga
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_dga
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_sniffer b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_sniffer
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/ignore_sniffer
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/reset b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/reset
deleted file mode 100644
index 9bda8c3..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/parameters/reset
+++ /dev/null
@@ -1 +0,0 @@
-Y
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/refcnt b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/refcnt
deleted file mode 100644
index 573541a..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/refcnt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.bss b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.bss
deleted file mode 100644
index e971686..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.bss
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014c828
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.data b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.data
deleted file mode 100644
index 5ccfa09..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.data
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014c040
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.exit.text b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.exit.text
deleted file mode 100644
index 446df03..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.exit.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014bd7c
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.gnu.linkonce.this_module b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.gnu.linkonce.this_module
deleted file mode 100644
index f91a8fd..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.gnu.linkonce.this_module
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014c600
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.init.text b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.init.text
deleted file mode 100644
index 1179bf2..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.init.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014e000
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.note.gnu.build-id b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.note.gnu.build-id
deleted file mode 100644
index e08ddab..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.note.gnu.build-id
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014bd90
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata
deleted file mode 100644
index 327441b..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014bfe0
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.1 b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.1
deleted file mode 100644
index e96b658..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.1
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014be29
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.8 b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.8
deleted file mode 100644
index d437cbe..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.rodata.str1.8
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014bdb8
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.smp_locks b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.smp_locks
deleted file mode 100644
index 955e243..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.smp_locks
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014bea8
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.strtab b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.strtab
deleted file mode 100644
index a874fed..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.strtab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014ede8
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.symtab b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.symtab
deleted file mode 100644
index fafe019..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.symtab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014e020
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.text b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.text
deleted file mode 100644
index 0a967df..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014a000
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/__param b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/__param
deleted file mode 100644
index 9f6710a..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/sections/__param
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa014bf20
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/srcversion b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/srcversion
deleted file mode 100644
index a688adf..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/srcversion
+++ /dev/null
@@ -1 +0,0 @@
-8EEAC35838CCA1118F97F5F
diff --git a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/version b/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/version
deleted file mode 100644
index 5a2a580..0000000
--- a/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/version
+++ /dev/null
@@ -1 +0,0 @@
-0.6
diff --git a/testsuite/rootfs-pristine/test-modinfo/correct.txt b/testsuite/rootfs-pristine/test-modinfo/correct.txt
deleted file mode 100644
index 4a7a4ac..0000000
--- a/testsuite/rootfs-pristine/test-modinfo/correct.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-filename: /ext4-i686.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: A80608676B83D55514B450E
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.i686 SMP mod_unload modversions 686
-filename: /ext4-ppc64.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: 670806A855D5836BE150B41
-depends: jbd2,mbcache
-vermagic: 2.6.32-220.el6.ppc64 SMP mod_unload modversions
-filename: /ext4-s390x.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: 670806A855D5836BE150B41
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.s390x SMP mod_unload modversions
-filename: /ext4-x86_64.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: A80608676B83D55514B450E
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.x86_64 SMP mod_unload modversions
-filename: /ext4-x86_64-sha1.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-alias: ext3
-alias: ext2
-depends: mbcache,jbd2
-intree: Y
-vermagic: 3.7.0 SMP mod_unload
-signer: Magrathea: Glacier signing key
-sig_key: E3:C8:FC:A7:3F:B3:1D:DE:84:81:EF:38:E3:4C:DE:4B:0C:FD:1B:F9
-sig_hashalgo: sha1
-filename: /ext4-x86_64-sha256.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-alias: ext3
-alias: ext2
-depends: mbcache,jbd2
-intree: Y
-vermagic: 3.7.0 SMP mod_unload
-signer: Magrathea: Glacier signing key
-sig_key: E3:C8:FC:A7:3F:B3:1D:DE:84:81:EF:38:E3:4C:DE:4B:0C:FD:1B:F9
-sig_hashalgo: sha256
diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-i686.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-i686.ko
deleted file mode 100644
index e5d2fb7..0000000
--- a/testsuite/rootfs-pristine/test-modinfo/ext4-i686.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-ppc64.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-ppc64.ko
deleted file mode 100644
index cb02ed4..0000000
--- a/testsuite/rootfs-pristine/test-modinfo/ext4-ppc64.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-s390x.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-s390x.ko
deleted file mode 100644
index 74c3799..0000000
--- a/testsuite/rootfs-pristine/test-modinfo/ext4-s390x.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha1.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha1.ko
deleted file mode 100644
index 6e894f9..0000000
--- a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha1.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha256.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha256.ko
deleted file mode 100644
index bf72008..0000000
--- a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha256.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64.ko
deleted file mode 100644
index ae96eef..0000000
--- a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/correct-psmouse.txt b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/correct-psmouse.txt
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/correct-psmouse.txt
+++ /dev/null
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/etc/modprobe.d/bogus.conf b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/etc/modprobe.d/bogus.conf
deleted file mode 100644
index 14bed0b..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/etc/modprobe.d/bogus.conf
+++ /dev/null
@@ -1 +0,0 @@
-alias psmouse deaddood
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko
deleted file mode 100644
index 4eac2a3..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias
deleted file mode 100644
index a4e7677..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias
+++ /dev/null
@@ -1,3 +0,0 @@
-# Aliases extracted from modules themselves.
-alias serio:ty05pr*id*ex* psmouse
-alias serio:ty01pr*id*ex* psmouse
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias.bin b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias.bin
deleted file mode 100644
index 0b13537..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.alias.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.builtin.bin b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.builtin.bin
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.builtin.bin
+++ /dev/null
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep
deleted file mode 100644
index 7ba5711..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep
+++ /dev/null
@@ -1 +0,0 @@
-kernel/drivers/input/mouse/psmouse.ko:
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep.bin b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep.bin
deleted file mode 100644
index bdd0eb5..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.dep.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.devname b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.devname
deleted file mode 100644
index 58f6d6d..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.devname
+++ /dev/null
@@ -1 +0,0 @@
-# Device nodes to trigger on-demand module loading.
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.softdep b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.softdep
deleted file mode 100644
index 3cc0512..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.softdep
+++ /dev/null
@@ -1,2 +0,0 @@
-# Soft dependencies extracted from modules themselves.
-# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols
deleted file mode 100644
index 618c345..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols
+++ /dev/null
@@ -1 +0,0 @@
-# Aliases for symbols, used by symbol_request().
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols.bin b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols.bin
deleted file mode 100644
index 7075435..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/lib/modules/4.4.4/modules.symbols.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/proc/modules b/testsuite/rootfs-pristine/test-modprobe/alias-to-none/proc/modules
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/alias-to-none/proc/modules
+++ /dev/null
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias
deleted file mode 100644
index ba76e18..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias
+++ /dev/null
@@ -1 +0,0 @@
-# Aliases extracted from modules themselves.
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias.bin b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias.bin
deleted file mode 100644
index 7075435..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.alias.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin
deleted file mode 100644
index 3c4ef2c..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin
+++ /dev/null
@@ -1 +0,0 @@
-kernel/net/unix/unix.ko
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin.bin b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin.bin
deleted file mode 100644
index 41af3ee..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.builtin.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep
+++ /dev/null
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep.bin b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep.bin
deleted file mode 100644
index 7075435..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.dep.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.devname b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.devname
deleted file mode 100644
index 58f6d6d..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.devname
+++ /dev/null
@@ -1 +0,0 @@
-# Device nodes to trigger on-demand module loading.
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.softdep b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.softdep
deleted file mode 100644
index 3cc0512..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.softdep
+++ /dev/null
@@ -1,2 +0,0 @@
-# Soft dependencies extracted from modules themselves.
-# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols
deleted file mode 100644
index 618c345..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols
+++ /dev/null
@@ -1 +0,0 @@
-# Aliases for symbols, used by symbol_request().
diff --git a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols.bin b/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols.bin
deleted file mode 100644
index 7075435..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/builtin/lib/modules/4.4.4/modules.symbols.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/etc/modprobe.d/dumb-instal-loop.conf b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/etc/modprobe.d/dumb-instal-loop.conf
deleted file mode 100644
index 8014af3..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/etc/modprobe.d/dumb-instal-loop.conf
+++ /dev/null
@@ -1 +0,0 @@
-install snd $MODPROBE --ignore-install snd && { $MODPROBE --quiet snd-ioctl32 ; $MODPROBE --quiet snd-pcm ; }
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd-pcm.ko.gz b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd-pcm.ko.gz
deleted file mode 100644
index b149c6a..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd-pcm.ko.gz
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd.ko.gz b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd.ko.gz
deleted file mode 100644
index c7c671d..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/sound/core/snd.ko.gz
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias
deleted file mode 100644
index 8631be6..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias
+++ /dev/null
@@ -1,2 +0,0 @@
-# Aliases extracted from modules themselves.
-alias char-major-116-* snd
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias.bin b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias.bin
deleted file mode 100644
index e9d2680..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.alias.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep
deleted file mode 100644
index 518aa59..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep
+++ /dev/null
@@ -1,2 +0,0 @@
-kernel/sound/core/snd.ko.gz:
-kernel/sound/core/snd-pcm.ko.gz: kernel/sound/core/snd.ko.gz
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep.bin b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep.bin
deleted file mode 100644
index 877ae7b..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.dep.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.devname b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.devname
deleted file mode 100644
index 58f6d6d..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.devname
+++ /dev/null
@@ -1 +0,0 @@
-# Device nodes to trigger on-demand module loading.
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.softdep b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.softdep
deleted file mode 100644
index 3cc0512..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.softdep
+++ /dev/null
@@ -1,2 +0,0 @@
-# Soft dependencies extracted from modules themselves.
-# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols
deleted file mode 100644
index 300cdc2..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols
+++ /dev/null
@@ -1,133 +0,0 @@
-# Aliases for symbols, used by symbol_request().
-alias symbol:copy_from_user_toio snd
-alias symbol:snd_kctl_jack_new snd
-alias symbol:snd_pcm_hw_constraint_minmax snd_pcm
-alias symbol:snd_ctl_register_ioctl_compat snd
-alias symbol:snd_pcm_period_elapsed snd_pcm
-alias symbol:snd_pcm_format_linear snd_pcm
-alias symbol:snd_pcm_format_big_endian snd_pcm
-alias symbol:snd_request_card snd
-alias symbol:snd_pcm_lib_ioctl snd_pcm
-alias symbol:snd_add_device_sysfs_file snd
-alias symbol:snd_card_proc_new snd
-alias symbol:snd_ctl_boolean_stereo_info snd
-alias symbol:snd_unregister_oss_device snd
-alias symbol:snd_card_free snd
-alias symbol:snd_pcm_sgbuf_ops_page snd_pcm
-alias symbol:snd_pcm_new_stream snd_pcm
-alias symbol:snd_card_create snd
-alias symbol:snd_card_register snd
-alias symbol:snd_ctl_free_one snd
-alias symbol:snd_register_device_for_dev snd
-alias symbol:snd_lookup_oss_minor_data snd
-alias symbol:snd_pcm_hw_constraint_step snd_pcm
-alias symbol:snd_seq_root snd
-alias symbol:snd_pcm_new snd_pcm
-alias symbol:snd_card_set_id snd
-alias symbol:snd_info_register snd
-alias symbol:snd_pcm_lib_preallocate_pages snd_pcm
-alias symbol:snd_pcm_hw_rule_noresample snd_pcm
-alias symbol:snd_ctl_remove snd
-alias symbol:snd_pcm_lib_read snd_pcm
-alias symbol:snd_pcm_mmap_data snd_pcm
-alias symbol:snd_pcm_hw_constraint_list snd_pcm
-alias symbol:snd_oss_info_register snd
-alias symbol:snd_dma_pointer snd
-alias symbol:snd_ctl_new1 snd
-alias symbol:snd_interval_ratnum snd_pcm
-alias symbol:snd_pcm_release_substream snd_pcm
-alias symbol:snd_pcm_suspend_all snd_pcm
-alias symbol:snd_ctl_register_ioctl snd
-alias symbol:snd_ctl_rename_id snd
-alias symbol:snd_card_file_add snd
-alias symbol:snd_pcm_limit_hw_rates snd_pcm
-alias symbol:snd_jack_set_parent snd
-alias symbol:snd_pcm_format_width snd_pcm
-alias symbol:snd_jack_new snd
-alias symbol:snd_ctl_make_virtual_master snd
-alias symbol:snd_jack_report snd
-alias symbol:snd_pcm_format_little_endian snd_pcm
-alias symbol:snd_ctl_notify snd
-alias symbol:snd_pcm_set_sync snd_pcm
-alias symbol:snd_component_add snd
-alias symbol:_snd_ctl_add_slave snd
-alias symbol:snd_device_register snd
-alias symbol:snd_iprintf snd
-alias symbol:snd_pcm_lib_default_mmap snd_pcm
-alias symbol:_snd_pcm_hw_params_any snd_pcm
-alias symbol:snd_card_file_remove snd
-alias symbol:snd_ctl_replace snd
-alias symbol:snd_pcm_link_rwlock snd_pcm
-alias symbol:snd_info_get_line snd
-alias symbol:snd_ctl_activate_id snd
-alias symbol:snd_pcm_format_signed snd_pcm
-alias symbol:snd_pcm_open_substream snd_pcm
-alias symbol:snd_dma_disable snd
-alias symbol:snd_pcm_set_ops snd_pcm
-alias symbol:release_and_free_resource snd
-alias symbol:snd_ecards_limit snd
-alias symbol:snd_pcm_hw_param_value snd_pcm
-alias symbol:snd_cards snd
-alias symbol:snd_device_free snd
-alias symbol:snd_dma_program snd
-alias symbol:snd_interval_refine snd_pcm
-alias symbol:snd_pcm_lib_preallocate_free_for_all snd_pcm
-alias symbol:snd_pcm_hw_constraint_msbits snd_pcm
-alias symbol:snd_pcm_lib_mmap_iomem snd_pcm
-alias symbol:snd_pcm_lib_get_vmalloc_page snd_pcm
-alias symbol:snd_pcm_suspend snd_pcm
-alias symbol:snd_pcm_format_unsigned snd_pcm
-alias symbol:snd_card_free_when_closed snd
-alias symbol:snd_ctl_unregister_ioctl_compat snd
-alias symbol:snd_interval_list snd_pcm
-alias symbol:snd_pcm_lib_malloc_pages snd_pcm
-alias symbol:snd_unregister_device snd
-alias symbol:snd_pcm_lib_readv snd_pcm
-alias symbol:snd_pcm_hw_constraint_ratnums snd_pcm
-alias symbol:snd_pcm_hw_constraint_ratdens snd_pcm
-alias symbol:snd_major snd
-alias symbol:copy_to_user_fromio snd
-alias symbol:snd_pcm_format_name snd_pcm
-alias symbol:snd_pcm_lib_preallocate_pages_for_all snd_pcm
-alias symbol:snd_ctl_add snd
-alias symbol:snd_info_create_card_entry snd
-alias symbol:snd_pcm_hw_rule_add snd_pcm
-alias symbol:snd_pcm_lib_writev snd_pcm
-alias symbol:snd_pcm_format_set_silence snd_pcm
-alias symbol:snd_pcm_hw_param_last snd_pcm
-alias symbol:snd_card_disconnect snd
-alias symbol:snd_info_get_str snd
-alias symbol:snd_lookup_minor_data snd
-alias symbol:snd_pci_quirk_lookup_id snd
-alias symbol:snd_pcm_rate_to_rate_bit snd_pcm
-alias symbol:snd_pcm_lib_free_vmalloc_buffer snd_pcm
-alias symbol:snd_pcm_format_silence_64 snd_pcm
-alias symbol:snd_pcm_sgbuf_get_chunk_size snd_pcm
-alias symbol:snd_pci_quirk_lookup snd
-alias symbol:snd_pcm_notify snd_pcm
-alias symbol:_snd_pcm_hw_param_setempty snd_pcm
-alias symbol:snd_power_wait snd
-alias symbol:snd_pcm_hw_constraint_pow2 snd_pcm
-alias symbol:snd_register_oss_device snd
-alias symbol:snd_ctl_find_numid snd
-alias symbol:snd_pcm_kernel_ioctl snd_pcm
-alias symbol:snd_pcm_hw_constraint_integer snd_pcm
-alias symbol:snd_pcm_lib_write snd_pcm
-alias symbol:snd_kctl_jack_report snd
-alias symbol:snd_pcm_lib_free_pages snd_pcm
-alias symbol:snd_pcm_hw_param_first snd_pcm
-alias symbol:snd_ctl_enum_info snd
-alias symbol:snd_jack_set_key snd
-alias symbol:snd_device_new snd
-alias symbol:snd_ctl_find_id snd
-alias symbol:snd_pcm_hw_refine snd_pcm
-alias symbol:snd_ctl_boolean_mono_info snd
-alias symbol:snd_mixer_oss_notify_callback snd
-alias symbol:snd_pcm_format_size snd_pcm
-alias symbol:snd_pcm_format_physical_width snd_pcm
-alias symbol:snd_info_free_entry snd
-alias symbol:snd_ctl_remove_id snd
-alias symbol:_snd_pcm_lib_alloc_vmalloc_buffer snd_pcm
-alias symbol:snd_pcm_stop snd_pcm
-alias symbol:snd_ctl_unregister_ioctl snd
-alias symbol:snd_info_create_module_entry snd
diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols.bin b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols.bin
deleted file mode 100644
index 03366e3..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.symbols.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/correct-psmouse.txt b/testsuite/rootfs-pristine/test-modprobe/show-depends/correct-psmouse.txt
deleted file mode 100644
index 1e773d7..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/correct-psmouse.txt
+++ /dev/null
@@ -1 +0,0 @@
-insmod /lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/correct.txt b/testsuite/rootfs-pristine/test-modprobe/show-depends/correct.txt
deleted file mode 100644
index 52fddba..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/correct.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-insmod /lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.ko
-insmod /lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.ko
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.ko b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.ko
deleted file mode 100644
index f4e21e0..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko
deleted file mode 100644
index 4eac2a3..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.ko b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.ko
deleted file mode 100644
index a8949a6..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias
deleted file mode 100644
index 94804f1..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias
+++ /dev/null
@@ -1,21 +0,0 @@
-# Aliases extracted from modules themselves.
-alias usb:v413Cp8197d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v0A5Cp21E3d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v0C10p0000d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v0BDBp1002d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v044Ep3002d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v044Ep3001d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v04BFp030Ad*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v057Cp3800d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8281d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp821Ad*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp821Fd*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp821Bd*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8218d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8215d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8213d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp21E1d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v*p*d*dcE0dsc01dp01ic*isc*ip* btusb
-alias serio:ty05pr*id*ex* psmouse
-alias serio:ty01pr*id*ex* psmouse
-alias net-pf-31 bluetooth
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias.bin b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias.bin
deleted file mode 100644
index 86481a4..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.alias.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep
deleted file mode 100644
index a34af87..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep
+++ /dev/null
@@ -1,3 +0,0 @@
-kernel/drivers/bluetooth/btusb.ko: kernel/net/bluetooth/bluetooth.ko
-kernel/drivers/input/mouse/psmouse.ko:
-kernel/net/bluetooth/bluetooth.ko:
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep.bin b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep.bin
deleted file mode 100644
index 3382706..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.dep.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.devname b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.devname
deleted file mode 100644
index 58f6d6d..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.devname
+++ /dev/null
@@ -1 +0,0 @@
-# Device nodes to trigger on-demand module loading.
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.softdep b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.softdep
deleted file mode 100644
index 3cc0512..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.softdep
+++ /dev/null
@@ -1,2 +0,0 @@
-# Soft dependencies extracted from modules themselves.
-# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols
deleted file mode 100644
index b970b60..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols
+++ /dev/null
@@ -1,45 +0,0 @@
-# Aliases for symbols, used by symbol_request().
-alias symbol:hci_conn_check_secure bluetooth
-alias symbol:hci_send_acl bluetooth
-alias symbol:hci_recv_fragment bluetooth
-alias symbol:hci_recv_frame bluetooth
-alias symbol:hci_le_ltk_reply bluetooth
-alias symbol:hci_send_sco bluetooth
-alias symbol:bt_debugfs bluetooth
-alias symbol:bt_accept_unlink bluetooth
-alias symbol:bt_sock_recvmsg bluetooth
-alias symbol:bt_sock_ioctl bluetooth
-alias symbol:hci_le_conn_update bluetooth
-alias symbol:hci_unregister_cb bluetooth
-alias symbol:hci_connect bluetooth
-alias symbol:hci_le_start_enc bluetooth
-alias symbol:bt_sock_link bluetooth
-alias symbol:bt_printk bluetooth
-alias symbol:hci_alloc_dev bluetooth
-alias symbol:baswap bluetooth
-alias symbol:hci_conn_switch_role bluetooth
-alias symbol:hci_resume_dev bluetooth
-alias symbol:bt_sock_stream_recvmsg bluetooth
-alias symbol:hci_conn_check_link_mode bluetooth
-alias symbol:hci_conn_hold_device bluetooth
-alias symbol:hci_conn_change_link_key bluetooth
-alias symbol:hci_conn_put_device bluetooth
-alias symbol:batostr bluetooth
-alias symbol:bt_to_errno bluetooth
-alias symbol:bt_accept_dequeue bluetooth
-alias symbol:hci_free_dev bluetooth
-alias symbol:bt_accept_enqueue bluetooth
-alias symbol:hci_find_link_key_type bluetooth
-alias symbol:hci_find_ltk bluetooth
-alias symbol:hci_recv_stream_fragment bluetooth
-alias symbol:bt_sock_register bluetooth
-alias symbol:hci_get_route bluetooth
-alias symbol:hci_register_dev bluetooth
-alias symbol:hci_unregister_dev bluetooth
-alias symbol:bt_sock_poll bluetooth
-alias symbol:bt_sock_wait_state bluetooth
-alias symbol:bt_sock_unlink bluetooth
-alias symbol:bt_sock_unregister bluetooth
-alias symbol:hci_register_cb bluetooth
-alias symbol:hci_suspend_dev bluetooth
-alias symbol:hci_conn_security bluetooth
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols.bin b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols.bin
deleted file mode 100644
index 156a61f..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.symbols.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/proc/modules b/testsuite/rootfs-pristine/test-modprobe/show-depends/proc/modules
deleted file mode 100644
index aab95dd..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/proc/modules
+++ /dev/null
@@ -1,2 +0,0 @@
-btusb 11911 0 - Live 0xffffffffa00ec000
-bluetooth 173424 1 btusb, Live 0xffffffffa0040000
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/coresize b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/coresize
deleted file mode 100644
index 8bc1425..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/coresize
+++ /dev/null
@@ -1 +0,0 @@
-173424
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/holders/btusb b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/holders/btusb
deleted file mode 120000
index 8fe6aa9..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/holders/btusb
+++ /dev/null
@@ -1 +0,0 @@
-../../btusb \ No newline at end of file
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initsize b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initsize
deleted file mode 100644
index 573541a..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initsize
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initstate b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initstate
deleted file mode 100644
index e23fe64..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/initstate
+++ /dev/null
@@ -1 +0,0 @@
-live
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/notes/.note.gnu.build-id b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/notes/.note.gnu.build-id
deleted file mode 100644
index e917247..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/notes/.note.gnu.build-id
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_ertm b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_ertm
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_ertm
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_esco b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_esco
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/disable_esco
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_hs b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_hs
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_hs
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_le b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_le
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_le
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_mgmt b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_mgmt
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/parameters/enable_mgmt
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/refcnt b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/refcnt
deleted file mode 100644
index d00491f..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/refcnt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.bss b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.bss
deleted file mode 100644
index ea8c54e..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.bss
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0063fe0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.data b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.data
deleted file mode 100644
index a6f2254..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.data
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0063360
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.exit.text b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.exit.text
deleted file mode 100644
index 86d3cd1..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.exit.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0060c32
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.gnu.linkonce.this_module b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.gnu.linkonce.this_module
deleted file mode 100644
index 50a1575..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.gnu.linkonce.this_module
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0063da0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.init.text b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.init.text
deleted file mode 100644
index 921b9d9..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.init.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0076000
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.note.gnu.build-id b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.note.gnu.build-id
deleted file mode 100644
index 8a4d2ce..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.note.gnu.build-id
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0060c98
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata
deleted file mode 100644
index 24af87e..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00610e0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.1 b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.1
deleted file mode 100644
index 0da8d6d..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.1
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0062674
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.8 b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.8
deleted file mode 100644
index 3c0aeba..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.rodata.str1.8
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0062af0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.smp_locks b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.smp_locks
deleted file mode 100644
index d1da04c..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.smp_locks
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00620cc
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.strtab b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.strtab
deleted file mode 100644
index 3e03a95..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.strtab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa007b280
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.symtab b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.symtab
deleted file mode 100644
index 9875bb4..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.symtab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0076300
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text
deleted file mode 100644
index db229db..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0040000
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text.unlikely b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text.unlikely
deleted file mode 100644
index 4d8920f..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/.text.unlikely
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0060c2c
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__bug_table b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__bug_table
deleted file mode 100644
index 07fd388..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__bug_table
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0062ac6
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__jump_table b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__jump_table
deleted file mode 100644
index ff0edf6..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__jump_table
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0063d10
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab
deleted file mode 100644
index 8542e00..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0060f80
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab_gpl b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab_gpl
deleted file mode 100644
index aaa4573..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__kcrctab_gpl
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00610d8
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab
deleted file mode 100644
index a81db94..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0060cc0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_gpl b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_gpl
deleted file mode 100644
index 4d4c450..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_gpl
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0060f70
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_strings b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_strings
deleted file mode 100644
index 5290e4c..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__ksymtab_strings
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa0062fe4
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__param b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__param
deleted file mode 100644
index 5d4be39..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/sections/__param
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00632c0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/srcversion b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/srcversion
deleted file mode 100644
index 64bc12e..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/srcversion
+++ /dev/null
@@ -1 +0,0 @@
-72F6D42DC4BD163E7718A31
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/taint b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/taint
deleted file mode 100644
index 8b13789..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/taint
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/version b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/version
deleted file mode 100644
index 6d28a11..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/bluetooth/version
+++ /dev/null
@@ -1 +0,0 @@
-2.16
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/coresize b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/coresize
deleted file mode 100644
index 4b104f9..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/coresize
+++ /dev/null
@@ -1 +0,0 @@
-11911
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/drivers/usb:btusb b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/drivers/usb:btusb
deleted file mode 120000
index c173837..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/drivers/usb:btusb
+++ /dev/null
@@ -1 +0,0 @@
-../../../bus/usb/drivers/btusb \ No newline at end of file
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/holders/.gitignore b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/holders/.gitignore
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/holders/.gitignore
+++ /dev/null
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initsize b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initsize
deleted file mode 100644
index 573541a..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initsize
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initstate b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initstate
deleted file mode 100644
index e23fe64..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/initstate
+++ /dev/null
@@ -1 +0,0 @@
-live
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/notes/.note.gnu.build-id b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/notes/.note.gnu.build-id
deleted file mode 100644
index 0afeca4..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/notes/.note.gnu.build-id
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/disable_scofix b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/disable_scofix
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/disable_scofix
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/force_scofix b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/force_scofix
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/force_scofix
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_csr b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_csr
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_csr
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_dga b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_dga
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_dga
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_sniffer b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_sniffer
deleted file mode 100644
index d52e798..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/ignore_sniffer
+++ /dev/null
@@ -1 +0,0 @@
-N
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/reset b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/reset
deleted file mode 100644
index 9bda8c3..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/parameters/reset
+++ /dev/null
@@ -1 +0,0 @@
-Y
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/refcnt b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/refcnt
deleted file mode 100644
index 573541a..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/refcnt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.bss b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.bss
deleted file mode 100644
index 44785c0..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.bss
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00ee708
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.data b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.data
deleted file mode 100644
index bfdb603..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.data
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00edf20
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.exit.text b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.exit.text
deleted file mode 100644
index a504729..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.exit.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00edc68
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.gnu.linkonce.this_module b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.gnu.linkonce.this_module
deleted file mode 100644
index 2b18edc..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.gnu.linkonce.this_module
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00ee4e0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.init.text b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.init.text
deleted file mode 100644
index 017c50e..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.init.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00f0000
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.note.gnu.build-id b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.note.gnu.build-id
deleted file mode 100644
index 982e7c1..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.note.gnu.build-id
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00edc7c
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata
deleted file mode 100644
index 4988b02..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00edec0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.1 b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.1
deleted file mode 100644
index 52bcaf7..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.1
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00edd11
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.8 b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.8
deleted file mode 100644
index 68be4ed..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.rodata.str1.8
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00edca0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.smp_locks b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.smp_locks
deleted file mode 100644
index 9978310..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.smp_locks
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00edd90
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.strtab b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.strtab
deleted file mode 100644
index e4fdf8e..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.strtab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00f0dd0
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.symtab b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.symtab
deleted file mode 100644
index 73f8cee..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.symtab
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00f0020
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.text b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.text
deleted file mode 100644
index d39dfe6..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/.text
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00ec000
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/__param b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/__param
deleted file mode 100644
index 76e34cd..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/sections/__param
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffffa00ede00
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/srcversion b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/srcversion
deleted file mode 100644
index 2d4bd99..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/srcversion
+++ /dev/null
@@ -1 +0,0 @@
-1FC03999655A6ECD28DC794
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/taint b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/taint
deleted file mode 100644
index 8b13789..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/taint
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/version b/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/version
deleted file mode 100644
index 5a2a580..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/show-depends/sys/module/btusb/version
+++ /dev/null
@@ -1 +0,0 @@
-0.6
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/etc/modprobe.d/dumb-softdep.conf b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/etc/modprobe.d/dumb-softdep.conf
deleted file mode 100644
index fa41143..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/etc/modprobe.d/dumb-softdep.conf
+++ /dev/null
@@ -1 +0,0 @@
-softdep bluetooth post: btusb
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.ko b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.ko
deleted file mode 100644
index f4e21e0..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/bluetooth/btusb.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko
deleted file mode 100644
index 4eac2a3..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/drivers/input/mouse/psmouse.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.ko b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.ko
deleted file mode 100644
index a8949a6..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/net/bluetooth/bluetooth.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias
deleted file mode 100644
index 94804f1..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias
+++ /dev/null
@@ -1,21 +0,0 @@
-# Aliases extracted from modules themselves.
-alias usb:v413Cp8197d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v0A5Cp21E3d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v0C10p0000d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v0BDBp1002d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v044Ep3002d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v044Ep3001d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v04BFp030Ad*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v057Cp3800d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8281d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp821Ad*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp821Fd*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp821Bd*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8218d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8215d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp8213d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v05ACp21E1d*dc*dsc*dp*ic*isc*ip* btusb
-alias usb:v*p*d*dcE0dsc01dp01ic*isc*ip* btusb
-alias serio:ty05pr*id*ex* psmouse
-alias serio:ty01pr*id*ex* psmouse
-alias net-pf-31 bluetooth
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias.bin b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias.bin
deleted file mode 100644
index 86481a4..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.alias.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep
deleted file mode 100644
index a34af87..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep
+++ /dev/null
@@ -1,3 +0,0 @@
-kernel/drivers/bluetooth/btusb.ko: kernel/net/bluetooth/bluetooth.ko
-kernel/drivers/input/mouse/psmouse.ko:
-kernel/net/bluetooth/bluetooth.ko:
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep.bin b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep.bin
deleted file mode 100644
index 3382706..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.dep.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.devname b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.devname
deleted file mode 100644
index 58f6d6d..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.devname
+++ /dev/null
@@ -1 +0,0 @@
-# Device nodes to trigger on-demand module loading.
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.softdep b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.softdep
deleted file mode 100644
index 3cc0512..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.softdep
+++ /dev/null
@@ -1,2 +0,0 @@
-# Soft dependencies extracted from modules themselves.
-# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols
deleted file mode 100644
index b970b60..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols
+++ /dev/null
@@ -1,45 +0,0 @@
-# Aliases for symbols, used by symbol_request().
-alias symbol:hci_conn_check_secure bluetooth
-alias symbol:hci_send_acl bluetooth
-alias symbol:hci_recv_fragment bluetooth
-alias symbol:hci_recv_frame bluetooth
-alias symbol:hci_le_ltk_reply bluetooth
-alias symbol:hci_send_sco bluetooth
-alias symbol:bt_debugfs bluetooth
-alias symbol:bt_accept_unlink bluetooth
-alias symbol:bt_sock_recvmsg bluetooth
-alias symbol:bt_sock_ioctl bluetooth
-alias symbol:hci_le_conn_update bluetooth
-alias symbol:hci_unregister_cb bluetooth
-alias symbol:hci_connect bluetooth
-alias symbol:hci_le_start_enc bluetooth
-alias symbol:bt_sock_link bluetooth
-alias symbol:bt_printk bluetooth
-alias symbol:hci_alloc_dev bluetooth
-alias symbol:baswap bluetooth
-alias symbol:hci_conn_switch_role bluetooth
-alias symbol:hci_resume_dev bluetooth
-alias symbol:bt_sock_stream_recvmsg bluetooth
-alias symbol:hci_conn_check_link_mode bluetooth
-alias symbol:hci_conn_hold_device bluetooth
-alias symbol:hci_conn_change_link_key bluetooth
-alias symbol:hci_conn_put_device bluetooth
-alias symbol:batostr bluetooth
-alias symbol:bt_to_errno bluetooth
-alias symbol:bt_accept_dequeue bluetooth
-alias symbol:hci_free_dev bluetooth
-alias symbol:bt_accept_enqueue bluetooth
-alias symbol:hci_find_link_key_type bluetooth
-alias symbol:hci_find_ltk bluetooth
-alias symbol:hci_recv_stream_fragment bluetooth
-alias symbol:bt_sock_register bluetooth
-alias symbol:hci_get_route bluetooth
-alias symbol:hci_register_dev bluetooth
-alias symbol:hci_unregister_dev bluetooth
-alias symbol:bt_sock_poll bluetooth
-alias symbol:bt_sock_wait_state bluetooth
-alias symbol:bt_sock_unlink bluetooth
-alias symbol:bt_sock_unregister bluetooth
-alias symbol:hci_register_cb bluetooth
-alias symbol:hci_suspend_dev bluetooth
-alias symbol:hci_conn_security bluetooth
diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols.bin b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols.bin
deleted file mode 100644
index 156a61f..0000000
--- a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.symbols.bin
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-new-module/from_alias/correct.txt b/testsuite/rootfs-pristine/test-new-module/from_alias/correct.txt
deleted file mode 100644
index 6ed98ea..0000000
--- a/testsuite/rootfs-pristine/test-new-module/from_alias/correct.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-modname: ext4
-
diff --git a/testsuite/rootfs-pristine/test-new-module/from_alias/etc/modprobe.d/modprobe.conf b/testsuite/rootfs-pristine/test-new-module/from_alias/etc/modprobe.d/modprobe.conf
deleted file mode 100644
index f9629a0..0000000
--- a/testsuite/rootfs-pristine/test-new-module/from_alias/etc/modprobe.d/modprobe.conf
+++ /dev/null
@@ -1 +0,0 @@
-alias ext4.* ext4
diff --git a/testsuite/rootfs-pristine/test-new-module/from_name/correct.txt b/testsuite/rootfs-pristine/test-new-module/from_name/correct.txt
deleted file mode 100644
index a75cd3b..0000000
--- a/testsuite/rootfs-pristine/test-new-module/from_name/correct.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-modname: ext4
-modname: balbalbalbbalbalbalbalbalbalbal
-modname: snd_hda_intel
-modname: snd_timer
-modname: iTCO_wdt
-
diff --git a/testsuite/rootfs-pristine/test-remove/correct.txt b/testsuite/rootfs-pristine/test-remove/correct.txt
deleted file mode 100644
index 1682154..0000000
--- a/testsuite/rootfs-pristine/test-remove/correct.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-filename: /ext4-i686.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: A80608676B83D55514B450E
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.i686 SMP mod_unload modversions 686
-filename: /ext4-ppc64.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: 670806A855D5836BE150B41
-depends: jbd2,mbcache
-vermagic: 2.6.32-220.el6.ppc64 SMP mod_unload modversions
-filename: /ext4-s390x.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: 670806A855D5836BE150B41
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.s390x SMP mod_unload modversions
-filename: /ext4-x86_64.ko
-license: GPL
-description: Fourth Extended Filesystem
-author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
-srcversion: A80608676B83D55514B450E
-depends: mbcache,jbd2
-vermagic: 2.6.32-220.el6.x86_64 SMP mod_unload modversions
diff --git a/testsuite/rootfs-pristine/test-remove/ext4-i686.ko b/testsuite/rootfs-pristine/test-remove/ext4-i686.ko
deleted file mode 100644
index e5d2fb7..0000000
--- a/testsuite/rootfs-pristine/test-remove/ext4-i686.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-remove/ext4-ppc64.ko b/testsuite/rootfs-pristine/test-remove/ext4-ppc64.ko
deleted file mode 100644
index cb02ed4..0000000
--- a/testsuite/rootfs-pristine/test-remove/ext4-ppc64.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-remove/ext4-s390x.ko b/testsuite/rootfs-pristine/test-remove/ext4-s390x.ko
deleted file mode 100644
index 74c3799..0000000
--- a/testsuite/rootfs-pristine/test-remove/ext4-s390x.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-remove/ext4-x86_64.ko b/testsuite/rootfs-pristine/test-remove/ext4-x86_64.ko
deleted file mode 100644
index ae96eef..0000000
--- a/testsuite/rootfs-pristine/test-remove/ext4-x86_64.ko
+++ /dev/null
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-rootfs/lib/modules/a b/testsuite/rootfs-pristine/test-rootfs/lib/modules/a
deleted file mode 100644
index 837c960..0000000
--- a/testsuite/rootfs-pristine/test-rootfs/lib/modules/a
+++ /dev/null
@@ -1 +0,0 @@
-kmod-test-chroot-works
diff --git a/testsuite/rootfs-pristine/test-rootfs/testdir/.gitignore b/testsuite/rootfs-pristine/test-rootfs/testdir/.gitignore
deleted file mode 100644
index e69de29..0000000
--- a/testsuite/rootfs-pristine/test-rootfs/testdir/.gitignore
+++ /dev/null
diff --git a/testsuite/rootfs.tar.xz b/testsuite/rootfs.tar.xz
new file mode 100644
index 0000000..1ed83da
--- /dev/null
+++ b/testsuite/rootfs.tar.xz
Binary files differ
diff --git a/testsuite/stripped-module.h b/testsuite/stripped-module.h
index 83986b2..9f97dae 100644
--- a/testsuite/stripped-module.h
+++ b/testsuite/stripped-module.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef _TESTSUITE_STRIPPED_MODULE_H
+#define _TESTSUITE_STRIPPED_MODULE_H
enum module_state
{
@@ -12,7 +13,6 @@ struct list_head {
};
#define MODULE_NAME_LEN (64 - sizeof(unsigned long))
-
struct module
{
enum module_state state;
@@ -24,6 +24,4 @@ struct module
char name[MODULE_NAME_LEN];
};
-/* padding */
-#define MODULE_NAME_OFFSET_64 4 + 4 + 2 * 8
-#define MODULE_NAME_OFFSET_32 4 + 2 * 4
+#endif
diff --git a/testsuite/test-alias.c b/testsuite/test-alias.c
index 5e21573..567d676 100644
--- a/testsuite/test-alias.c
+++ b/testsuite/test-alias.c
@@ -1,20 +1,19 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
* Copyright (C) 2012 Pedro Pedruzzi
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
diff --git a/testsuite/test-blacklist.c b/testsuite/test-blacklist.c
deleted file mode 100644
index a018392..0000000
--- a/testsuite/test-blacklist.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <string.h>
-#include <libkmod.h>
-
-/* good luck bulding a kmod_list outside of the library... makes this blacklist
- * function rather pointless */
-#include <libkmod-private.h>
-
-/* FIXME: hack, change name so we don't clash */
-#undef ERR
-#include "testsuite.h"
-
-static int blacklist_1(const struct test *t)
-{
- struct kmod_ctx *ctx;
- struct kmod_list *list = NULL, *l, *filtered;
- struct kmod_module *mod;
- int err;
- size_t len = 0;
-
- const char *names[] = { "pcspkr", "pcspkr2", "floppy", "ext4", NULL };
- const char **name;
-
- ctx = kmod_new(NULL, NULL);
- if (ctx == NULL)
- exit(EXIT_FAILURE);
-
- for(name = names; *name; name++) {
- err = kmod_module_new_from_name(ctx, *name, &mod);
- if (err < 0)
- goto fail_lookup;
- list = kmod_list_append(list, mod);
- }
-
- err = kmod_module_apply_filter(ctx, KMOD_FILTER_BLACKLIST, list,
- &filtered);
- if (err < 0) {
- ERR("Could not filter: %s\n", strerror(-err));
- goto fail;
- }
- if (filtered == NULL) {
- ERR("All modules were filtered out!\n");
- goto fail;
- }
-
- kmod_list_foreach(l, filtered) {
- const char *modname;
- mod = kmod_module_get_module(l);
- modname = kmod_module_get_name(mod);
- if (strcmp("pcspkr", modname) == 0 || strcmp("floppy", modname) == 0)
- goto fail;
- len++;
- kmod_module_unref(mod);
- }
-
- if (len != 2)
- goto fail;
-
- kmod_module_unref_list(filtered);
- kmod_module_unref_list(list);
- kmod_unref(ctx);
-
- return EXIT_SUCCESS;
-
-fail:
- kmod_module_unref_list(list);
-fail_lookup:
- kmod_unref(ctx);
- return EXIT_FAILURE;
-}
-static const struct test sblacklist_1 = {
- .name = "blacklist_1",
- .description = "check if modules are correctly blacklisted",
- .func = blacklist_1,
- .config = {
- [TC_ROOTFS] = TESTSUITE_ROOTFS "test-blacklist/",
- },
- .need_spawn = true,
-};
-
-static const struct test *tests[] = {
- &sblacklist_1,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
diff --git a/testsuite/test-dependencies.c b/testsuite/test-dependencies.c
deleted file mode 100644
index cdd8066..0000000
--- a/testsuite/test-dependencies.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <string.h>
-#include <libkmod.h>
-
-#include "testsuite.h"
-#define TEST_UNAME "4.0.20-kmod"
-
-static int test_dependencies(const struct test *t)
-{
- struct kmod_ctx *ctx;
- struct kmod_module *mod;
- struct kmod_list *list, *l;
- int err;
- size_t len = 0;
- int crc16 = 0, mbcache = 0, jbd2 = 0;
-
- ctx = kmod_new(NULL, NULL);
- if (ctx == NULL)
- return EXIT_FAILURE;
-
- err = kmod_module_new_from_name(ctx, "ext4", &mod);
- if (err < 0) {
- kmod_unref(ctx);
- return EXIT_FAILURE;
- }
-
- list = kmod_module_get_dependencies(mod);
-
- kmod_list_foreach(l, list) {
- struct kmod_module *m = kmod_module_get_module(l);
- const char *name = kmod_module_get_name(m);
-
- if (strcmp(name, "crc16") == 0)
- crc16 = 1;
- if (strcmp(name, "mbcache") == 0)
- mbcache = 1;
- else if (strcmp(name, "jbd2") == 0)
- jbd2 = 1;
-
- kmod_module_unref(m);
- len++;
- }
-
- /* crc16, mbcache, jbd2 */
- if (len != 3 || !crc16 || !mbcache || !jbd2)
- return EXIT_FAILURE;
-
- kmod_module_unref_list(list);
- kmod_module_unref(mod);
- kmod_unref(ctx);
-
- return EXIT_SUCCESS;
-}
-static const struct test stest_dependencies = {
- .name = "test_dependencies",
- .description = "test if kmod_module_get_dependencies works",
- .func = test_dependencies,
- .config = {
- [TC_ROOTFS] = TESTSUITE_ROOTFS "test-dependencies/",
- [TC_UNAME_R] = TEST_UNAME,
- },
- .need_spawn = true,
-};
-
-static const struct test *tests[] = {
- &stest_dependencies,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
deleted file mode 100644
index 0ea8982..0000000
--- a/testsuite/test-depmod.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <string.h>
-
-#include "testsuite.h"
-
-#define MODULES_ORDER_UNAME "3.5.4-1-ARCH"
-#define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed"
-#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_ORDER_UNAME
-static __noreturn int depmod_modules_order_for_compressed(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
- const char *const args[] = {
- progname,
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-static DEFINE_TEST(depmod_modules_order_for_compressed,
- .description = "check if depmod let aliases in right order when using compressed modules",
- .config = {
- [TC_UNAME_R] = MODULES_ORDER_UNAME,
- [TC_ROOTFS] = MODULES_ORDER_ROOTFS,
- },
- .output = {
- .files = (const struct keyval[]) {
- { MODULES_ORDER_LIB_MODULES "/correct-modules.alias",
- MODULES_ORDER_LIB_MODULES "/modules.alias" },
- { }
- },
- });
-
-
-static const struct test *tests[] = {
- &sdepmod_modules_order_for_compressed,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
diff --git a/testsuite/test-init.c b/testsuite/test-init.c
index 47a6512..f09c4d2 100644
--- a/testsuite/test-init.c
+++ b/testsuite/test-init.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
@@ -71,7 +70,7 @@ static __noreturn int test_insert(const struct test *t)
static DEFINE_TEST(test_insert,
.description = "test if libkmod's insert_module returns ok",
.config = {
- [TC_ROOTFS] = TESTSUITE_ROOTFS "test-init/",
+ [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/",
[TC_INIT_MODULE_RETCODES] = "bla:1:20",
},
.need_spawn = true);
@@ -105,7 +104,7 @@ static __noreturn int test_remove(const struct test *t)
static DEFINE_TEST(test_remove,
.description = "test if libkmod's remove_module returns ok",
.config = {
- [TC_ROOTFS] = TESTSUITE_ROOTFS "test-remove/",
+ [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/",
[TC_DELETE_MODULE_RETCODES] = "bla:1:20",
},
.need_spawn = true);
diff --git a/testsuite/test-loaded.c b/testsuite/test-loaded.c
index 33865cb..81c9e5a 100644
--- a/testsuite/test-loaded.c
+++ b/testsuite/test-loaded.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
diff --git a/testsuite/test-modinfo.c b/testsuite/test-modinfo.c
index c5934ea..0ff6998 100644
--- a/testsuite/test-modinfo.c
+++ b/testsuite/test-modinfo.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
@@ -32,8 +31,7 @@ static __noreturn int modinfo_jonsmodules(const struct test *t)
const char *const args[] = {
progname,
"/ext4-i686.ko", "/ext4-ppc64.ko", "/ext4-s390x.ko",
- "/ext4-x86_64.ko", "/ext4-x86_64-sha1.ko",
- "/ext4-x86_64-sha256.ko",
+ "/ext4-x86_64.ko",
NULL,
};
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index cc90dae..3aebcae 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
@@ -70,30 +69,6 @@ static DEFINE_TEST(modprobe_show_depends2,
.stdout = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct-psmouse.txt",
});
-
-static __noreturn int modprobe_show_alias_to_none(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "--show-depends", "--ignore-install", "--quiet", "psmouse",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-static DEFINE_TEST(modprobe_show_alias_to_none,
- .description = "check if modprobe --show-depends doesn't explode with an alias to nothing",
- .config = {
- [TC_UNAME_R] = "4.4.4",
- [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/alias-to-none",
- },
- .output = {
- .stdout = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct-psmouse.txt",
- });
-
-
static __noreturn int modprobe_builtin(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
@@ -113,59 +88,10 @@ static DEFINE_TEST(modprobe_builtin,
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/builtin",
});
-static __noreturn int modprobe_softdep_loop(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "bluetooth",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-static DEFINE_TEST(modprobe_softdep_loop,
- .description = "check if modprobe breaks softdep loop",
- .config = {
- [TC_UNAME_R] = "4.4.4",
- [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/softdep-loop",
- [TC_INIT_MODULE_RETCODES] = "",
- });
-
-static __noreturn int modprobe_install_cmd_loop(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "snd-pcm",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-static DEFINE_TEST(modprobe_install_cmd_loop,
- .description = "check if modprobe breaks install-commands loop",
- .config = {
- [TC_UNAME_R] = "4.4.4",
- [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/install-cmd-loop",
- [TC_INIT_MODULE_RETCODES] = "",
- },
- .env_vars = (const struct keyval[]) {
- { "MODPROBE", ABS_TOP_BUILDDIR "/tools/modprobe" },
- { }
- },
- );
-
-
static const struct test *tests[] = {
&smodprobe_show_depends,
&smodprobe_show_depends2,
- &smodprobe_show_alias_to_none,
&smodprobe_builtin,
- &smodprobe_softdep_loop,
- &smodprobe_install_cmd_loop,
NULL,
};
diff --git a/testsuite/test-new-module.c b/testsuite/test-new-module.c
index 240480e..9a0cc37 100644
--- a/testsuite/test-new-module.c
+++ b/testsuite/test-new-module.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
diff --git a/testsuite/test-testsuite.c b/testsuite/test-testsuite.c
index f52dd1f..043e09d 100644
--- a/testsuite/test-testsuite.c
+++ b/testsuite/test-testsuite.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index 6d85d7f..9efe8de 100644
--- a/testsuite/testsuite.c
+++ b/testsuite/testsuite.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
@@ -24,14 +23,11 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <sys/prctl.h>
-#include <sys/stat.h>
#include <sys/wait.h>
-#include "libkmod-util.h"
#include "testsuite.h"
static const char *ANSI_HIGHLIGHT_GREEN_ON = "\x1B[1;32m";
@@ -59,19 +55,6 @@ struct _env_config {
[TC_DELETE_MODULE_RETCODES] = { S_TC_DELETE_MODULE_RETCODES, OVERRIDE_LIBDIR "delete_module.so" },
};
-#define USEC_PER_SEC 1000000ULL
-#define USEC_PER_MSEC 1000ULL
-#define TEST_TIMEOUT_USEC 2 * USEC_PER_SEC
-static unsigned long long now_usec(void)
-{
- struct timespec ts;
-
- if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
- return 0;
-
- return ts_usec(&ts);
-}
-
static void help(void)
{
const struct option *itr;
@@ -175,7 +158,6 @@ static void test_export_environ(const struct test *t)
char *preload = NULL;
size_t preloadlen = 0;
size_t i;
- const struct keyval *env;
unsetenv("LD_PRELOAD");
@@ -209,13 +191,10 @@ static void test_export_environ(const struct test *t)
setenv("LD_PRELOAD", preload, 1);
free(preload);
-
- for (env = t->env_vars; env && env->key; env++)
- setenv(env->key, env->val, 1);
}
static inline int test_run_child(const struct test *t, int fdout[2],
- int fderr[2], int fdmonitor[2])
+ int fderr[2])
{
/* kill child if parent dies */
prctl(PR_SET_PDEATHSIG, SIGTERM);
@@ -239,30 +218,6 @@ static inline int test_run_child(const struct test *t, int fdout[2],
}
}
- close(fdmonitor[0]);
-
- if (t->config[TC_ROOTFS] != NULL) {
- const char *stamp = TESTSUITE_ROOTFS "../stamp-rootfs";
- const char *rootfs = t->config[TC_ROOTFS];
- struct stat rootfsst, stampst;
-
- if (stat(stamp, &stampst) != 0) {
- ERR("could not stat %s\n - %m", stamp);
- exit(EXIT_FAILURE);
- }
-
- if (stat(rootfs, &rootfsst) != 0) {
- ERR("could not stat %s\n - %m", rootfs);
- exit(EXIT_FAILURE);
- }
-
- if (stat_mstamp(&rootfsst) > stat_mstamp(&stampst)) {
- ERR("rootfs %s is dirty, please run 'make rootfs' before runnning this test\n",
- rootfs);
- exit(EXIT_FAILURE);
- }
- }
-
if (t->need_spawn)
return test_spawn_test(t);
else
@@ -270,11 +225,13 @@ static inline int test_run_child(const struct test *t, int fdout[2],
}
static inline bool test_run_parent_check_outputs(const struct test *t,
- int fdout, int fderr, int fdmonitor, pid_t child)
+ int fdout, int fderr)
{
- struct epoll_event ep_outpipe, ep_errpipe, ep_monitor;
+ struct epoll_event ep_outpipe, ep_errpipe;
int err, fd_ep, fd_matchout = -1, fd_matcherr = -1;
- unsigned long long end_usec, start_usec;
+
+ if (t->output.stdout == NULL && t->output.stderr == NULL)
+ return true;
fd_ep = epoll_create1(EPOLL_CLOEXEC);
if (fd_ep < 0) {
@@ -321,28 +278,11 @@ static inline bool test_run_parent_check_outputs(const struct test *t,
} else
fderr = -1;
- memset(&ep_monitor, 0, sizeof(struct epoll_event));
- ep_monitor.events = EPOLLHUP;
- ep_monitor.data.ptr = &fdmonitor;
- if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fdmonitor, &ep_monitor) < 0) {
- err = -errno;
- ERR("could not add monitor fd to epoll: %m\n");
- goto out;
- }
-
- start_usec = now_usec();
- end_usec = start_usec + TEST_TIMEOUT_USEC;
-
- for (err = 0; fdmonitor >= 0 || fdout >= 0 || fderr >= 0;) {
- int fdcount, i, timeout;
+ for (err = 0; fdout >= 0 || fderr >= 0;) {
+ int fdcount, i;
struct epoll_event ev[4];
- unsigned long long curr_usec = now_usec();
- if (curr_usec > end_usec)
- break;
-
- timeout = (end_usec - curr_usec) / USEC_PER_MSEC;
- fdcount = epoll_wait(fd_ep, ev, 4, timeout);
+ fdcount = epoll_wait(fd_ep, ev, 4, -1);
if (fdcount < 0) {
if (errno == EINTR)
continue;
@@ -371,13 +311,8 @@ static inline bool test_run_parent_check_outputs(const struct test *t,
if (*fd == fdout)
fd_match = fd_matchout;
- else if (*fd == fderr)
+ else
fd_match = fd_matcherr;
- else {
- ERR("Unexpected activity on monitor pipe\n");
- err = -EINVAL;
- goto out;
- }
for (;;) {
int rmatch = read(fd_match,
@@ -416,14 +351,8 @@ static inline bool test_run_parent_check_outputs(const struct test *t,
*fd = -1;
}
}
- }
- if (err == 0 && fdmonitor >= 0) {
- err = -EINVAL;
- ERR("Test '%s' timed out, killing %d\n", t->name, child);
- kill(child, SIGKILL);
}
-
out:
if (fd_matchout >= 0)
close(fd_matchout);
@@ -434,102 +363,8 @@ out:
return err == 0;
}
-static inline int safe_read(int fd, void *buf, size_t count)
-{
- int r;
-
- while (1) {
- r = read(fd, buf, count);
- if (r == -1 && errno == EINTR)
- continue;
- break;
- }
-
- return r;
-}
-
-static bool check_generated_files(const struct test *t)
-{
- const struct keyval *k;
-
- /* This is not meant to be a diff replacement, just stupidly check if
- * the files match. Bear in mind they can be binary files */
- for (k = t->output.files; k && k->key; k++) {
- struct stat sta, stb;
- int fda = -1, fdb = -1;
- char bufa[4096];
- char bufb[4096];
-
- fda = open(k->key, O_RDONLY);
- if (fda < 0) {
- ERR("could not open %s\n - %m\n", k->key);
- goto fail;
- }
-
- fdb = open(k->val, O_RDONLY);
- if (fdb < 0) {
- ERR("could not open %s\n - %m\n", k->val);
- goto fail;
- }
-
- if (fstat(fda, &sta) != 0) {
- ERR("could not fstat %d %s\n - %m\n", fda, k->key);
- goto fail;
- }
-
- if (fstat(fdb, &stb) != 0) {
- ERR("could not fstat %d %s\n - %m\n", fdb, k->key);
- goto fail;
- }
-
- if (sta.st_size != stb.st_size) {
- ERR("sizes do not match %s %s\n", k->key, k->val);
- goto fail;
- }
-
- for (;;) {
- int r, done;
-
- r = safe_read(fda, bufa, sizeof(bufa));
- if (r < 0)
- goto fail;
-
- if (r == 0)
- /* size is already checked, go to next file */
- goto next;
-
- for (done = 0; done < r;) {
- int r2 = safe_read(fdb, bufb + done, r - done);
-
- if (r2 <= 0)
- goto fail;
-
- done += r2;
- }
-
- if (memcmp(bufa, bufb, r) != 0)
- goto fail;
- }
-
-next:
- close(fda);
- close(fdb);
- continue;
-
-fail:
- if (fda >= 0)
- close(fda);
- if (fdb >= 0)
- close(fdb);
-
- return false;
- }
-
- return true;
-}
-
static inline int test_run_parent(const struct test *t, int fdout[2],
- int fderr[2], int fdmonitor[2], pid_t child)
+ int fderr[2])
{
pid_t pid;
int err;
@@ -540,10 +375,8 @@ static inline int test_run_parent(const struct test *t, int fdout[2],
close(fdout[1]);
if (t->output.stderr != NULL)
close(fderr[1]);
- close(fdmonitor[1]);
- matchout = test_run_parent_check_outputs(t, fdout[0], fderr[0],
- fdmonitor[0], child);
+ matchout = test_run_parent_check_outputs(t, fdout[0], fderr[0]);
/*
* break pipe on the other end: either child already closed or we want
@@ -553,7 +386,6 @@ static inline int test_run_parent(const struct test *t, int fdout[2],
close(fdout[0]);
if (t->output.stderr != NULL)
close(fderr[0]);
- close(fdmonitor[0]);
do {
pid = wait(&err);
@@ -573,12 +405,8 @@ static inline int test_run_parent(const struct test *t, int fdout[2],
} else if (WIFSIGNALED(err)) {
ERR("'%s' [%u] terminated by signal %d (%s)\n", t->name, pid,
WTERMSIG(err), strsignal(WTERMSIG(err)));
- return t->expected_fail ? EXIT_SUCCESS : EXIT_FAILURE;
}
- if (matchout)
- matchout = check_generated_files(t);
-
if (t->expected_fail == false) {
if (err == 0) {
if (matchout)
@@ -645,7 +473,6 @@ int test_run(const struct test *t)
pid_t pid;
int fdout[2];
int fderr[2];
- int fdmonitor[2];
if (t->need_spawn && oneshot)
test_run_spawned(t);
@@ -664,11 +491,6 @@ int test_run(const struct test *t)
}
}
- if (pipe(fdmonitor) != 0) {
- ERR("could not create monitor pipe for %s\n", t->name);
- return EXIT_FAILURE;
- }
-
if (prepend_path(t->path) < 0) {
ERR("failed to prepend '%s' to PATH\n", t->path);
return EXIT_FAILURE;
@@ -684,7 +506,7 @@ int test_run(const struct test *t)
}
if (pid > 0)
- return test_run_parent(t, fdout, fderr, fdmonitor, pid);
+ return test_run_parent(t, fdout, fderr);
- return test_run_child(t, fdout, fderr, fdmonitor);
+ return test_run_child(t, fdout, fderr);
}
diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h
index 329d4a1..be3bfb8 100644
--- a/testsuite/testsuite.h
+++ b/testsuite/testsuite.h
@@ -1,22 +1,22 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#pragma once
+#ifndef _LIBKMOD_TESTSUITE_
+#define _LIBKMOD_TESTSUITE_
#include <stdbool.h>
#include <stdarg.h>
@@ -72,31 +72,17 @@ enum test_config {
#define S_TC_INIT_MODULE_RETCODES "TESTSUITE_INIT_MODULE_RETCODES"
#define S_TC_DELETE_MODULE_RETCODES "TESTSUITE_DELETE_MODULE_RETCODES"
-struct keyval {
- const char *key;
- const char *val;
-};
struct test {
const char *name;
const char *description;
struct {
- /* File with correct stdout */
const char *stdout;
- /* File with correct stderr */
const char *stderr;
-
- /*
- * Vector with pair of files
- * key = correct file
- * val = file to check
- */
- const struct keyval *files;
} output;
testfunc func;
const char *config[_TC_LAST];
const char *path;
- const struct keyval *env_vars;
bool need_spawn;
bool expected_fail;
};
@@ -152,4 +138,6 @@ int test_run(const struct test *t);
exit(EXIT_SUCCESS); \
} \
+#endif
+
#define __noreturn __attribute__((noreturn))
diff --git a/testsuite/uname.c b/testsuite/uname.c
index 2ada200..8e5bdbb 100644
--- a/testsuite/uname.c
+++ b/testsuite/uname.c
@@ -1,19 +1,18 @@
/*
- * Copyright (C) 2012-2013 ProFUSION embedded systems
+ * Copyright (C) 2012 ProFUSION embedded systems
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
diff --git a/tools/depmod.c b/tools/kmod-depmod.c
index 4a02631..1871e18 100644
--- a/tools/depmod.c
+++ b/tools/kmod-depmod.c
@@ -1,7 +1,7 @@
/*
* kmod-depmod - calculate modules.dep using libkmod.
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
#include <getopt.h>
#include <errno.h>
#include <string.h>
+#include <syslog.h>
#include <limits.h>
#include <dirent.h>
#include <sys/utsname.h>
@@ -35,45 +36,58 @@
#include <unistd.h>
#include <ctype.h>
-#include "kmod.h"
-
#define DEFAULT_VERBOSE LOG_WARNING
static int verbose = DEFAULT_VERBOSE;
+static const struct kmod_ext {
+ const char *ext;
+ size_t len;
+} kmod_exts[] = {
+ {".ko", sizeof(".ko") - 1},
+#ifdef ENABLE_ZLIB
+ {".ko.gz", sizeof(".ko.gz") - 1},
+#endif
+#ifdef ENABLE_XZ
+ {".ko.xz", sizeof(".ko.xz") - 1},
+#endif
+ {NULL, 0},
+};
+
static const char CFG_BUILTIN_KEY[] = "built-in";
static const char *default_cfg_paths[] = {
"/run/depmod.d",
SYSCONFDIR "/depmod.d",
- "/lib/depmod.d",
+ ROOTPREFIX "/lib/depmod.d",
NULL
};
static const char cmdopts_s[] = "aAb:C:E:F:euqrvnP:wmVh";
static const struct option cmdopts[] = {
- { "all", no_argument, 0, 'a' },
- { "quick", no_argument, 0, 'A' },
- { "basedir", required_argument, 0, 'b' },
- { "config", required_argument, 0, 'C' },
- { "symvers", required_argument, 0, 'E' },
- { "filesyms", required_argument, 0, 'F' },
- { "errsyms", no_argument, 0, 'e' },
- { "unresolved-error", no_argument, 0, 'u' }, /* deprecated */
- { "quiet", no_argument, 0, 'q' }, /* deprecated */
- { "root", no_argument, 0, 'r' }, /* deprecated */
- { "verbose", no_argument, 0, 'v' },
- { "show", no_argument, 0, 'n' },
- { "dry-run", no_argument, 0, 'n' },
- { "symbol-prefix", required_argument, 0, 'P' },
- { "warn", no_argument, 0, 'w' },
- { "map", no_argument, 0, 'm' }, /* deprecated */
- { "version", no_argument, 0, 'V' },
- { "help", no_argument, 0, 'h' },
- { }
+ {"all", no_argument, 0, 'a'},
+ {"quick", no_argument, 0, 'A'},
+ {"basedir", required_argument, 0, 'b'},
+ {"config", required_argument, 0, 'C'},
+ {"symvers", required_argument, 0, 'E'},
+ {"filesyms", required_argument, 0, 'F'},
+ {"errsyms", no_argument, 0, 'e'},
+ {"unresolved-error", no_argument, 0, 'u'}, /* deprecated */
+ {"quiet", no_argument, 0, 'q'}, /* deprecated */
+ {"root", no_argument, 0, 'r'}, /* deprecated */
+ {"verbose", no_argument, 0, 'v'},
+ {"show", no_argument, 0, 'n'},
+ {"dry-run", no_argument, 0, 'n'},
+ {"symbol-prefix", no_argument, 0, 'P'},
+ {"warn", no_argument, 0, 'w'},
+ {"map", no_argument, 0, 'm'}, /* deprecated */
+ {"version", no_argument, 0, 'V'},
+ {"help", no_argument, 0, 'h'},
+ {NULL, 0, 0, 0}
};
-static void help(void)
+static void help(const char *progname)
{
- printf("Usage:\n"
+ fprintf(stderr,
+ "Usage:\n"
"\t%s -[aA] [options] [forced_version]\n"
"\n"
"If no arguments (except options) are given, \"depmod -a\" is assumed\n"
@@ -98,10 +112,9 @@ static void help(void)
"\t current kernel symbols.\n"
"\t-E, --symvers=FILE Use Module.symvers file to check\n"
"\t symbol versions.\n",
- program_invocation_short_name);
+ progname);
}
-_printf_format_(1, 2)
static inline void _show(const char *fmt, ...)
{
va_list args;
@@ -114,6 +127,58 @@ static inline void _show(const char *fmt, ...)
fflush(stdout);
va_end(args);
}
+
+static inline void _log(int prio, const char *fmt, ...)
+{
+ const char *prioname;
+ char buf[32], *msg;
+ va_list args;
+
+ if (prio > verbose)
+ return;
+
+ va_start(args, fmt);
+ if (vasprintf(&msg, fmt, args) < 0)
+ msg = NULL;
+ va_end(args);
+ if (msg == NULL)
+ return;
+
+ switch (prio) {
+ case LOG_CRIT:
+ prioname = "FATAL";
+ break;
+ case LOG_ERR:
+ prioname = "ERROR";
+ break;
+ case LOG_WARNING:
+ prioname = "WARNING";
+ break;
+ case LOG_NOTICE:
+ prioname = "NOTICE";
+ break;
+ case LOG_INFO:
+ prioname = "INFO";
+ break;
+ case LOG_DEBUG:
+ prioname = "DEBUG";
+ break;
+ default:
+ snprintf(buf, sizeof(buf), "LOG-%03d", prio);
+ prioname = buf;
+ }
+
+ fprintf(stderr, "%s: %s", prioname, msg);
+ free(msg);
+
+ if (prio <= LOG_CRIT)
+ exit(EXIT_FAILURE);
+}
+#define CRIT(...) _log(LOG_CRIT, __VA_ARGS__)
+#define ERR(...) _log(LOG_ERR, __VA_ARGS__)
+#define WRN(...) _log(LOG_WARNING, __VA_ARGS__)
+#define INF(...) _log(LOG_INFO, __VA_ARGS__)
+#define DBG(...) _log(LOG_DEBUG, __VA_ARGS__)
#define SHOW(...) _show(__VA_ARGS__)
@@ -926,11 +991,8 @@ static void cfg_free(struct cfg *cfg)
/* depmod calculations ***********************************************/
struct mod {
struct kmod_module *kmod;
- char *path;
+ const char *path;
const char *relpath; /* path relative to '$ROOT/lib/modules/$VER/' */
- char *uncrelpath; /* same as relpath but ending in .ko */
- struct kmod_list *info_list;
- struct kmod_list *dep_sym_list;
struct array deps; /* struct symbol */
size_t baselen; /* points to start of basename/filename */
size_t modnamelen;
@@ -952,7 +1014,7 @@ struct depmod {
const struct cfg *cfg;
struct kmod_ctx *ctx;
struct array modules;
- struct hash *modules_by_uncrelpath;
+ struct hash *modules_by_relpath;
struct hash *modules_by_name;
struct hash *symbols;
unsigned int dep_loops;
@@ -963,10 +1025,6 @@ static void mod_free(struct mod *mod)
DBG("free %p kmod=%p, path=%s\n", mod, mod->kmod, mod->path);
array_free_array(&mod->deps);
kmod_module_unref(mod->kmod);
- kmod_module_info_free_list(mod->info_list);
- kmod_module_dependency_symbols_free_list(mod->dep_sym_list);
- free(mod->uncrelpath);
- free(mod->path);
free(mod);
}
@@ -1008,10 +1066,10 @@ static int depmod_init(struct depmod *depmod, struct cfg *cfg,
array_init(&depmod->modules, 128);
- depmod->modules_by_uncrelpath = hash_new(512, NULL);
- if (depmod->modules_by_uncrelpath == NULL) {
+ depmod->modules_by_relpath = hash_new(512, NULL);
+ if (depmod->modules_by_relpath == NULL) {
err = -errno;
- goto modules_by_uncrelpath_failed;
+ goto modules_by_relpath_failed;
}
depmod->modules_by_name = hash_new(512, NULL);
@@ -1031,8 +1089,8 @@ static int depmod_init(struct depmod *depmod, struct cfg *cfg,
symbols_failed:
hash_free(depmod->modules_by_name);
modules_by_name_failed:
- hash_free(depmod->modules_by_uncrelpath);
-modules_by_uncrelpath_failed:
+ hash_free(depmod->modules_by_relpath);
+modules_by_relpath_failed:
return err;
}
@@ -1042,7 +1100,7 @@ static void depmod_shutdown(struct depmod *depmod)
hash_free(depmod->symbols);
- hash_free(depmod->modules_by_uncrelpath);
+ hash_free(depmod->modules_by_relpath);
hash_free(depmod->modules_by_name);
@@ -1056,7 +1114,7 @@ static void depmod_shutdown(struct depmod *depmod)
static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
{
const struct cfg *cfg = depmod->cfg;
- const char *modname, *lastslash;
+ const char *modname;
size_t modnamelen;
struct mod *mod;
int err;
@@ -1075,9 +1133,8 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
array_init(&mod->deps, 4);
- mod->path = strdup(kmod_module_get_path(kmod));
- lastslash = strrchr(mod->path, '/');
- mod->baselen = lastslash - mod->path;
+ mod->path = kmod_module_get_path(kmod);
+ mod->baselen = strrchr(mod->path, '/') - mod->path;
if (strncmp(mod->path, cfg->dirname, cfg->dirnamelen) == 0 &&
mod->path[cfg->dirnamelen] == '/')
mod->relpath = mod->path + cfg->dirnamelen + 1;
@@ -1087,40 +1144,33 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
err = hash_add_unique(depmod->modules_by_name, mod->modname, mod);
if (err < 0) {
ERR("hash_add_unique %s: %s\n", mod->modname, strerror(-err));
- goto fail;
+ free(mod);
+ return err;
}
if (mod->relpath != NULL) {
- size_t uncrelpathlen = lastslash - mod->relpath + modnamelen
- + kmod_exts[KMOD_EXT_UNC].len;
- mod->uncrelpath = memdup(mod->relpath, uncrelpathlen + 1);
- mod->uncrelpath[uncrelpathlen] = '\0';
- err = hash_add_unique(depmod->modules_by_uncrelpath,
- mod->uncrelpath, mod);
+ err = hash_add_unique(depmod->modules_by_relpath,
+ mod->relpath, mod);
if (err < 0) {
ERR("hash_add_unique %s: %s\n",
- mod->uncrelpath, strerror(-err));
+ mod->relpath, strerror(-err));
hash_del(depmod->modules_by_name, mod->modname);
- goto fail;
+ free(mod);
+ return err;
}
}
DBG("add %p kmod=%p, path=%s\n", mod, kmod, mod->path);
return 0;
-
-fail:
- free(mod->uncrelpath);
- free(mod);
- return err;
}
static int depmod_module_del(struct depmod *depmod, struct mod *mod)
{
DBG("del %p kmod=%p, path=%s\n", mod, mod->kmod, mod->path);
- if (mod->uncrelpath != NULL)
- hash_del(depmod->modules_by_uncrelpath, mod->uncrelpath);
+ if (mod->relpath != NULL)
+ hash_del(depmod->modules_by_relpath, mod->relpath);
hash_del(depmod->modules_by_name, mod->modname);
@@ -1189,10 +1239,20 @@ static int depmod_modules_search_file(struct depmod *depmod, size_t baselen, siz
struct mod *mod;
const char *relpath;
char modname[PATH_MAX];
+ const struct kmod_ext *eitr;
size_t modnamelen;
- int err;
+ uint8_t matches = 0;
+ int err = 0;
- if (!path_ends_with_kmod_ext(path + baselen, namelen))
+ for (eitr = kmod_exts; eitr->ext != NULL; eitr++) {
+ if (namelen <= eitr->len)
+ continue;
+ if (streq(path + baselen + namelen - eitr->len, eitr->ext)) {
+ matches = 1;
+ break;
+ }
+ }
+ if (!matches)
return 0;
if (path_to_modname(path, modname, &modnamelen) == NULL) {
@@ -1257,7 +1317,7 @@ static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t basel
namelen = strlen(name);
if (baselen + namelen + 2 >= PATH_MAX) {
path[baselen] = '\0';
- ERR("path is too long %s%s\n", path, name);
+ ERR("path is too long %s%s %zd\n", path, name);
continue;
}
memcpy(path + baselen, name, namelen + 1);
@@ -1342,7 +1402,7 @@ static int depmod_modules_search(struct depmod *depmod)
err = depmod_modules_search_dir(depmod, d, baselen, path);
closedir(d);
- return err;
+ return 0;
}
static int mod_cmp(const void *pa, const void *pb) {
@@ -1412,7 +1472,7 @@ static void depmod_modules_sort(struct depmod *depmod)
continue;
line[len - 1] = '\0';
- mod = hash_find(depmod->modules_by_uncrelpath, line);
+ mod = hash_find(depmod->modules_by_relpath, line);
if (mod == NULL)
continue;
mod->sort_idx = idx - total;
@@ -1429,14 +1489,13 @@ corrupted:
}
static int depmod_symbol_add(struct depmod *depmod, const char *name,
- bool prefix_skipped, uint64_t crc,
- const struct mod *owner)
+ uint64_t crc, const struct mod *owner)
{
size_t namelen;
int err;
struct symbol *sym;
- if (!prefix_skipped && (name[0] == depmod->cfg->sym_prefix))
+ if (name[0] == depmod->cfg->sym_prefix)
name++;
namelen = strlen(name) + 1;
@@ -1470,42 +1529,32 @@ static struct symbol *depmod_symbol_find(const struct depmod *depmod,
return hash_find(depmod->symbols, name);
}
-static int depmod_load_modules(struct depmod *depmod)
+static int depmod_load_symbols(struct depmod *depmod)
{
- struct mod **itr, **itr_end;
+ const struct mod **itr, **itr_end;
DBG("load symbols (%zd modules)\n", depmod->modules.count);
- itr = (struct mod **)depmod->modules.array;
+ itr = (const struct mod **)depmod->modules.array;
itr_end = itr + depmod->modules.count;
for (; itr < itr_end; itr++) {
- struct mod *mod = *itr;
+ const struct mod *mod = *itr;
struct kmod_list *l, *list = NULL;
int err = kmod_module_get_symbols(mod->kmod, &list);
if (err < 0) {
- if (err == -ENOENT)
- DBG("ignoring %s: no symbols\n", mod->path);
- else
- ERR("failed to load symbols from %s: %s\n",
- mod->path, strerror(-err));
- goto load_info;
+ DBG("ignoring %s: no symbols: %s\n",
+ mod->path, strerror(-err));
+ continue;
}
kmod_list_foreach(l, list) {
const char *name = kmod_module_symbol_get_symbol(l);
uint64_t crc = kmod_module_symbol_get_crc(l);
- depmod_symbol_add(depmod, name, false, crc, mod);
+ depmod_symbol_add(depmod, name, crc, mod);
}
kmod_module_symbols_free_list(list);
-
-load_info:
- kmod_module_get_info(mod->kmod, &mod->info_list);
- kmod_module_get_dependency_symbols(mod->kmod,
- &mod->dep_sym_list);
- kmod_module_unref(mod->kmod);
- mod->kmod = NULL;
}
- DBG("loaded symbols (%zd modules, %u symbols)\n",
+ DBG("loaded symbols (%zd modules, %zd symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
return 0;
@@ -1514,10 +1563,16 @@ load_info:
static int depmod_load_module_dependencies(struct depmod *depmod, struct mod *mod)
{
const struct cfg *cfg = depmod->cfg;
- struct kmod_list *l;
+ struct kmod_list *l, *list = NULL;
+ int err = kmod_module_get_dependency_symbols(mod->kmod, &list);
+ if (err < 0) {
+ DBG("ignoring %s: no dependency symbols: %s\n",
+ mod->path, strerror(-err));
+ return 0;
+ }
DBG("do dependencies of %s\n", mod->path);
- kmod_list_foreach(l, mod->dep_sym_list) {
+ kmod_list_foreach(l, list) {
const char *name = kmod_module_dependency_symbol_get_symbol(l);
uint64_t crc = kmod_module_dependency_symbol_get_crc(l);
int bindtype = kmod_module_dependency_symbol_get_bind(l);
@@ -1543,7 +1598,7 @@ static int depmod_load_module_dependencies(struct depmod *depmod, struct mod *mo
mod_add_dependency(mod, sym);
}
-
+ kmod_module_dependency_symbols_free_list(list);
return 0;
}
@@ -1551,23 +1606,17 @@ static int depmod_load_dependencies(struct depmod *depmod)
{
struct mod **itr, **itr_end;
- DBG("load dependencies (%zd modules, %u symbols)\n",
+ DBG("load dependencies (%zd modules, %zd symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
itr = (struct mod **)depmod->modules.array;
itr_end = itr + depmod->modules.count;
for (; itr < itr_end; itr++) {
struct mod *mod = *itr;
-
- if (mod->dep_sym_list == NULL) {
- DBG("ignoring %s: no dependency symbols\n", mod->path);
- continue;
- }
-
depmod_load_module_dependencies(depmod, mod);
}
- DBG("loaded dependencies (%zd modules, %u symbols)\n",
+ DBG("loaded dependencies (%zd modules, %zd symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
return 0;
@@ -1610,7 +1659,7 @@ static int depmod_calculate_dependencies(struct depmod *depmod)
roots = users + n_mods;
sorted = roots + n_mods;
- DBG("calculate dependencies and ordering (%hu modules)\n", n_mods);
+ DBG("calculate dependencies and ordering (%zd modules)\n", n_mods);
assert(depmod->modules.count < UINT16_MAX);
@@ -1651,7 +1700,7 @@ static int depmod_calculate_dependencies(struct depmod *depmod)
}
if (n_sorted < n_mods) {
- WRN("found %u modules in dependency cycles!\n",
+ WRN("found %hu modules in dependency cycles!\n",
n_mods - n_sorted);
for (i = 0; i < n_mods; i++) {
struct mod *m;
@@ -1667,7 +1716,7 @@ static int depmod_calculate_dependencies(struct depmod *depmod)
depmod_sort_dependencies(depmod);
- DBG("calculated dependencies and ordering (%u loops, %hu modules)\n",
+ DBG("calculated dependencies and ordering (%u loops, %zd modules)\n",
depmod->dep_loops, n_mods);
free(users);
@@ -1678,7 +1727,7 @@ static int depmod_load(struct depmod *depmod)
{
int err;
- err = depmod_load_modules(depmod);
+ err = depmod_load_symbols(depmod);
if (err < 0)
return err;
@@ -1898,17 +1947,21 @@ static int output_aliases(struct depmod *depmod, FILE *out)
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l;
-
- kmod_list_foreach(l, mod->info_list) {
+ struct kmod_list *l, *list = NULL;
+ int r = kmod_module_get_info(mod->kmod, &list);
+ if (r < 0 || list == NULL)
+ continue;
+ kmod_list_foreach(l, list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
if (!streq(key, "alias"))
continue;
- fprintf(out, "alias %s %s\n", value, mod->modname);
+ fprintf(out, "alias %s %s\n",
+ value, kmod_module_get_name(mod->kmod));
}
+ kmod_module_info_free_list(list);
}
return 0;
@@ -1929,12 +1982,14 @@ static int output_aliases_bin(struct depmod *depmod, FILE *out)
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l;
-
- kmod_list_foreach(l, mod->info_list) {
+ struct kmod_list *l, *list = NULL;
+ int r = kmod_module_get_info(mod->kmod, &list);
+ if (r < 0 || list == NULL)
+ continue;
+ kmod_list_foreach(l, list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
- const char *alias;
+ const char *modname, *alias;
int duplicate;
if (!streq(key, "alias"))
@@ -1944,12 +1999,14 @@ static int output_aliases_bin(struct depmod *depmod, FILE *out)
if (alias == NULL)
continue;
- duplicate = index_insert(idx, alias, mod->modname,
+ modname = kmod_module_get_name(mod->kmod);
+ duplicate = index_insert(idx, alias, modname,
mod->idx);
if (duplicate && depmod->cfg->warn_dups)
WRN("duplicate module alias:\n%s %s\n",
- alias, mod->modname);
+ alias, modname);
}
+ kmod_module_info_free_list(list);
}
index_write(idx, out);
@@ -1968,17 +2025,21 @@ static int output_softdeps(struct depmod *depmod, FILE *out)
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l;
-
- kmod_list_foreach(l, mod->info_list) {
+ struct kmod_list *l, *list = NULL;
+ int r = kmod_module_get_info(mod->kmod, &list);
+ if (r < 0 || list == NULL)
+ continue;
+ kmod_list_foreach(l, list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
if (!streq(key, "softdep"))
continue;
- fprintf(out, "softdep %s %s\n", mod->modname, value);
+ fprintf(out, "softdep %s %s\n",
+ kmod_module_get_name(mod->kmod), value);
}
+ kmod_module_info_free_list(list);
}
return 0;
@@ -2055,11 +2116,12 @@ static int output_builtin_bin(struct depmod *depmod, FILE *out)
return 0;
snprintf(infile, sizeof(infile), "%s/modules.builtin",
- depmod->cfg->dirname);
+ depmod->cfg->dirname);
in = fopen(infile, "r");
if (in == NULL) {
+ int err = -errno;
WRN("could not open %s: %m\n", infile);
- return 0;
+ return err;
}
idx = index_create();
@@ -2093,12 +2155,17 @@ static int output_devname(struct depmod *depmod, FILE *out)
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l;
+ struct kmod_list *l, *list = NULL;
const char *devname = NULL;
char type = '\0';
unsigned int major = 0, minor = 0;
+ int r;
- kmod_list_foreach(l, mod->info_list) {
+ r = kmod_module_get_info(mod->kmod, &list);
+ if (r < 0 || list == NULL)
+ continue;
+
+ kmod_list_foreach(l, list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
unsigned int maj, min;
@@ -2121,11 +2188,13 @@ static int output_devname(struct depmod *depmod, FILE *out)
}
if (type != '\0' && devname != NULL) {
- fprintf(out, "%s %s %c%u:%u\n", mod->modname,
+ fprintf(out, "%s %s %c%u:%u\n",
+ kmod_module_get_name(mod->kmod),
devname, type, major, minor);
break;
}
}
+ kmod_module_info_free_list(list);
}
return 0;
@@ -2137,16 +2206,16 @@ static int depmod_output(struct depmod *depmod, FILE *out)
const char *name;
int (*cb)(struct depmod *depmod, FILE *out);
} *itr, depfiles[] = {
- { "modules.dep", output_deps },
- { "modules.dep.bin", output_deps_bin },
- { "modules.alias", output_aliases },
- { "modules.alias.bin", output_aliases_bin },
- { "modules.softdep", output_softdeps },
- { "modules.symbols", output_symbols },
- { "modules.symbols.bin", output_symbols_bin },
- { "modules.builtin.bin", output_builtin_bin },
- { "modules.devname", output_devname },
- { }
+ {"modules.dep", output_deps},
+ {"modules.dep.bin", output_deps_bin},
+ {"modules.alias", output_aliases},
+ {"modules.alias.bin", output_aliases_bin},
+ {"modules.softdep", output_softdeps},
+ {"modules.symbols", output_symbols},
+ {"modules.symbols.bin", output_symbols_bin},
+ {"modules.builtin.bin", output_builtin_bin},
+ {"modules.devname", output_devname},
+ {NULL, NULL}
};
const char *dname = depmod->cfg->dirname;
int dfd, err = 0;
@@ -2165,7 +2234,7 @@ static int depmod_output(struct depmod *depmod, FILE *out)
for (itr = depfiles; itr->name != NULL; itr++) {
FILE *fp = out;
char tmp[NAME_MAX] = "";
- int r, ferr;
+ int r;
if (fp == NULL) {
int flags = O_CREAT | O_TRUNC | O_WRONLY;
@@ -2191,46 +2260,32 @@ static int depmod_output(struct depmod *depmod, FILE *out)
if (fp == out)
continue;
- ferr = ferror(fp) | fclose(fp);
-
+ fclose(fp);
if (r < 0) {
if (unlinkat(dfd, tmp, 0) != 0)
ERR("unlinkat(%s, %s): %m\n", dname, tmp);
-
- ERR("Could not write index '%s': %s\n", itr->name,
- strerror(-r));
- err = -errno;
- break;
- }
-
- unlinkat(dfd, itr->name, 0);
- if (renameat(dfd, tmp, dfd, itr->name) != 0) {
- err = -errno;
- CRIT("renameat(%s, %s, %s, %s): %m\n",
- dname, tmp, dname, itr->name);
- break;
- }
-
- if (ferr) {
- err = -ENOSPC;
- ERR("Could not create index '%s'. Output is truncated: %s\n",
- itr->name, strerror(-err));
- break;
+ } else {
+ unlinkat(dfd, itr->name, 0);
+ if (renameat(dfd, tmp, dfd, itr->name) != 0) {
+ err = -errno;
+ CRIT("renameat(%s, %s, %s, %s): %m\n",
+ dname, tmp, dname, itr->name);
+ break;
+ }
}
}
if (dfd >= 0)
close(dfd);
-
return err;
}
static void depmod_add_fake_syms(struct depmod *depmod)
{
/* __this_module is magic inserted by kernel loader. */
- depmod_symbol_add(depmod, "__this_module", true, 0, NULL);
+ depmod_symbol_add(depmod, "__this_module", 0, NULL);
/* On S390, this is faked up too */
- depmod_symbol_add(depmod, "_GLOBAL_OFFSET_TABLE_", true, 0, NULL);
+ depmod_symbol_add(depmod, "_GLOBAL_OFFSET_TABLE_", 0, NULL);
}
static int depmod_load_symvers(struct depmod *depmod, const char *filename)
@@ -2271,7 +2326,7 @@ static int depmod_load_symvers(struct depmod *depmod, const char *filename)
continue;
}
- depmod_symbol_add(depmod, sym, false, crc, NULL);
+ depmod_symbol_add(depmod, sym, crc, NULL);
}
depmod_add_fake_syms(depmod);
@@ -2312,10 +2367,6 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)
goto invalid_syntax;
p++;
- /* skip prefix */
- if (p[0] == depmod->cfg->sym_prefix)
- p++;
-
/* Covers gpl-only and normal symbols. */
if (strncmp(p, ksymstr, ksymstr_len) != 0)
continue;
@@ -2324,7 +2375,7 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)
if (end != NULL)
*end = '\0';
- depmod_symbol_add(depmod, p + ksymstr_len, true, 0, NULL);
+ depmod_symbol_add(depmod, p + ksymstr_len, 0, NULL);
continue;
invalid_syntax:
@@ -2357,7 +2408,7 @@ static int depfile_up_to_date_dir(DIR *d, time_t mtime, size_t baselen, char *pa
namelen = strlen(name);
if (baselen + namelen + 2 >= PATH_MAX) {
path[baselen] = '\0';
- ERR("path is too long %s%s\n", path, name);
+ ERR("path is too long %s%s %zd\n", path, name);
continue;
}
@@ -2393,9 +2444,18 @@ static int depfile_up_to_date_dir(DIR *d, time_t mtime, size_t baselen, char *pa
path);
closedir(subdir);
} else if (S_ISREG(st.st_mode)) {
- if (!path_ends_with_kmod_ext(name, namelen))
+ const struct kmod_ext *eitr;
+ uint8_t matches = 0;
+ for (eitr = kmod_exts; eitr->ext != NULL; eitr++) {
+ if (namelen <= eitr->len)
+ continue;
+ if (streq(name + namelen - eitr->len, eitr->ext)) {
+ matches = 1;
+ break;
+ }
+ }
+ if (!matches)
continue;
-
memcpy(path + baselen, name, namelen + 1);
err = st.st_mtime <= mtime;
if (err == 0) {
@@ -2534,15 +2594,17 @@ static int do_depmod(int argc, char *argv[])
case 'q':
case 'r':
case 'm':
- if (idx > 0)
- WRN("Ignored deprecated option --%s\n",
- cmdopts[idx].name);
- else
- WRN("Ignored deprecated option -%c\n", c);
-
+ if (idx > 0) {
+ fprintf(stderr,
+ "ignored deprecated option --%s\n",
+ cmdopts[idx].name);
+ } else {
+ fprintf(stderr,
+ "ignored deprecated option -%c\n", c);
+ }
break;
case 'h':
- help();
+ help(basename(argv[0]));
free(config_paths);
return EXIT_SUCCESS;
case 'V':
@@ -2552,7 +2614,9 @@ static int do_depmod(int argc, char *argv[])
case '?':
goto cmdline_failed;
default:
- ERR("unexpected getopt_long() value '%c'.\n", c);
+ fprintf(stderr,
+ "Error: unexpected getopt_long() value '%c'.\n",
+ c);
goto cmdline_failed;
}
}
@@ -2569,7 +2633,7 @@ static int do_depmod(int argc, char *argv[])
}
cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
- "%s/lib/modules/%s",
+ "%s" ROOTPREFIX "/lib/modules/%s",
root == NULL ? "" : root, cfg.kversion);
if (optind == argc)
@@ -2592,8 +2656,7 @@ static int do_depmod(int argc, char *argv[])
CRIT("kmod_new(\"%s\", {NULL}) failed: %m\n", cfg.dirname);
goto cmdline_failed;
}
-
- log_setup_kmod_log(ctx, verbose);
+ kmod_set_log_priority(ctx, verbose);
err = depmod_init(&depmod, &cfg, ctx);
if (err < 0) {
@@ -2693,8 +2756,19 @@ cmdline_failed:
return EXIT_FAILURE;
}
+#ifndef KMOD_BUNDLE_TOOL
+int main(int argc, char *argv[])
+{
+ return do_depmod(argc, argv);
+}
+
+#else
+#include "kmod.h"
+
const struct kmod_cmd kmod_cmd_compat_depmod = {
.name = "depmod",
.cmd = do_depmod,
.help = "compat depmod command",
};
+
+#endif
diff --git a/tools/insmod.c b/tools/kmod-insmod.c
index a795d89..4459cc0 100644
--- a/tools/insmod.c
+++ b/tools/kmod-insmod.c
@@ -1,7 +1,7 @@
/*
* kmod-insmod - insert modules into linux kernel using libkmod.
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +24,6 @@
#include <string.h>
#include "libkmod.h"
-#include "kmod.h"
static const char cmdopts_s[] = "psfVh";
static const struct option cmdopts[] = {
@@ -33,14 +32,15 @@ static const struct option cmdopts[] = {
{NULL, 0, 0, 0}
};
-static void help(void)
+static void help(const char *progname)
{
- printf("Usage:\n"
+ fprintf(stderr,
+ "Usage:\n"
"\t%s [options] filename [args]\n"
"Options:\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
- program_invocation_short_name);
+ progname);
}
static const char *mod_strerror(int err)
@@ -81,7 +81,7 @@ static int do_insmod(int argc, char *argv[])
/* ignored, for compatibility only */
break;
case 'h':
- help();
+ help(basename(argv[0]));
return EXIT_SUCCESS;
case 'V':
puts(PACKAGE " version " VERSION);
@@ -89,20 +89,22 @@ static int do_insmod(int argc, char *argv[])
case '?':
return EXIT_FAILURE;
default:
- ERR("unexpected getopt_long() value '%c'.\n",
+ fprintf(stderr,
+ "Error: unexpected getopt_long() value '%c'.\n",
c);
return EXIT_FAILURE;
}
}
if (optind >= argc) {
- ERR("missing filename.\n");
+ fprintf(stderr, "Error: missing filename.\n");
return EXIT_FAILURE;
}
filename = argv[optind];
if (strcmp(filename, "-") == 0) {
- ERR("this tool does not support loading from stdin!\n");
+ fputs("Error: this tool does not support loading from stdin!\n",
+ stderr);
return EXIT_FAILURE;
}
@@ -110,7 +112,7 @@ static int do_insmod(int argc, char *argv[])
size_t len = strlen(argv[i]);
void *tmp = realloc(opts, optslen + len + 2);
if (tmp == NULL) {
- ERR("out of memory\n");
+ fputs("Error: out of memory\n", stderr);
free(opts);
return EXIT_FAILURE;
}
@@ -126,22 +128,22 @@ static int do_insmod(int argc, char *argv[])
ctx = kmod_new(NULL, &null_config);
if (!ctx) {
- ERR("kmod_new() failed!\n");
+ fputs("Error: kmod_new() failed!\n", stderr);
free(opts);
return EXIT_FAILURE;
}
err = kmod_module_new_from_path(ctx, filename, &mod);
if (err < 0) {
- ERR("could not load module %s: %s\n", filename,
- strerror(-err));
+ fprintf(stderr, "Error: could not load module %s: %s\n",
+ filename, strerror(-err));
goto end;
}
err = kmod_module_insert_module(mod, 0, opts);
if (err < 0) {
- ERR("could not insert module %s: %s\n", filename,
- mod_strerror(-err));
+ fprintf(stderr, "Error: could not insert module %s: %s\n",
+ filename, mod_strerror(-err));
}
kmod_module_unref(mod);
@@ -151,8 +153,19 @@ end:
return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
+#ifndef KMOD_BUNDLE_TOOL
+int main(int argc, char *argv[])
+{
+ return do_insmod(argc, argv);
+}
+
+#else
+#include "kmod.h"
+
const struct kmod_cmd kmod_cmd_compat_insmod = {
.name = "insmod",
.cmd = do_insmod,
.help = "compat insmod command",
};
+
+#endif
diff --git a/tools/lsmod.c b/tools/kmod-lsmod.c
index b00a9cd..ad66b75 100644
--- a/tools/lsmod.c
+++ b/tools/kmod-lsmod.c
@@ -1,7 +1,7 @@
/*
* kmod-lsmod - list modules from linux kernel using libkmod.
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@
#include <string.h>
#include "libkmod.h"
-#include "kmod.h"
static int do_lsmod(int argc, char *argv[])
{
@@ -86,6 +85,15 @@ static int do_lsmod(int argc, char *argv[])
return EXIT_SUCCESS;
}
+#ifndef KMOD_BUNDLE_TOOL
+int main(int argc, char *argv[])
+{
+ return do_lsmod(argc, argv);
+}
+
+#else
+#include "kmod.h"
+
const struct kmod_cmd kmod_cmd_compat_lsmod = {
.name = "lsmod",
.cmd = do_lsmod,
@@ -97,3 +105,5 @@ const struct kmod_cmd kmod_cmd_list = {
.cmd = do_lsmod,
.help = "list currently loaded modules",
};
+
+#endif
diff --git a/tools/modinfo.c b/tools/kmod-modinfo.c
index 9a60d71..aa5223f 100644
--- a/tools/modinfo.c
+++ b/tools/kmod-modinfo.c
@@ -1,7 +1,7 @@
/*
* kmod-modinfo - query kernel module information using libkmod.
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,9 +27,8 @@
#include <sys/utsname.h>
#include <sys/stat.h>
#include "libkmod.h"
-#include "libkmod-util.h"
-#include "kmod.h"
+#define LOG(fmt, ...) fprintf(stderr, "ERROR: "fmt, ##__VA_ARGS__)
static char separator = '\n';
static const char *field = NULL;
@@ -88,7 +87,7 @@ static int process_parm(const char *key, const char *value, struct param **param
struct param *it;
const char *colon = strchr(value, ':');
if (colon == NULL) {
- ERR("Found invalid \"%s=%s\": missing ':'\n",
+ LOG("Found invalid \"%s=%s\": missing ':'\n",
key, value);
return 0;
}
@@ -109,7 +108,7 @@ static int process_parm(const char *key, const char *value, struct param **param
it = add_param(name, namelen, param, paramlen, type, typelen, params);
if (it == NULL) {
- ERR("Out of memory!\n");
+ LOG("Out of memory!\n");
return -ENOMEM;
}
@@ -183,7 +182,7 @@ static int modinfo_do(struct kmod_module *mod)
err = kmod_module_get_info(mod, &list);
if (err < 0) {
- ERR("could not get modinfo from '%s': %s\n",
+ LOG("could not get modinfo from '%s': %s\n",
kmod_module_get_name(mod), strerror(-err));
return err;
}
@@ -265,7 +264,7 @@ static int modinfo_path_do(struct kmod_ctx *ctx, const char *path)
struct kmod_module *mod;
int err = kmod_module_new_from_path(ctx, path, &mod);
if (err < 0) {
- ERR("Module file %s not found.\n", path);
+ LOG("Module file %s not found.\n", path);
return err;
}
err = modinfo_do(mod);
@@ -278,24 +277,24 @@ static int modinfo_alias_do(struct kmod_ctx *ctx, const char *alias)
struct kmod_list *l, *filtered, *list = NULL;
int err = kmod_module_new_from_lookup(ctx, alias, &list);
if (err < 0) {
- ERR("Module alias %s not found.\n", alias);
+ LOG("Module alias %s not found.\n", alias);
return err;
}
if (list == NULL) {
- ERR("Module %s not found.\n", alias);
+ LOG("Module %s not found.\n", alias);
return -ENOENT;
}
err = kmod_module_apply_filter(ctx, KMOD_FILTER_BUILTIN, list, &filtered);
kmod_module_unref_list(list);
if (err < 0) {
- ERR("Failed to filter list: %m\n");
+ LOG("Failed to filter list: %m\n");
return err;
}
if (filtered == NULL) {
- ERR("Module %s not found.\n", alias);
+ LOG("Module %s not found.\n", alias);
return -ENOENT;
}
@@ -326,9 +325,10 @@ static const struct option cmdopts[] = {
{NULL, 0, 0, 0}
};
-static void help(void)
+static void help(const char *progname)
{
- printf("Usage:\n"
+ fprintf(stderr,
+ "Usage:\n"
"\t%s [options] filename [args]\n"
"Options:\n"
"\t-a, --author Print only 'author'\n"
@@ -339,19 +339,26 @@ static void help(void)
"\t-0, --null Use \\0 instead of \\n\n"
"\t-F, --field=FIELD Print only provided FIELD\n"
"\t-k, --set-version=VERSION Use VERSION instead of `uname -r`\n"
- "\t-b, --basedir=DIR Use DIR as filesystem root for /lib/modules\n"
+ "\t-b, --basedir=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
"\t-V, --version Show version\n"
"\t-h, --help Show this help\n",
- program_invocation_short_name);
+ progname);
}
static bool is_module_filename(const char *name)
{
struct stat st;
+ const char *ptr;
if (stat(name, &st) == 0 && S_ISREG(st.st_mode) &&
- path_ends_with_kmod_ext(name, strlen(name)))
+ (ptr = strstr(name, ".ko")) != NULL) {
+ /*
+ * We screened for .ko; make sure this is either at the end of
+ * the name or followed by another '.' (e.g. gz or xz modules)
+ */
+ if(ptr[3] == '\0' || ptr[3] == '.')
return true;
+ }
return false;
}
@@ -400,7 +407,7 @@ static int do_modinfo(int argc, char *argv[])
root = optarg;
break;
case 'h':
- help();
+ help(basename(argv[0]));
return EXIT_SUCCESS;
case 'V':
puts(PACKAGE " version " VERSION);
@@ -408,13 +415,15 @@ static int do_modinfo(int argc, char *argv[])
case '?':
return EXIT_FAILURE;
default:
- ERR("unexpected getopt_long() value '%c'.\n", c);
+ fprintf(stderr,
+ "Error: unexpected getopt_long() value '%c'.\n",
+ c);
return EXIT_FAILURE;
}
}
if (optind >= argc) {
- ERR("missing module or filename.\n");
+ fprintf(stderr, "Error: missing module or filename.\n");
return EXIT_FAILURE;
}
@@ -424,19 +433,20 @@ static int do_modinfo(int argc, char *argv[])
root = "";
if (kversion == NULL) {
if (uname(&u) < 0) {
- ERR("uname() failed: %m\n");
+ fprintf(stderr, "Error: uname() failed: %s\n",
+ strerror(errno));
return EXIT_FAILURE;
}
kversion = u.release;
}
- snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" ROOTPREFIX "/lib/modules/%s",
root, kversion);
dirname = dirname_buf;
}
ctx = kmod_new(dirname, &null_config);
if (!ctx) {
- ERR("kmod_new() failed!\n");
+ fputs("Error: kmod_new() failed!\n", stderr);
return EXIT_FAILURE;
}
@@ -458,8 +468,19 @@ static int do_modinfo(int argc, char *argv[])
return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
+#ifndef KMOD_BUNDLE_TOOL
+int main(int argc, char *argv[])
+{
+ return do_modinfo(argc, argv);
+}
+
+#else
+#include "kmod.h"
+
const struct kmod_cmd kmod_cmd_compat_modinfo = {
.name = "modinfo",
.cmd = do_modinfo,
.help = "compat modinfo command",
};
+
+#endif
diff --git a/tools/modprobe.c b/tools/kmod-modprobe.c
index 6b34658..b94bdf3 100644
--- a/tools/modprobe.c
+++ b/tools/kmod-modprobe.c
@@ -1,7 +1,7 @@
/*
* kmod-modprobe - manage linux kernel modules using libkmod.
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -29,17 +28,15 @@
#include <sys/utsname.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <syslog.h>
#include <limits.h>
#include "libkmod.h"
#include "libkmod-array.h"
#include "macro.h"
-#include "kmod.h"
-
static int log_priority = LOG_CRIT;
static int use_syslog = 0;
-#define LOG(...) log_printf(log_priority, __VA_ARGS__)
#define DEFAULT_VERBOSE LOG_WARNING
static int verbose = DEFAULT_VERBOSE;
@@ -91,9 +88,10 @@ static const struct option cmdopts[] = {
{NULL, 0, 0, 0}
};
-static void help(void)
+static void help(const char *progname)
{
- printf("Usage:\n"
+ fprintf(stderr,
+ "Usage:\n"
"\t%s [options] [-i] [-b] modulename\n"
"\t%s [options] -a [-i] [-b] modulename [modulename...]\n"
"\t%s [options] -r [-i] modulename\n"
@@ -129,7 +127,7 @@ static void help(void)
"\t-n, --show Same as --dry-run\n"
"\t-C, --config=FILE Use FILE instead of default search paths\n"
- "\t-d, --dirname=DIR Use DIR as filesystem root for /lib/modules\n"
+ "\t-d, --dirname=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
"\t-s, --syslog print to syslog, not stderr\n"
@@ -137,12 +135,9 @@ static void help(void)
"\t-v, --verbose enables more messages\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
- program_invocation_short_name, program_invocation_short_name,
- program_invocation_short_name, program_invocation_short_name,
- program_invocation_short_name, program_invocation_short_name);
+ progname, progname, progname, progname, progname, progname);
}
-_printf_format_(1, 2)
static inline void _show(const char *fmt, ...)
{
va_list args;
@@ -155,6 +150,61 @@ static inline void _show(const char *fmt, ...)
fflush(stdout);
va_end(args);
}
+
+static inline void _log(int prio, const char *fmt, ...)
+{
+ const char *prioname;
+ char buf[32], *msg;
+ va_list args;
+
+ if (prio > verbose)
+ return;
+
+ va_start(args, fmt);
+ if (vasprintf(&msg, fmt, args) < 0)
+ msg = NULL;
+ va_end(args);
+ if (msg == NULL)
+ return;
+
+ switch (prio) {
+ case LOG_CRIT:
+ prioname = "FATAL";
+ break;
+ case LOG_ERR:
+ prioname = "ERROR";
+ break;
+ case LOG_WARNING:
+ prioname = "WARNING";
+ break;
+ case LOG_NOTICE:
+ prioname = "NOTICE";
+ break;
+ case LOG_INFO:
+ prioname = "INFO";
+ break;
+ case LOG_DEBUG:
+ prioname = "DEBUG";
+ break;
+ default:
+ snprintf(buf, sizeof(buf), "LOG-%03d", prio);
+ prioname = buf;
+ }
+
+ if (use_syslog)
+ syslog(LOG_NOTICE, "%s: %s", prioname, msg);
+ else
+ fprintf(stderr, "%s: %s", prioname, msg);
+ free(msg);
+
+ if (prio <= LOG_CRIT)
+ exit(EXIT_FAILURE);
+}
+#define ERR(...) _log(LOG_ERR, __VA_ARGS__)
+#define WRN(...) _log(LOG_WARNING, __VA_ARGS__)
+#define INF(...) _log(LOG_INFO, __VA_ARGS__)
+#define DBG(...) _log(LOG_DEBUG, __VA_ARGS__)
+#define LOG(...) _log(log_priority, __VA_ARGS__)
#define SHOW(...) _show(__VA_ARGS__)
static int show_config(struct kmod_ctx *ctx)
@@ -167,7 +217,7 @@ static int show_config(struct kmod_ctx *ctx)
{ "install", kmod_config_get_install_commands },
{ "remove", kmod_config_get_remove_commands },
{ "alias", kmod_config_get_aliases },
- { "options", kmod_config_get_options },
+ { "option", kmod_config_get_options },
{ "softdep", kmod_config_get_softdeps },
};
size_t i;
@@ -362,17 +412,22 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
int state = kmod_module_get_initstate(mod);
if (state < 0) {
+ LOG ("Module %s not found.\n", modname);
+ err = -ENOENT;
+ goto error;
+ } else if (state == KMOD_MODULE_BUILTIN) {
+ LOG("Module %s is builtin.\n", modname);
+ err = -ENOENT;
+ goto error;
+ } else if (state != KMOD_MODULE_LIVE) {
if (first_time) {
LOG("Module %s is not in kernel.\n", modname);
err = -ENOENT;
+ goto error;
} else {
err = 0;
+ goto error;
}
- goto error;
- } else if (state == KMOD_MODULE_BUILTIN) {
- LOG("Module %s is builtin.\n", modname);
- err = -ENOENT;
- goto error;
}
}
@@ -386,7 +441,7 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
goto error;
}
- if (!ignore_loaded && !cmd) {
+ if (!ignore_loaded) {
int usage = kmod_module_get_refcnt(mod);
if (usage > 0) {
@@ -424,10 +479,8 @@ static int rmmod(struct kmod_ctx *ctx, const char *alias)
if (err < 0)
return err;
- if (list == NULL) {
+ if (list == NULL)
LOG("Module %s not found.\n", alias);
- err = -ENOENT;
- }
kmod_list_foreach(l, list) {
struct kmod_module *mod = kmod_module_get_module(l);
@@ -485,24 +538,10 @@ static int handle_failed_lookup(struct kmod_ctx *ctx, const char *alias)
static void print_action(struct kmod_module *m, bool install,
const char *options)
{
- const char *path;
-
- if (install) {
+ if (install)
printf("install %s %s\n", kmod_module_get_install_commands(m),
options);
- return;
- }
-
- path = kmod_module_get_path(m);
-
- if (path == NULL) {
- /*
- * Either a builtin module, or an alias, print only for
- * builtin
- */
- if (kmod_module_get_initstate(m) == KMOD_MODULE_BUILTIN)
- printf("builtin %s\n", kmod_module_get_name(m));
- } else
+ else
printf("insmod %s %s\n", kmod_module_get_path(m), options);
}
@@ -535,7 +574,6 @@ static int insmod(struct kmod_ctx *ctx, const char *alias,
if (do_show || verbose > DEFAULT_VERBOSE)
show = &print_action;
- flags |= KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY;
if (use_blacklist)
flags |= KMOD_PROBE_APPLY_BLACKLIST;
@@ -561,11 +599,6 @@ static int insmod(struct kmod_ctx *ctx, const char *alias,
ERR("could not insert '%s': Module already in kernel\n",
kmod_module_get_name(mod));
break;
- case -ENOENT:
- ERR("could not insert '%s': Unknown symbol in module, "
- "or unknown parameter (see dmesg)\n",
- kmod_module_get_name(mod));
- break;
default:
ERR("could not insert '%s': %s\n",
kmod_module_get_name(mod),
@@ -739,6 +772,47 @@ static char **prepend_options_from_env(int *p_argc, char **orig_argv)
return new_argv;
}
+static void log_syslog(void *data, int priority, const char *file, int line,
+ const char *fn, const char *format, va_list args)
+{
+ char *str, buf[32];
+ const char *prioname;
+
+ switch (priority) {
+ case LOG_CRIT:
+ prioname = "FATAL";
+ break;
+ case LOG_ERR:
+ prioname = "ERROR";
+ break;
+ case LOG_WARNING:
+ prioname = "WARNING";
+ break;
+ case LOG_NOTICE:
+ prioname = "NOTICE";
+ break;
+ case LOG_INFO:
+ prioname = "INFO";
+ break;
+ case LOG_DEBUG:
+ prioname = "DEBUG";
+ break;
+ default:
+ snprintf(buf, sizeof(buf), "LOG-%03d", priority);
+ prioname = buf;
+ }
+
+ if (vasprintf(&str, format, args) < 0)
+ return;
+#ifdef ENABLE_DEBUG
+ syslog(LOG_NOTICE, "%s: %s:%d %s() %s", prioname, file, line, fn, str);
+#else
+ syslog(LOG_NOTICE, "%s: %s", prioname, str);
+#endif
+ free(str);
+ (void)data;
+}
+
static int do_modprobe(int argc, char **orig_argv)
{
struct kmod_ctx *ctx;
@@ -757,7 +831,8 @@ static int do_modprobe(int argc, char **orig_argv)
argv = prepend_options_from_env(&argc, orig_argv);
if (argv == NULL) {
- ERR("Could not prepend options from command line\n");
+ fputs("Error: could not prepend options from command line\n",
+ stderr);
return EXIT_FAILURE;
}
@@ -816,9 +891,8 @@ static int do_modprobe(int argc, char **orig_argv)
size_t bytes = sizeof(char *) * (n_config_paths + 2);
void *tmp = realloc(config_paths, bytes);
if (!tmp) {
- ERR("out-of-memory\n");
- err = -1;
- goto done;
+ fputs("Error: out-of-memory\n", stderr);
+ goto cmdline_failed;
}
config_paths = tmp;
config_paths[n_config_paths] = optarg;
@@ -841,7 +915,7 @@ static int do_modprobe(int argc, char **orig_argv)
break;
case 'q':
env_modprobe_options_append("-q");
- verbose = LOG_EMERG;
+ verbose--;
break;
case 'v':
env_modprobe_options_append("-v");
@@ -849,32 +923,32 @@ static int do_modprobe(int argc, char **orig_argv)
break;
case 'V':
puts(PACKAGE " version " VERSION);
- err = 0;
- goto done;
+ if (argv != orig_argv)
+ free(argv);
+ free(config_paths);
+ return EXIT_SUCCESS;
case 'h':
- help();
- err = 0;
- goto done;
+ help(basename(argv[0]));
+ if (argv != orig_argv)
+ free(argv);
+ free(config_paths);
+ return EXIT_SUCCESS;
case '?':
- err = -1;
- goto done;
+ goto cmdline_failed;
default:
- ERR("unexpected getopt_long() value '%c'.\n", c);
- err = -1;
- goto done;
+ fprintf(stderr, "Error: unexpected getopt_long() value '%c'.\n",
+ c);
+ goto cmdline_failed;
}
}
args = argv + optind;
nargs = argc - optind;
- log_open(use_syslog);
-
if (!do_show_config) {
if (nargs == 0) {
- ERR("missing parameters. See -h.\n");
- err = -1;
- goto done;
+ fputs("Error: missing parameters. See -h.\n", stderr);
+ goto cmdline_failed;
}
}
@@ -884,35 +958,37 @@ static int do_modprobe(int argc, char **orig_argv)
root = "";
if (kversion == NULL) {
if (uname(&u) < 0) {
- ERR("uname() failed: %m\n");
- err = -1;
- goto done;
+ fprintf(stderr, "Error: uname() failed: %s\n",
+ strerror(errno));
+ goto cmdline_failed;
}
kversion = u.release;
}
snprintf(dirname_buf, sizeof(dirname_buf),
- "%s/lib/modules/%s", root,
+ "%s" ROOTPREFIX "/lib/modules/%s", root,
kversion);
dirname = dirname_buf;
}
ctx = kmod_new(dirname, config_paths);
if (!ctx) {
- ERR("kmod_new() failed!\n");
- err = -1;
- goto done;
+ fputs("Error: kmod_new() failed!\n", stderr);
+ goto cmdline_failed;
}
-
- log_setup_kmod_log(ctx, verbose);
-
kmod_load_resources(ctx);
+ kmod_set_log_priority(ctx, verbose);
+ if (use_syslog) {
+ openlog("modprobe", LOG_CONS, LOG_DAEMON);
+ kmod_set_log_fn(ctx, log_syslog, NULL);
+ }
+
if (do_show_config)
err = show_config(ctx);
else if (do_show_modversions)
err = show_modversions(ctx, args[0]);
else if (do_remove)
- err = rmmod_all(ctx, args, nargs);
+ err = rmmod_all(ctx, args, use_all ? nargs : 1);
else if (use_all)
err = insmod_all(ctx, args, nargs);
else {
@@ -926,19 +1002,35 @@ static int do_modprobe(int argc, char **orig_argv)
kmod_unref(ctx);
-done:
- log_close();
+ if (use_syslog)
+ closelog();
if (argv != orig_argv)
free(argv);
free(config_paths);
-
return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+
+cmdline_failed:
+ if (argv != orig_argv)
+ free(argv);
+ free(config_paths);
+ return EXIT_FAILURE;
+}
+
+#ifndef KMOD_BUNDLE_TOOL
+int main(int argc, char *argv[])
+{
+ return do_modprobe(argc, argv);
}
+#else
+#include "kmod.h"
+
const struct kmod_cmd kmod_cmd_compat_modprobe = {
.name = "modprobe",
.cmd = do_modprobe,
.help = "compat modprobe command",
};
+
+#endif
diff --git a/tools/rmmod.c b/tools/kmod-rmmod.c
index bf5a408..33a73ca 100644
--- a/tools/rmmod.c
+++ b/tools/kmod-rmmod.c
@@ -1,7 +1,7 @@
/*
* kmod-rmmod - remove modules from linux kernel using libkmod.
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,14 +25,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <syslog.h>
#include "libkmod.h"
-#include "macro.h"
-#include "kmod.h"
-
-#define DEFAULT_VERBOSE LOG_ERR
-static int verbose = DEFAULT_VERBOSE;
-static int use_syslog;
static const char cmdopts_s[] = "fsvVwh";
static const struct option cmdopts[] = {
@@ -45,9 +40,10 @@ static const struct option cmdopts[] = {
{NULL, 0, 0, 0}
};
-static void help(void)
+static void help(const char *progname)
{
- printf("Usage:\n"
+ fprintf(stderr,
+ "Usage:\n"
"\t%s [options] modulename ...\n"
"Options:\n"
"\t-f, --force forces a module unload and may crash your\n"
@@ -56,21 +52,59 @@ static void help(void)
"\t-s, --syslog print to syslog, not stderr\n"
"\t-v, --verbose enables more messages\n"
"\t-V, --version show version\n"
+ "\t-w, --wait begins module removal even if it is used and\n"
+ "\t will stop new users from accessing it.\n"
"\t-h, --help show this help\n",
- program_invocation_short_name);
+ progname);
+}
+
+static void log_syslog(void *data, int priority, const char *file, int line,
+ const char *fn, const char *format,
+ va_list args)
+{
+ char *str, buf[32];
+ const char *prioname;
+
+ switch (priority) {
+ case LOG_CRIT:
+ prioname = "FATAL";
+ break;
+ case LOG_ERR:
+ prioname = "ERROR";
+ break;
+ case LOG_WARNING:
+ prioname = "WARNING";
+ break;
+ case LOG_NOTICE:
+ prioname = "NOTICE";
+ break;
+ case LOG_INFO:
+ prioname = "INFO";
+ break;
+ case LOG_DEBUG:
+ prioname = "DEBUG";
+ break;
+ default:
+ snprintf(buf, sizeof(buf), "LOG-%03d", priority);
+ prioname = buf;
+ }
+
+ if (vasprintf(&str, format, args) < 0)
+ return;
+#ifdef ENABLE_DEBUG
+ syslog(LOG_NOTICE, "%s: %s:%d %s() %s", prioname, file, line, fn, str);
+#else
+ syslog(LOG_NOTICE, "%s: %s", prioname, str);
+#endif
+ free(str);
+ (void)data;
}
static int check_module_inuse(struct kmod_module *mod) {
struct kmod_list *holders;
- int state;
-
- state = kmod_module_get_initstate(mod);
- if (state == KMOD_MODULE_BUILTIN) {
- ERR("Module %s is builtin.\n", kmod_module_get_name(mod));
- return -ENOENT;
- } else if (state < 0) {
- ERR("Module %s is not currently loaded\n",
+ if (kmod_module_get_initstate(mod) == -ENOENT) {
+ fprintf(stderr, "Error: Module %s is not currently loaded\n",
kmod_module_get_name(mod));
return -ENOENT;
}
@@ -79,7 +113,8 @@ static int check_module_inuse(struct kmod_module *mod) {
if (holders != NULL) {
struct kmod_list *itr;
- ERR("Module %s is in use by:", kmod_module_get_name(mod));
+ fprintf(stderr, "Error: Module %s is in use by:",
+ kmod_module_get_name(mod));
kmod_list_foreach(itr, holders) {
struct kmod_module *hm = kmod_module_get_module(itr);
@@ -93,7 +128,8 @@ static int check_module_inuse(struct kmod_module *mod) {
}
if (kmod_module_get_refcnt(mod) != 0) {
- ERR("Module %s is in use\n", kmod_module_get_name(mod));
+ fprintf(stderr, "Error: Module %s is in use\n",
+ kmod_module_get_name(mod));
return -EBUSY;
}
@@ -105,6 +141,8 @@ static int do_rmmod(int argc, char *argv[])
struct kmod_ctx *ctx;
const char *null_config = NULL;
int flags = KMOD_REMOVE_NOWAIT;
+ int use_syslog = 0;
+ int verbose = 0;
int i, err, r = 0;
for (;;) {
@@ -123,12 +161,10 @@ static int do_rmmod(int argc, char *argv[])
verbose++;
break;
case 'w':
- ERR("'Wait' behavior is targeted for removal from kernel.\nWe will now sleep for 10s, and then continue.\n");
- sleep(10);
flags &= ~KMOD_REMOVE_NOWAIT;
break;
case 'h':
- help();
+ help(basename(argv[0]));
return EXIT_SUCCESS;
case 'V':
puts(PACKAGE " version " VERSION);
@@ -136,27 +172,29 @@ static int do_rmmod(int argc, char *argv[])
case '?':
return EXIT_FAILURE;
default:
- ERR("unexpected getopt_long() value '%c'.\n", c);
+ fprintf(stderr,
+ "Error: unexpected getopt_long() value '%c'.\n",
+ c);
return EXIT_FAILURE;
}
}
- log_open(use_syslog);
-
if (optind >= argc) {
- ERR("missing module name.\n");
- r = EXIT_FAILURE;
- goto done;
+ fprintf(stderr, "Error: missing module name.\n");
+ return EXIT_FAILURE;
}
ctx = kmod_new(NULL, &null_config);
if (!ctx) {
- ERR("kmod_new() failed!\n");
- r = EXIT_FAILURE;
- goto done;
+ fputs("Error: kmod_new() failed!\n", stderr);
+ return EXIT_FAILURE;
}
- log_setup_kmod_log(ctx, verbose);
+ kmod_set_log_priority(ctx, kmod_get_log_priority(ctx) + verbose);
+ if (use_syslog) {
+ openlog("rmmod", LOG_CONS, LOG_DAEMON);
+ kmod_set_log_fn(ctx, log_syslog, NULL);
+ }
for (i = optind; i < argc; i++) {
struct kmod_module *mod;
@@ -168,8 +206,8 @@ static int do_rmmod(int argc, char *argv[])
err = kmod_module_new_from_name(ctx, arg, &mod);
if (err < 0) {
- ERR("could not use module %s: %s\n", arg,
- strerror(-err));
+ fprintf(stderr, "Error: could not use module %s: %s\n",
+ arg, strerror(-err));
break;
}
@@ -181,8 +219,9 @@ static int do_rmmod(int argc, char *argv[])
err = kmod_module_remove_module(mod, flags);
if (err < 0) {
- ERR("could not remove module %s: %s\n", arg,
- strerror(-err));
+ fprintf(stderr,
+ "Error: could not remove module %s: %s\n",
+ arg, strerror(-err));
r++;
}
next:
@@ -191,14 +230,25 @@ next:
kmod_unref(ctx);
-done:
- log_close();
+ if (use_syslog)
+ closelog();
return r == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
+#ifndef KMOD_BUNDLE_TOOL
+int main(int argc, char *argv[])
+{
+ return do_rmmod(argc, argv);
+}
+
+#else
+#include "kmod.h"
+
const struct kmod_cmd kmod_cmd_compat_rmmod = {
.name = "rmmod",
.cmd = do_rmmod,
.help = "compat rmmod command",
};
+
+#endif
diff --git a/tools/kmod.c b/tools/kmod.c
index 347bb7d..52b0c5d 100644
--- a/tools/kmod.c
+++ b/tools/kmod.c
@@ -1,7 +1,7 @@
/*
* kmod - one tool to rule them all
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,7 +37,6 @@ static const struct kmod_cmd kmod_cmd_help;
static const struct kmod_cmd *kmod_cmds[] = {
&kmod_cmd_help,
&kmod_cmd_list,
- &kmod_cmd_static_nodes,
};
static const struct kmod_cmd *kmod_compat_cmds[] = {
@@ -158,9 +157,10 @@ static int handle_kmod_compat_commands(int argc, char *argv[])
int main(int argc, char *argv[])
{
+ const char *binname = basename(argv[0]);
int err;
- if (strcmp(program_invocation_short_name, "kmod") == 0)
+ if (strcmp(binname, "kmod") == 0)
err = handle_kmod_commands(argc, argv);
else
err = handle_kmod_compat_commands(argc, argv);
diff --git a/tools/kmod.h b/tools/kmod.h
index 68a646a..8717aec 100644
--- a/tools/kmod.h
+++ b/tools/kmod.h
@@ -1,7 +1,7 @@
/*
* kmod - one tool to rule them all
*
- * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2011-2012 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#pragma once
+#ifndef _KMOD_MACRO_H_
+#define _KMOD_MACRO_H_
#include "macro.h"
@@ -35,6 +36,4 @@ extern const struct kmod_cmd kmod_cmd_compat_modprobe;
extern const struct kmod_cmd kmod_cmd_compat_depmod;
extern const struct kmod_cmd kmod_cmd_list;
-extern const struct kmod_cmd kmod_cmd_static_nodes;
-
-#include "log.h"
+#endif
diff --git a/tools/log.c b/tools/log.c
deleted file mode 100644
index 05f6b77..0000000
--- a/tools/log.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * kmod - log infrastructure
- *
- * Copyright (C) 2012-2013 ProFUSION embedded systems
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <syslog.h>
-
-#include "libkmod.h"
-#include "kmod.h"
-
-static bool log_use_syslog;
-static int log_priority = LOG_ERR;
-
-static _always_inline_ const char *prio_to_str(int prio)
-{
- const char *prioname;
- char buf[32];
-
- switch (prio) {
- case LOG_CRIT:
- prioname = "FATAL";
- break;
- case LOG_ERR:
- prioname = "ERROR";
- break;
- case LOG_WARNING:
- prioname = "WARNING";
- break;
- case LOG_NOTICE:
- prioname = "NOTICE";
- break;
- case LOG_INFO:
- prioname = "INFO";
- break;
- case LOG_DEBUG:
- prioname = "DEBUG";
- break;
- default:
- snprintf(buf, sizeof(buf), "LOG-%03d", prio);
- prioname = buf;
- }
-
- return prioname;
-}
-
-_printf_format_(6, 0)
-static void log_kmod(void *data, int priority, const char *file, int line,
- const char *fn, const char *format, va_list args)
-{
- const char *prioname = prio_to_str(priority);
- char *str;
-
- if (vasprintf(&str, format, args) < 0)
- return;
-
- if (log_use_syslog) {
-#ifdef ENABLE_DEBUG
- syslog(priority, "%s: %s:%d %s() %s", prioname, file, line,
- fn, str);
-#else
- syslog(priority, "%s: %s", prioname, str);
-#endif
- } else {
-#ifdef ENABLE_DEBUG
- fprintf(stderr, "%s: %s: %s:%d %s() %s",
- program_invocation_short_name, prioname, file, line,
- fn, str);
-#else
- fprintf(stderr, "%s: %s: %s", program_invocation_short_name,
- prioname, str);
-#endif
- }
-
- free(str);
- (void)data;
-}
-void log_open(bool use_syslog)
-{
- log_use_syslog = use_syslog;
-
- if (log_use_syslog)
- openlog(program_invocation_short_name, LOG_CONS, LOG_DAEMON);
-}
-
-void log_close(void)
-{
- if (log_use_syslog)
- closelog();
-}
-
-void log_printf(int prio, const char *fmt, ...)
-{
- const char *prioname;
- char *msg;
- va_list args;
-
- if (prio > log_priority)
- return;
-
- va_start(args, fmt);
- if (vasprintf(&msg, fmt, args) < 0)
- msg = NULL;
- va_end(args);
- if (msg == NULL)
- return;
-
- prioname = prio_to_str(prio);
-
- if (log_use_syslog)
- syslog(prio, "%s: %s", prioname, msg);
- else
- fprintf(stderr, "%s: %s: %s", program_invocation_short_name,
- prioname, msg);
- free(msg);
-
- if (prio <= LOG_CRIT)
- exit(EXIT_FAILURE);
-}
-
-void log_setup_kmod_log(struct kmod_ctx *ctx, int priority)
-{
- log_priority = priority;
-
- kmod_set_log_priority(ctx, log_priority);
- kmod_set_log_fn(ctx, log_kmod, NULL);
-}
diff --git a/tools/log.h b/tools/log.h
deleted file mode 100644
index d55a4c6..0000000
--- a/tools/log.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * kmod - log infrastructure
- *
- * Copyright (C) 2012-2013 ProFUSION embedded systems
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <syslog.h>
-
-#include "kmod.h"
-
-void log_open(bool use_syslog);
-void log_close(void);
-void log_printf(int prio, const char *fmt, ...) _printf_format_(2, 3);
-#define CRIT(...) log_printf(LOG_CRIT, __VA_ARGS__)
-#define ERR(...) log_printf(LOG_ERR, __VA_ARGS__)
-#define WRN(...) log_printf(LOG_WARNING, __VA_ARGS__)
-#define INF(...) log_printf(LOG_INFO, __VA_ARGS__)
-#define DBG(...) log_printf(LOG_DEBUG, __VA_ARGS__)
-
-struct kmod_ctx;
-void log_setup_kmod_log(struct kmod_ctx *ctx, int priority);
diff --git a/tools/static-nodes.c b/tools/static-nodes.c
deleted file mode 100644
index 03f59f1..0000000
--- a/tools/static-nodes.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * kmod-static-nodes - manage modules.devname
- *
- * Copyright (C) 2004-2012 Kay Sievers <kay@vrfy.org>
- * Copyright (C) 2011-2013 ProFUSION embedded systems
- * Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <getopt.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <limits.h>
-#include <sys/utsname.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include "libkmod-util.h"
-
-#include "kmod.h"
-
-struct static_nodes_format {
- const char *name;
- int (*write)(FILE *, char[], char[], char, unsigned int, unsigned int);
- const char *description;
-};
-
-static const struct static_nodes_format static_nodes_format_human;
-static const struct static_nodes_format static_nodes_format_tmpfiles;
-static const struct static_nodes_format static_nodes_format_devname;
-
-static const struct static_nodes_format *static_nodes_formats[] = {
- &static_nodes_format_human,
- &static_nodes_format_tmpfiles,
- &static_nodes_format_devname,
-};
-
-static const char cmdopts_s[] = "o:f:h";
-static const struct option cmdopts[] = {
- { "output", required_argument, 0, 'o'},
- { "format", required_argument, 0, 'f'},
- { "help", no_argument, 0, 'h'},
- { },
-};
-
-static int write_human(FILE *out, char modname[], char devname[], char type, unsigned int maj, unsigned int min)
-{
- int ret;
-
- ret = fprintf(out,
- "Module: %s\n"
- "\tDevice node: /dev/%s\n"
- "\t\tType: %s device\n"
- "\t\tMajor: %u\n"
- "\t\tMinor: %u\n",
- modname, devname,
- (type == 'c') ? "character" : "block", maj, min);
- if (ret >= 0)
- return EXIT_SUCCESS;
- else
- return EXIT_FAILURE;
-}
-
-static const struct static_nodes_format static_nodes_format_human = {
- .name = "human",
- .write = write_human,
- .description = "(default) a human readable format. Do not parse.",
-};
-
-static int write_tmpfiles(FILE *out, char modname[], char devname[], char type, unsigned int maj, unsigned int min)
-{
- const char *dir;
- int ret;
-
- dir = strrchr(devname, '/');
- if (dir) {
- ret = fprintf(out, "d /dev/%.*s 0755 - - -\n",
- (int)(dir - devname), devname);
- if (ret < 0)
- return EXIT_FAILURE;
- }
-
- ret = fprintf(out, "%c /dev/%s 0600 - - - %u:%u\n",
- type, devname, maj, min);
- if (ret < 0)
- return EXIT_FAILURE;
-
- return EXIT_SUCCESS;
-}
-
-static const struct static_nodes_format static_nodes_format_tmpfiles = {
- .name = "tmpfiles",
- .write = write_tmpfiles,
- .description = "the tmpfiles.d(5) format used by systemd-tmpfiles.",
-};
-
-static int write_devname(FILE *out, char modname[], char devname[], char type, unsigned int maj, unsigned int min)
-{
- int ret;
-
- ret = fprintf(out, "%s %s %c%u:%u\n", modname, devname, type, maj, min);
- if (ret >= 0)
- return EXIT_SUCCESS;
- else
- return EXIT_FAILURE;
-}
-
-static const struct static_nodes_format static_nodes_format_devname = {
- .name = "devname",
- .write = write_devname,
- .description = "the modules.devname format.",
-};
-
-static void help(void)
-{
- size_t i;
-
- printf("Usage:\n"
- "\t%s static-nodes [options]\n"
- "\n"
- "kmod static-nodes outputs the static-node information of the currently running kernel.\n"
- "\n"
- "Options:\n"
- "\t-f, --format=FORMAT use a machine-readable format\n"
- "\t-o, --output=FILE write output to file\n"
- "\t-h, --help show this help\n"
- "\n"
- "Formats:\n",
- program_invocation_short_name);
-
- for (i = 0; i < ARRAY_SIZE(static_nodes_formats); i++) {
- if (static_nodes_formats[i]->description != NULL) {
- printf("\t%-12s %s\n", static_nodes_formats[i]->name,
- static_nodes_formats[i]->description);
- }
- }
-}
-
-static int do_static_nodes(int argc, char *argv[])
-{
- struct utsname kernel;
- char modules[PATH_MAX];
- FILE *in = NULL, *out = stdout;
- const struct static_nodes_format *format = &static_nodes_format_human;
- char buf[4096];
- int ret = EXIT_SUCCESS;
-
- for (;;) {
- int c, idx = 0, valid;
- size_t i;
-
- c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
- if (c == -1) {
- break;
- }
- switch (c) {
- case 'o':
- out = fopen(optarg, "we");
- if (out == NULL) {
- fprintf(stderr, "Error: could not create %s!\n",
- optarg);
- ret = EXIT_FAILURE;
- goto finish;
- }
- break;
- case 'f':
- valid = 0;
-
- for (i = 0; i < ARRAY_SIZE(static_nodes_formats); i++) {
- if (streq(static_nodes_formats[i]->name, optarg)) {
- format = static_nodes_formats[i];
- valid = 1;
- }
- }
-
- if (!valid) {
- fprintf(stderr, "Unknown format: '%s'.\n",
- optarg);
- help();
- ret = EXIT_FAILURE;
- goto finish;
- }
- break;
- case 'h':
- help();
- goto finish;
- case '?':
- ret = EXIT_FAILURE;
- goto finish;
- default:
- fprintf(stderr, "Unexpected commandline option '%c'.\n",
- c);
- help();
- ret = EXIT_FAILURE;
- goto finish;
- }
- }
-
- if (uname(&kernel) < 0) {
- fputs("Error: uname failed!\n", stderr);
- ret = EXIT_FAILURE;
- goto finish;
- }
-
- snprintf(modules, sizeof(modules), "/lib/modules/%s/modules.devname",
- kernel.release);
- in = fopen(modules, "re");
- if (in == NULL) {
- fprintf(stderr, "Error: could not open /lib/modules/%s/modules.devname - %m\n",
- kernel.release);
- ret = EXIT_FAILURE;
- goto finish;
- }
-
- while (fgets(buf, sizeof(buf), in) != NULL) {
- char modname[PATH_MAX];
- char devname[PATH_MAX];
- char type;
- unsigned int maj, min;
- int matches;
-
- if (buf[0] == '#')
- continue;
-
- matches = sscanf(buf, "%s %s %c%u:%u", modname, devname,
- &type, &maj, &min);
- if (matches != 5 || (type != 'c' && type != 'b')) {
- fprintf(stderr, "Error: invalid devname entry: %s", buf);
- ret = EXIT_FAILURE;
- continue;
- }
-
- format->write(out, modname, devname, type, maj, min);
- }
-
-finish:
- if (in)
- fclose(in);
- if (out)
- fclose(out);
- return ret;
-}
-
-const struct kmod_cmd kmod_cmd_static_nodes = {
- .name = "static-nodes",
- .cmd = do_static_nodes,
- .help = "outputs the static-node information installed with the currently running kernel",
-};