]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - repair/globals.h
Update copyright dates (again)
[thirdparty/xfsprogs-dev.git] / repair / globals.h
CommitLineData
2bd0ea18 1/*
0d3e0b37 2 * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
2bd0ea18
NS
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32
33#ifndef _XFS_REPAIR_GLOBAL_H
34#define _XFS_REPAIR_GLOBAL_H
35
36#ifndef EXTERN
37#define EXTERN extern
38#endif
39
40/* useful macros */
41
42#define rounddown(x, y) (((x)/(y))*(y))
43
44/* error flags */
45
46#define XR_OK 0 /* good */
47#define XR_BAD_MAGIC 1 /* bad magic number */
48#define XR_BAD_BLOCKSIZE 2 /* bad block size */
49#define XR_BAD_BLOCKLOG 3 /* bad sb_blocklog field */
50#define XR_BAD_VERSION 4 /* bad version number */
51#define XR_BAD_INPROGRESS 5 /* in progress set */
52#define XR_BAD_FS_SIZE_DATA 6 /* ag sizes, number, fs size mismatch */
53#define XR_BAD_INO_SIZE_DATA 7 /* bad inode size or perblock fields */
54#define XR_BAD_SECT_SIZE_DATA 8 /* bad sector size info */
55#define XR_AGF_GEO_MISMATCH 9 /* agf info conflicts with sb */
56#define XR_AGI_GEO_MISMATCH 10 /* agf info conflicts with sb */
57#define XR_SB_GEO_MISMATCH 11 /* sb geo conflicts with fs sb geo */
58#define XR_EOF 12 /* seeked beyond EOF */
59#define XR_BAD_RT_GEO_DATA 13 /* realtime geometry inconsistent */
60#define XR_BAD_INO_MAX_PCT 14 /* max % of inodes > 100% */
61#define XR_BAD_INO_ALIGN 15 /* bad inode alignment value */
62#define XR_INSUFF_SEC_SB 16 /* not enough matching secondary sbs */
63#define XR_BAD_SB_UNIT 17 /* bad stripe unit */
64#define XR_BAD_SB_WIDTH 18 /* bad stripe width */
65#define XR_BAD_SVN 19 /* bad shared version number */
66#define XR_BAD_ERR_CODE 20 /* Bad error code */
67
68/* XFS filesystem (il)legal values */
69
70#define XR_LOG2BSIZE_MIN 9 /* min/max fs blocksize (log2) */
71#define XR_LOG2BSIZE_MAX 16 /* 2^XR_* == blocksize */
72
73#define NUM_SBS 8 /* max # of sbs to verify */
74#define NUM_AGH_SECTS 4 /* # of components in an ag header */
75
76#define MEM_ALIGN 128 /* I/O buf alignment - a cache line */
77
78/*
79 * secondary sb mask -- if the secondary sb feature bits has a
80 * the partial sb mask bit set, then you depend on the fields
81 * in it up to and including sb_inoalignmt but the unused part of the
82 * sector may have trash in it. If the sb has any bits set that are in
83 * the good mask, then the entire sb and sector are good (was bzero'ed
84 * by mkfs). The third mask is for filesystems made by pre-6.5 campus
85 * alpha mkfs's. Those are rare so we'll check for those under
86 * a special option.
87 */
88#define XR_PART_SECSB_VNMASK 0x0F80 /* >= XFS_SB_VERSION_ALIGNBIT */
89#define XR_GOOD_SECSB_VNMASK 0x0F00 /* >= XFS_SB_VERSION_DALIGNBIT */
90#define XR_ALPHA_SECSB_VNMASK 0x0180 /* DALIGN|ALIGN bits */
91
92/* global variables for xfs_repair */
93
94/* arguments and argument flag variables */
95
96EXTERN char *fs_name; /* name of filesystem */
97EXTERN int verbose; /* verbose flag, mostly for debugging */
98
99
100/* for reading stuff in manually (bypassing libsim) */
101
102EXTERN char *iobuf; /* large buffer */
103EXTERN int iobuf_size;
104EXTERN char *smallbuf; /* small (1-4 page) buffer */
105EXTERN int smallbuf_size;
106EXTERN char *sb_bufs[NUM_SBS]; /* superblock buffers */
107EXTERN int sbbuf_size;
108
109/* direct I/O info */
110
111EXTERN int minio_align; /* min I/O size and alignment */
112EXTERN int mem_align; /* memory alignment */
113EXTERN int max_iosize; /* max I/O size */
114
115/* file descriptors */
116
117EXTERN int fs_fd; /* filesystem fd */
118
119/* command-line flags */
120
121EXTERN int verbose;
122EXTERN int no_modify;
123EXTERN int isa_file;
d321ceac 124EXTERN int zap_log;
2bd0ea18
NS
125EXTERN int dumpcore; /* abort, not exit on fatal errs */
126EXTERN int delete_attr_ok; /* can clear attrs w/o clearing files */
127EXTERN int force_geo; /* can set geo on low confidence info */
128EXTERN int assume_xfs; /* assume we have an xfs fs */
129EXTERN int pre_65_beta; /* fs was mkfs'ed by a version earlier * than 6.5-beta */
42a564ab
ES
130EXTERN char *log_name; /* Name of log device */
131EXTERN int log_spec; /* Log dev specified as option */
132EXTERN char *rt_name; /* Name of realtime device */
133EXTERN int rt_spec; /* Realtime dev specified as option */
2bd0ea18
NS
134
135/* misc status variables */
136
137EXTERN int primary_sb_modified;
138EXTERN int bad_ino_btree;
139EXTERN int clear_sunit;
140EXTERN int fs_is_dirty;
141
142/* for hunting down the root inode */
143
144EXTERN int need_root_inode;
145EXTERN int need_root_dotdot;
146
147EXTERN int need_rbmino;
148EXTERN int need_rsumino;
149
150EXTERN int lost_quotas;
151EXTERN int have_uquotino;
b36eef04 152EXTERN int have_gquotino;
2bd0ea18 153EXTERN int lost_uquotino;
b36eef04 154EXTERN int lost_gquotino;
2bd0ea18
NS
155
156EXTERN xfs_agino_t first_prealloc_ino;
157EXTERN xfs_agino_t last_prealloc_ino;
158EXTERN xfs_agblock_t bnobt_root;
159EXTERN xfs_agblock_t bcntbt_root;
160EXTERN xfs_agblock_t inobt_root;
161
162/* configuration vars -- fs geometry dependent */
163
164EXTERN int inodes_per_block;
165EXTERN int inodes_per_cluster; /* inodes per inode buffer */
166EXTERN unsigned int glob_agcount;
167EXTERN int chunks_pblock; /* # of 64-ino chunks per allocation */
168EXTERN int max_symlink_blocks;
169EXTERN __int64_t fs_max_file_offset;
170
171/* block allocation bitmaps */
172
173EXTERN __uint64_t **ba_bmap; /* see incore.h */
174EXTERN __uint64_t *rt_ba_bmap; /* see incore.h */
175
176/* realtime info */
177
178EXTERN xfs_rtword_t *btmcompute;
179EXTERN xfs_suminfo_t *sumcompute;
180
181/* inode tree records have full or partial backptr fields ? */
182
183EXTERN int full_backptrs; /*
184 * if 1, use backptrs_t component
185 * of ino_un union, if 0, use
186 * parent_list_t component. see
187 * incore.h for more details
188 */
189
190#define ORPHANAGE "lost+found"
191
192/* superblock counters */
193
194EXTERN __uint64_t sb_icount; /* allocated (made) inodes */
195EXTERN __uint64_t sb_ifree; /* free inodes */
196EXTERN __uint64_t sb_fdblocks; /* free data blocks */
197EXTERN __uint64_t sb_frextents; /* free realtime extents */
198
199EXTERN xfs_ino_t orphanage_ino;
200EXTERN xfs_ino_t old_orphanage_ino;
201
202/* superblock geometry info */
203
204EXTERN xfs_extlen_t sb_inoalignmt;
205EXTERN __uint32_t sb_unit;
206EXTERN __uint32_t sb_width;
207
208#endif /* _XFS_REPAIR_GLOBAL_H */