mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-30 05:24:25 +01:00
move all our stuff into /lkmc in guest
Motivation: userland is getting several new subdirectories, it would be too insane to just dump all of that in the guest root filesystem. To alleviate the cd pain, .profile puts user inside /lkmc by default.
This commit is contained in:
27
rootfs_overlay/lkmc/dep.sh
Executable file
27
rootfs_overlay/lkmc/dep.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
f=/sys/kernel/debug/lkmc_dep
|
||||
f2=/sys/kernel/debug/lkmc_dep2
|
||||
|
||||
insmod dep.ko
|
||||
insmod dep2.ko
|
||||
|
||||
# Initial value.
|
||||
[ "$(cat "$f")" = 0 ]
|
||||
|
||||
# Changhing dep2 also changes dep.
|
||||
printf 1 > "$f2"
|
||||
[ "$(cat "$f")" = 1 ]
|
||||
|
||||
# Changhing dep also changes dep2.
|
||||
printf 2 > "$f"
|
||||
[ "$(cat "$f2")" = 2 ]
|
||||
|
||||
# sysfs shows us that the module has dependants.
|
||||
[ "$(cat /sys/module/dep/refcnt)" = 1 ]
|
||||
[ "$(ls /sys/module/dep/holders)" = dep2 ]
|
||||
rmmod dep2.ko
|
||||
[ "$(cat /sys/module/dep/refcnt)" = 0 ]
|
||||
[ -z "$(ls /sys/module/dep/holders)" ]
|
||||
|
||||
rmmod dep.ko
|
||||
Reference in New Issue
Block a user