Annotation of XNU/bsd/ufs/lfs/lfs_debug.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.