From bcf10eb39b5ffc1c48a1d3dc53d011cb27504cb4 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 25 Feb 2000 06:39:39 +0000 Subject: [PATCH] demos/*: update demos to handle module autoloading (Steve Bruggeman) --- lustre/demos/Makefile | 2 ++ lustre/demos/basesetup.sh | 10 +++++++++- lustre/demos/config.sh | 7 ++++++- lustre/demos/obdfssetup.sh | 8 ++++---- lustre/demos/snap3set.sh | 2 +- lustre/demos/snapsetup.sh | 6 +++--- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lustre/demos/Makefile b/lustre/demos/Makefile index 8876cf9..85e6e5b 100644 --- a/lustre/demos/Makefile +++ b/lustre/demos/Makefile @@ -4,4 +4,6 @@ perms: @-chmod a+x *.sh clean: + -rm -f *~ *.orig +install: diff --git a/lustre/demos/basesetup.sh b/lustre/demos/basesetup.sh index fcf382f..b5796ec 100755 --- a/lustre/demos/basesetup.sh +++ b/lustre/demos/basesetup.sh @@ -5,13 +5,21 @@ OBDDIR="`dirname $0`/.." # source config info . $OBDDIR/demos/config.sh +# module configuration +if [ "$MODCONF" -a -f $MODCONF ]; then + if [ -z "`grep -i "alias *char-major-$OBDMAJ *obdclass" $MODCONF`" ]; then + echo "alias char-major-${OBDMAJ} obdclass" >>$MODCONF + fi +fi + + # temp file if [ "$TMPFILE" -a -f $TMPFILE ]; then echo "$TMPFILE exists; I'm unwilling to overwrite it. Remove [N/y]?" 1>&2 rm -i $TMPFILE [ -f $TMPFILE ] && exit 1 fi -[ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k +[ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=$TMPSIZE # loop device diff --git a/lustre/demos/config.sh b/lustre/demos/config.sh index fd87c13..51f4df5 100644 --- a/lustre/demos/config.sh +++ b/lustre/demos/config.sh @@ -7,9 +7,14 @@ # Major number for OBD devices OBDMAJ=186 +# Module configuration file +[ -f /etc/conf.modules ] && MODCONF=/etc/conf.modules +[ -z "$MODCONF" -a -f /etc/modules.conf ] && MODCONF=/etc/modules.conf + # If LOOPDEV is empty (""), then no loopback device will be configured. # If TMPFILE is empty (""), then no temporary file will be created for loop. -TMPFILE="/tmp/obdfs.tmpfile" +[ "$TMPFILE" ] || TMPFILE="/tmp/obdfs.tmpfile" +[ "$TMPSIZE" ] || TMPSIZE=10240 LOOPDEV="/dev/loop0" # If LOOPDEV is empty, then it is assumed that BASEDEV is a real block device diff --git a/lustre/demos/obdfssetup.sh b/lustre/demos/obdfssetup.sh index bf37c39..81ca302 100755 --- a/lustre/demos/obdfssetup.sh +++ b/lustre/demos/obdfssetup.sh @@ -11,13 +11,13 @@ if [ x$? != x0 ]; then exit 4; fi -insmod $OBDDIR/class/obdclass.o -insmod $OBDDIR/ext2obd/obdext2.o -insmod $OBDDIR/obdfs/obdfs.o +#insmod $OBDDIR/class/obdclass.o +#insmod $OBDDIR/ext2obd/obdext2.o +#insmod $OBDDIR/obdfs/obdfs.o plog log "ATTACHING /dev/obd0, SETUP $BASEDEV" $OBDDIR/class/obdcontrol -f << EOF -attach ext2_obd +attach obdext2 setup $BASEDEV quit EOF diff --git a/lustre/demos/snap3set.sh b/lustre/demos/snap3set.sh index 88645a2..c314f30 100755 --- a/lustre/demos/snap3set.sh +++ b/lustre/demos/snap3set.sh @@ -21,7 +21,7 @@ q y snapset 0 $SNAPTABLE device /dev/obd3 -attach snap_obd 0 3 0 +attach obdsnap 0 3 0 setup quit EOF diff --git a/lustre/demos/snapsetup.sh b/lustre/demos/snapsetup.sh index d2e7f73..b8b5eaa 100755 --- a/lustre/demos/snapsetup.sh +++ b/lustre/demos/snapsetup.sh @@ -25,7 +25,7 @@ fi plog umount $MNTOBD -plog insmod $OBDDIR/snap/obdsnap.o +#plog insmod $OBDDIR/snap/obdsnap.o rm -f $SNAPTABLE @@ -49,10 +49,10 @@ q y snapset 0 $SNAPTABLE device /dev/obd1 -attach snap_obd 0 1 0 +attach obdsnap 0 1 0 setup device /dev/obd2 -attach snap_obd 0 2 0 +attach obdsnap 0 2 0 setup quit EOF -- 1.8.3.1