Deleted Added
full compact
debug.c (103949) debug.c (118915)
1/*
2 * Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
3 * Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Christoph Herrmann and Thomas-Henning von Kamptz, Munich and Frankfurt.
8 *

--- 27 unchanged lines hidden (view full) ---

36 * SUCH DAMAGE.
37 *
38 * $TSHeader: src/sbin/growfs/debug.c,v 1.3 2000/12/12 19:31:00 tomsoft Exp $
39 *
40 */
41
42#ifndef lint
43static const char rcsid[] =
1/*
2 * Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
3 * Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Christoph Herrmann and Thomas-Henning von Kamptz, Munich and Frankfurt.
8 *

--- 27 unchanged lines hidden (view full) ---

36 * SUCH DAMAGE.
37 *
38 * $TSHeader: src/sbin/growfs/debug.c,v 1.3 2000/12/12 19:31:00 tomsoft Exp $
39 *
40 */
41
42#ifndef lint
43static const char rcsid[] =
44 "$FreeBSD: head/sbin/growfs/debug.c 103949 2002-09-25 04:06:37Z mike $";
44 "$FreeBSD: head/sbin/growfs/debug.c 118915 2003-08-14 18:40:59Z rwatson $";
45#endif /* not lint */
46
47/* ********************************************************** INCLUDES ***** */
48#include <sys/param.h>
49
50#include <limits.h>
51#include <stdio.h>
52#include <ufs/ufs/dinode.h>

--- 87 unchanged lines hidden (view full) ---

140 if(!dbg_log) {
141 return;
142 }
143
144 fprintf(dbg_log, "===== START SUPERBLOCK =====\n");
145 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)sb, comment);
146 indent++;
147
45#endif /* not lint */
46
47/* ********************************************************** INCLUDES ***** */
48#include <sys/param.h>
49
50#include <limits.h>
51#include <stdio.h>
52#include <ufs/ufs/dinode.h>

--- 87 unchanged lines hidden (view full) ---

