Fix up mode bits
[xfstests-dev.git] / common.dmapi
1 ##/bin/sh
2 #
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # dmapi functions
6 #
7
8 # Commands relitive to dmapi qa
9
10 DMAPI_QASUITE1_DIR=$here/dmapi/src/suite1/
11 DMAPI_QASUITE2_DIR=$here/dmapi/src/suite2/
12 DMAPI_COMMON_DIR=$here/dmapi/src/common/
13
14 DMAPI_LS_TO_COPY_PATH=$DMAPI_QASUITE2_DIR/bindir/ls_to_copy
15
16 _dmapi_scratch_mount () {
17     if [ `echo "$MOUNT_OPTIONS" | grep -c dmapi` -gt 0 -o \
18         `echo "$MOUNT_OPTIONS" | grep -c dmi` -gt 0 ] ; then
19         #already got dmapi options set
20         _scratch_mount
21         dmapi_mount_result=$?
22     else
23         _scratch_mount "-o dmapi,mtpt=$SCRATCH_MNT"
24         dmapi_mount_result=$?
25     fi
26
27     if [ $dmapi_mount_result -ne 0 ] ; then
28         _notrun "Assuming DMAPI modules are not loaded"
29     fi
30 }
31
32 _filter_dmapi_print_event() {
33     $PERL_PROG -ne '
34 # replace session/file specific output with generic placeholders
35 s/token\s+\d+/token TOKEN/g ;
36 s/sequence\s+\d+/sequence SEQ/g ;
37 s/^\s+parent\s+dir\s+\w+/parent dir PARENT_DIR/g ;
38 s/^\s+name\s+.*/name FILE_NAME/g ;
39 s/^\s+mode\s+bits\s+mode\s+\d+:\s+/mode bits mode MODE: /g ;
40 s/perm\s+[\w|-]+\s[\w|-]+\s[\w|-]+/perm PERMISSIONS/g ;
41 s/,\s+type\s+.*/, type FILE_TYPE/g ;
42 s/^\s+object\s+\w+/object OBJECT/g ;
43 s/^\s+new\s+object\s+\w+/new object OBJECT/g ;
44 s/^\s+handle\s+\w+/handle HANDLE/g ;
45 s/^\s+attrcopy\s+\w+/attrcopy COPY/g ;
46 s/^\s+attrname\s+\w+/attrname NAME/g ;
47
48 # when print_event is killed, the following is output. trim it
49 s/^\s*print_event: Processing any undelivered event messages.*\n//g ;
50 s/^\s*print_event: Shutting down the session.*\n//g ;
51
52 # trim blank lines
53 s/^\s*\n//g ;
54     print ;'
55 }
56