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
29 _require_command /usr/bin/indent
31 cprog=$tmp.get_structs.c
32 oprog=$tmp.get_structs
36 #include <xfs/libxlog.h>
39 cat >$tmp.ignore <<EOF
60 xfs_inode_log_format_t
66 xfs_attr_list_context_t
97 xfs_fsop_setdm_handlereq_t
98 xfs_fsop_attrlist_handlereq_t
100 xfs_fsop_attrmulti_handlereq_t
114 xfs_fsop_getparents_handlereq_t
117 echo 'int main(int argc, char *argv[]) {' >>$cprog
120 # Printfs of typedef sizes
122 cat /usr/include/xfs/xfs*.h | indent |\
123 sed -e 's/__attribute__ *[(][(]packed[)][)]//' |\
125 egrep '} *xfs_.*_t' |\
126 egrep -v -f $tmp.ignore |\
127 awk '{sub(/[;,]/,"",$2); print "printf(\"sizeof(", $2, ") = %d\\n\", sizeof(", $2, "));"}' \
131 # Look at offsets of key ones which differ in lengths
135 cat /usr/include/xfs/xfs*.h | indent |\
137 /typedef struct xfs_sb/ { structon = 1; next }
138 structon && $2 ~ /^sb_/ { sub(/[;,]/,"",$2)
139 print "printf(\"offsetof(xfs_sb_t,", $2, ") = %d\\n\", offsetof(xfs_sb_t,", $2, "));"; next}
140 structon && /}/ { structon = 0; next}
143 echo 'return 0; }' >>$cprog
145 # create and run program
147 eval $oprog | LC_COLLATE=POSIX sort