]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2bd0ea18 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
4 | * All Rights Reserved. | |
2bd0ea18 | 5 | */ |
6b803e5a CH |
6 | #include "libxfs.h" |
7 | #include "libxlog.h" | |
2bd0ea18 NS |
8 | |
9 | #include "logprint.h" | |
10 | ||
2bd0ea18 NS |
11 | /* |
12 | * Start is defined to be the block pointing to the oldest valid log record. | |
2bd0ea18 NS |
13 | */ |
14 | int | |
15 | xlog_print_find_oldest( | |
999f0b9c | 16 | struct xlog *log, |
15c81278 | 17 | xfs_daddr_t *last_blk) |
2bd0ea18 NS |
18 | { |
19 | xfs_buf_t *bp; | |
20 | xfs_daddr_t first_blk; | |
15c81278 | 21 | uint first_half_cycle, last_half_cycle; |
a134873e | 22 | int error = 0; |
dfc130f3 | 23 | |
2bd0ea18 NS |
24 | if (xlog_find_zeroed(log, &first_blk)) |
25 | return 0; | |
26 | ||
27 | first_blk = 0; /* read first block */ | |
15c81278 | 28 | bp = xlog_get_bp(log, 1); |
c40bdaa2 | 29 | xlog_bread_noalign(log, 0, 1, bp); |
5e656dbb | 30 | first_half_cycle = xlog_get_cycle(XFS_BUF_PTR(bp)); |
2bd0ea18 | 31 | *last_blk = log->l_logBBsize-1; /* read last block */ |
c40bdaa2 | 32 | xlog_bread_noalign(log, *last_blk, 1, bp); |
5e656dbb | 33 | last_half_cycle = xlog_get_cycle(XFS_BUF_PTR(bp)); |
2bd0ea18 NS |
34 | ASSERT(last_half_cycle != 0); |
35 | ||
a134873e | 36 | if (first_half_cycle == last_half_cycle) /* all cycle nos are same */ |
2bd0ea18 | 37 | *last_blk = 0; |
a134873e | 38 | else /* have 1st and last; look for middle cycle */ |
2bd0ea18 NS |
39 | error = xlog_find_cycle_start(log, bp, first_blk, |
40 | last_blk, last_half_cycle); | |
2bd0ea18 NS |
41 | |
42 | xlog_put_bp(bp); | |
a134873e | 43 | return error; |
15c81278 | 44 | } |
2bd0ea18 NS |
45 | |
46 | void | |
47 | xlog_recover_print_data( | |
d60ba955 | 48 | char *p, |
dfc130f3 | 49 | int len) |
2bd0ea18 NS |
50 | { |
51 | if (print_data) { | |
52 | uint *dp = (uint *)p; | |
53 | int nums = len >> 2; | |
54 | int j = 0; | |
55 | ||
56 | while (j < nums) { | |
57 | if ((j % 8) == 0) | |
58 | printf("%2x ", j); | |
59 | printf("%8x ", *dp); | |
60 | dp++; | |
61 | j++; | |
62 | if ((j % 8) == 0) | |
63 | printf("\n"); | |
64 | } | |
65 | printf("\n"); | |
66 | } | |
15c81278 | 67 | } |
2bd0ea18 NS |
68 | |
69 | STATIC void | |
70 | xlog_recover_print_buffer( | |
15c81278 | 71 | xlog_recover_item_t *item) |
2bd0ea18 NS |
72 | { |
73 | xfs_agi_t *agi; | |
74 | xfs_agf_t *agf; | |
2bd0ea18 | 75 | xfs_buf_log_format_t *f; |
d60ba955 | 76 | char *p; |
2bd0ea18 NS |
77 | int len, num, i; |
78 | xfs_daddr_t blkno; | |
79 | xfs_disk_dquot_t *ddq; | |
80 | ||
81 | f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; | |
2bd0ea18 | 82 | printf(" "); |
5e656dbb | 83 | ASSERT(f->blf_type == XFS_LI_BUF); |
9ee7055c | 84 | printf(_("BUF: #regs:%d start blkno:0x%llx len:%d bmap size:%d flags:0x%x\n"), |
5e656dbb BN |
85 | f->blf_size, (long long)f->blf_blkno, f->blf_len, f->blf_map_size, f->blf_flags); |
86 | blkno = (xfs_daddr_t)f->blf_blkno; | |
2bd0ea18 NS |
87 | num = f->blf_size-1; |
88 | i = 1; | |
89 | while (num-- > 0) { | |
90 | p = item->ri_buf[i].i_addr; | |
91 | len = item->ri_buf[i].i_len; | |
92 | i++; | |
93 | if (blkno == 0) { /* super block */ | |
9ee7055c | 94 | printf(_(" SUPER Block Buffer:\n")); |
f8149110 | 95 | if (!print_buffer) |
5e656dbb | 96 | continue; |
f934f4a5 AE |
97 | printf(_(" icount:%llu ifree:%llu "), |
98 | (unsigned long long) | |
99 | be64_to_cpu(*(__be64 *)(p)), | |
100 | (unsigned long long) | |
101 | be64_to_cpu(*(__be64 *)(p+8))); | |
102 | printf(_("fdblks:%llu frext:%llu\n"), | |
103 | (unsigned long long) | |
104 | be64_to_cpu(*(__be64 *)(p+16)), | |
105 | (unsigned long long) | |
106 | be64_to_cpu(*(__be64 *)(p+24))); | |
9ee7055c | 107 | printf(_(" sunit:%u swidth:%u\n"), |
5e656dbb BN |
108 | be32_to_cpu(*(__be32 *)(p+56)), |
109 | be32_to_cpu(*(__be32 *)(p+60))); | |
110 | } else if (be32_to_cpu(*(__be32 *)p) == XFS_AGI_MAGIC) { | |
a59111c1 | 111 | int bucket, buckets; |
2bd0ea18 | 112 | agi = (xfs_agi_t *)p; |
9ee7055c | 113 | printf(_(" AGI Buffer: (XAGI)\n")); |
f8149110 | 114 | if (!print_buffer) |
5e656dbb | 115 | continue; |
9ee7055c | 116 | printf(_(" ver:%d "), |
5e656dbb | 117 | be32_to_cpu(agi->agi_versionnum)); |
9ee7055c | 118 | printf(_("seq#:%d len:%d cnt:%d root:%d\n"), |
5e656dbb BN |
119 | be32_to_cpu(agi->agi_seqno), |
120 | be32_to_cpu(agi->agi_length), | |
121 | be32_to_cpu(agi->agi_count), | |
122 | be32_to_cpu(agi->agi_root)); | |
9ee7055c | 123 | printf(_(" level:%d free#:0x%x newino:0x%x\n"), |
5e656dbb BN |
124 | be32_to_cpu(agi->agi_level), |
125 | be32_to_cpu(agi->agi_freecount), | |
126 | be32_to_cpu(agi->agi_newino)); | |
a59111c1 DC |
127 | if (len == 128) { |
128 | buckets = 17; | |
129 | } else if (len == 256) { | |
130 | buckets = 32 + 17; | |
131 | } else { | |
132 | buckets = XFS_AGI_UNLINKED_BUCKETS; | |
133 | } | |
134 | for (bucket = 0; bucket < buckets;) { | |
135 | int col; | |
136 | printf(_("bucket[%d - %d]: "), bucket, bucket+3); | |
137 | for (col = 0; col < 4; col++, bucket++) { | |
138 | if (bucket < buckets) { | |
139 | printf("0x%x ", | |
140 | be32_to_cpu(agi->agi_unlinked[bucket])); | |
141 | } | |
142 | } | |
143 | printf("\n"); | |
144 | } | |
5e656dbb | 145 | } else if (be32_to_cpu(*(__be32 *)p) == XFS_AGF_MAGIC) { |
2bd0ea18 | 146 | agf = (xfs_agf_t *)p; |
9ee7055c | 147 | printf(_(" AGF Buffer: (XAGF)\n")); |
f8149110 | 148 | if (!print_buffer) |
5e656dbb | 149 | continue; |
9ee7055c | 150 | printf(_(" ver:%d seq#:%d len:%d \n"), |
5e656dbb BN |
151 | be32_to_cpu(agf->agf_versionnum), |
152 | be32_to_cpu(agf->agf_seqno), | |
153 | be32_to_cpu(agf->agf_length)); | |
9ee7055c | 154 | printf(_(" root BNO:%d CNT:%d\n"), |
5e656dbb BN |
155 | be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNOi]), |
156 | be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNTi])); | |
9ee7055c | 157 | printf(_(" level BNO:%d CNT:%d\n"), |
5e656dbb BN |
158 | be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]), |
159 | be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi])); | |
9ee7055c AM |
160 | printf(_(" 1st:%d last:%d cnt:%d " |
161 | "freeblks:%d longest:%d\n"), | |
5e656dbb BN |
162 | be32_to_cpu(agf->agf_flfirst), |
163 | be32_to_cpu(agf->agf_fllast), | |
164 | be32_to_cpu(agf->agf_flcount), | |
165 | be32_to_cpu(agf->agf_freeblks), | |
166 | be32_to_cpu(agf->agf_longest)); | |
2bd0ea18 NS |
167 | } else if (*(uint *)p == XFS_DQUOT_MAGIC) { |
168 | ddq = (xfs_disk_dquot_t *)p; | |
9ee7055c | 169 | printf(_(" DQUOT Buffer:\n")); |
f8149110 | 170 | if (!print_buffer) |
5e656dbb | 171 | continue; |
9ee7055c | 172 | printf(_(" UIDs 0x%lx-0x%lx\n"), |
5e656dbb BN |
173 | (unsigned long)be32_to_cpu(ddq->d_id), |
174 | (unsigned long)be32_to_cpu(ddq->d_id) + | |
2bd0ea18 NS |
175 | (BBTOB(f->blf_len) / sizeof(xfs_dqblk_t)) - 1); |
176 | } else { | |
9ee7055c | 177 | printf(_(" BUF DATA\n")); |
2bd0ea18 NS |
178 | if (!print_buffer) continue; |
179 | xlog_recover_print_data(p, len); | |
180 | } | |
181 | } | |
15c81278 | 182 | } |
2bd0ea18 NS |
183 | |
184 | STATIC void | |
185 | xlog_recover_print_quotaoff( | |
15c81278 | 186 | xlog_recover_item_t *item) |
2bd0ea18 | 187 | { |
15c81278 | 188 | xfs_qoff_logformat_t *qoff_f; |
6af9d3ef | 189 | char str[32] = { 0 }; |
2bd0ea18 NS |
190 | |
191 | qoff_f = (xfs_qoff_logformat_t *)item->ri_buf[0].i_addr; | |
192 | ASSERT(qoff_f); | |
dfc130f3 | 193 | if (qoff_f->qf_flags & XFS_UQUOTA_ACCT) |
6af9d3ef | 194 | strcat(str, "USER QUOTA"); |
b36eef04 NS |
195 | if (qoff_f->qf_flags & XFS_GQUOTA_ACCT) |
196 | strcat(str, "GROUP QUOTA"); | |
6af9d3ef NS |
197 | if (qoff_f->qf_flags & XFS_PQUOTA_ACCT) |
198 | strcat(str, "PROJECT QUOTA"); | |
9ee7055c | 199 | printf(_("\tQUOTAOFF: #regs:%d type:%s\n"), |
2bd0ea18 NS |
200 | qoff_f->qf_size, str); |
201 | } | |
202 | ||
2bd0ea18 NS |
203 | STATIC void |
204 | xlog_recover_print_dquot( | |
15c81278 | 205 | xlog_recover_item_t *item) |
2bd0ea18 | 206 | { |
dfc130f3 | 207 | xfs_dq_logformat_t *f; |
2bd0ea18 NS |
208 | xfs_disk_dquot_t *d; |
209 | ||
210 | f = (xfs_dq_logformat_t *)item->ri_buf[0].i_addr; | |
211 | ASSERT(f); | |
212 | ASSERT(f->qlf_len == 1); | |
213 | d = (xfs_disk_dquot_t *)item->ri_buf[1].i_addr; | |
9ee7055c | 214 | printf(_("\tDQUOT: #regs:%d blkno:%lld boffset:%u id: %d\n"), |
5b64e00a | 215 | f->qlf_size, (long long)f->qlf_blkno, f->qlf_boffset, f->qlf_id); |
2bd0ea18 NS |
216 | if (!print_quota) |
217 | return; | |
9ee7055c | 218 | printf(_("\t\tmagic 0x%x\tversion 0x%x\tID 0x%x (%d)\t\n"), |
5e656dbb BN |
219 | be16_to_cpu(d->d_magic), |
220 | d->d_version, | |
221 | be32_to_cpu(d->d_id), | |
222 | be32_to_cpu(d->d_id)); | |
9ee7055c AM |
223 | printf(_("\t\tblk_hard 0x%x\tblk_soft 0x%x\tino_hard 0x%x" |
224 | "\tino_soft 0x%x\n"), | |
5e656dbb BN |
225 | (int)be64_to_cpu(d->d_blk_hardlimit), |
226 | (int)be64_to_cpu(d->d_blk_softlimit), | |
227 | (int)be64_to_cpu(d->d_ino_hardlimit), | |
228 | (int)be64_to_cpu(d->d_ino_softlimit)); | |
9ee7055c | 229 | printf(_("\t\tbcount 0x%x (%d) icount 0x%x (%d)\n"), |
5e656dbb BN |
230 | (int)be64_to_cpu(d->d_bcount), |
231 | (int)be64_to_cpu(d->d_bcount), | |
232 | (int)be64_to_cpu(d->d_icount), | |
233 | (int)be64_to_cpu(d->d_icount)); | |
9ee7055c | 234 | printf(_("\t\tbtimer 0x%x itimer 0x%x \n"), |
5e656dbb BN |
235 | (int)be32_to_cpu(d->d_btimer), |
236 | (int)be32_to_cpu(d->d_itimer)); | |
2bd0ea18 NS |
237 | } |
238 | ||
239 | STATIC void | |
240 | xlog_recover_print_inode_core( | |
138659f1 | 241 | struct xfs_log_dinode *di) |
2bd0ea18 | 242 | { |
9ee7055c | 243 | printf(_(" CORE inode:\n")); |
2bd0ea18 NS |
244 | if (!print_inode) |
245 | return; | |
f089fc42 | 246 | printf(_(" magic:%c%c mode:0x%x ver:%d format:%d\n"), |
dfc130f3 | 247 | (di->di_magic>>8) & 0xff, di->di_magic & 0xff, |
f089fc42 | 248 | di->di_mode, di->di_version, di->di_format); |
138659f1 DC |
249 | printf(_(" uid:%d gid:%d nlink:%d projid:0x%04x%04x\n"), |
250 | di->di_uid, di->di_gid, di->di_nlink, | |
251 | di->di_projid_hi, di->di_projid_lo); | |
9ee7055c | 252 | printf(_(" atime:%d mtime:%d ctime:%d\n"), |
2bd0ea18 | 253 | di->di_atime.t_sec, di->di_mtime.t_sec, di->di_ctime.t_sec); |
9ee7055c AM |
254 | printf(_(" flushiter:%d\n"), di->di_flushiter); |
255 | printf(_(" size:0x%llx nblks:0x%llx exsize:%d " | |
256 | "nextents:%d anextents:%d\n"), (unsigned long long) | |
5b64e00a NS |
257 | di->di_size, (unsigned long long)di->di_nblocks, |
258 | di->di_extsize, di->di_nextents, (int)di->di_anextents); | |
9ee7055c | 259 | printf(_(" forkoff:%d dmevmask:0x%x dmstate:%d flags:0x%x " |
3c84c543 | 260 | "gen:%u\n"), |
2bd0ea18 NS |
261 | (int)di->di_forkoff, di->di_dmevmask, (int)di->di_dmstate, |
262 | (int)di->di_flags, di->di_gen); | |
1fe708d6 | 263 | if (di->di_version == 3) { |
12f365e2 | 264 | printf(_(" flags2 0x%llx cowextsize 0x%x\n"), |
1fe708d6 DW |
265 | (unsigned long long)di->di_flags2, di->di_cowextsize); |
266 | } | |
15c81278 | 267 | } |
2bd0ea18 NS |
268 | |
269 | STATIC void | |
270 | xlog_recover_print_inode( | |
15c81278 | 271 | xlog_recover_item_t *item) |
2bd0ea18 | 272 | { |
e784bcd5 DW |
273 | struct xfs_inode_log_format f_buf; |
274 | struct xfs_inode_log_format *f; | |
2bd0ea18 NS |
275 | int attr_index; |
276 | int hasdata; | |
277 | int hasattr; | |
278 | ||
87daa553 DC |
279 | ASSERT(item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format_32) || |
280 | item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)); | |
299173ff TS |
281 | f = xfs_inode_item_format_convert(item->ri_buf[0].i_addr, item->ri_buf[0].i_len, &f_buf); |
282 | ||
9ee7055c | 283 | printf(_(" INODE: #regs:%d ino:0x%llx flags:0x%x dsize:%d\n"), |
5b64e00a NS |
284 | f->ilf_size, (unsigned long long)f->ilf_ino, f->ilf_fields, |
285 | f->ilf_dsize); | |
2bd0ea18 NS |
286 | |
287 | /* core inode comes 2nd */ | |
138659f1 DC |
288 | ASSERT(item->ri_buf[1].i_len == xfs_log_dinode_size(2) || |
289 | item->ri_buf[1].i_len == xfs_log_dinode_size(3)); | |
290 | xlog_recover_print_inode_core((struct xfs_log_dinode *) | |
2bd0ea18 NS |
291 | item->ri_buf[1].i_addr); |
292 | ||
293 | hasdata = (f->ilf_fields & XFS_ILOG_DFORK) != 0; | |
294 | hasattr = (f->ilf_fields & XFS_ILOG_AFORK) != 0; | |
295 | /* does anything come next */ | |
15c81278 NS |
296 | switch (f->ilf_fields & (XFS_ILOG_DFORK|XFS_ILOG_DEV|XFS_ILOG_UUID)) { |
297 | case XFS_ILOG_DEXT: | |
298 | ASSERT(f->ilf_size == 3 + hasattr); | |
9ee7055c | 299 | printf(_(" DATA FORK EXTENTS inode data:\n")); |
15c81278 NS |
300 | if (print_inode && print_data) |
301 | xlog_recover_print_data(item->ri_buf[2].i_addr, | |
302 | item->ri_buf[2].i_len); | |
303 | break; | |
304 | case XFS_ILOG_DBROOT: | |
305 | ASSERT(f->ilf_size == 3 + hasattr); | |
9ee7055c | 306 | printf(_(" DATA FORK BTREE inode data:\n")); |
15c81278 NS |
307 | if (print_inode && print_data) |
308 | xlog_recover_print_data(item->ri_buf[2].i_addr, | |
309 | item->ri_buf[2].i_len); | |
310 | break; | |
311 | case XFS_ILOG_DDATA: | |
312 | ASSERT(f->ilf_size == 3 + hasattr); | |
9ee7055c | 313 | printf(_(" DATA FORK LOCAL inode data:\n")); |
15c81278 NS |
314 | if (print_inode && print_data) |
315 | xlog_recover_print_data(item->ri_buf[2].i_addr, | |
316 | item->ri_buf[2].i_len); | |
317 | break; | |
318 | case XFS_ILOG_DEV: | |
319 | ASSERT(f->ilf_size == 2 + hasattr); | |
9ee7055c | 320 | printf(_(" DEV inode: no extra region\n")); |
15c81278 NS |
321 | break; |
322 | case XFS_ILOG_UUID: | |
323 | ASSERT(f->ilf_size == 2 + hasattr); | |
9ee7055c | 324 | printf(_(" UUID inode: no extra region\n")); |
15c81278 NS |
325 | break; |
326 | ||
327 | case 0: | |
328 | ASSERT(f->ilf_size == 2 + hasattr); | |
329 | break; | |
330 | default: | |
331 | xlog_panic("xlog_print_trans_inode: illegal inode type"); | |
2bd0ea18 NS |
332 | } |
333 | ||
334 | if (hasattr) { | |
335 | attr_index = 2 + hasdata; | |
336 | switch (f->ilf_fields & XFS_ILOG_AFORK) { | |
15c81278 NS |
337 | case XFS_ILOG_AEXT: |
338 | ASSERT(f->ilf_size == 3 + hasdata); | |
9ee7055c | 339 | printf(_(" ATTR FORK EXTENTS inode data:\n")); |
15c81278 NS |
340 | if (print_inode && print_data) |
341 | xlog_recover_print_data( | |
342 | item->ri_buf[attr_index].i_addr, | |
343 | item->ri_buf[attr_index].i_len); | |
344 | break; | |
345 | case XFS_ILOG_ABROOT: | |
346 | ASSERT(f->ilf_size == 3 + hasdata); | |
9ee7055c | 347 | printf(_(" ATTR FORK BTREE inode data:\n")); |
15c81278 NS |
348 | if (print_inode && print_data) |
349 | xlog_recover_print_data( | |
350 | item->ri_buf[attr_index].i_addr, | |
351 | item->ri_buf[attr_index].i_len); | |
352 | break; | |
353 | case XFS_ILOG_ADATA: | |
354 | ASSERT(f->ilf_size == 3 + hasdata); | |
9ee7055c | 355 | printf(_(" ATTR FORK LOCAL inode data:\n")); |
15c81278 NS |
356 | if (print_inode && print_data) |
357 | xlog_recover_print_data( | |
358 | item->ri_buf[attr_index].i_addr, | |
359 | item->ri_buf[attr_index].i_len); | |
360 | break; | |
361 | default: | |
362 | xlog_panic("%s: illegal inode log flag", __FUNCTION__); | |
2bd0ea18 NS |
363 | } |
364 | } | |
15c81278 | 365 | } |
2bd0ea18 | 366 | |
2bd0ea18 | 367 | |
2e6b5c91 DC |
368 | STATIC void |
369 | xlog_recover_print_icreate( | |
370 | struct xlog_recover_item *item) | |
371 | { | |
372 | struct xfs_icreate_log *icl; | |
373 | ||
374 | icl = (struct xfs_icreate_log *)item->ri_buf[0].i_addr; | |
375 | ||
376 | printf(_(" ICR: #ag: %d agbno: 0x%x len: %d\n" | |
377 | " cnt: %d isize: %d gen: 0x%x\n"), | |
378 | be32_to_cpu(icl->icl_ag), be32_to_cpu(icl->icl_agbno), | |
379 | be32_to_cpu(icl->icl_length), be32_to_cpu(icl->icl_count), | |
380 | be32_to_cpu(icl->icl_isize), be32_to_cpu(icl->icl_gen)); | |
381 | } | |
382 | ||
2bd0ea18 NS |
383 | void |
384 | xlog_recover_print_logitem( | |
15c81278 | 385 | xlog_recover_item_t *item) |
2bd0ea18 NS |
386 | { |
387 | switch (ITEM_TYPE(item)) { | |
15c81278 | 388 | case XFS_LI_BUF: |
15c81278 NS |
389 | xlog_recover_print_buffer(item); |
390 | break; | |
2e6b5c91 DC |
391 | case XFS_LI_ICREATE: |
392 | xlog_recover_print_icreate(item); | |
393 | break; | |
15c81278 | 394 | case XFS_LI_INODE: |
15c81278 NS |
395 | xlog_recover_print_inode(item); |
396 | break; | |
397 | case XFS_LI_EFD: | |
398 | xlog_recover_print_efd(item); | |
399 | break; | |
400 | case XFS_LI_EFI: | |
401 | xlog_recover_print_efi(item); | |
402 | break; | |
4428538d DW |
403 | case XFS_LI_RUD: |
404 | xlog_recover_print_rud(item); | |
405 | break; | |
406 | case XFS_LI_RUI: | |
407 | xlog_recover_print_rui(item); | |
408 | break; | |
77e3149e DW |
409 | case XFS_LI_CUD: |
410 | xlog_recover_print_cud(item); | |
411 | break; | |
412 | case XFS_LI_CUI: | |
413 | xlog_recover_print_cui(item); | |
414 | break; | |
dc4957df DW |
415 | case XFS_LI_BUD: |
416 | xlog_recover_print_bud(item); | |
417 | break; | |
418 | case XFS_LI_BUI: | |
419 | xlog_recover_print_bui(item); | |
420 | break; | |
15c81278 NS |
421 | case XFS_LI_DQUOT: |
422 | xlog_recover_print_dquot(item); | |
423 | break; | |
424 | case XFS_LI_QUOTAOFF: | |
425 | xlog_recover_print_quotaoff(item); | |
426 | break; | |
427 | default: | |
9ee7055c | 428 | printf(_("xlog_recover_print_logitem: illegal type\n")); |
15c81278 | 429 | break; |
2bd0ea18 | 430 | } |
15c81278 | 431 | } |
2bd0ea18 NS |
432 | |
433 | void | |
15c81278 NS |
434 | xlog_recover_print_item( |
435 | xlog_recover_item_t *item) | |
2bd0ea18 | 436 | { |
15c81278 | 437 | int i; |
2bd0ea18 NS |
438 | |
439 | switch (ITEM_TYPE(item)) { | |
15c81278 | 440 | case XFS_LI_BUF: |
2bd0ea18 NS |
441 | printf("BUF"); |
442 | break; | |
2e6b5c91 DC |
443 | case XFS_LI_ICREATE: |
444 | printf("ICR"); | |
445 | break; | |
15c81278 | 446 | case XFS_LI_INODE: |
2bd0ea18 NS |
447 | printf("INO"); |
448 | break; | |
15c81278 | 449 | case XFS_LI_EFD: |
2bd0ea18 NS |
450 | printf("EFD"); |
451 | break; | |
15c81278 | 452 | case XFS_LI_EFI: |
2bd0ea18 NS |
453 | printf("EFI"); |
454 | break; | |
4428538d DW |
455 | case XFS_LI_RUD: |
456 | printf("RUD"); | |
457 | break; | |
458 | case XFS_LI_RUI: | |
459 | printf("RUI"); | |
460 | break; | |
77e3149e DW |
461 | case XFS_LI_CUD: |
462 | printf("CUD"); | |
463 | break; | |
464 | case XFS_LI_CUI: | |
465 | printf("CUI"); | |
466 | break; | |
dc4957df DW |
467 | case XFS_LI_BUD: |
468 | printf("BUD"); | |
469 | break; | |
470 | case XFS_LI_BUI: | |
471 | printf("BUI"); | |
472 | break; | |
15c81278 | 473 | case XFS_LI_DQUOT: |
2bd0ea18 NS |
474 | printf("DQ "); |
475 | break; | |
15c81278 | 476 | case XFS_LI_QUOTAOFF: |
2bd0ea18 NS |
477 | printf("QOFF"); |
478 | break; | |
15c81278 | 479 | default: |
9ee7055c | 480 | cmn_err(CE_PANIC, _("%s: illegal type"), __FUNCTION__); |
2bd0ea18 | 481 | break; |
2bd0ea18 NS |
482 | } |
483 | ||
484 | /* type isn't filled in yet | |
9ee7055c | 485 | printf(_("ITEM: type: %d cnt: %d total: %d "), |
2bd0ea18 NS |
486 | item->ri_type, item->ri_cnt, item->ri_total); |
487 | */ | |
9ee7055c | 488 | printf(_(": cnt:%d total:%d "), item->ri_cnt, item->ri_total); |
2bd0ea18 | 489 | for (i=0; i<item->ri_cnt; i++) { |
9ee7055c | 490 | printf(_("a:0x%lx len:%d "), |
5b64e00a | 491 | (long)item->ri_buf[i].i_addr, item->ri_buf[i].i_len); |
2bd0ea18 NS |
492 | } |
493 | printf("\n"); | |
494 | xlog_recover_print_logitem(item); | |
15c81278 | 495 | } |
2bd0ea18 NS |
496 | |
497 | void | |
15c81278 NS |
498 | xlog_recover_print_trans( |
499 | xlog_recover_t *trans, | |
c40bdaa2 | 500 | struct list_head *itemq, |
15c81278 | 501 | int print) |
2bd0ea18 | 502 | { |
c40bdaa2 | 503 | xlog_recover_item_t *item; |
2bd0ea18 NS |
504 | |
505 | if (print < 3) | |
506 | return; | |
507 | ||
dfc130f3 | 508 | print_xlog_record_line(); |
2bd0ea18 | 509 | xlog_recover_print_trans_head(trans); |
c40bdaa2 | 510 | list_for_each_entry(item, itemq, ri_list) |
2bd0ea18 | 511 | xlog_recover_print_item(item); |
15c81278 | 512 | } |