140 if(!dbg_log) {
141 return;
142 }
143
144 fprintf(dbg_log, "===== START SUPERBLOCK =====\n");
145 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)sb, comment);
146 indent++;
147
148 fprintf(dbg_log, "sblkno ufs_daddr_t 0x%08x\n",
148 fprintf(dbg_log, "sblkno int32_t 0x%08x\n",
149 sb->fs_sblkno);
149 sb->fs_sblkno);
150 fprintf(dbg_log, "cblkno ufs_daddr_t 0x%08x\n",
150 fprintf(dbg_log, "cblkno int32_t 0x%08x\n",
151 sb->fs_cblkno);
151 sb->fs_cblkno);
152 fprintf(dbg_log, "iblkno ufs_daddr_t 0x%08x\n",
152 fprintf(dbg_log, "iblkno int32_t 0x%08x\n",
153 sb->fs_iblkno);
153 sb->fs_iblkno);
154 fprintf(dbg_log, "dblkno ufs_daddr_t 0x%08x\n",
154 fprintf(dbg_log, "dblkno int32_t 0x%08x\n",
155 sb->fs_dblkno);
156
155 sb->fs_dblkno);
156
157 fprintf(dbg_log, "cgoffset int32_t 0x%08x\n",
158 sb->fs_cgoffset);
159 fprintf(dbg_log, "cgmask int32_t 0x%08x\n",
160 sb->fs_cgmask);
161 fprintf(dbg_log, "time time_t %10u\n",
162 (unsigned int)sb->fs_time);
163 fprintf(dbg_log, "size int32_t 0x%08x\n",
164 sb->fs_size);
165 fprintf(dbg_log, "dsize int32_t 0x%08x\n",
166 sb->fs_dsize);
167 fprintf(dbg_log, "ncg int32_t 0x%08x\n",
157 fprintf(dbg_log, "old_cgoffset int32_t 0x%08x\n",
158 sb->fs_old_cgoffset);
159 fprintf(dbg_log, "old_cgmask int32_t 0x%08x\n",
160 sb->fs_old_cgmask);
161 fprintf(dbg_log, "old_time int32_t %10u\n",
162 (unsigned int)sb->fs_old_time);
163 fprintf(dbg_log, "old_size int32_t 0x%08x\n",
164 sb->fs_old_size);
165 fprintf(dbg_log, "old_dsize int32_t 0x%08x\n",
166 sb->fs_old_dsize);
167 fprintf(dbg_log, "ncg int32_t 0x%08x\n",
168 sb->fs_ncg);
168 sb->fs_ncg);
169 fprintf(dbg_log, "bsize int32_t 0x%08x\n",
169 fprintf(dbg_log, "bsize int32_t 0x%08x\n",
170 sb->fs_bsize);
170 sb->fs_bsize);
171 fprintf(dbg_log, "fsize int32_t 0x%08x\n",
171 fprintf(dbg_log, "fsize int32_t 0x%08x\n",
172 sb->fs_fsize);
172 sb->fs_fsize);
173 fprintf(dbg_log, "frag int32_t 0x%08x\n",
173 fprintf(dbg_log, "frag int32_t 0x%08x\n",
174 sb->fs_frag);
175
174 sb->fs_frag);
175
176 fprintf(dbg_log, "minfree int32_t 0x%08x\n",
176 fprintf(dbg_log, "minfree int32_t 0x%08x\n",
177 sb->fs_minfree);
177 sb->fs_minfree);
178 fprintf(dbg_log, "rotdelay int32_t 0x%08x\n",
179 sb->fs_rotdelay);
180 fprintf(dbg_log, "rps int32_t 0x%08x\n",
181 sb->fs_rps);
178 fprintf(dbg_log, "old_rotdelay int32_t 0x%08x\n",
179 sb->fs_old_rotdelay);
180 fprintf(dbg_log, "old_rps int32_t 0x%08x\n",
181 sb->fs_old_rps);
182
182
183 fprintf(dbg_log, "bmask int32_t 0x%08x\n",
183 fprintf(dbg_log, "bmask int32_t 0x%08x\n",
184 sb->fs_bmask);
184 sb->fs_bmask);
185 fprintf(dbg_log, "fmask int32_t 0x%08x\n",
185 fprintf(dbg_log, "fmask int32_t 0x%08x\n",
186 sb->fs_fmask);
186 sb->fs_fmask);
187 fprintf(dbg_log, "bshift int32_t 0x%08x\n",
187 fprintf(dbg_log, "bshift int32_t 0x%08x\n",
188 sb->fs_bshift);
188 sb->fs_bshift);
189 fprintf(dbg_log, "fshift int32_t 0x%08x\n",
189 fprintf(dbg_log, "fshift int32_t 0x%08x\n",
190 sb->fs_fshift);
191
190 sb->fs_fshift);
191
192 fprintf(dbg_log, "maxcontig int32_t 0x%08x\n",
192 fprintf(dbg_log, "maxcontig int32_t 0x%08x\n",
193 sb->fs_maxcontig);
193 sb->fs_maxcontig);
194 fprintf(dbg_log, "maxbpg int32_t 0x%08x\n",
194 fprintf(dbg_log, "maxbpg int32_t 0x%08x\n",
195 sb->fs_maxbpg);
196
195 sb->fs_maxbpg);
196
197 fprintf(dbg_log, "fragshift int32_t 0x%08x\n",
197 fprintf(dbg_log, "fragshift int32_t 0x%08x\n",
198 sb->fs_fragshift);
198 sb->fs_fragshift);
199 fprintf(dbg_log, "fsbtodb int32_t 0x%08x\n",
199 fprintf(dbg_log, "fsbtodb int32_t 0x%08x\n",
200 sb->fs_fsbtodb);
200 sb->fs_fsbtodb);
201 fprintf(dbg_log, "sbsize int32_t 0x%08x\n",
201 fprintf(dbg_log, "sbsize int32_t 0x%08x\n",
202 sb->fs_sbsize);
202 sb->fs_sbsize);
203 fprintf(dbg_log, "csmask int32_t 0x%08x\n",
204 sb->fs_csmask);
205 fprintf(dbg_log, "csshift int32_t 0x%08x\n",
206 sb->fs_csshift);
207 fprintf(dbg_log, "nindir int32_t 0x%08x\n",
203 fprintf(dbg_log, "spare1 int32_t[2] 0x%08x 0x%08x\n",
204 sb->fs_spare1[0], sb->fs_spare1[1]);
205 fprintf(dbg_log, "nindir int32_t 0x%08x\n",
208 sb->fs_nindir);
206 sb->fs_nindir);
209 fprintf(dbg_log, "inopb int32_t 0x%08x\n",
207 fprintf(dbg_log, "inopb int32_t 0x%08x\n",
210 sb->fs_inopb);
208 sb->fs_inopb);
211 fprintf(dbg_log, "nspf int32_t 0x%08x\n",
212 sb->fs_nspf);
209 fprintf(dbg_log, "old_nspf int32_t 0x%08x\n",
210 sb->fs_old_nspf);
213
211
214 fprintf(dbg_log, "optim int32_t 0x%08x\n",
212 fprintf(dbg_log, "optim int32_t 0x%08x\n",
215 sb->fs_optim);
216
213 sb->fs_optim);
214
217 fprintf(dbg_log, "npsect int32_t 0x%08x\n",
218 sb->fs_npsect);
219 fprintf(dbg_log, "interleave int32_t 0x%08x\n",
220 sb->fs_interleave);
221 fprintf(dbg_log, "trackskew int32_t 0x%08x\n",
222 sb->fs_trackskew);
215 fprintf(dbg_log, "old_npsect int32_t 0x%08x\n",
216 sb->fs_old_npsect);
217 fprintf(dbg_log, "old_interleave int32_t 0x%08x\n",
218 sb->fs_old_interleave);
219 fprintf(dbg_log, "old_trackskew int32_t 0x%08x\n",
220 sb->fs_old_trackskew);
223
221
224 fprintf(dbg_log, "id int32_t[2] %08x %08x\n",
222 fprintf(dbg_log, "id int32_t[2] 0x%08x 0x%08x\n",
225 sb->fs_id[0], sb->fs_id[1]);
226
223 sb->fs_id[0], sb->fs_id[1]);
224
227 fprintf(dbg_log, "csaddr ufs_daddr_t 0x%08x\n",
228 sb->fs_csaddr);
229 fprintf(dbg_log, "cssize int32_t 0x%08x\n",
225 fprintf(dbg_log, "old_csaddr int32_t 0x%08x\n",
226 sb->fs_old_csaddr);
227 fprintf(dbg_log, "cssize int32_t 0x%08x\n",
230 sb->fs_cssize);
228 sb->fs_cssize);
231 fprintf(dbg_log, "cgsize int32_t 0x%08x\n",
229 fprintf(dbg_log, "cgsize int32_t 0x%08x\n",
232 sb->fs_cgsize);
233
230 sb->fs_cgsize);
231
234 fprintf(dbg_log, "ntrak int32_t 0x%08x\n",
235 sb->fs_ntrak);
236 fprintf(dbg_log, "nsect int32_t 0x%08x\n",
237 sb->fs_nsect);
238 fprintf(dbg_log, "spc int32_t 0x%08x\n",
239 sb->fs_spc);
232 fprintf(dbg_log, "spare2 int32_t 0x%08x\n",
233 sb->fs_spare2);
234 fprintf(dbg_log, "old_nsect int32_t 0x%08x\n",
235 sb->fs_old_nsect);
236 fprintf(dbg_log, "old_spc int32_t 0x%08x\n",
237 sb->fs_old_spc);
240
238
241 fprintf(dbg_log, "ncyl int32_t 0x%08x\n",
242 sb->fs_ncyl);
239 fprintf(dbg_log, "old_ncyl int32_t 0x%08x\n",
240 sb->fs_old_ncyl);
243
241
244 fprintf(dbg_log, "cpg int32_t 0x%08x\n",
245 sb->fs_cpg);
246 fprintf(dbg_log, "ipg int32_t 0x%08x\n",
242 fprintf(dbg_log, "old_cpg int32_t 0x%08x\n",
243 sb->fs_old_cpg);
244 fprintf(dbg_log, "ipg int32_t 0x%08x\n",
247 sb->fs_ipg);
245 sb->fs_ipg);
248 fprintf(dbg_log, "fpg int32_t 0x%08x\n",
246 fprintf(dbg_log, "fpg int32_t 0x%08x\n",
249 sb->fs_fpg);
250
247 sb->fs_fpg);
248
251 dbg_dump_csum("internal cstotal", &sb->fs_cstotal);
249 dbg_dump_csum("internal old_cstotal", &sb->fs_old_cstotal);
252
250
253 fprintf(dbg_log, "fmod int8_t 0x%02x\n",
251 fprintf(dbg_log, "fmod int8_t 0x%02x\n",
254 sb->fs_fmod);
252 sb->fs_fmod);
255 fprintf(dbg_log, "clean int8_t 0x%02x\n",
253 fprintf(dbg_log, "clean int8_t 0x%02x\n",
256 sb->fs_clean);
254 sb->fs_clean);
257 fprintf(dbg_log, "ronly int8_t 0x%02x\n",
255 fprintf(dbg_log, "ronly int8_t 0x%02x\n",
258 sb->fs_ronly);
256 sb->fs_ronly);
259 fprintf(dbg_log, "flags int8_t 0x%02x\n",
260 sb->fs_flags);
261 fprintf(dbg_log, "fsmnt u_char[MAXMNTLEN] \"%s\"\n",
257 fprintf(dbg_log, "old_flags int8_t 0x%02x\n",
258 sb->fs_old_flags);
259 fprintf(dbg_log, "fsmnt u_char[MAXMNTLEN] \"%s\"\n",
262 sb->fs_fsmnt);
260 sb->fs_fsmnt);
261 fprintf(dbg_log, "volname u_char[MAXVOLLEN] \"%s\"\n",
262 sb->fs_volname);
263 fprintf(dbg_log, "swuid u_int64_t 0x%08x%08x\n",
264 ((unsigned int *)&(sb->fs_swuid))[1],
265 ((unsigned int *)&(sb->fs_swuid))[0]);
263
266
264 fprintf(dbg_log, "cgrotor int32_t 0x%08x\n",
267 fprintf(dbg_log, "pad int32_t 0x%08x\n",
268 sb->fs_pad);
269
270 fprintf(dbg_log, "cgrotor int32_t 0x%08x\n",
265 sb->fs_cgrotor);
266/*
267 * struct csum[MAXCSBUFS] - is only maintained in memory
268 */
269/* fprintf(dbg_log, " int32_t\n", sb->*fs_maxcluster);*/
271 sb->fs_cgrotor);
272/*
273 * struct csum[MAXCSBUFS] - is only maintained in memory
274 */
275/* fprintf(dbg_log, " int32_t\n", sb->*fs_maxcluster);*/
270 fprintf(dbg_log, "cpc int32_t 0x%08x\n",
271 sb->fs_cpc);
276 fprintf(dbg_log, "old_cpc int32_t 0x%08x\n",
277 sb->fs_old_cpc);
272/*
273 * int16_t fs_opostbl[16][8] - is dumped when used in dbg_dump_sptbl
274 */
278/*
279 * int16_t fs_opostbl[16][8] - is dumped when used in dbg_dump_sptbl
280 */
281 fprintf(dbg_log, "maxbsize int32_t 0x%08x\n",
282 sb->fs_maxbsize);
283 fprintf(dbg_log, "sblockloc int64_t 0x%08x%08x\n",
284 ((unsigned int *)&(sb->fs_sblockloc))[1],
285 ((unsigned int *)&(sb->fs_sblockloc))[0]);
286
287 dbg_dump_csum_total("internal cstotal", &sb->fs_cstotal);
288
289 fprintf(dbg_log, "time ufs_time_t %10u\n",
290 (unsigned int)sb->fs_time);
291
292 fprintf(dbg_log, "size int64_t 0x%08x%08x\n",
293 ((unsigned int *)&(sb->fs_size))[1],
294 ((unsigned int *)&(sb->fs_size))[0]);
295 fprintf(dbg_log, "dsize int64_t 0x%08x%08x\n",
296 ((unsigned int *)&(sb->fs_dsize))[1],
297 ((unsigned int *)&(sb->fs_dsize))[0]);
298 fprintf(dbg_log, "csaddr ufs2_daddr_t 0x%08x%08x\n",
299 ((unsigned int *)&(sb->fs_csaddr))[1],
300 ((unsigned int *)&(sb->fs_csaddr))[0]);
301 fprintf(dbg_log, "pendingblocks int64_t 0x%08x%08x\n",
302 ((unsigned int *)&(sb->fs_pendingblocks))[1],
303 ((unsigned int *)&(sb->fs_pendingblocks))[0]);
304 fprintf(dbg_log, "pendinginodes int32_t 0x%08x\n",
305 sb->fs_pendinginodes);
306
275#ifdef FSMAXSNAP
276 for(j=0; j<FSMAXSNAP; j++) {
307#ifdef FSMAXSNAP
308 for(j=0; j<FSMAXSNAP; j++) {
277 fprintf(dbg_log, "snapinum int32_t[%2d] 0x%08x\n",
309 fprintf(dbg_log, "snapinum int32_t[%2d] 0x%08x\n",
278 j, sb->fs_snapinum[j]);
279 if(!sb->fs_snapinum[j]) { /* list is dense */
280 break;
281 }
282 }
283#endif /* FSMAXSNAP */
310 j, sb->fs_snapinum[j]);
311 if(!sb->fs_snapinum[j]) { /* list is dense */
312 break;
313 }
314 }
315#endif /* FSMAXSNAP */
284 fprintf(dbg_log, "contigsumsize int32_t 0x%08x\n",
316 fprintf(dbg_log, "avgfilesize int32_t 0x%08x\n",
317 sb->fs_avgfilesize);
318 fprintf(dbg_log, "avgfpdir int32_t 0x%08x\n",
319 sb->fs_avgfpdir);
320 fprintf(dbg_log, "save_cgsize int32_t 0x%08x\n",
321 sb->fs_save_cgsize);
322 fprintf(dbg_log, "flags int32_t 0x%08x\n",
323 sb->fs_flags);
324 fprintf(dbg_log, "contigsumsize int32_t 0x%08x\n",
285 sb->fs_contigsumsize);
325 sb->fs_contigsumsize);
286 fprintf(dbg_log, "maxsymlinklen int32_t 0x%08x\n",
326 fprintf(dbg_log, "maxsymlinklen int32_t 0x%08x\n",
287 sb->fs_maxsymlinklen);
327 sb->fs_maxsymlinklen);
288 fprintf(dbg_log, "inodefmt int32_t 0x%08x\n",
289 sb->fs_inodefmt);
290 fprintf(dbg_log, "maxfilesize u_int64_t 0x%08x%08x\n",
328 fprintf(dbg_log, "old_inodefmt int32_t 0x%08x\n",
329 sb->fs_old_inodefmt);
330 fprintf(dbg_log, "maxfilesize u_int64_t 0x%08x%08x\n",
291 ((unsigned int *)&(sb->fs_maxfilesize))[1],
292 ((unsigned int *)&(sb->fs_maxfilesize))[0]);
331 ((unsigned int *)&(sb->fs_maxfilesize))[1],
332 ((unsigned int *)&(sb->fs_maxfilesize))[0]);
293 fprintf(dbg_log, "qbmask int64_t 0x%08x%08x\n",
333 fprintf(dbg_log, "qbmask int64_t 0x%08x%08x\n",
294 ((unsigned int *)&(sb->fs_qbmask))[1],
295 ((unsigned int *)&(sb->fs_qbmask))[0]);
334 ((unsigned int *)&(sb->fs_qbmask))[1],
335 ((unsigned int *)&(sb->fs_qbmask))[0]);
296 fprintf(dbg_log, "qfmask int64_t 0x%08x%08x\n",
336 fprintf(dbg_log, "qfmask int64_t 0x%08x%08x\n",
297 ((unsigned int *)&(sb->fs_qfmask))[1],
298 ((unsigned int *)&(sb->fs_qfmask))[0]);
337 ((unsigned int *)&(sb->fs_qfmask))[1],
338 ((unsigned int *)&(sb->fs_qfmask))[0]);
299 fprintf(dbg_log, "state int32_t 0x%08x\n",
339 fprintf(dbg_log, "state int32_t 0x%08x\n",
300 sb->fs_state);
340 sb->fs_state);
301 fprintf(dbg_log, "postblformat int32_t 0x%08x\n",
302 sb->fs_postblformat);
303 fprintf(dbg_log, "nrpos int32_t 0x%08x\n",
304 sb->fs_nrpos);
305 fprintf(dbg_log, "postbloff int32_t 0x%08x\n",
306 sb->fs_postbloff);
307 fprintf(dbg_log, "rotbloff int32_t 0x%08x\n",
308 sb->fs_rotbloff);
309 fprintf(dbg_log, "magic int32_t 0x%08x\n",
341 fprintf(dbg_log, "old_postblformat int32_t 0x%08x\n",
342 sb->fs_old_postblformat);
343 fprintf(dbg_log, "old_nrpos int32_t 0x%08x\n",
344 sb->fs_old_nrpos);
345 fprintf(dbg_log, "spare5 int32_t[2] 0x%08x 0x%08x\n",
346 sb->fs_spare5[0], sb->fs_spare5[1]);
347 fprintf(dbg_log, "magic int32_t 0x%08x\n",
310 sb->fs_magic);
311
312 indent--;
313 fprintf(dbg_log, "===== END SUPERBLOCK =====\n");
314
315 return;
316}
317

