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