The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/tools/nfsd/inject_fault.sh

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/bash
    2 #
    3 # Copyright (c) 2011 Bryan Schumaker <bjschuma@netapp.com>
    4 #
    5 # Script for easier NFSD fault injection
    6 
    7 # Check that debugfs has been mounted
    8 DEBUGFS=`cat /proc/mounts | grep debugfs`
    9 if [ "$DEBUGFS" == "" ]; then
   10         echo "debugfs does not appear to be mounted!"
   11         echo "Please mount debugfs and try again"
   12         exit 1
   13 fi
   14 
   15 # Check that the fault injection directory exists
   16 DEBUGDIR=`echo $DEBUGFS | awk '{print $2}'`/nfsd
   17 if [ ! -d "$DEBUGDIR" ]; then
   18         echo "$DEBUGDIR does not exist"
   19         echo "Check that your .config selects CONFIG_NFSD_FAULT_INJECTION"
   20         exit 1
   21 fi
   22 
   23 function help()
   24 {
   25         echo "Usage $0 injection_type [count]"
   26         echo ""
   27         echo "Injection types are:"
   28         ls $DEBUGDIR
   29         exit 1
   30 }
   31 
   32 if [ $# == 0 ]; then
   33         help
   34 elif [ ! -f $DEBUGDIR/$1 ]; then
   35         help
   36 elif [ $# != 2 ]; then
   37         COUNT=0
   38 else
   39         COUNT=$2
   40 fi
   41 
   42 BEFORE=`mktemp`
   43 AFTER=`mktemp`
   44 dmesg > $BEFORE
   45 echo $COUNT > $DEBUGDIR/$1
   46 dmesg > $AFTER
   47 # Capture lines that only exist in the $AFTER file
   48 diff $BEFORE $AFTER | grep ">"
   49 rm -f $BEFORE $AFTER

Cache object: 7b80a938270afce45c384a30c3fb7440


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.