home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
live
/
etc
/
pcmcia
/
memory
< prev
next >
Wrap
Text File
|
1999-10-31
|
2KB
|
87 lines
#!/bin/bash
#
# memory 1.24 1998/10/08 19:44:18 (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.
#
# This script creates character devices for direct access to the PCMCIA
# address spaces:
#
# /dev/{name}c - common memory direct access device
# /dev/{name}a - attribute memory direct access device
#
# It also creates character and block devices for accessing the first
# attribute and common memory partitions:
#
# /dev/{name}c0c - common memory, character device
# /dev/{name}c0b - common memory, block device
# /dev/{name}a0c - attribute memory, character device
#
# The script passes an extended device address to 'memory.opts' in the
# ADDRESS variable, to retrieve device-specific configuration options
# for the common-memory block device.
#
# The address format is "scheme,socket" where "scheme" is the current
# PCMCIA device configuration scheme, and "socket" is the socket number.
#
if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi
# Get device attributes
get_info $DEVICE
# Load site-specific settings
ADDRESS="$SCHEME,$SOCKET"
. $0.opts
case "$ACTION" in
'start')
rm -f /dev/${DEVICE}*
if [ "$DRIVER" = "memory_cb" ] ; then
for N in 0 1 2 3 4 5 6 7 ; do
mknod /dev/${DEVICE}s${N} c $MAJOR `expr $MINOR + $N`
done
else
mknod /dev/${DEVICE}c0c c $MAJOR `expr $MINOR`
mknod /dev/${DEVICE}c0b b $MAJOR `expr $MINOR`
mknod /dev/${DEVICE}a0c c $MAJOR `expr $MINOR + 4`
mknod /dev/${DEVICE}c c $MAJOR `expr $MINOR + 8`
mknod /dev/${DEVICE}a c $MAJOR `expr $MINOR + 8 + 4`
add_blkdev /dev/${DEVICE}c0b || exit 1
fi
;;
'check')
fuser -s /dev/${DEVICE}* && exit 1
if [ "$DRIVER" != "memory_cb" ] ; then
fuser -s -m /dev/${DEVICE}c0b && exit 1
fi
;;
'stop')
fuser -s -k /dev/${DEVICE}*
if [ "$DRIVER" != "memory_cb" ] ; then
rm_blkdev /dev/${DEVICE}c0b || exit 1
fi
rm -f /dev/${DEVICE}*
;;
'cksum')
chk_simple "$3,$SOCKET,$INSTANCE" || exit 1
;;
'suspend'|'resume')
;;
*)
usage
;;
esac
exit 0