--- 10 unchanged lines hidden (view full) ---

328 return;
329 }
330
331 fprintf(dbg_log, "===== START CYLINDER GROUP =====\n");
332 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
333 indent++;
334
335 fprintf(dbg_log, "magic int32_t 0x%08x\n", cgr->cg_magic);
348 sb->fs_magic);
349
350 indent--;
351 fprintf(dbg_log, "===== END SUPERBLOCK =====\n");
352
353 return;
354}
355

--- 10 unchanged lines hidden (view full) ---

366 return;
367 }
368
369 fprintf(dbg_log, "===== START CYLINDER GROUP =====\n");
370 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
371 indent++;
372
373 fprintf(dbg_log, "magic int32_t 0x%08x\n", cgr->cg_magic);
336 fprintf(dbg_log, "time time_t %10u\n", (unsigned int)
337 cgr->cg_time);
374 fprintf(dbg_log, "old_time int32_t 0x%08x\n", cgr->cg_old_time);
338 fprintf(dbg_log, "cgx int32_t 0x%08x\n", cgr->cg_cgx);
375 fprintf(dbg_log, "cgx int32_t 0x%08x\n", cgr->cg_cgx);
339 fprintf(dbg_log, "ncyl int16_t 0x%04x\n", cgr->cg_ncyl);
340 fprintf(dbg_log, "niblk int16_t 0x%04x\n", cgr->cg_niblk);
376 fprintf(dbg_log, "old_ncyl int16_t 0x%04x\n", cgr->cg_old_ncyl);
377 fprintf(dbg_log, "old_niblk int16_t 0x%04x\n", cgr->cg_old_niblk);
341 fprintf(dbg_log, "ndblk int32_t 0x%08x\n", cgr->cg_ndblk);
342 dbg_dump_csum("internal cs", &cgr->cg_cs);
343 fprintf(dbg_log, "rotor int32_t 0x%08x\n", cgr->cg_rotor);
344 fprintf(dbg_log, "frotor int32_t 0x%08x\n", cgr->cg_frotor);
345 fprintf(dbg_log, "irotor int32_t 0x%08x\n", cgr->cg_irotor);
346 for(j=0; j<MAXFRAG; j++) {
347 fprintf(dbg_log, "frsum int32_t[%d] 0x%08x\n", j,
348 cgr->cg_frsum[j]);
349 }
378 fprintf(dbg_log, "ndblk int32_t 0x%08x\n", cgr->cg_ndblk);
379 dbg_dump_csum("internal cs", &cgr->cg_cs);
380 fprintf(dbg_log, "rotor int32_t 0x%08x\n", cgr->cg_rotor);
381 fprintf(dbg_log, "frotor int32_t 0x%08x\n", cgr->cg_frotor);
382 fprintf(dbg_log, "irotor int32_t 0x%08x\n", cgr->cg_irotor);
383 for(j=0; j<MAXFRAG; j++) {
384 fprintf(dbg_log, "frsum int32_t[%d] 0x%08x\n", j,
385 cgr->cg_frsum[j]);
386 }
350 fprintf(dbg_log, "btotoff int32_t 0x%08x\n", cgr->cg_btotoff);
351 fprintf(dbg_log, "boff int32_t 0x%08x\n", cgr->cg_boff);
387 fprintf(dbg_log, "old_btotoff int32_t 0x%08x\n", cgr->cg_old_btotoff);
388 fprintf(dbg_log, "old_boff int32_t 0x%08x\n", cgr->cg_old_boff);
352 fprintf(dbg_log, "iusedoff int32_t 0x%08x\n", cgr->cg_iusedoff);
353 fprintf(dbg_log, "freeoff int32_t 0x%08x\n", cgr->cg_freeoff);
354 fprintf(dbg_log, "nextfreeoff int32_t 0x%08x\n",
355 cgr->cg_nextfreeoff);
356 fprintf(dbg_log, "clustersumoff int32_t 0x%08x\n",
357 cgr->cg_clustersumoff);
389 fprintf(dbg_log, "iusedoff int32_t 0x%08x\n", cgr->cg_iusedoff);
390 fprintf(dbg_log, "freeoff int32_t 0x%08x\n", cgr->cg_freeoff);
391 fprintf(dbg_log, "nextfreeoff int32_t 0x%08x\n",
392 cgr->cg_nextfreeoff);
393 fprintf(dbg_log, "clustersumoff int32_t 0x%08x\n",
394 cgr->cg_clustersumoff);
358 fprintf(dbg_log, "clusterof int32_t 0x%08x\n",
395 fprintf(dbg_log, "clusteroff int32_t 0x%08x\n",
359 cgr->cg_clusteroff);
360 fprintf(dbg_log, "nclusterblks int32_t 0x%08x\n",
361 cgr->cg_nclusterblks);
396 cgr->cg_clusteroff);
397 fprintf(dbg_log, "nclusterblks int32_t 0x%08x\n",
398 cgr->cg_nclusterblks);
399 fprintf(dbg_log, "niblk int32_t 0x%08x\n", cgr->cg_niblk);
400 fprintf(dbg_log, "initediblk int32_t 0x%08x\n", cgr->cg_initediblk);
401 fprintf(dbg_log, "time ufs_time_t %10u\n",
402 (unsigned int)cgr->cg_initediblk);
362
363 indent--;
364 fprintf(dbg_log, "===== END CYLINDER GROUP =====\n");
365
366 return;
367}
368
369/* ***************************************************** dbg_dump_csum ***** */

