Under BSD/OS 4.0 you can automatically mount and unmount an ATA PC Card Flash disk when it is inserted or removed from your system. The key is to use the /etc/pccard.conf file and the new -F option to umount.
In my example I added the following two lines to my /etc/pccard.conf file:
wdc @insert "/usr/local/libexec/flashin %D %U %S" wdc @remove "/usr/local/libexec/flashout %D %U %S"The %D is replaced with the device name (wdc), the %U is replaced with the unit number (typically 1 or 2) and the %S is replaced with the slot number. In my system I have configured my kernel with:
wd2 at wdc1 drive 0 wd3 at wdc2 drive 0So unit 1 is always wd2 and unit 2 is always wd3. My flashin script looks like:
#! /bin/sh
case $2 in)
1) DEV=2 ;;
2) DEV=3 ;;
*) exit 0;;
esac
fakelabel -u wd$DEV
mount -t msdos -r /dev/wd${DEV}d /mnt/flash$2
and the flashout script is:
#! /bin/sh case $2 in) 1) DEV=2 ;; 2) DEV=3 ;; *) exit 0;; esac umount -F /mnt/flash$2The -F option is needed because the mount is done *after* the disk is removed! If you upgrade the mount to read/write you should be sure to unmount or downgrade the mount before pulling the disk.
I have directories in /mnt on which I mount things (I do not mount directly on /mnt). Note that you must already have made the directories /mnt/flash1 and /mnt/flash2 as mount points.
You can abuse this procedure, but then you get what you deserve.