check: exit with exit code 1 after printing the usage message
[xfstests-dev.git] / common / ceph
1 #
2 # CephFS specific common functions.
3 #
4
5 # _ceph_create_file_layout <filename> <stripe unit> <stripe count> <object size>
6 # This function creates a new empty file and sets the file layout according to
7 # parameters.  It will exit if the file already exists.
8 _ceph_create_file_layout()
9 {
10         local fname=$1
11         local stripe_unit=$2
12         local stripe_count=$3
13         local obj_size=$4
14
15         if [ -e $fname ]; then
16                 echo "File $fname already exists."
17                 exit 1
18         fi
19         touch $fname
20         $SETFATTR_PROG -n ceph.file.layout \
21                 -v "stripe_unit=$objsz stripe_count=1 object_size=$objsz" \
22                 $fname
23 }
24
25 # this test requires to access file capabilities through vxattr 'ceph.caps'.
26 _require_ceph_vxattr_caps()
27 {
28         $GETFATTR_PROG -n "ceph.caps" $TEST_DIR >/dev/null 2>&1 \
29           || _notrun "ceph.caps vxattr not supported"
30 }