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.
10 #-----------------------------------------------------------------------
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
23 # get standard environment
26 # real QA test starts here
30 cprog=$tmp.get_structs.c
31 oprog=$tmp.get_structs
35 #include <xfs/libxlog.h>
38 cat >$tmp.ignore <<EOF
59 xfs_inode_log_format_t
65 xfs_attr_list_context_t
96 xfs_fsop_setdm_handlereq_t
97 xfs_fsop_attrlist_handlereq_t
99 xfs_fsop_attrmulti_handlereq_t
113 xfs_fsop_getparents_handlereq_t
116 echo 'int main(int argc, char *argv[]) {' >>$cprog
119 # Printfs of typedef sizes
121 cat /usr/include/xfs/xfs*.h | indent |\
122 sed -e 's/__attribute__ *[(][(]packed[)][)]//' |\
124 egrep '} *xfs_.*_t' |\
125 egrep -v -f $tmp.ignore |\
126 awk '{sub(/[;,]/,"",$2); print "printf(\"sizeof(", $2, ") = %d\\n\", sizeof(", $2, "));"}' \
130 # Look at offsets of key ones which differ in lengths
134 cat /usr/include/xfs/xfs*.h | indent |\
136 /typedef struct xfs_sb/ { structon = 1; next }
137 structon && $2 ~ /^sb_/ { sub(/[;,]/,"",$2)
138 print "printf(\"offsetof(xfs_sb_t,", $2, ") = %d\\n\", offsetof(xfs_sb_t,", $2, "));"; next}
139 structon && /}/ { structon = 0; next}
142 echo 'return 0; }' >>$cprog
144 # create and run program
146 eval $oprog | LC_COLLATE=POSIX sort