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";
24 # Return the next unused loop device on stdout and in the $LOOPDEV
25 # environment variable.
28 while [ -b ${LOOP}${LOOPNUM} ]; do
29 LOOPDEV=${LOOP}${LOOPNUM}
30 losetup ${LOOPDEV} > /dev/null 2>&1 || NEXT=${LOOPDEV}
31 LOOPNUM=`expr ${LOOPNUM} + 1`
32 [ "$NEXT" ] && echo ${NEXT} && break
36 # Create a new filesystem. If we are using a loopback device, we check
37 # for existing "template" filesystems instead of creating a new one,
38 # because it is _much_ faster to gunzip the empty filesystem instead of
39 # creating a new one from scratch. Conversely, if we are creating a
40 # filesystem on a device we use mkfs, because that only writes sparsely
41 # to the device. The empty filesystems are also highly compressed (1000:1)
42 # so they don't take too much space.
48 [ "$1" = "ext3" ] && MKFS="mkfs.ext2 -j"
51 [ $# -lt 2 -o $# -gt 3 ] && \
52 echo "usage: $0 <fstype> <file> [size]" 1>&2 && exit -1
55 [ -f "$PM" ] || PM="/etc/mtab"
57 grep "$2 " $PM 1>&2 && echo "$0: $2 is in $PM!" 1>&2 && exit -1
59 $MKFS $MKFSOPT $2 $3 || exit -1
60 LOOPDEV=$2 # Not really a loop device
63 echo "usage: $0 <fstype> <file> <size>" 1>&2 && exit -1
65 if [ -f "$EFILE" ]; then
66 echo "using existing filesystem $EFILE for $2"
67 zcat "$EFILE" > $2 || exit -1
70 echo "creating new filesystem on $2"
71 dd if=/dev/zero of=$2 bs=1k count=$3 1>&2 || exit -1
72 $MKFS $MKFSOPT -F $2 1>&2 || exit -1
74 LOOPDEV=`next_loop_dev`
75 losetup ${LOOPDEV} $2 1>&2 || exit -1
79 # Set up to use an existing filesystem. We take the same parameters as
80 # new_fs, even though we only use the <file> parameter, to make it easy
81 # to convert between new_fs and old_fs in testing scripts.
86 LOOPDEV=$2 # Not really a loop device
88 LOOPDEV=`next_loop_dev`
89 losetup ${LOOPDEV} $2 1>&2 || exit -1
94 $DEBCTL modules > $R/tmp/ogdb
95 echo "The GDB module script is in /tmp/ogdb. Press enter to continue"
100 [ -c /dev/portals ] || mknod /dev/portals c 10 240
102 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
103 insmod $SRCDIR/../../portals/linux/qswnal/kqswnal.o
104 insmod $SRCDIR/../../portals/linux/socknal/ksocknal.o || exit -1
106 [ "$NETWORK" = "tcp" ] && ($ACCEPTOR $PORT)
108 [ -c /dev/obd ] || mknod /dev/obd c 10 241
110 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
111 insmod $SRCDIR/../../obd/rpc/ptlrpc.o || exit -1
112 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1
113 insmod $SRCDIR/../../obd/ext2obd/obdext2.o || exit -1
114 insmod $SRCDIR/../../obd/filterobd/obdfilter.o || exit -1
115 insmod $SRCDIR/../../obd/ost/ost.o || exit -1
116 insmod $SRCDIR/../../obd/osc/osc.o || exit -1
117 insmod $SRCDIR/../../obd/obdecho/obdecho.o || exit -1
118 insmod $SRCDIR/../../obd/mds/mds.o || exit -1
119 insmod $SRCDIR/../../obd/mdc/mdc.o || exit -1
120 insmod $SRCDIR/../../obd/llight/llite.o || exit -1
124 [ -d /mnt/lustre ] || mkdir /mnt/lustre
128 if [ -z "$NETWORK" -o -z "$LOCALHOST" -o -z "$SERVER" ]; then
129 echo "$0: NETWORK or LOCALHOST or SERVER is not set"
134 elan) if [ "$PORT" ]; then
135 echo "$0: NETWORK is elan but PORT is set"
139 tcp) if [ -z "$PORT" ]; then
140 echo "$0: NETWORK is tcp but PORT is not set"
144 *) echo "$0: unknown NETWORK \'$NETWORK\'"
152 connect $SERVER $PORT
161 [ -c /dev/portals ] || mknod /dev/portals c 10 240
163 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
165 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
166 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1