--- 18 unchanged lines hidden (view full) ---

388 fprintf(dbg_log, "nffree int32_t 0x%08x\n", cs->cs_nffree);
389
390 indent--;
391 fprintf(dbg_log, "===== END CYLINDER SUMMARY =====\n");
392
393 return;
394}
395
403
404 indent--;
405 fprintf(dbg_log, "===== END CYLINDER GROUP =====\n");
406
407 return;
408}
409
410/* ***************************************************** dbg_dump_csum ***** */

--- 18 unchanged lines hidden (view full) ---

429 fprintf(dbg_log, "nffree int32_t 0x%08x\n", cs->cs_nffree);
430
431 indent--;
432 fprintf(dbg_log, "===== END CYLINDER SUMMARY =====\n");
433
434 return;
435}
436
437/* ************************************************ dbg_dump_csum_total ***** */
438/*
439 * Dump a cylinder summary.
440 */
441void
442dbg_dump_csum_total(const char *comment, struct csum_total *cs)
443{
444
445 if(!dbg_log) {
446 return;
447 }
448
449 fprintf(dbg_log, "===== START CYLINDER SUMMARY TOTAL =====\n");
450 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment);
451 indent++;
452
453 fprintf(dbg_log, "ndir int64_t 0x%08x%08x\n",
454 ((unsigned int *)&(cs->cs_ndir))[1],
455 ((unsigned int *)&(cs->cs_ndir))[0]);
456 fprintf(dbg_log, "nbfree int64_t 0x%08x%08x\n",
457 ((unsigned int *)&(cs->cs_nbfree))[1],
458 ((unsigned int *)&(cs->cs_nbfree))[0]);
459 fprintf(dbg_log, "nifree int64_t 0x%08x%08x\n",
460 ((unsigned int *)&(cs->cs_nifree))[1],
461 ((unsigned int *)&(cs->cs_nifree))[0]);
462 fprintf(dbg_log, "nffree int64_t 0x%08x%08x\n",
463 ((unsigned int *)&(cs->cs_nffree))[1],
464 ((unsigned int *)&(cs->cs_nffree))[0]);
465 fprintf(dbg_log, "numclusters int64_t 0x%08x%08x\n",
466 ((unsigned int *)&(cs->cs_numclusters))[1],
467 ((unsigned int *)&(cs->cs_numclusters))[0]);
468
469 indent--;
470 fprintf(dbg_log, "===== END CYLINDER SUMMARY TOTAL =====\n");
471
472 return;
473}
396/* **************************************************** dbg_dump_inmap ***** */
397/*
398 * Dump the inode allocation map in one cylinder group.
399 */
400void
401dbg_dump_inmap(struct fs *sb, const char *comment, struct cg *cgr)
402{
403 int j,k,l,e;

--- 48 unchanged lines hidden (view full) ---

452 return;
453 }
454
455 fprintf(dbg_log, "===== START FRAGMENT ALLOCATION MAP =====\n");
456 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
457 indent++;
458
459 cp=(unsigned char *)cg_blksfree(cgr);
474/* **************************************************** dbg_dump_inmap ***** */
475/*
476 * Dump the inode allocation map in one cylinder group.
477 */
478void
479dbg_dump_inmap(struct fs *sb, const char *comment, struct cg *cgr)
480{
481 int j,k,l,e;

--- 48 unchanged lines hidden (view full) ---

530 return;
531 }
532
533 fprintf(dbg_log, "===== START FRAGMENT ALLOCATION MAP =====\n");
534 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
535 indent++;
536
537 cp=(unsigned char *)cg_blksfree(cgr);
460 e=howmany((sb->fs_cpg * sb->fs_spc / NSPF(sb)), CHAR_BIT);
538 if (sb->fs_old_nspf)
539 e=howmany((sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf), CHAR_BIT);
540 else
541 e = 0;
461 for(j=0; j<e; j+=32) {
462 fprintf(dbg_log, "%08x: ", j);
463 for(k=0; k<32; k+=8) {
464 if(j+k+8<e) {
465 fprintf(dbg_log,
466 "%02x%02x%02x%02x%02x%02x%02x%02x ",
467 cp[0], cp[1], cp[2], cp[3],
468 cp[4], cp[5], cp[6], cp[7]);

--- 27 unchanged lines hidden (view full) ---

496 return;
497 }
498
499 fprintf(dbg_log, "===== START CLUSTER ALLOCATION MAP =====\n");
500 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
501 indent++;
502
503 cp=(unsigned char *)cg_clustersfree(cgr);
542 for(j=0; j<e; j+=32) {
543 fprintf(dbg_log, "%08x: ", j);
544 for(k=0; k<32; k+=8) {
545 if(j+k+8<e) {
546 fprintf(dbg_log,
547 "%02x%02x%02x%02x%02x%02x%02x%02x ",
548 cp[0], cp[1], cp[2], cp[3],
549 cp[4], cp[5], cp[6], cp[7]);

--- 27 unchanged lines hidden (view full) ---

577 return;
578 }
579
580 fprintf(dbg_log, "===== START CLUSTER ALLOCATION MAP =====\n");
581 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
582 indent++;
583
584 cp=(unsigned char *)cg_clustersfree(cgr);
504 e=howmany(sb->fs_cpg * sb->fs_spc / NSPB(sb), CHAR_BIT);
585 if (sb->fs_old_nspf)
586 e=howmany(sb->fs_old_cpg * sb->fs_old_spc / (sb->fs_old_nspf << sb->fs_fragshift), CHAR_BIT);
587 else
588 e = 0;
505 for(j=0; j<e; j+=32) {
506 fprintf(dbg_log, "%08x: ", j);
507 for(k=0; k<32; k+=8) {
508 if(j+k+8<e) {
509 fprintf(dbg_log,
510 "%02x%02x%02x%02x%02x%02x%02x%02x ",
511 cp[0], cp[1], cp[2], cp[3],
512 cp[4], cp[5], cp[6], cp[7]);

--- 37 unchanged lines hidden (view full) ---

550 }
551
552 indent--;
553 fprintf(dbg_log, "===== END CLUSTER SUMMARY =====\n");
554
555 return;
556}
557
589 for(j=0; j<e; j+=32) {
590 fprintf(dbg_log, "%08x: ", j);
591 for(k=0; k<32; k+=8) {
592 if(j+k+8<e) {
593 fprintf(dbg_log,
594 "%02x%02x%02x%02x%02x%02x%02x%02x ",
595 cp[0], cp[1], cp[2], cp[3],
596 cp[4], cp[5], cp[6], cp[7]);

--- 37 unchanged lines hidden (view full) ---

634 }
635
636 indent--;
637 fprintf(dbg_log, "===== END CLUSTER SUMMARY =====\n");
638
639 return;
640}
641
642#ifdef NOT_CURRENTLY
643/*
644 * This code dates from before the UFS2 integration, and doesn't compile
645 * post-UFS2 due to the use of cg_blks(). I'm not sure how best to update
646 * this for UFS2, where the rotational bits of UFS no longer apply, so
647 * will leave it disabled for now; it should probably be re-enabled
648 * specifically for UFS1.
649 */
558/* **************************************************** dbg_dump_sptbl ***** */
559/*
560 * Dump the block summary, and the rotational layout table.
561 */
562void
563dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
564{
565 int j,k;

--- 4 unchanged lines hidden (view full) ---

570 }
571
572 fprintf(dbg_log,
573 "===== START BLOCK SUMMARY AND POSITION TABLE =====\n");
574 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
575 indent++;
576
577 ip=(int *)cg_blktot(cgr);
650/* **************************************************** dbg_dump_sptbl ***** */
651/*
652 * Dump the block summary, and the rotational layout table.
653 */
654void
655dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
656{
657 int j,k;

--- 4 unchanged lines hidden (view full) ---

662 }
663
664 fprintf(dbg_log,
665 "===== START BLOCK SUMMARY AND POSITION TABLE =====\n");
666 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
667 indent++;
668
669 ip=(int *)cg_blktot(cgr);
578 for(j=0; jfs_cpg; j++) {
670 for(j=0; j<sb->fs_old_cpg; j++) {
579 fprintf(dbg_log, "%2d: %5d = ", j, *ip++);
671 fprintf(dbg_log, "%2d: %5d = ", j, *ip++);
580 for(k=0; kfs_nrpos; k++) {
672 for(k=0; k<sb->fs_old_nrpos; k++) {
581 fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]);
673 fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]);
582 if(kfs_nrpos-1) {
674 if(k<sb->fs_old_nrpos-1) {
583 fprintf(dbg_log, " + ");
584 }
585 }
586 fprintf(dbg_log, "\n");
587 }
588
589 indent--;
590 fprintf(dbg_log, "===== END BLOCK SUMMARY AND POSITION TABLE =====\n");
591
592 return;
593}
675 fprintf(dbg_log, " + ");
676 }
677 }
678 fprintf(dbg_log, "\n");
679 }
680
681 indent--;
682 fprintf(dbg_log, "===== END BLOCK SUMMARY AND POSITION TABLE =====\n");
683
684 return;
685}
686#endif
594
687
595/* ****************************************************** dbg_dump_ino ***** */
688/* ************************************************** dbg_dump_ufs1_ino ***** */
596/*
689/*
597 * Dump an inode structure.
690 * Dump a UFS1 inode structure.
598 */
599void
691 */
692void
600dbg_dump_ino(struct fs *sb, const char *comment, struct dinode *ino)
693dbg_dump_ufs1_ino(struct fs *sb, const char *comment, struct ufs1_dinode *ino)
601{
602 int ictr;
603 int remaining_blocks;
604
605 if(!dbg_log) {
606 return;
607 }
608
694{
695 int ictr;
696 int remaining_blocks;
697
698 if(!dbg_log) {
699 return;
700 }
701
609 fprintf(dbg_log, "===== START INODE DUMP =====\n");
702 fprintf(dbg_log, "===== START UFS1 INODE DUMP =====\n");
610 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment);
611 indent++;
612
613 fprintf(dbg_log, "mode u_int16_t 0%o\n", ino->di_mode);
614 fprintf(dbg_log, "nlink int16_t 0x%04x\n", ino->di_nlink);
615 fprintf(dbg_log, "size u_int64_t 0x%08x%08x\n",
616 ((unsigned int *)&(ino->di_size))[1],
617 ((unsigned int *)&(ino->di_size))[0]);

--- 13 unchanged lines hidden (view full) ---

631 fprintf(dbg_log, "db ufs_daddr_t[%x] 0x%08x\n", ictr,
632 ino->di_db[ictr]);
633 }
634 remaining_blocks-=NDADDR;
635 if(remaining_blocks>0) {
636 fprintf(dbg_log, "ib ufs_daddr_t[0] 0x%08x\n",
637 ino->di_ib[0]);
638 }
703 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment);
704 indent++;
705
706 fprintf(dbg_log, "mode u_int16_t 0%o\n", ino->di_mode);
707 fprintf(dbg_log, "nlink int16_t 0x%04x\n", ino->di_nlink);
708 fprintf(dbg_log, "size u_int64_t 0x%08x%08x\n",
709 ((unsigned int *)&(ino->di_size))[1],
710 ((unsigned int *)&(ino->di_size))[0]);

