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