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 [ $# -ne 3 ] && echo "usage: $0 <fstype> <file> <size>" 1>&2 && exit -1
50 [ "$1" = "ext3" ] && MKFS="mkfs.ext2 -j"
53 $MKFS $MKFSOPT $2 || exit -1
54 LOOPDEV=$2 # Not really a loop device
56 if [ -f "$EFILE" ]; then
57 echo "using existing filesystem $EFILE for $2"
58 zcat "$EFILE" > $2 || exit -1
61 echo "creating new filesystem on $2"
62 dd if=/dev/zero of=$2 bs=1k count=$3 1>&2 || exit -1
63 $MKFS $MKFSOPT -F $2 1>&2 || exit -1
65 LOOPDEV=`next_loop_dev`
66 losetup ${LOOPDEV} $2 1>&2 || exit -1
70 # Set up to use an existing filesystem. We take the same parameters as
71 # new_fs, even though we only use the <file> parameter, to make it easy
72 # to convert between new_fs and old_fs in testing scripts.
77 LOOPDEV=$2 # Not really a loop device
79 LOOPDEV=`next_loop_dev`
80 losetup ${LOOPDEV} $2 1>&2 || exit -1
85 $DEBCTL modules > $R/tmp/ogdb
86 echo "The GDB module script is in /tmp/ogdb. Press enter to continue"
91 [ -c /dev/portals ] || mknod /dev/portals c 10 240
93 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
94 insmod $SRCDIR/../../portals/linux/qswnal/kqswnal.o
95 insmod $SRCDIR/../../portals/linux/socknal/ksocknal.o || exit -1
97 [ "$NETWORK" = "tcp" ] && ($ACCEPTOR $PORT &)
99 [ -c /dev/obd ] || mknod /dev/obd c 10 241
101 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
102 insmod $SRCDIR/../../obd/rpc/ptlrpc.o || exit -1
103 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1
104 insmod $SRCDIR/../../obd/ext2obd/obdext2.o || exit -1
105 insmod $SRCDIR/../../obd/filterobd/obdfilter.o || exit -1
106 insmod $SRCDIR/../../obd/ost/ost.o || exit -1
107 insmod $SRCDIR/../../obd/osc/osc.o || exit -1
108 insmod $SRCDIR/../../obd/obdecho/obdecho.o || exit -1
109 insmod $SRCDIR/../../obd/mds/mds.o || exit -1
110 insmod $SRCDIR/../../obd/mdc/mdc.o || exit -1
111 insmod $SRCDIR/../../obd/llight/llight.o || exit -1
115 [ -d /mnt/obd ] || mkdir /mnt/obd
119 if [ -z "$NETWORK" -o -z "$LOCALHOST" -o -z "$SERVER" ]; then
120 echo "$0: NETWORK or LOCALHOST or SERVER is not set"
125 elan) if [ "$PORT" ]; then
126 echo "$0: NETWORK is elan but PORT is set"
130 tcp) if [ -z "$PORT" ]; then
131 echo "$0: NETWORK is tcp but PORT is not set"
135 *) echo "$0: unknown NETWORK \'$NETWORK\'"
143 connect $SERVER $PORT
152 [ -c /dev/portals ] || mknod /dev/portals c 10 240
154 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
156 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
157 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1