vars.c revision 1.17 1 /* $NetBSD: vars.c,v 1.17 2013/06/08 02:16:03 dholland 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 (at) 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 *
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.
29 */
30
31 #include <sys/param.h>
32 #include <sys/time.h>
33 #include <sys/mount.h> /* XXX */
34 #include <ufs/lfs/lfs.h>
35 #include "fsck.h"
36
37 /* variables previously of file scope (from fsck.h) */
38 struct dups *duplist; /* head of dup list */
39 struct dups *muldup; /* end of unique duplicate dup block numbers */
40
41 struct zlncnt *zlnhead; /* head of zero link count list */
42 struct zlncnt *orphead = NULL; /* head of "properly orphaned" list */
43
44 struct lfs *fs;
45
46 daddr_t idaddr; /* inode block containing ifile inode */
47 long numdirs, listmax, inplast;
48
49 char nflag; /* assume a no response */
50 char yflag; /* assume a yes response */
51 int bflag; /* location of alternate super block */
52 int debug; /* output debugging info */
53 int exitonfail;
54 int preen; /* just fix normal inconsistencies */
55 int quiet; /* don't report clean filesystems */
56 char havesb; /* superblock has been read */
57 char skipclean; /* skip clean file systems if preening */
58 int fsmodified; /* 1 => write done to file system */
59 int fsreadfd; /* file descriptor for reading file system */
60 int rerun; /* rerun fsck. Only used in non-preen mode */
61
62 daddr_t maxfsblock; /* number of blocks in the file system */
63 #ifndef VERBOSE_BLOCKMAP
64 char *blockmap; /* ptr to primary blk allocation map */
65 #else
66 ino_t *blockmap;
67 #endif
68 ino_t maxino; /* number of inodes in file system */
69 ino_t lastino; /* last inode in use */
70 char *statemap; /* ptr to inode state table */
71 char *typemap; /* ptr to inode type table */
72 int16_t *lncntp; /* ptr to link count table */
73
74 ino_t lfdir; /* lost & found directory inode number */
75 int lfmode; /* lost & found directory creation mode */
76
77 daddr_t n_blks; /* number of blocks in use */
78 ino_t n_files; /* number of files in use */
79
80 struct ulfs1_dinode zino;
81
82 int no_roll_forward = 0; /* don't roll forward */
83