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