1 /* $NetBSD: lfs_debug.c,v 1.7 1996/11/15 23:11:56 cgd 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 printf("%s%x\t%s%x\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 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 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 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 printf("%s%x\t%s%d\t%s%x\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 printf("%s%x\t%s%d\t%s%x\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 printf("%s%d\t%s%d\t%s%x\t%s%qx\n", 92 "sushift ", lfsp->lfs_sushift, 93 "fsbtodb ", lfsp->lfs_fsbtodb, 94 "cksum ", lfsp->lfs_cksum, 95 "maxfilesize ", (long long)lfsp->lfs_maxfilesize); 96 97 printf("Superblock disk addresses:"); 98 for (i = 0; i < LFS_MAXNUMSB; i++) 99 printf(" %x", lfsp->lfs_sboffs[i]); 100 printf("\n"); 101 102 printf("Checkpoint Info\n"); 103 printf("%s%d\t%s%x\t%s%d\n", 104 "free ", lfsp->lfs_free, 105 "idaddr ", lfsp->lfs_idaddr, 106 "ifile ", lfsp->lfs_ifile); 107 printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\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 printf("tstamp %x\n", lfsp->lfs_tstamp); 115 } 116 117 void 118 lfs_dump_dinode(dip) 119 struct dinode *dip; 120 { 121 int i; 122 123 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 ", (long long)dip->di_size); 129 printf("inum %d\n", dip->di_inumber); 130 printf("Direct Addresses\n"); 131 for (i = 0; i < NDADDR; i++) { 132 printf("\t%x", dip->di_db[i]); 133 if ((i % 6) == 5) 134 printf("\n"); 135 } 136 for (i = 0; i < NIADDR; i++) 137 printf("\t%x", dip->di_ib[i]); 138 printf("\n"); 139 } 140 #endif /* DEBUG */ 141