#!/bin/sh
#
# ftl 1.22 1998/10/08 19:44:18 (David Hinds)
#
# Initialize or shutdown an FTL memory device
#
# The first argument should be the action to be performed, and the
# second, the base name for the device.
#
# The script passes an extended device address to 'ftl.opts' in the 
# ADDRESS variable, to retrieve device-specific configuration options.
# The address format is "scheme,socket,instance" where "scheme" is the
# current PCMCIA configuration scheme, "socket" is the socket number,
# and "instance" is used to number multiple FTL regions on a single
# card.
#

if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi

# Get device attributes
get_info $DEVICE

# Load site-specific settings
ADDRESS="$SCHEME,$SOCKET,$INSTANCE"
. $0.opts

case "$ACTION" in

'start')
    rm -f /dev/$DEVICE
    mknod /dev/$DEVICE b $MAJOR $MINOR
    mknod /dev/${DEVICE}p1 b $MAJOR `expr $MINOR + 1`
    mknod /dev/${DEVICE}p2 b $MAJOR `expr $MINOR + 2`
    mknod /dev/${DEVICE}p3 b $MAJOR `expr $MINOR + 3`
    mknod /dev/${DEVICE}p4 b $MAJOR `expr $MINOR + 4`
    add_parts /dev/$DEVICE "$PARTS" || exit 1
    ;;

'check')
    fuser -s -m /dev/${DEVICE}* && exit 1
    ;;

'stop')
    rm_parts /dev/$DEVICE "$PARTS"
    rm -f /dev/$DEVICE /dev/${DEVICE}p[1-4]
    ;;

'cksum')
    chk_parts "$3,$SOCKET,$INSTANCE" || exit 1
    ;;
    
'suspend'|'resume')
    ;;

*)
    usage
    ;;

esac

exit 0
