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