#!/bin/sh # # ftl.sample 1.2 1995/05/25 04:27:58 (David Hinds) # # Initialize or shutdown an FTL memory device # # The first argument should be either 'start' or 'stop'. The second # argument is the base name for the device. When starting a device, # there should be two additional arguments, the major and minor device # numbers. # # This script creates one block device file, which maps the first # common memory region. usage() { echo "usage: ftl [action] [device name] [major] [minor]" exit 1 } if [ $# -lt 2 ] ; then usage ; fi action=$1 name=$2 case "${action:?}" in 'start') if [ $# -ne 4 ] ; then usage ; fi major=$3 minor=$4 rm -f /dev/${name}* mknod /dev/${name} b $major $minor ;; 'stop') fuser -k /dev/${name}* rm -f /dev/${name}* ;; esac