1 /* $NetBSD: vars.c,v 1.12 2006/09/01 19:52:48 perseant Exp $ */
3 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Konrad E. Schroder <perseant@hhhh.org>.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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.
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
31 #include <sys/param.h>
33 #include <ufs/ufs/dinode.h>
34 #include <ufs/ufs/dir.h>
35 #include <sys/mount.h> /* XXX */
36 #include <ufs/lfs/lfs.h>
39 /* variables previously of file scope (from fsck.h) */
40 struct dups
*duplist
; /* head of dup list */
41 struct dups
*muldup
; /* end of unique duplicate dup block numbers */
43 struct zlncnt
*zlnhead
; /* head of zero link count list */
44 struct zlncnt
*orphead
= NULL
; /* head of "properly orphaned" list */
48 daddr_t idaddr
; /* inode block containing ifile inode */
49 long numdirs
, listmax
, inplast
;
51 long dev_bsize
; /* computed value of DEV_BSIZE */
52 long secsize
; /* actual disk sector size */
53 char nflag
; /* assume a no response */
54 char yflag
; /* assume a yes response */
55 int bflag
; /* location of alternate super block */
56 int debug
; /* output debugging info */
58 int preen
; /* just fix normal inconsistencies */
59 int quiet
; /* don't report clean filesystems */
60 char havesb
; /* superblock has been read */
61 char skipclean
; /* skip clean file systems if preening */
62 int fsmodified
; /* 1 => write done to file system */
63 int fsreadfd
; /* file descriptor for reading file system */
64 int rerun
; /* rerun fsck. Only used in non-preen mode */
66 daddr_t maxfsblock
; /* number of blocks in the file system */
67 #ifndef VERBOSE_BLOCKMAP
68 char *blockmap
; /* ptr to primary blk allocation map */
72 ino_t maxino
; /* number of inodes in file system */
73 ino_t lastino
; /* last inode in use */
74 char *statemap
; /* ptr to inode state table */
75 char *typemap
; /* ptr to inode type table */
76 int16_t *lncntp
; /* ptr to link count table */
78 ino_t lfdir
; /* lost & found directory inode number */
79 int lfmode
; /* lost & found directory creation mode */
81 daddr_t n_blks
; /* number of blocks in use */
82 ino_t n_files
; /* number of files in use */
84 struct ufs1_dinode zino
;
86 int no_roll_forward
= 0; /* don't roll forward */