mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
seq_file: move doc to README
This commit is contained in:
@@ -1,29 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
set -e
|
||||
f=/sys/kernel/debug/lkmc_seq_file
|
||||
insmod /seq_file.ko
|
||||
cd /sys/kernel/debug
|
||||
|
||||
cat 'lkmc_seq_file'
|
||||
# => 0
|
||||
# => 1
|
||||
# => 2
|
||||
|
||||
cat 'lkmc_seq_file'
|
||||
# => 0
|
||||
# => 1
|
||||
# => 2
|
||||
|
||||
dd if='lkmc_seq_file' bs=1 count=2 skip=0 status=none
|
||||
# => 0
|
||||
dd if='lkmc_seq_file' bs=1 count=4 skip=0 status=none
|
||||
# => 0
|
||||
# => 1
|
||||
dd if='lkmc_seq_file' bs=1 count=2 skip=2 status=none
|
||||
# => 1
|
||||
dd if='lkmc_seq_file' bs=4 count=1 skip=0 status=none
|
||||
# => 0
|
||||
# => 1
|
||||
|
||||
[ "$(cat "$f")" = "$(printf '0\n1\n2\n')" ]
|
||||
[ "$(cat "$f")" = "$(printf '0\n1\n2\n')" ]
|
||||
[ "$(dd if="$f" bs=1 count=2 skip=0 status=none)" = "$(printf '0\n')" ]
|
||||
[ "$(dd if="$f" bs=1 count=2 skip=2 status=none)" = "$(printf '1\n')" ]
|
||||
[ "$(dd if="$f" bs=4 count=1 skip=0 status=none)" = "$(printf '0\n1\n')" ]
|
||||
rmmod seq_file
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
insmod /seq_file_single.ko
|
||||
cd /sys/kernel/debug
|
||||
cat 'lkmc_seq_file_single'
|
||||
# => ab
|
||||
# => cd
|
||||
dd if='lkmc_seq_file_single' bs=1 count=3 skip=1
|
||||
# => b
|
||||
# => c
|
||||
|
||||
rmmod seq_file_single
|
||||
7
rootfs_overlay/seq_file_single_open.sh
Executable file
7
rootfs_overlay/seq_file_single_open.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
f=/sys/kernel/debug/lkmc_seq_file_single_open
|
||||
insmod /seq_file_single_open.ko
|
||||
[ "$(cat "$f")" = "$(printf 'ab\ncd\n')" ]
|
||||
[ "$(dd if="$f" bs=1 count=3 skip=1)" = "$(printf "b\nc\n")" ]
|
||||
rmmod seq_file_single_open
|
||||
@@ -6,8 +6,10 @@ for test in \
|
||||
/debugfs.sh \
|
||||
/fops.sh \
|
||||
/procfs.sh \
|
||||
/sysfs.sh
|
||||
do
|
||||
/seq_file.sh \
|
||||
/seq_file_single_open.sh \
|
||||
/sysfs.sh \
|
||||
; do
|
||||
if ! "$test"; then
|
||||
echo "lkmc_test_fail: ${test}"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user