1 export PATH=$PATH:/sbin:/usr/sbin
7 PTLCTL=$SRCDIR/../../portals/linux/utils/ptlctl
8 OBDCTL=$SRCDIR/../../obd/utils/obdctl
9 DEBCTL=$SRCDIR/../../portals/linux/utils/debugctl
10 ACCEPTOR=$SRCDIR/../../portals/linux/utils/acceptor
12 LOOPNUM=0; export LOOPNUM
13 if [ -b /dev/loop0 ]; then
16 if [ -b /dev/loop/0 ]; then
19 echo "Cannot find /dev/loop0 or /dev/loop/0" 1>&2 && exit -1
23 # Return the next unused loop device on stdout and in the $LOOPDEV
24 # environment variable.
27 while [ -b ${LOOP}${LOOPNUM} ]; do
28 LOOPDEV=${LOOP}${LOOPNUM}
29 losetup ${LOOPDEV} > /dev/null 2>&1 || NEXT=${LOOPDEV}
30 LOOPNUM=`expr ${LOOPNUM} + 1`
31 [ "$NEXT" ] && echo ${NEXT} && break
35 # Create a new filesystem. If we are using a loopback device, we check
36 # for existing "template" filesystems instead of creating a new one,
37 # because it is _much_ faster to gunzip the empty filesystem instead of
38 # creating a new one from scratch. Conversely, if we are creating a
39 # filesystem on a device we use mkfs, because that only writes sparsely
40 # to the device. The empty filesystems are also highly compressed (1000:1)
41 # so they don't take too much space.
47 [ "$1" = "ext3" ] && MKFS="mkfs.ext2 -j"
50 [ $# -lt 2 -o $# -gt 3 ] && \
51 echo "usage: $0 <fstype> <file> [size]" 1>&2 && exit -1
54 [ -f "$PM" ] || PM="/etc/mtab"
56 grep "$2 " $PM 1>&2 && echo "$0: $2 is in $PM!" 1>&2 && exit -1
58 $MKFS $MKFSOPT $2 $3 || exit -1
59 LOOPDEV=$2 # Not really a loop device
62 echo "usage: $0 <fstype> <file> <size>" 1>&2 && exit -1
64 if [ -f "$EFILE" ]; then
65 echo "using existing filesystem $EFILE for $2"
66 zcat "$EFILE" > $2 || exit -1
69 echo "creating new filesystem on $2"
70 dd if=/dev/zero of=$2 bs=1k count=$3 1>&2 || exit -1
71 $MKFS $MKFSOPT -F $2 1>&2 || exit -1
73 LOOPDEV=`next_loop_dev`
74 losetup ${LOOPDEV} $2 1>&2 || exit -1
78 # Set up to use an existing filesystem. We take the same parameters as
79 # new_fs, even though we only use the <file> parameter, to make it easy
80 # to convert between new_fs and old_fs in testing scripts.
85 LOOPDEV=$2 # Not really a loop device
87 LOOPDEV=`next_loop_dev`
88 losetup ${LOOPDEV} $2 1>&2 || exit -1
93 $DEBCTL modules > $R/tmp/ogdb
94 echo "The GDB module script is in /tmp/ogdb"
98 if [ -z "$NETWORK" -o -z "$LOCALHOST" -o -z "$SERVER" ]; then
99 echo "$0: NETWORK or LOCALHOST or SERVER is not set" 1>&2
103 [ -c /dev/portals ] || mknod /dev/portals c 10 240
105 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
108 elan) if [ "$PORT" ]; then
109 echo "$0: NETWORK is elan but PORT is set" 1>&2
112 insmod $SRCDIR/../../portals/linux/qswnal/kqswnal.o
114 tcp) if [ -z "$PORT" ]; then
115 echo "$0: NETWORK is tcp but PORT is not set" 1>&2
118 insmod $SRCDIR/../../portals/linux/socknal/ksocknal.o || exit -1
121 *) echo "$0: unknown NETWORK \'$NETWORK\'" 1>&2
129 connect $SERVER $PORT
138 [ -c /dev/obd ] || mknod /dev/obd c 10 241
140 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
141 insmod $SRCDIR/../../obd/rpc/ptlrpc.o || exit -1
142 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1
143 insmod $SRCDIR/../../obd/ext2obd/obdext2.o || exit -1
144 insmod $SRCDIR/../../obd/filterobd/obdfilter.o || exit -1
145 insmod $SRCDIR/../../obd/ost/ost.o || exit -1
146 insmod $SRCDIR/../../obd/osc/osc.o || exit -1
147 insmod $SRCDIR/../../obd/obdecho/obdecho.o || exit -1
148 insmod $SRCDIR/../../obd/mds/mds.o || exit -1
149 insmod $SRCDIR/../../obd/mdc/mdc.o || exit -1
150 insmod $SRCDIR/../../obd/llight/llite.o || exit -1
154 [ -d /mnt/lustre ] || mkdir /mnt/lustre
158 [ -c /dev/portals ] || mknod /dev/portals c 10 240
160 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
162 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
163 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1