Home | History | Annotate | Line # | Download | only in fsck_lfs
vars.c revision 1.14.6.1
      1  1.14.6.1      yamt /* $NetBSD: vars.c,v 1.14.6.1 2014/05/22 11:37:28 yamt Exp $	 */
      2       1.7  perseant /*-
      3       1.7  perseant  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
      4       1.7  perseant  * All rights reserved.
      5       1.7  perseant  *
      6       1.7  perseant  * This code is derived from software contributed to The NetBSD Foundation
      7       1.7  perseant  * by Konrad E. Schroder <perseant (at) hhhh.org>.
      8       1.7  perseant  *
      9       1.7  perseant  * Redistribution and use in source and binary forms, with or without
     10       1.7  perseant  * modification, are permitted provided that the following conditions
     11       1.7  perseant  * are met:
     12       1.7  perseant  * 1. Redistributions of source code must retain the above copyright
     13       1.7  perseant  *    notice, this list of conditions and the following disclaimer.
     14       1.7  perseant  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.7  perseant  *    notice, this list of conditions and the following disclaimer in the
     16       1.7  perseant  *    documentation and/or other materials provided with the distribution.
     17       1.7  perseant  *
     18       1.7  perseant  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19       1.7  perseant  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20       1.7  perseant  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21       1.7  perseant  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22       1.7  perseant  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23       1.7  perseant  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24       1.7  perseant  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25       1.7  perseant  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26       1.7  perseant  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27       1.7  perseant  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28       1.7  perseant  * POSSIBILITY OF SUCH DAMAGE.
     29       1.7  perseant  */
     30       1.2    kleink 
     31       1.1  perseant #include <sys/param.h>
     32       1.1  perseant #include <sys/time.h>
     33       1.3  perseant #include <sys/mount.h>		/* XXX */
     34       1.1  perseant #include <ufs/lfs/lfs.h>
     35       1.1  perseant #include "fsck.h"
     36       1.1  perseant 
     37       1.1  perseant /* variables previously of file scope (from fsck.h) */
     38       1.7  perseant struct dups *duplist;		/* head of dup list */
     39       1.7  perseant struct dups *muldup;		/* end of unique duplicate dup block numbers */
     40       1.7  perseant 
     41       1.7  perseant struct zlncnt *zlnhead;		/* head of zero link count list */
     42      1.12  perseant struct zlncnt *orphead = NULL;	/* head of "properly orphaned" list */
     43       1.7  perseant 
     44       1.7  perseant struct lfs *fs;
     45       1.7  perseant 
     46       1.7  perseant daddr_t idaddr;			/* inode block containing ifile inode */
     47       1.7  perseant long numdirs, listmax, inplast;
     48       1.7  perseant 
     49       1.7  perseant char nflag;			/* assume a no response */
     50       1.7  perseant char yflag;			/* assume a yes response */
     51       1.7  perseant int bflag;			/* location of alternate super block */
     52       1.7  perseant int debug;			/* output debugging info */
     53       1.7  perseant int exitonfail;
     54       1.7  perseant int preen;			/* just fix normal inconsistencies */
     55       1.9  perseant int quiet;			/* don't report clean filesystems */
     56       1.7  perseant char havesb;			/* superblock has been read */
     57       1.7  perseant char skipclean;			/* skip clean file systems if preening */
     58       1.7  perseant int fsmodified;			/* 1 => write done to file system */
     59       1.7  perseant int fsreadfd;			/* file descriptor for reading file system */
     60       1.7  perseant int rerun;			/* rerun fsck.  Only used in non-preen mode */
     61       1.1  perseant 
     62       1.7  perseant daddr_t maxfsblock;		/* number of blocks in the file system */
     63       1.1  perseant #ifndef VERBOSE_BLOCKMAP
     64       1.7  perseant char *blockmap;			/* ptr to primary blk allocation map */
     65       1.1  perseant #else
     66       1.7  perseant ino_t *blockmap;
     67       1.1  perseant #endif
     68       1.7  perseant ino_t maxino;			/* number of inodes in file system */
     69       1.7  perseant ino_t lastino;			/* last inode in use */
     70       1.7  perseant char *statemap;			/* ptr to inode state table */
     71       1.7  perseant char *typemap;			/* ptr to inode type table */
     72       1.7  perseant int16_t *lncntp;		/* ptr to link count table */
     73       1.7  perseant 
     74       1.7  perseant ino_t lfdir;			/* lost & found directory inode number */
     75       1.7  perseant int lfmode;			/* lost & found directory creation mode */
     76       1.1  perseant 
     77       1.7  perseant daddr_t n_blks;			/* number of blocks in use */
     78       1.7  perseant ino_t n_files;			/* number of files in use */
     79       1.1  perseant 
     80  1.14.6.1      yamt struct ulfs1_dinode zino;
     81      1.11  perseant 
     82      1.11  perseant int no_roll_forward = 0;	/* don't roll forward */
     83