aoe-flush.in 520 B

12345678910111213141516171819202122232425262728
  1. #! /bin/sh
  2. # aoe-flush - ask aoe driver to forget about devices
  3. # Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
  4. zero="`basename $0`"
  5. f="@devdir@/flush"
  6. spec=""
  7. if ! test -w "$f"; then
  8. echo 1>&2 "$zero: $f does not exist or is not writeable."
  9. exit 1
  10. fi
  11. if ! test -c $f; then
  12. exec 1>&2
  13. echo "$zero: $f is not a character device file"
  14. echo "$zero: use udev or aoe-mkdevs to create it"
  15. exit 1
  16. fi
  17. if test "$1" = "-a"; then
  18. spec=all
  19. fi
  20. echo $spec > "$f" || {
  21. echo 1>&2 "$zero: flush failed"
  22. exit 1
  23. }