]>
Commit | Line | Data |
---|---|---|
2bd0ea18 | 1 | /* |
0d3e0b37 | 2 | * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. |
dfc130f3 | 3 | * |
2bd0ea18 NS |
4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | |
6 | * published by the Free Software Foundation. | |
dfc130f3 | 7 | * |
2bd0ea18 NS |
8 | * This program is distributed in the hope that it would be useful, but |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
dfc130f3 | 11 | * |
2bd0ea18 NS |
12 | * Further, this software is distributed without any warranty that it is |
13 | * free of the rightful claim of any third person regarding infringement | |
14 | * or the like. Any license provided herein, whether implied or | |
15 | * otherwise, applies only to this software file. Patent licenses, if | |
16 | * any, provided herein do not apply to combinations of this program with | |
17 | * other software, or any other product whatsoever. | |
dfc130f3 | 18 | * |
2bd0ea18 NS |
19 | * You should have received a copy of the GNU General Public License along |
20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | |
21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | |
dfc130f3 | 22 | * |
2bd0ea18 NS |
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
24 | * Mountain View, CA 94043, or: | |
dfc130f3 RC |
25 | * |
26 | * http://www.sgi.com | |
27 | * | |
28 | * For further information regarding this notice, see: | |
29 | * | |
2bd0ea18 NS |
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ |
31 | */ | |
32 | ||
33 | #include <libxfs.h> | |
34 | #include "type.h" | |
35 | #include "faddr.h" | |
36 | #include "fprint.h" | |
37 | #include "field.h" | |
38 | #include "inode.h" | |
39 | #include "bnobt.h" | |
40 | #include "cntbt.h" | |
41 | #include "inobt.h" | |
42 | #include "bmapbt.h" | |
43 | #include "bmroot.h" | |
44 | #include "bit.h" | |
45 | #include "agf.h" | |
46 | #include "agfl.h" | |
47 | #include "agi.h" | |
48 | #include "sb.h" | |
49 | #include "dir.h" | |
50 | #include "dirshort.h" | |
51 | #include "attr.h" | |
52 | #include "attrshort.h" | |
53 | #include "dquot.h" | |
54 | #include "dir2.h" | |
55 | #include "dir2sf.h" | |
56 | ||
57 | const ftattr_t ftattrtab[] = { | |
58 | { FLDT_AEXTNUM, "aextnum", fp_num, "%d", SI(bitsz(xfs_aextnum_t)), | |
59 | FTARG_SIGNED, NULL, NULL }, | |
60 | { FLDT_AGBLOCK, "agblock", fp_num, "%u", SI(bitsz(xfs_agblock_t)), | |
61 | FTARG_DONULL, fa_agblock, NULL }, | |
62 | { FLDT_AGBLOCKNZ, "agblocknz", fp_num, "%u", SI(bitsz(xfs_agblock_t)), | |
63 | FTARG_SKIPZERO|FTARG_DONULL, fa_agblock, NULL }, | |
64 | { FLDT_AGF, "agf", NULL, (char *)agf_flds, agf_size, FTARG_SIZE, NULL, | |
65 | agf_flds }, | |
66 | { FLDT_AGFL, "agfl", NULL, (char *)agfl_flds, agfl_size, FTARG_SIZE, | |
67 | NULL, agfl_flds }, | |
68 | { FLDT_AGI, "agi", NULL, (char *)agi_flds, agi_size, FTARG_SIZE, NULL, | |
69 | agi_flds }, | |
70 | { FLDT_AGINO, "agino", fp_num, "%u", SI(bitsz(xfs_agino_t)), | |
71 | FTARG_DONULL, fa_agino, NULL }, | |
72 | { FLDT_AGINONN, "aginonn", fp_num, "%u", SI(bitsz(xfs_agino_t)), | |
73 | FTARG_SKIPNULL, fa_agino, NULL }, | |
74 | { FLDT_AGNUMBER, "agnumber", fp_num, "%u", SI(bitsz(xfs_agnumber_t)), | |
75 | FTARG_DONULL, NULL, NULL }, | |
76 | { FLDT_ATTR, "attr", NULL, (char *)attr_flds, attr_size, FTARG_SIZE, | |
77 | NULL, attr_flds }, | |
78 | { FLDT_ATTR_BLKINFO, "attr_blkinfo", NULL, (char *)attr_blkinfo_flds, | |
79 | SI(bitsz(struct xfs_da_blkinfo)), 0, NULL, attr_blkinfo_flds }, | |
80 | { FLDT_ATTR_LEAF_ENTRY, "attr_leaf_entry", fp_sarray, | |
81 | (char *)attr_leaf_entry_flds, SI(bitsz(struct xfs_attr_leaf_entry)), | |
82 | 0, NULL, attr_leaf_entry_flds }, | |
83 | { FLDT_ATTR_LEAF_HDR, "attr_leaf_hdr", NULL, (char *)attr_leaf_hdr_flds, | |
84 | SI(bitsz(struct xfs_attr_leaf_hdr)), 0, NULL, attr_leaf_hdr_flds }, | |
85 | { FLDT_ATTR_LEAF_MAP, "attr_leaf_map", fp_sarray, | |
86 | (char *)attr_leaf_map_flds, SI(bitsz(struct xfs_attr_leaf_map)), 0, | |
87 | NULL, attr_leaf_map_flds }, | |
88 | { FLDT_ATTR_LEAF_NAME, "attr_leaf_name", NULL, | |
89 | (char *)attr_leaf_name_flds, attr_leaf_name_size, FTARG_SIZE, NULL, | |
90 | attr_leaf_name_flds }, | |
91 | { FLDT_ATTR_NODE_ENTRY, "attr_node_entry", fp_sarray, | |
92 | (char *)attr_node_entry_flds, SI(bitsz(struct xfs_da_node_entry)), 0, | |
93 | NULL, attr_node_entry_flds }, | |
94 | { FLDT_ATTR_NODE_HDR, "attr_node_hdr", NULL, (char *)attr_node_hdr_flds, | |
95 | SI(bitsz(struct xfs_da_node_hdr)), 0, NULL, attr_node_hdr_flds }, | |
96 | { FLDT_ATTR_SF_ENTRY, "attr_sf_entry", NULL, (char *)attr_sf_entry_flds, | |
97 | attr_sf_entry_size, FTARG_SIZE, NULL, attr_sf_entry_flds }, | |
98 | { FLDT_ATTR_SF_HDR, "attr_sf_hdr", NULL, (char *)attr_sf_hdr_flds, | |
99 | SI(bitsz(struct xfs_attr_sf_hdr)), 0, NULL, attr_sf_hdr_flds }, | |
100 | { FLDT_ATTRBLOCK, "attrblock", fp_num, "%u", SI(bitsz(__uint32_t)), 0, | |
101 | fa_attrblock, NULL }, | |
102 | { FLDT_ATTRSHORT, "attrshort", NULL, (char *)attr_shortform_flds, | |
103 | attrshort_size, FTARG_SIZE, NULL, attr_shortform_flds }, | |
104 | { FLDT_BMAPBTA, "bmapbta", NULL, (char *)bmapbta_flds, bmapbta_size, | |
105 | FTARG_SIZE, NULL, bmapbta_flds }, | |
106 | { FLDT_BMAPBTAKEY, "bmapbtakey", fp_sarray, (char *)bmapbta_key_flds, | |
107 | SI(bitsz(xfs_bmbt_key_t)), 0, NULL, bmapbta_key_flds }, | |
108 | { FLDT_BMAPBTAPTR, "bmapbtaptr", fp_num, "%llu", | |
109 | SI(bitsz(xfs_bmbt_ptr_t)), 0, fa_dfsbno, NULL }, | |
110 | { FLDT_BMAPBTAREC, "bmapbtarec", fp_sarray, (char *)bmapbta_rec_flds, | |
111 | SI(bitsz(xfs_bmbt_rec_t)), 0, NULL, bmapbta_rec_flds }, | |
112 | { FLDT_BMAPBTD, "bmapbtd", NULL, (char *)bmapbtd_flds, bmapbtd_size, | |
113 | FTARG_SIZE, NULL, bmapbtd_flds }, | |
114 | { FLDT_BMAPBTDKEY, "bmapbtdkey", fp_sarray, (char *)bmapbtd_key_flds, | |
115 | SI(bitsz(xfs_bmbt_key_t)), 0, NULL, bmapbtd_key_flds }, | |
116 | { FLDT_BMAPBTDPTR, "bmapbtdptr", fp_num, "%llu", | |
117 | SI(bitsz(xfs_bmbt_ptr_t)), 0, fa_dfsbno, NULL }, | |
118 | { FLDT_BMAPBTDREC, "bmapbtdrec", fp_sarray, (char *)bmapbtd_rec_flds, | |
119 | SI(bitsz(xfs_bmbt_rec_t)), 0, NULL, bmapbtd_rec_flds }, | |
120 | { FLDT_BMROOTA, "bmroota", NULL, (char *)bmroota_flds, bmroota_size, | |
121 | FTARG_SIZE, NULL, bmroota_flds }, | |
122 | { FLDT_BMROOTAKEY, "bmrootakey", fp_sarray, (char *)bmroota_key_flds, | |
123 | SI(bitsz(xfs_bmdr_key_t)), 0, NULL, bmroota_key_flds }, | |
124 | { FLDT_BMROOTAPTR, "bmrootaptr", fp_num, "%llu", | |
125 | SI(bitsz(xfs_bmdr_ptr_t)), 0, fa_dfsbno, NULL }, | |
126 | { FLDT_BMROOTD, "bmrootd", NULL, (char *)bmrootd_flds, bmrootd_size, | |
127 | FTARG_SIZE, NULL, bmrootd_flds }, | |
128 | { FLDT_BMROOTDKEY, "bmrootdkey", fp_sarray, (char *)bmrootd_key_flds, | |
129 | SI(bitsz(xfs_bmdr_key_t)), 0, NULL, bmrootd_key_flds }, | |
130 | { FLDT_BMROOTDPTR, "bmrootdptr", fp_num, "%llu", | |
131 | SI(bitsz(xfs_bmdr_ptr_t)), 0, fa_dfsbno, NULL }, | |
132 | { FLDT_BNOBT, "bnobt", NULL, (char *)bnobt_flds, bnobt_size, FTARG_SIZE, | |
133 | NULL, bnobt_flds }, | |
134 | { FLDT_BNOBTKEY, "bnobtkey", fp_sarray, (char *)bnobt_key_flds, | |
135 | SI(bitsz(xfs_alloc_key_t)), 0, NULL, bnobt_key_flds }, | |
136 | { FLDT_BNOBTPTR, "bnobtptr", fp_num, "%u", SI(bitsz(xfs_alloc_ptr_t)), | |
137 | 0, fa_agblock, NULL }, | |
138 | { FLDT_BNOBTREC, "bnobtrec", fp_sarray, (char *)bnobt_rec_flds, | |
139 | SI(bitsz(xfs_alloc_rec_t)), 0, NULL, bnobt_rec_flds }, | |
140 | { FLDT_CEXTFLG, "cextflag", fp_num, "%u", SI(BMBT_EXNTFLAG_BITLEN), 0, | |
141 | NULL, NULL }, | |
142 | { FLDT_CEXTLEN, "cextlen", fp_num, "%u", SI(BMBT_BLOCKCOUNT_BITLEN), 0, | |
143 | NULL, NULL }, | |
144 | { FLDT_CFILEOFFA, "cfileoffa", fp_num, "%llu", SI(BMBT_STARTOFF_BITLEN), | |
145 | 0, fa_cfileoffa, NULL }, | |
146 | { FLDT_CFILEOFFD, "cfileoffd", fp_num, "%llu", SI(BMBT_STARTOFF_BITLEN), | |
147 | 0, fa_cfileoffd, NULL }, | |
148 | { FLDT_CFSBLOCK, "cfsblock", fp_num, "%llu", SI(BMBT_STARTBLOCK_BITLEN), | |
149 | 0, fa_cfsblock, NULL }, | |
150 | { FLDT_CHARNS, "charns", fp_charns, NULL, SI(bitsz(char)), 0, NULL, | |
151 | NULL }, | |
152 | { FLDT_CHARS, "chars", fp_num, "%c", SI(bitsz(char)), 0, NULL, NULL }, | |
153 | { FLDT_CNTBT, "cntbt", NULL, (char *)cntbt_flds, cntbt_size, FTARG_SIZE, | |
154 | NULL, cntbt_flds }, | |
155 | { FLDT_CNTBTKEY, "cntbtkey", fp_sarray, (char *)cntbt_key_flds, | |
156 | SI(bitsz(xfs_alloc_key_t)), 0, NULL, cntbt_key_flds }, | |
157 | { FLDT_CNTBTPTR, "cntbtptr", fp_num, "%u", SI(bitsz(xfs_alloc_ptr_t)), | |
158 | 0, fa_agblock, NULL }, | |
159 | { FLDT_CNTBTREC, "cntbtrec", fp_sarray, (char *)cntbt_rec_flds, | |
160 | SI(bitsz(xfs_alloc_rec_t)), 0, NULL, cntbt_rec_flds }, | |
161 | { FLDT_DEV, "dev", fp_num, "%#x", SI(bitsz(xfs_dev_t)), 0, NULL, NULL }, | |
162 | { FLDT_DFILOFFA, "dfiloffa", fp_num, "%llu", SI(bitsz(xfs_dfiloff_t)), | |
163 | 0, fa_dfiloffa, NULL }, | |
164 | { FLDT_DFILOFFD, "dfiloffd", fp_num, "%llu", SI(bitsz(xfs_dfiloff_t)), | |
165 | 0, fa_dfiloffd, NULL }, | |
166 | { FLDT_DFSBNO, "dfsbno", fp_num, "%llu", SI(bitsz(xfs_dfsbno_t)), | |
167 | FTARG_DONULL, fa_dfsbno, NULL }, | |
168 | { FLDT_DINODE_A, "dinode_a", NULL, (char *)inode_a_flds, inode_a_size, | |
169 | FTARG_SIZE|FTARG_OKEMPTY, NULL, inode_a_flds }, | |
170 | { FLDT_DINODE_CORE, "dinode_core", NULL, (char *)inode_core_flds, | |
171 | SI(bitsz(xfs_dinode_core_t)), 0, NULL, inode_core_flds }, | |
172 | { FLDT_DINODE_FMT, "dinode_fmt", fp_dinode_fmt, NULL, | |
173 | SI(bitsz(__int8_t)), 0, NULL, NULL }, | |
174 | { FLDT_DINODE_U, "dinode_u", NULL, (char *)inode_u_flds, inode_u_size, | |
175 | FTARG_SIZE|FTARG_OKEMPTY, NULL, inode_u_flds }, | |
176 | { FLDT_DIR, "dir", NULL, (char *)dir_flds, dir_size, FTARG_SIZE, NULL, | |
177 | dir_flds }, | |
178 | { FLDT_DIR2, "dir2", NULL, (char *)dir2_flds, dir2_size, FTARG_SIZE, | |
179 | NULL, dir2_flds }, | |
180 | { FLDT_DIR2_BLOCK_TAIL, "dir2_block_tail", NULL, | |
181 | (char *)dir2_block_tail_flds, SI(bitsz(xfs_dir2_block_tail_t)), 0, | |
182 | NULL, dir2_block_tail_flds }, | |
183 | { FLDT_DIR2_DATA_FREE, "dir2_data_free", NULL, | |
184 | (char *)dir2_data_free_flds, SI(bitsz(xfs_dir2_data_free_t)), 0, NULL, | |
185 | dir2_data_free_flds }, | |
186 | { FLDT_DIR2_DATA_HDR, "dir2_data_hdr", NULL, (char *)dir2_data_hdr_flds, | |
187 | SI(bitsz(xfs_dir2_data_hdr_t)), 0, NULL, dir2_data_hdr_flds }, | |
188 | { FLDT_DIR2_DATA_OFF, "dir2_data_off", fp_num, "%#x", | |
189 | SI(bitsz(xfs_dir2_data_off_t)), 0, NULL, NULL }, | |
190 | { FLDT_DIR2_DATA_OFFNZ, "dir2_data_offnz", fp_num, "%#x", | |
191 | SI(bitsz(xfs_dir2_data_off_t)), FTARG_SKIPZERO, NULL, NULL }, | |
192 | { FLDT_DIR2_DATA_UNION, "dir2_data_union", NULL, | |
193 | (char *)dir2_data_union_flds, dir2_data_union_size, FTARG_SIZE, NULL, | |
194 | dir2_data_union_flds }, | |
195 | { FLDT_DIR2_FREE_HDR, "dir2_free_hdr", NULL, (char *)dir2_free_hdr_flds, | |
196 | SI(bitsz(xfs_dir2_free_hdr_t)), 0, NULL, dir2_free_hdr_flds }, | |
197 | { FLDT_DIR2_INO4, "dir2_ino4", fp_num, "%u", SI(bitsz(xfs_dir2_ino4_t)), | |
198 | 0, fa_ino4, NULL }, | |
199 | { FLDT_DIR2_INO8, "dir2_ino8", fp_num, "%llu", | |
200 | SI(bitsz(xfs_dir2_ino8_t)), 0, fa_ino8, NULL }, | |
201 | { FLDT_DIR2_INOU, "dir2_inou", NULL, (char *)dir2_inou_flds, | |
202 | dir2_inou_size, FTARG_SIZE, NULL, dir2_inou_flds }, | |
203 | { FLDT_DIR2_LEAF_ENTRY, "dir2_leaf_entry", NULL, | |
204 | (char *)dir2_leaf_entry_flds, SI(bitsz(xfs_dir2_leaf_entry_t)), 0, | |
205 | NULL, dir2_leaf_entry_flds }, | |
206 | { FLDT_DIR2_LEAF_HDR, "dir2_leaf_hdr", NULL, (char *)dir2_leaf_hdr_flds, | |
207 | SI(bitsz(xfs_dir2_leaf_hdr_t)), 0, NULL, dir2_leaf_hdr_flds }, | |
208 | { FLDT_DIR2_LEAF_TAIL, "dir2_leaf_tail", NULL, | |
209 | (char *)dir2_leaf_tail_flds, SI(bitsz(xfs_dir2_leaf_tail_t)), 0, NULL, | |
210 | dir2_leaf_tail_flds }, | |
211 | { FLDT_DIR2_SF_ENTRY, "dir2_sf_entry", NULL, (char *)dir2_sf_entry_flds, | |
212 | dir2_sf_entry_size, FTARG_SIZE, NULL, dir2_sf_entry_flds }, | |
213 | { FLDT_DIR2_SF_HDR, "dir2_sf_hdr", NULL, (char *)dir2_sf_hdr_flds, | |
214 | dir2_sf_hdr_size, FTARG_SIZE, NULL, dir2_sf_hdr_flds }, | |
215 | { FLDT_DIR2_SF_OFF, "dir2_sf_off", fp_num, "%#x", | |
216 | SI(bitsz(xfs_dir2_sf_off_t)), 0, NULL, NULL }, | |
217 | { FLDT_DIR2SF, "dir2sf", NULL, (char *)dir2sf_flds, dir2sf_size, | |
218 | FTARG_SIZE, NULL, dir2sf_flds }, | |
219 | { FLDT_DIR_BLKINFO, "dir_blkinfo", NULL, (char *)dir_blkinfo_flds, | |
220 | SI(bitsz(struct xfs_da_blkinfo)), 0, NULL, dir_blkinfo_flds }, | |
221 | { FLDT_DIR_INO, "dir_ino", fp_num, "%llu", SI(bitsz(xfs_dir_ino_t)), 0, | |
222 | fa_ino, NULL }, | |
223 | { FLDT_DIR_LEAF_ENTRY, "dir_leaf_entry", fp_sarray, | |
224 | (char *)dir_leaf_entry_flds, SI(bitsz(struct xfs_dir_leaf_entry)), 0, | |
225 | NULL, dir_leaf_entry_flds }, | |
226 | { FLDT_DIR_LEAF_HDR, "dir_leaf_hdr", NULL, (char *)dir_leaf_hdr_flds, | |
227 | SI(bitsz(struct xfs_dir_leaf_hdr)), 0, NULL, dir_leaf_hdr_flds }, | |
228 | { FLDT_DIR_LEAF_MAP, "dir_leaf_map", fp_sarray, | |
229 | (char *)dir_leaf_map_flds, SI(bitsz(struct xfs_dir_leaf_map)), 0, | |
230 | NULL, dir_leaf_map_flds }, | |
231 | { FLDT_DIR_LEAF_NAME, "dir_leaf_name", NULL, (char *)dir_leaf_name_flds, | |
232 | dir_leaf_name_size, FTARG_SIZE, NULL, dir_leaf_name_flds }, | |
233 | { FLDT_DIR_NODE_ENTRY, "dir_node_entry", fp_sarray, | |
234 | (char *)dir_node_entry_flds, SI(bitsz(struct xfs_da_node_entry)), 0, | |
235 | NULL, dir_node_entry_flds }, | |
236 | { FLDT_DIR_NODE_HDR, "dir_node_hdr", NULL, (char *)dir_node_hdr_flds, | |
237 | SI(bitsz(struct xfs_da_node_hdr)), 0, NULL, dir_node_hdr_flds }, | |
238 | { FLDT_DIR_SF_ENTRY, "dir_sf_entry", NULL, (char *)dir_sf_entry_flds, | |
239 | dir_sf_entry_size, FTARG_SIZE, NULL, dir_sf_entry_flds }, | |
240 | { FLDT_DIR_SF_HDR, "dir_sf_hdr", NULL, (char *)dir_sf_hdr_flds, | |
241 | SI(bitsz(struct xfs_dir_sf_hdr)), 0, NULL, dir_sf_hdr_flds }, | |
242 | { FLDT_DIRBLOCK, "dirblock", fp_num, "%u", SI(bitsz(__uint32_t)), 0, | |
243 | fa_dirblock, NULL }, | |
244 | { FLDT_DIRSHORT, "dirshort", NULL, (char *)dir_shortform_flds, | |
245 | dirshort_size, FTARG_SIZE, NULL, dir_shortform_flds }, | |
246 | { FLDT_DISK_DQUOT, "disk_dquot", NULL, (char *)disk_dquot_flds, | |
247 | SI(bitsz(xfs_disk_dquot_t)), 0, NULL, disk_dquot_flds }, | |
248 | { FLDT_DQBLK, "dqblk", NULL, (char *)dqblk_flds, SI(bitsz(xfs_dqblk_t)), | |
249 | 0, NULL, dqblk_flds }, | |
250 | { FLDT_DQID, "dqid", fp_num, "%d", SI(bitsz(xfs_dqid_t)), 0, NULL, | |
251 | NULL }, | |
252 | { FLDT_DRFSBNO, "drfsbno", fp_num, "%llu", SI(bitsz(xfs_drfsbno_t)), | |
253 | FTARG_DONULL, fa_drfsbno, NULL }, | |
254 | { FLDT_DRTBNO, "drtbno", fp_num, "%llu", SI(bitsz(xfs_drtbno_t)), | |
255 | FTARG_DONULL, fa_drtbno, NULL }, | |
256 | { FLDT_EXTLEN, "extlen", fp_num, "%u", SI(bitsz(xfs_extlen_t)), 0, NULL, | |
257 | NULL }, | |
258 | { FLDT_EXTNUM, "extnum", fp_num, "%d", SI(bitsz(xfs_extnum_t)), | |
259 | FTARG_SIGNED, NULL, NULL }, | |
260 | { FLDT_FSIZE, "fsize", fp_num, "%lld", SI(bitsz(xfs_fsize_t)), | |
261 | FTARG_SIGNED, NULL, NULL }, | |
262 | { FLDT_INO, "ino", fp_num, "%llu", SI(bitsz(xfs_ino_t)), FTARG_DONULL, | |
263 | fa_ino, NULL }, | |
264 | { FLDT_INOBT, "inobt", NULL, (char *)inobt_flds, inobt_size, | |
265 | FTARG_SIZE, NULL, inobt_flds }, | |
266 | { FLDT_INOBTKEY, "inobtkey", fp_sarray, (char *)inobt_key_flds, | |
267 | SI(bitsz(xfs_inobt_key_t)), 0, NULL, inobt_key_flds }, | |
268 | { FLDT_INOBTPTR, "inobtptr", fp_num, "%u", SI(bitsz(xfs_inobt_ptr_t)), | |
269 | 0, fa_agblock, NULL }, | |
270 | { FLDT_INOBTREC, "inobtrec", fp_sarray, (char *)inobt_rec_flds, | |
271 | SI(bitsz(xfs_inobt_rec_t)), 0, NULL, inobt_rec_flds }, | |
272 | { FLDT_INODE, "inode", NULL, (char *)inode_flds, inode_size, FTARG_SIZE, | |
273 | NULL, inode_flds }, | |
274 | { FLDT_INOFREE, "inofree", fp_num, "%#llx", SI(bitsz(xfs_inofree_t)), 0, | |
275 | NULL, NULL }, | |
276 | { FLDT_INT16D, "int16d", fp_num, "%d", SI(bitsz(__int16_t)), | |
277 | FTARG_SIGNED, NULL, NULL }, | |
278 | { FLDT_INT32D, "int32d", fp_num, "%d", SI(bitsz(__int32_t)), | |
279 | FTARG_SIGNED, NULL, NULL }, | |
280 | { FLDT_INT64D, "int64d", fp_num, "%lld", SI(bitsz(__int64_t)), | |
281 | FTARG_SIGNED, NULL, NULL }, | |
282 | { FLDT_INT8D, "int8d", fp_num, "%d", SI(bitsz(__int8_t)), FTARG_SIGNED, | |
283 | NULL, NULL }, | |
284 | { FLDT_NSEC, "nsec", fp_num, "%09d", SI(bitsz(__int32_t)), FTARG_SIGNED, | |
285 | NULL, NULL }, | |
286 | { FLDT_QCNT, "qcnt", fp_num, "%llu", SI(bitsz(xfs_qcnt_t)), 0, NULL, | |
287 | NULL }, | |
288 | { FLDT_QWARNCNT, "qwarncnt", fp_num, "%u", SI(bitsz(xfs_qwarncnt_t)), 0, | |
289 | NULL, NULL }, | |
290 | { FLDT_SB, "sb", NULL, (char *)sb_flds, sb_size, FTARG_SIZE, NULL, | |
291 | sb_flds }, | |
292 | { FLDT_TIME, "time", fp_time, NULL, SI(bitsz(__int32_t)), FTARG_SIGNED, | |
293 | NULL, NULL }, | |
294 | { FLDT_TIMESTAMP, "timestamp", NULL, (char *)timestamp_flds, | |
295 | SI(bitsz(xfs_timestamp_t)), 0, NULL, timestamp_flds }, | |
296 | { FLDT_UINT1, "uint1", fp_num, "%u", SI(1), 0, NULL, NULL }, | |
297 | { FLDT_UINT16D, "uint16d", fp_num, "%u", SI(bitsz(__uint16_t)), 0, NULL, | |
298 | NULL }, | |
299 | { FLDT_UINT16O, "uint16o", fp_num, "%#o", SI(bitsz(__uint16_t)), 0, | |
300 | NULL, NULL }, | |
301 | { FLDT_UINT16X, "uint16x", fp_num, "%#x", SI(bitsz(__uint16_t)), 0, | |
302 | NULL, NULL }, | |
303 | { FLDT_UINT32D, "uint32d", fp_num, "%u", SI(bitsz(__uint32_t)), 0, NULL, | |
304 | NULL }, | |
305 | { FLDT_UINT32O, "uint32o", fp_num, "%#o", SI(bitsz(__uint32_t)), 0, | |
306 | NULL, NULL }, | |
307 | { FLDT_UINT32X, "uint32x", fp_num, "%#x", SI(bitsz(__uint32_t)), 0, | |
308 | NULL, NULL }, | |
309 | { FLDT_UINT64D, "uint64d", fp_num, "%llu", SI(bitsz(__uint64_t)), 0, | |
310 | NULL, NULL }, | |
311 | { FLDT_UINT64O, "uint64o", fp_num, "%#llo", SI(bitsz(__uint64_t)), 0, | |
312 | NULL, NULL }, | |
313 | { FLDT_UINT64X, "uint64x", fp_num, "%#llx", SI(bitsz(__uint64_t)), 0, | |
314 | NULL, NULL }, | |
315 | { FLDT_UINT8D, "uint8d", fp_num, "%u", SI(bitsz(__uint8_t)), 0, NULL, | |
316 | NULL }, | |
317 | { FLDT_UINT8O, "uint8o", fp_num, "%#o", SI(bitsz(__uint8_t)), 0, NULL, | |
318 | NULL }, | |
319 | { FLDT_UINT8X, "uint8x", fp_num, "%#x", SI(bitsz(__uint8_t)), 0, NULL, | |
320 | NULL }, | |
321 | { FLDT_UUID, "uuid", fp_uuid, NULL, SI(bitsz(uuid_t)), 0, NULL, NULL }, | |
322 | { FLDT_ZZZ, NULL } | |
323 | }; | |
324 | ||
325 | int | |
326 | bitoffset( | |
327 | const field_t *f, | |
328 | void *obj, | |
329 | int startoff, | |
330 | int idx) | |
331 | { | |
332 | ||
333 | if (!(f->flags & FLD_OFFSET)) { | |
334 | if (f->flags & FLD_ARRAY) { | |
335 | int abase; | |
336 | #ifdef DEBUG | |
337 | const ftattr_t *fa = &ftattrtab[f->ftyp]; | |
338 | #endif | |
339 | ||
340 | abase = (f->flags & FLD_ABASE1) != 0; | |
341 | ASSERT(fa->ftyp == f->ftyp); | |
342 | ASSERT((fa->arg & FTARG_SIZE) == 0); | |
343 | return (int)(__psint_t)f->offset + | |
344 | (idx - abase) * fsize(f, obj, startoff, idx); | |
345 | } else | |
346 | return (int)(__psint_t)f->offset; | |
347 | } else | |
348 | return (*f->offset)(obj, startoff, idx); | |
349 | } | |
350 | ||
351 | int | |
352 | fcount( | |
353 | const field_t *f, | |
354 | void *obj, | |
355 | int startoff) | |
356 | { | |
357 | if (!(f->flags & FLD_COUNT)) | |
358 | return (int)(__psint_t)f->count; | |
359 | else | |
360 | return (*f->count)(obj, startoff); | |
361 | } | |
362 | ||
363 | const field_t * | |
364 | findfield( | |
365 | char *name, | |
366 | const field_t *fields, | |
dfc130f3 RC |
367 | void *obj, |
368 | int startoff) | |
2bd0ea18 NS |
369 | { |
370 | const field_t *f; | |
371 | ||
dfc130f3 | 372 | /* we only match if this field name matches and has a non-zero count */ |
2bd0ea18 NS |
373 | for (f = fields; f->name; f++) |
374 | if (strcmp(f->name, name) == 0 && fcount(f, obj, startoff)) | |
375 | return f; | |
376 | return NULL; | |
377 | } | |
378 | ||
379 | int | |
380 | fsize( | |
381 | const field_t *f, | |
382 | void *obj, | |
383 | int startoff, | |
384 | int idx) | |
385 | { | |
386 | const ftattr_t *fa; | |
387 | ||
388 | fa = &ftattrtab[f->ftyp]; | |
389 | ASSERT(fa->ftyp == f->ftyp); | |
390 | if (!(fa->arg & FTARG_SIZE)) | |
391 | return (int)(__psint_t)fa->size; | |
392 | else | |
393 | return (*fa->size)(obj, startoff, idx); | |
394 | } |