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