Home | History | Annotate | Line # | Download | only in lfs
lfs_debug.c revision 1.2
      1  1.2      cgd /*	$NetBSD: lfs_debug.c,v 1.2 1994/06/29 06:46:54 cgd 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.1  mycroft #include <sys/namei.h>
     41  1.1  mycroft #include <sys/vnode.h>
     42  1.1  mycroft #include <sys/mount.h>
     43  1.1  mycroft 
     44  1.1  mycroft #include <ufs/ufs/quota.h>
     45  1.1  mycroft #include <ufs/ufs/inode.h>
     46  1.1  mycroft #include <ufs/lfs/lfs.h>
     47  1.1  mycroft #include <ufs/lfs/lfs_extern.h>
     48  1.1  mycroft 
     49  1.1  mycroft void
     50  1.1  mycroft lfs_dump_super(lfsp)
     51  1.1  mycroft 	struct lfs *lfsp;
     52  1.1  mycroft {
     53  1.1  mycroft 	int i;
     54  1.1  mycroft 
     55  1.1  mycroft 	(void)printf("%s%lx\t%s%lx\t%s%d\t%s%d\n",
     56  1.1  mycroft 		"magic    ", lfsp->lfs_magic,
     57  1.1  mycroft 		"version  ", lfsp->lfs_version,
     58  1.1  mycroft 		"size     ", lfsp->lfs_size,
     59  1.1  mycroft 		"ssize    ", lfsp->lfs_ssize);
     60  1.1  mycroft 	(void)printf("%s%d\t%s%d\t%s%d\t%s%d\n",
     61  1.1  mycroft 		"dsize    ", lfsp->lfs_dsize,
     62  1.1  mycroft 		"bsize    ", lfsp->lfs_bsize,
     63  1.1  mycroft 		"fsize    ", lfsp->lfs_fsize,
     64  1.1  mycroft 		"frag     ", lfsp->lfs_frag);
     65  1.1  mycroft 
     66  1.1  mycroft 	(void)printf("%s%d\t%s%d\t%s%d\t%s%d\n",
     67  1.1  mycroft 		"minfree  ", lfsp->lfs_minfree,
     68  1.1  mycroft 		"inopb    ", lfsp->lfs_inopb,
     69  1.1  mycroft 		"ifpb     ", lfsp->lfs_ifpb,
     70  1.1  mycroft 		"nindir   ", lfsp->lfs_nindir);
     71  1.1  mycroft 
     72  1.1  mycroft 	(void)printf("%s%d\t%s%d\t%s%d\t%s%d\n",
     73  1.1  mycroft 		"nseg     ", lfsp->lfs_nseg,
     74  1.1  mycroft 		"nspf     ", lfsp->lfs_nspf,
     75  1.1  mycroft 		"cleansz  ", lfsp->lfs_cleansz,
     76  1.1  mycroft 		"segtabsz ", lfsp->lfs_segtabsz);
     77  1.1  mycroft 
     78  1.1  mycroft 	(void)printf("%s%lx\t%s%d\t%s%lx\t%s%d\n",
     79  1.1  mycroft 		"segmask  ", lfsp->lfs_segmask,
     80  1.1  mycroft 		"segshift ", lfsp->lfs_segshift,
     81  1.1  mycroft 		"bmask    ", lfsp->lfs_bmask,
     82  1.1  mycroft 		"bshift   ", lfsp->lfs_bshift);
     83  1.1  mycroft 
     84  1.1  mycroft 	(void)printf("%s%lx\t%s%d\t%s%lx\t%s%d\n",
     85  1.1  mycroft 		"ffmask   ", lfsp->lfs_ffmask,
     86  1.1  mycroft 		"ffshift  ", lfsp->lfs_ffshift,
     87  1.1  mycroft 		"fbmask   ", lfsp->lfs_fbmask,
     88  1.1  mycroft 		"fbshift  ", lfsp->lfs_fbshift);
     89  1.1  mycroft 
     90  1.1  mycroft 	(void)printf("%s%d\t%s%d\t%s%lx\t%s%qx\n",
     91  1.1  mycroft 		"sushift  ", lfsp->lfs_sushift,
     92  1.1  mycroft 		"fsbtodb  ", lfsp->lfs_fsbtodb,
     93  1.1  mycroft 		"cksum    ", lfsp->lfs_cksum,
     94  1.1  mycroft 		"maxfilesize ", lfsp->lfs_maxfilesize);
     95  1.1  mycroft 
     96  1.1  mycroft 	(void)printf("Superblock disk addresses:");
     97  1.1  mycroft 	for (i = 0; i < LFS_MAXNUMSB; i++)
     98  1.1  mycroft 		(void)printf(" %lx", lfsp->lfs_sboffs[i]);
     99  1.1  mycroft 	(void)printf("\n");
    100  1.1  mycroft 
    101  1.1  mycroft 	(void)printf("Checkpoint Info\n");
    102  1.1  mycroft 	(void)printf("%s%d\t%s%lx\t%s%d\n",
    103  1.1  mycroft 		"free     ", lfsp->lfs_free,
    104  1.1  mycroft 		"idaddr   ", lfsp->lfs_idaddr,
    105  1.1  mycroft 		"ifile    ", lfsp->lfs_ifile);
    106  1.1  mycroft 	(void)printf("%s%lx\t%s%d\t%s%lx\t%s%lx\t%s%lx\t%s%lx\n",
    107  1.1  mycroft 		"bfree    ", lfsp->lfs_bfree,
    108  1.1  mycroft 		"nfiles   ", lfsp->lfs_nfiles,
    109  1.1  mycroft 		"lastseg  ", lfsp->lfs_lastseg,
    110  1.1  mycroft 		"nextseg  ", lfsp->lfs_nextseg,
    111  1.1  mycroft 		"curseg   ", lfsp->lfs_curseg,
    112  1.1  mycroft 		"offset   ", lfsp->lfs_offset);
    113  1.1  mycroft 	(void)printf("tstamp   %lx\n", lfsp->lfs_tstamp);
    114  1.1  mycroft }
    115  1.1  mycroft 
    116  1.1  mycroft void
    117  1.1  mycroft lfs_dump_dinode(dip)
    118  1.1  mycroft 	struct dinode *dip;
    119  1.1  mycroft {
    120  1.1  mycroft 	int i;
    121  1.1  mycroft 
    122  1.1  mycroft 	(void)printf("%s%u\t%s%d\t%s%u\t%s%u\t%s%lu\n",
    123  1.1  mycroft 		"mode  ", dip->di_mode,
    124  1.1  mycroft 		"nlink ", dip->di_nlink,
    125  1.1  mycroft 		"uid   ", dip->di_uid,
    126  1.1  mycroft 		"gid   ", dip->di_gid,
    127  1.1  mycroft 		"size  ", dip->di_size);
    128  1.1  mycroft 	(void)printf("inum  %ld\n", dip->di_inumber);
    129  1.1  mycroft 	(void)printf("Direct Addresses\n");
    130  1.1  mycroft 	for (i = 0; i < NDADDR; i++) {
    131  1.1  mycroft 		(void)printf("\t%lx", dip->di_db[i]);
    132  1.1  mycroft 		if ((i % 6) == 5)
    133  1.1  mycroft 			(void)printf("\n");
    134  1.1  mycroft 	}
    135  1.1  mycroft 	for (i = 0; i < NIADDR; i++)
    136  1.1  mycroft 		(void)printf("\t%lx", dip->di_ib[i]);
    137  1.1  mycroft 	(void)printf("\n");
    138  1.1  mycroft }
    139  1.1  mycroft #endif /* DEBUG */
    140