ide 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/sh
  2. #
  3. # ide 1.15 2001/11/21 13:44:09 (David Hinds)
  4. #
  5. # Initialize or shutdown a PCMCIA ATA/IDE adapter
  6. #
  7. # The first argument should be either 'start' or 'stop'. The second
  8. # argument is the base name for the device.
  9. #
  10. # The script passes an extended device address to 'ide.opts' in the
  11. # ADDRESS variable, to retrieve device-specific configuration options.
  12. # The address format is "scheme,socket,serial_no[,part]" where
  13. # "scheme" is the PCMCIA configuration scheme, "socket" is the socket
  14. # number, "serial_no" is the card's serial number if available, and
  15. # "part" is, optionally, the partition number.
  16. #
  17. # The script first calls ide.opts for the entire device. If ide.opts
  18. # returns with the PARTS variable set, then this variable contains a
  19. # list of partitions for which options should be read.
  20. #
  21. if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi
  22. # Get device attributes
  23. get_info $DEVICE
  24. if [ ! -b /dev/$DEVICE ] ; then
  25. log mknod /dev/$DEVICE b $MAJOR $MINOR
  26. for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
  27. minor=`expr $part + $MINOR`
  28. log mknod /dev/${DEVICE}$part b $MAJOR $minor
  29. done
  30. fi
  31. eval `/sbin/ide_info /dev/$DEVICE` || usage
  32. # Load site-specific settings
  33. ADDRESS="$SCHEME,$SOCKET,$SERIAL_NO"
  34. . $0.opts
  35. case "$ACTION" in
  36. 'start')
  37. [ -n "$VERBOSE" -a -n "$INFO" ] && echo "$INFO"
  38. add_parts "$ADDRESS" "$PARTS" || exit 1
  39. ;;
  40. 'check')
  41. is_true $NO_CHECK && exit 0
  42. if [ -b /dev/$DEVICE ] ; then
  43. do_fuser -s -m /dev/${DEVICE}* && exit 1
  44. else
  45. do_fuser -s /dev/${DEVICE}* && exit 1
  46. fi
  47. ;;
  48. 'stop')
  49. rm_parts "$ADDRESS" "$PARTS" || exit 1
  50. ;;
  51. 'cksum')
  52. chk_parts "$NEW_SCHEME,$SOCKET,$SERIAL_NO" || exit 1
  53. ;;
  54. 'suspend'|'resume')
  55. ;;
  56. *)
  57. usage
  58. ;;
  59. esac
  60. exit 0