sony-laptop: fix uninitialised variable
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / Documentation / fault-injection / failmodule.sh
blob474a8b971f9ca82ad722e4166e6d323cee368a36
1 #!/bin/bash
3 # Usage: failmodule <failname> <modulename> [stacktrace-depth]
5 # <failname>: "failslab", "fail_alloc_page", or "fail_make_request"
7 # <modulename>: module name that you want to inject faults.
9 # [stacktrace-depth]: the maximum number of stacktrace walking allowed
12 STACKTRACE_DEPTH=5
13 if [ $# -gt 2 ]; then
14 STACKTRACE_DEPTH=$3
17 if [ ! -d /debug/$1 ]; then
18 echo "Fault-injection $1 does not exist" >&2
19 exit 1
21 if [ ! -d /sys/module/$2 ]; then
22 echo "Module $2 does not exist" >&2
23 exit 1
26 # Disable any fault injection
27 echo 0 > /debug/$1/stacktrace-depth
29 echo `cat /sys/module/$2/sections/.text` > /debug/$1/require-start
30 echo `cat /sys/module/$2/sections/.exit.text` > /debug/$1/require-end
31 echo $STACKTRACE_DEPTH > /debug/$1/stacktrace-depth