mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-29 04:54:27 +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:
30
rootfs_overlay/lkmc/fops.sh
Executable file
30
rootfs_overlay/lkmc/fops.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Setup
|
||||
f=/sys/kernel/debug/lkmc_fops
|
||||
insmod fops.ko
|
||||
|
||||
# read
|
||||
[ "$(cat "$f")" = abcd ]
|
||||
|
||||
# write
|
||||
printf 01 > "$f"
|
||||
[ "$(cat "$f")" = 01cd ]
|
||||
|
||||
# ENOSPC
|
||||
printf abcd > "$f"
|
||||
set +e
|
||||
printf 12345 > "$f"
|
||||
exit_status="$?"
|
||||
set -e
|
||||
[ "$exit_status" -eq 8 ]
|
||||
[ "$(cat "$f")" = abcd ]
|
||||
|
||||
# seek
|
||||
printf 1234 > "$f"
|
||||
printf z | dd bs=1 of="$f" seek=2
|
||||
[ "$(cat "$f")" = 12z4 ]
|
||||
|
||||
# Teardown
|
||||
rmmod fops
|
||||
Reference in New Issue
Block a user