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
54 $MKFS $MKFSOPT $2 $3 || exit -1
55 LOOPDEV=$2 # Not really a loop device
58 echo "usage: $0 <fstype> <file> <size>" 1>&2 && exit -1
60 if [ -f "$EFILE" ]; then
61 echo "using existing filesystem $EFILE for $2"
62 zcat "$EFILE" > $2 || exit -1
65 echo "creating new filesystem on $2"
66 dd if=/dev/zero of=$2 bs=1k count=$3 1>&2 || exit -1
67 $MKFS $MKFSOPT -F $2 1>&2 || exit -1
69 LOOPDEV=`next_loop_dev`
70 losetup ${LOOPDEV} $2 1>&2 || exit -1
74 # Set up to use an existing filesystem. We take the same parameters as
75 # new_fs, even though we only use the <file> parameter, to make it easy
76 # to convert between new_fs and old_fs in testing scripts.
81 LOOPDEV=$2 # Not really a loop device
83 LOOPDEV=`next_loop_dev`
84 losetup ${LOOPDEV} $2 1>&2 || exit -1
89 $DEBCTL modules > $R/tmp/ogdb
90 echo "The GDB module script is in /tmp/ogdb. Press enter to continue"
95 [ -c /dev/portals ] || mknod /dev/portals c 10 240
97 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
98 insmod $SRCDIR/../../portals/linux/qswnal/kqswnal.o
99 insmod $SRCDIR/../../portals/linux/socknal/ksocknal.o || exit -1
101 [ "$NETWORK" = "tcp" ] && ($ACCEPTOR $PORT &)
103 [ -c /dev/obd ] || mknod /dev/obd c 10 241
105 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
106 insmod $SRCDIR/../../obd/rpc/ptlrpc.o || exit -1
107 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1
108 insmod $SRCDIR/../../obd/ext2obd/obdext2.o || exit -1
109 insmod $SRCDIR/../../obd/filterobd/obdfilter.o || exit -1
110 insmod $SRCDIR/../../obd/ost/ost.o || exit -1
111 insmod $SRCDIR/../../obd/osc/osc.o || exit -1
112 insmod $SRCDIR/../../obd/obdecho/obdecho.o || exit -1
113 insmod $SRCDIR/../../obd/mds/mds.o || exit -1
114 insmod $SRCDIR/../../obd/mdc/mdc.o || exit -1
115 insmod $SRCDIR/../../obd/llight/llight.o || exit -1
119 [ -d /mnt/obd ] || mkdir /mnt/obd
123 if [ -z "$NETWORK" -o -z "$LOCALHOST" -o -z "$SERVER" ]; then
124 echo "$0: NETWORK or LOCALHOST or SERVER is not set"
129 elan) if [ "$PORT" ]; then
130 echo "$0: NETWORK is elan but PORT is set"
134 tcp) if [ -z "$PORT" ]; then
135 echo "$0: NETWORK is tcp but PORT is not set"
139 *) echo "$0: unknown NETWORK \'$NETWORK\'"
147 connect $SERVER $PORT
156 [ -c /dev/portals ] || mknod /dev/portals c 10 240
158 insmod $SRCDIR/../../portals/linux/oslib/portals.o || exit -1
160 insmod $SRCDIR/../../obd/class/obdclass.o || exit -1
161 insmod $SRCDIR/../../obd/ldlm/ldlm.o || exit -1