Whamcloud - gitweb
Modify changelog to use LustreNetLink instead of seq_file
[fs/lustre-release.git] / lustre / tests / rmtacl / make-tree
1 #!/bin/sh
2
3 # reduce LEVELS from 3 => 2 by CFS
4 LEVELS=2 ;              [ -z "$1" ] || LEVELS=$1
5 DIRS=10 ;               [ -z "$2" ] || DIRS=$2
6 FILES=10 ;              [ -z "$2" ] || FILES=$3
7 NUMBER_OF_ACLS=50 ;     [ -z "$3" ] || NUMBER_OF_ACLS=$4
8
9 function random_dir() {
10         mkdir -p $1
11         #lfs lsetfacl -s "u::rwx,u:$[($RANDOM % $NUMBER_OF_ACLS)+1000]:rwx,g::rx,o:-" $1
12 }
13
14 function random_file() {
15         touch $1
16         #lfs lsetfacl -s "u::rw,u:$[($RANDOM % $NUMBER_OF_ACLS)+1000]:rw,g::r,o:-" $1
17 }
18
19 function create () {
20         local LEVEL=$1
21         if [ $LEVEL -eq 0 ]; then
22                 local I=0
23                 while [ $I -lt $FILES ]; do
24                         random_file file$I
25                         I=$[$I+1]
26                 done
27         else
28                 local I=0
29                 while [ $I -lt $DIRS ]; do
30                         random_dir dir$I
31                         cd dir$I
32                         create $[$LEVEL-1]
33                         cd ..
34                         I=$[$I+1]
35                 done
36         fi
37         return
38 }
39
40 mkdir -p tree
41 cd tree
42 create $LEVELS
43 cd ..
44 exit 0
45