--- 13 unchanged lines hidden (view full) ---

724 fprintf(dbg_log, "db ufs_daddr_t[%x] 0x%08x\n", ictr,
725 ino->di_db[ictr]);
726 }
727 remaining_blocks-=NDADDR;
728 if(remaining_blocks>0) {
729 fprintf(dbg_log, "ib ufs_daddr_t[0] 0x%08x\n",
730 ino->di_ib[0]);
731 }
639 remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs_daddr_t));
732 remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs1_daddr_t));
640 if(remaining_blocks>0) {
641 fprintf(dbg_log, "ib ufs_daddr_t[1] 0x%08x\n",
642 ino->di_ib[1]);
643 }
644#define SQUARE(a) ((a)*(a))
733 if(remaining_blocks>0) {
734 fprintf(dbg_log, "ib ufs_daddr_t[1] 0x%08x\n",
735 ino->di_ib[1]);
736 }
737#define SQUARE(a) ((a)*(a))
645 remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs_daddr_t)));
738 remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs1_daddr_t)));
646#undef SQUARE
647 if(remaining_blocks>0) {
648 fprintf(dbg_log, "ib ufs_daddr_t[2] 0x%08x\n",
649 ino->di_ib[2]);
650 }
651
652 fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags);
653 fprintf(dbg_log, "blocks int32_t 0x%08x\n", ino->di_blocks);
654 fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen);
655 fprintf(dbg_log, "uid u_int32_t 0x%08x\n", ino->di_uid);
656 fprintf(dbg_log, "gid u_int32_t 0x%08x\n", ino->di_gid);
657
658 indent--;
739#undef SQUARE
740 if(remaining_blocks>0) {
741 fprintf(dbg_log, "ib ufs_daddr_t[2] 0x%08x\n",
742 ino->di_ib[2]);
743 }
744
745 fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags);
746 fprintf(dbg_log, "blocks int32_t 0x%08x\n", ino->di_blocks);
747 fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen);
748 fprintf(dbg_log, "uid u_int32_t 0x%08x\n", ino->di_uid);
749 fprintf(dbg_log, "gid u_int32_t 0x%08x\n", ino->di_gid);
750
751 indent--;
659 fprintf(dbg_log, "===== END INODE DUMP =====\n");
752 fprintf(dbg_log, "===== END UFS1 INODE DUMP =====\n");
660
661 return;
662}
663
753
754 return;
755}
756
757/* ************************************************** dbg_dump_ufs2_ino ***** */
758/*
759 * Dump a UFS2 inode structure.
760 */
761void
762dbg_dump_ufs2_ino(struct fs *sb, const char *comment, struct ufs2_dinode *ino)
763{
764 int ictr;
765 int remaining_blocks;
766
767 if(!dbg_log) {
768 return;
769 }
770
771 fprintf(dbg_log, "===== START UFS2 INODE DUMP =====\n");
772 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment);
773 indent++;
774
775 fprintf(dbg_log, "mode u_int16_t 0%o\n", ino->di_mode);
776 fprintf(dbg_log, "nlink int16_t 0x%04x\n", ino->di_nlink);
777 fprintf(dbg_log, "uid u_int32_t 0x%08x\n", ino->di_uid);
778 fprintf(dbg_log, "gid u_int32_t 0x%08x\n", ino->di_gid);
779 fprintf(dbg_log, "blksize u_int32_t 0x%08x\n", ino->di_blksize);
780 fprintf(dbg_log, "size u_int64_t 0x%08x%08x\n",
781 ((unsigned int *)&(ino->di_size))[1],
782 ((unsigned int *)&(ino->di_size))[0]);
783 fprintf(dbg_log, "blocks u_int64_t 0x%08x%08x\n",
784 ((unsigned int *)&(ino->di_blocks))[1],
785 ((unsigned int *)&(ino->di_blocks))[0]);
786 fprintf(dbg_log, "atime ufs_time_t %10u\n", ino->di_atime);
787 fprintf(dbg_log, "mtime ufs_time_t %10u\n", ino->di_mtime);
788 fprintf(dbg_log, "ctime ufs_time_t %10u\n", ino->di_ctime);
789 fprintf(dbg_log, "birthtime ufs_time_t %10u\n", ino->di_birthtime);
790 fprintf(dbg_log, "mtimensec int32_t 0x%08x\n", ino->di_mtimensec);
791 fprintf(dbg_log, "atimensec int32_t 0x%08x\n", ino->di_atimensec);
792 fprintf(dbg_log, "ctimensec int32_t 0x%08x\n", ino->di_ctimensec);
793 fprintf(dbg_log, "birthnsec int32_t 0x%08x\n", ino->di_birthnsec);
794 fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen);
795 fprintf(dbg_log, "kernflags u_int32_t 0x%08x\n", ino->di_kernflags);
796 fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags);
797 fprintf(dbg_log, "extsize int32_t 0x%08x\n", ino->di_extsize);
798
799 /* XXX: What do we do with di_extb[NXADDR]? */
800
801 remaining_blocks=howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */
802 for(ictr=0; ictr < MIN(NDADDR, remaining_blocks); ictr++) {
803 fprintf(dbg_log, "db ufs2_daddr_t[%x] 0x%16x\n", ictr,
804 ino->di_db[ictr]);
805 }
806 remaining_blocks-=NDADDR;
807 if(remaining_blocks>0) {
808 fprintf(dbg_log, "ib ufs2_daddr_t[0] 0x%16x\n",
809 ino->di_ib[0]);
810 }
811 remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs2_daddr_t));
812 if(remaining_blocks>0) {
813 fprintf(dbg_log, "ib ufs2_daddr_t[1] 0x%16x\n",
814 ino->di_ib[1]);
815 }
816#define SQUARE(a) ((a)*(a))
817 remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs2_daddr_t)));
818#undef SQUARE
819 if(remaining_blocks>0) {
820 fprintf(dbg_log, "ib ufs2_daddr_t[2] 0x%16x\n",
821 ino->di_ib[2]);
822 }
823
824 indent--;
825 fprintf(dbg_log, "===== END UFS2 INODE DUMP =====\n");
826
827 return;
828}
829
664/* ***************************************************** dbg_dump_iblk ***** */
665/*
666 * Dump an indirect block. The iteration to dump a full file has to be
667 * written around.
668 */
669void
670dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
671{
672 unsigned int *mem;
830/* ***************************************************** dbg_dump_iblk ***** */
831/*
832 * Dump an indirect block. The iteration to dump a full file has to be
833 * written around.
834 */
835void
836dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
837{
838 unsigned int *mem;
673 int i, j;
839 int i, j, size;
674
675 if(!dbg_log) {
676 return;
677 }
678
679 fprintf(dbg_log, "===== START INDIRECT BLOCK DUMP =====\n");
680 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)block,
681 comment);
682 indent++;
683
840
841 if(!dbg_log) {
842 return;
843 }
844
845 fprintf(dbg_log, "===== START INDIRECT BLOCK DUMP =====\n");
846 fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)block,
847 comment);
848 indent++;
849
850 if (sb->fs_magic == FS_UFS1_MAGIC)
851 size = sizeof(ufs1_daddr_t);
852 else
853 size = sizeof(ufs2_daddr_t);
854
684 mem=(unsigned int *)block;
855 mem=(unsigned int *)block;
685 for (i=0; (size_t)i<MIN(howmany(sb->fs_bsize, sizeof(ufs_daddr_t)),
856 for (i=0; (size_t)ifs_bsize, size),
686 length); i+=8) {
687 fprintf(dbg_log, "%04x: ", i);
688 for (j=0; j<8; j++) {
689 if((size_t)(i+j)<length) {
690 fprintf(dbg_log, "%08X ", *mem++);
691 }
692 }
693 fprintf(dbg_log, "\n");
694 }
695
696 indent--;
697 fprintf(dbg_log, "===== END INDIRECT BLOCK DUMP =====\n");
698
699 return;
700}
701
702#endif /* FS_DEBUG */
703
857 length); i+=8) {
858 fprintf(dbg_log, "%04x: ", i);
859 for (j=0; j<8; j++) {
860 if((size_t)(i+j)<length) {
861 fprintf(dbg_log, "%08X ", *mem++);
862 }
863 }
864 fprintf(dbg_log, "\n");
865 }
866
867 indent--;
868 fprintf(dbg_log, "===== END INDIRECT BLOCK DUMP =====\n");
869
870 return;
871}
872
873#endif /* FS_DEBUG */
874