aoe-mkdevs 710 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. n_shelves=${n_shelves:-10}
  3. n_partitions=${n_partitions:-16}
  4. if test "$#" != "1"; then
  5. echo "Usage: sh `basename $0` {dir}" 1>&2
  6. echo " n_partitions=16 sh `basename $0` {dir}" 1>&2
  7. exit 1
  8. fi
  9. dir=$1
  10. MAJOR=152
  11. set -e
  12. mkdir -p $dir
  13. # (Status info is in sysfs. See status.sh.)
  14. # rm -f $dir/stat
  15. # mknod -m 0400 $dir/stat c $MAJOR 1
  16. rm -f $dir/err
  17. mknod -m 0400 $dir/err c $MAJOR 2
  18. rm -f $dir/discover
  19. mknod -m 0200 $dir/discover c $MAJOR 3
  20. rm -f $dir/interfaces
  21. mknod -m 0200 $dir/interfaces c $MAJOR 4
  22. # pass along the env var to aoe-mkshelf
  23. export n_partitions
  24. mkshelf=`echo $0 | sed 's!mkdevs!mkshelf!'`
  25. i=0
  26. while test $i -lt $n_shelves; do
  27. sh $mkshelf $dir $i
  28. i=`expr $i + 1`
  29. done