5 # Keep an eye on some of the xfs type sizes
6 # Motivation from differing ondisk types for 32 and 64 bit word versions.
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2006 Silicon Graphics, Inc. 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
24 #-----------------------------------------------------------------------
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35 # get standard environment
38 # real QA test starts here
41 _require_command $INDENT_PROG "indent"
43 # filter out known changes to xfs type sizes
46 # lazy SB adds __be32 agf_btreeblks - pv960372
47 if [ "$($MKFS_XFS_PROG 2>&1 | grep -c lazy-count )" == "0" ]; then
49 s/sizeof\( xfs_agf_t \) = 60/sizeof( xfs_agf_t ) = <SIZE>/;
53 s/sizeof\( xfs_agf_t \) = 64/sizeof( xfs_agf_t ) = <SIZE>/;
58 # filter out known changes to xfs type names
61 sed -e 's/xfs_bmbt_rec_64_t/xfs_bmbt_rec_t/'
66 sed -e 's/__attribute__ *[(][(]packed[)][)]//' \
70 cprog=$tmp.get_structs.c
71 oprog=$tmp.get_structs
76 #include <xfs/libxlog.h>
79 cat >$tmp.ignore <<EOF
103 xfs_inode_log_format_t
109 xfs_attr_list_context_t
118 xfs_buf_log_format_v1_t
127 xfs_dir2_data_entry_t
128 xfs_dir2_data_union_t
146 xfs_inobt_rec_incore_t
150 xfs_fsop_setdm_handlereq_t
151 xfs_fsop_attrlist_handlereq_t
153 xfs_fsop_attrmulti_handlereq_t
168 xfs_fsop_getparents_handlereq_t
172 echo 'int main(int argc, char *argv[]) {' >>$cprog
175 # Printfs of typedef sizes
177 cat /usr/include/xfs/xfs*.h | indent |\
180 egrep '} *xfs_.*_t' |\
181 egrep -v -f $tmp.ignore |\
182 awk '{sub(/[;,]/,"",$2); print "printf(\"sizeof(", $2, ") = %d\\n\", sizeof(", $2, "));"}' \
186 # Look at offsets of key ones which differ in lengths
190 cat /usr/include/xfs/xfs*.h | indent |\
192 /typedef struct xfs_sb/ { structon = 1; next }
193 structon && $2 ~ /^sb_/ { sub(/[;,]/,"",$2)
194 print "printf(\"offsetof(xfs_sb_t,", $2, ") = %d\\n\", offsetof(xfs_sb_t,", $2, "));"; next}
195 structon && /}/ { structon = 0; next}
198 echo 'return 0; }' >>$cprog
200 # create and run program
201 cc -o $oprog $cprog >> $seq.full 2>&1 || \
202 _notrun "Could not compile test program (see end of $seq.full)"
203 $oprog | _type_size_filter | _type_name_filter > $progout
206 # add addition sizes and xfs_sb_t fields that don't exist in the version
210 # xfsprogs 2.9.8: sb_bad_features2 in pv 978822
211 if [ $XFSPROGS_VERSION -lt 20908 ]; then
212 echo 'offsetof(xfs_sb_t, sb_bad_features2 ) = 204' >>$progout
214 if [ $XFSPROGS_VERSION -lt 30000 ]; then
215 echo 'sizeof( xfs_dsb_t ) = 208' >>$progout;
218 LC_COLLATE=POSIX sort $progout