lfs_debug.c revision 1.1 1 1.1 mycroft /*
2 1.1 mycroft * Copyright (c) 1991, 1993
3 1.1 mycroft * The Regents of the University of California. All rights reserved.
4 1.1 mycroft *
5 1.1 mycroft * Redistribution and use in source and binary forms, with or without
6 1.1 mycroft * modification, are permitted provided that the following conditions
7 1.1 mycroft * are met:
8 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
9 1.1 mycroft * notice, this list of conditions and the following disclaimer.
10 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
11 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
12 1.1 mycroft * documentation and/or other materials provided with the distribution.
13 1.1 mycroft * 3. All advertising materials mentioning features or use of this software
14 1.1 mycroft * must display the following acknowledgement:
15 1.1 mycroft * This product includes software developed by the University of
16 1.1 mycroft * California, Berkeley and its contributors.
17 1.1 mycroft * 4. Neither the name of the University nor the names of its contributors
18 1.1 mycroft * may be used to endorse or promote products derived from this software
19 1.1 mycroft * without specific prior written permission.
20 1.1 mycroft *
21 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.1 mycroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.1 mycroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.1 mycroft * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.1 mycroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.1 mycroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.1 mycroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.1 mycroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.1 mycroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.1 mycroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.1 mycroft * SUCH DAMAGE.
32 1.1 mycroft *
33 1.1 mycroft * from: @(#)lfs_debug.c 8.1 (Berkeley) 6/11/93
34 1.1 mycroft * $Id: lfs_debug.c,v 1.1 1994/06/08 11:42:32 mycroft Exp $
35 1.1 mycroft */
36 1.1 mycroft
37 1.1 mycroft #ifdef DEBUG
38 1.1 mycroft #include <sys/param.h>
39 1.1 mycroft #include <sys/namei.h>
40 1.1 mycroft #include <sys/vnode.h>
41 1.1 mycroft #include <sys/mount.h>
42 1.1 mycroft
43 1.1 mycroft #include <ufs/ufs/quota.h>
44 1.1 mycroft #include <ufs/ufs/inode.h>
45 1.1 mycroft #include <ufs/lfs/lfs.h>
46 1.1 mycroft #include <ufs/lfs/lfs_extern.h>
47 1.1 mycroft
48 1.1 mycroft void
49 1.1 mycroft lfs_dump_super(lfsp)
50 1.1 mycroft struct lfs *lfsp;
51 1.1 mycroft {
52 1.1 mycroft int i;
53 1.1 mycroft
54 1.1 mycroft (void)printf("%s%lx\t%s%lx\t%s%d\t%s%d\n",
55 1.1 mycroft "magic ", lfsp->lfs_magic,
56 1.1 mycroft "version ", lfsp->lfs_version,
57 1.1 mycroft "size ", lfsp->lfs_size,
58 1.1 mycroft "ssize ", lfsp->lfs_ssize);
59 1.1 mycroft (void)printf("%s%d\t%s%d\t%s%d\t%s%d\n",
60 1.1 mycroft "dsize ", lfsp->lfs_dsize,
61 1.1 mycroft "bsize ", lfsp->lfs_bsize,
62 1.1 mycroft "fsize ", lfsp->lfs_fsize,
63 1.1 mycroft "frag ", lfsp->lfs_frag);
64 1.1 mycroft
65 1.1 mycroft (void)printf("%s%d\t%s%d\t%s%d\t%s%d\n",
66 1.1 mycroft "minfree ", lfsp->lfs_minfree,
67 1.1 mycroft "inopb ", lfsp->lfs_inopb,
68 1.1 mycroft "ifpb ", lfsp->lfs_ifpb,
69 1.1 mycroft "nindir ", lfsp->lfs_nindir);
70 1.1 mycroft
71 1.1 mycroft (void)printf("%s%d\t%s%d\t%s%d\t%s%d\n",
72 1.1 mycroft "nseg ", lfsp->lfs_nseg,
73 1.1 mycroft "nspf ", lfsp->lfs_nspf,
74 1.1 mycroft "cleansz ", lfsp->lfs_cleansz,
75 1.1 mycroft "segtabsz ", lfsp->lfs_segtabsz);
76 1.1 mycroft
77 1.1 mycroft (void)printf("%s%lx\t%s%d\t%s%lx\t%s%d\n",
78 1.1 mycroft "segmask ", lfsp->lfs_segmask,
79 1.1 mycroft "segshift ", lfsp->lfs_segshift,
80 1.1 mycroft "bmask ", lfsp->lfs_bmask,
81 1.1 mycroft "bshift ", lfsp->lfs_bshift);
82 1.1 mycroft
83 1.1 mycroft (void)printf("%s%lx\t%s%d\t%s%lx\t%s%d\n",
84 1.1 mycroft "ffmask ", lfsp->lfs_ffmask,
85 1.1 mycroft "ffshift ", lfsp->lfs_ffshift,
86 1.1 mycroft "fbmask ", lfsp->lfs_fbmask,
87 1.1 mycroft "fbshift ", lfsp->lfs_fbshift);
88 1.1 mycroft
89 1.1 mycroft (void)printf("%s%d\t%s%d\t%s%lx\t%s%qx\n",
90 1.1 mycroft "sushift ", lfsp->lfs_sushift,
91 1.1 mycroft "fsbtodb ", lfsp->lfs_fsbtodb,
92 1.1 mycroft "cksum ", lfsp->lfs_cksum,
93 1.1 mycroft "maxfilesize ", lfsp->lfs_maxfilesize);
94 1.1 mycroft
95 1.1 mycroft (void)printf("Superblock disk addresses:");
96 1.1 mycroft for (i = 0; i < LFS_MAXNUMSB; i++)
97 1.1 mycroft (void)printf(" %lx", lfsp->lfs_sboffs[i]);
98 1.1 mycroft (void)printf("\n");
99 1.1 mycroft
100 1.1 mycroft (void)printf("Checkpoint Info\n");
101 1.1 mycroft (void)printf("%s%d\t%s%lx\t%s%d\n",
102 1.1 mycroft "free ", lfsp->lfs_free,
103 1.1 mycroft "idaddr ", lfsp->lfs_idaddr,
104 1.1 mycroft "ifile ", lfsp->lfs_ifile);
105 1.1 mycroft (void)printf("%s%lx\t%s%d\t%s%lx\t%s%lx\t%s%lx\t%s%lx\n",
106 1.1 mycroft "bfree ", lfsp->lfs_bfree,
107 1.1 mycroft "nfiles ", lfsp->lfs_nfiles,
108 1.1 mycroft "lastseg ", lfsp->lfs_lastseg,
109 1.1 mycroft "nextseg ", lfsp->lfs_nextseg,
110 1.1 mycroft "curseg ", lfsp->lfs_curseg,
111 1.1 mycroft "offset ", lfsp->lfs_offset);
112 1.1 mycroft (void)printf("tstamp %lx\n", lfsp->lfs_tstamp);
113 1.1 mycroft }
114 1.1 mycroft
115 1.1 mycroft void
116 1.1 mycroft lfs_dump_dinode(dip)
117 1.1 mycroft struct dinode *dip;
118 1.1 mycroft {
119 1.1 mycroft int i;
120 1.1 mycroft
121 1.1 mycroft (void)printf("%s%u\t%s%d\t%s%u\t%s%u\t%s%lu\n",
122 1.1 mycroft "mode ", dip->di_mode,
123 1.1 mycroft "nlink ", dip->di_nlink,
124 1.1 mycroft "uid ", dip->di_uid,
125 1.1 mycroft "gid ", dip->di_gid,
126 1.1 mycroft "size ", dip->di_size);
127 1.1 mycroft (void)printf("inum %ld\n", dip->di_inumber);
128 1.1 mycroft (void)printf("Direct Addresses\n");
129 1.1 mycroft for (i = 0; i < NDADDR; i++) {
130 1.1 mycroft (void)printf("\t%lx", dip->di_db[i]);
131 1.1 mycroft if ((i % 6) == 5)
132 1.1 mycroft (void)printf("\n");
133 1.1 mycroft }
134 1.1 mycroft for (i = 0; i < NIADDR; i++)
135 1.1 mycroft (void)printf("\t%lx", dip->di_ib[i]);
136 1.1 mycroft (void)printf("\n");
137 1.1 mycroft }
138 1.1 mycroft #endif /* DEBUG */
139