#!/bin/sh # # pcmem.sample $Revision: 1.1 $ $Date: 1995/05/25 04:30:06 $ (David Hinds) # # Initialize or shutdown a PCMCIA 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. # # Three devices will be created: # # /dev/{name}a - character device, attribute memory # /dev/{name}b - block device, common memory # /dev/{name}c - character device, common memory action=$1 name=$2 case "${action:?}" in 'start') major=$3 minor=$4 rm -f /dev/${name:?}a /dev/${name:?}b /dev/${name:?}c mknod /dev/${name:?}c c ${major:?} ${minor:?} mknod /dev/${name:?}a c ${major:?} `expr ${minor:?} + 1` mknod /dev/${name:?}b b ${major:?} ${minor:?} ;; 'stop') fuser -k /dev/${name:?}a /dev/${name:?}b /dev/${name:?}c rm -f /dev/${name:?}a /dev/${name:?}b /dev/${name:?}c ;; esac