4 # Test the xfs_db write of the XFS BMBT entries. For each XFS BMBT field,
5 # write the value 0, each bit and finally the entry beyond the maximum legal
6 # value. Also makes sure a core write and hex input still work.
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2014 SGI. All Rights Reserved.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
46 echo "testing $field with $bits bits"
47 $XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" $SCRATCH_DEV
49 for n in `seq 0 1 $bits`; do
50 $XFS_DB_PROG -x -c "inode $FILE_INO" \
51 -c "write $field $num" $SCRATCH_DEV
57 # get standard environment, filters and checks
61 # real QA test starts here
63 # Modify as appropriate.
69 _scratch_mkfs -m crc=0 >/dev/null 2>&1
72 # create the test file
73 echo "make a file with data so it has an extent" > $SCRATCH_MNT/file
75 # find the inode for the test file
76 FILE_INO=`ls -i $SCRATCH_MNT |awk '{print $1}'`
80 # test bit length constants
81 BMBT_EXNTFLAG_BITLEN=1
82 BMBT_STARTOFF_BITLEN=54
83 BMBT_STARTBLOCK_BITLEN=52
84 BMBT_BLOCKCOUNT_BITLEN=21
86 # test setting the BMBT entries from 0 to past the valid number.
87 _do_bit_test "u.bmx[0].extentflag" $BMBT_EXNTFLAG_BITLEN
88 _do_bit_test "u.bmx[0].startoff" $BMBT_STARTOFF_BITLEN
89 _do_bit_test "u.bmx[0].startblock" $BMBT_STARTBLOCK_BITLEN
90 _do_bit_test "u.bmx[0].blockcount" $BMBT_BLOCKCOUNT_BITLEN
91 # test setting the 32 bit generation number
92 $XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0x5a" $SCRATCH_DEV
93 $XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0xa5" $SCRATCH_DEV
94 $XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0" $SCRATCH_DEV
95 $XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #5a5a" $SCRATCH_DEV
96 $XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #a5a5" $SCRATCH_DEV