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