mkdevs.sh 841 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. echo "Creating AoE devnode files in $dir ..."
  12. set -e
  13. mkdir -p $dir
  14. # (Status info is in sysfs. See status.sh.)
  15. # rm -f $dir/stat
  16. # mknod -m 0400 $dir/stat c $MAJOR 1
  17. rm -f $dir/err
  18. mknod -m 0400 $dir/err c $MAJOR 2
  19. rm -f $dir/discover
  20. mknod -m 0200 $dir/discover c $MAJOR 3
  21. rm -f $dir/interfaces
  22. mknod -m 0200 $dir/interfaces c $MAJOR 4
  23. rm -f $dir/revalidate
  24. mknod -m 0200 $dir/revalidate c $MAJOR 5
  25. rm -f $dir/flush
  26. mknod -m 0200 $dir/flush c $MAJOR 6
  27. export n_partitions
  28. mkshelf=`echo $0 | sed 's!mkdevs!mkshelf!'`
  29. i=0
  30. while test $i -lt $n_shelves; do
  31. sh -xc "sh $mkshelf $dir $i"
  32. i=`expr $i + 1`
  33. done