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