]>
Commit | Line | Data |
---|---|---|
2bd0ea18 | 1 | /* |
da23017d NS |
2 | * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
dfc130f3 | 4 | * |
da23017d NS |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License as | |
2bd0ea18 | 7 | * published by the Free Software Foundation. |
dfc130f3 | 8 | * |
da23017d NS |
9 | * This program is distributed in the hope that it would be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
dfc130f3 | 13 | * |
da23017d NS |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
2bd0ea18 NS |
17 | */ |
18 | ||
19 | #ifndef _XFS_REPAIR_GLOBAL_H | |
20 | #define _XFS_REPAIR_GLOBAL_H | |
21 | ||
22 | #ifndef EXTERN | |
23 | #define EXTERN extern | |
24 | #endif | |
25 | ||
26 | /* useful macros */ | |
27 | ||
28 | #define rounddown(x, y) (((x)/(y))*(y)) | |
29 | ||
30 | /* error flags */ | |
31 | ||
32 | #define XR_OK 0 /* good */ | |
33 | #define XR_BAD_MAGIC 1 /* bad magic number */ | |
34 | #define XR_BAD_BLOCKSIZE 2 /* bad block size */ | |
35 | #define XR_BAD_BLOCKLOG 3 /* bad sb_blocklog field */ | |
36 | #define XR_BAD_VERSION 4 /* bad version number */ | |
37 | #define XR_BAD_INPROGRESS 5 /* in progress set */ | |
38 | #define XR_BAD_FS_SIZE_DATA 6 /* ag sizes, number, fs size mismatch */ | |
39 | #define XR_BAD_INO_SIZE_DATA 7 /* bad inode size or perblock fields */ | |
40 | #define XR_BAD_SECT_SIZE_DATA 8 /* bad sector size info */ | |
41 | #define XR_AGF_GEO_MISMATCH 9 /* agf info conflicts with sb */ | |
42 | #define XR_AGI_GEO_MISMATCH 10 /* agf info conflicts with sb */ | |
43 | #define XR_SB_GEO_MISMATCH 11 /* sb geo conflicts with fs sb geo */ | |
44 | #define XR_EOF 12 /* seeked beyond EOF */ | |
45 | #define XR_BAD_RT_GEO_DATA 13 /* realtime geometry inconsistent */ | |
46 | #define XR_BAD_INO_MAX_PCT 14 /* max % of inodes > 100% */ | |
47 | #define XR_BAD_INO_ALIGN 15 /* bad inode alignment value */ | |
48 | #define XR_INSUFF_SEC_SB 16 /* not enough matching secondary sbs */ | |
49 | #define XR_BAD_SB_UNIT 17 /* bad stripe unit */ | |
50 | #define XR_BAD_SB_WIDTH 18 /* bad stripe width */ | |
51 | #define XR_BAD_SVN 19 /* bad shared version number */ | |
88f364a9 | 52 | #define XR_BAD_CRC 20 /* Bad CRC */ |
02b56f87 DW |
53 | #define XR_BAD_DIR_SIZE_DATA 21 /* Bad directory geometry */ |
54 | #define XR_BAD_ERR_CODE 22 /* Bad error code */ | |
2bd0ea18 NS |
55 | |
56 | /* XFS filesystem (il)legal values */ | |
57 | ||
58 | #define XR_LOG2BSIZE_MIN 9 /* min/max fs blocksize (log2) */ | |
59 | #define XR_LOG2BSIZE_MAX 16 /* 2^XR_* == blocksize */ | |
60 | ||
2bd0ea18 NS |
61 | #define NUM_AGH_SECTS 4 /* # of components in an ag header */ |
62 | ||
2bd0ea18 NS |
63 | /* global variables for xfs_repair */ |
64 | ||
65 | /* arguments and argument flag variables */ | |
66 | ||
67 | EXTERN char *fs_name; /* name of filesystem */ | |
68 | EXTERN int verbose; /* verbose flag, mostly for debugging */ | |
69 | ||
70 | ||
71 | /* for reading stuff in manually (bypassing libsim) */ | |
72 | ||
73 | EXTERN char *iobuf; /* large buffer */ | |
74 | EXTERN int iobuf_size; | |
75 | EXTERN char *smallbuf; /* small (1-4 page) buffer */ | |
76 | EXTERN int smallbuf_size; | |
2bd0ea18 NS |
77 | EXTERN int sbbuf_size; |
78 | ||
79 | /* direct I/O info */ | |
80 | ||
81 | EXTERN int minio_align; /* min I/O size and alignment */ | |
82 | EXTERN int mem_align; /* memory alignment */ | |
83 | EXTERN int max_iosize; /* max I/O size */ | |
84 | ||
85 | /* file descriptors */ | |
86 | ||
87 | EXTERN int fs_fd; /* filesystem fd */ | |
88 | ||
89 | /* command-line flags */ | |
90 | ||
91 | EXTERN int verbose; | |
92 | EXTERN int no_modify; | |
32a82561 | 93 | EXTERN int dangerously; /* live dangerously ... fix ro mount */ |
2bd0ea18 | 94 | EXTERN int isa_file; |
d321ceac | 95 | EXTERN int zap_log; |
2bd0ea18 | 96 | EXTERN int dumpcore; /* abort, not exit on fatal errs */ |
2bd0ea18 NS |
97 | EXTERN int force_geo; /* can set geo on low confidence info */ |
98 | EXTERN int assume_xfs; /* assume we have an xfs fs */ | |
42a564ab ES |
99 | EXTERN char *log_name; /* Name of log device */ |
100 | EXTERN int log_spec; /* Log dev specified as option */ | |
101 | EXTERN char *rt_name; /* Name of realtime device */ | |
102 | EXTERN int rt_spec; /* Realtime dev specified as option */ | |
4af916f8 BN |
103 | EXTERN int convert_lazy_count; /* Convert lazy-count mode on/off */ |
104 | EXTERN int lazy_count; /* What to set if to if converting */ | |
2bd0ea18 NS |
105 | |
106 | /* misc status variables */ | |
107 | ||
108 | EXTERN int primary_sb_modified; | |
109 | EXTERN int bad_ino_btree; | |
6bf4721d | 110 | EXTERN int copied_sunit; |
2bd0ea18 NS |
111 | EXTERN int fs_is_dirty; |
112 | ||
113 | /* for hunting down the root inode */ | |
114 | ||
115 | EXTERN int need_root_inode; | |
116 | EXTERN int need_root_dotdot; | |
117 | ||
118 | EXTERN int need_rbmino; | |
119 | EXTERN int need_rsumino; | |
120 | ||
121 | EXTERN int lost_quotas; | |
122 | EXTERN int have_uquotino; | |
b36eef04 | 123 | EXTERN int have_gquotino; |
0340d706 | 124 | EXTERN int have_pquotino; |
2bd0ea18 | 125 | EXTERN int lost_uquotino; |
b36eef04 | 126 | EXTERN int lost_gquotino; |
9b27bdbb | 127 | EXTERN int lost_pquotino; |
2bd0ea18 NS |
128 | |
129 | EXTERN xfs_agino_t first_prealloc_ino; | |
130 | EXTERN xfs_agino_t last_prealloc_ino; | |
131 | EXTERN xfs_agblock_t bnobt_root; | |
132 | EXTERN xfs_agblock_t bcntbt_root; | |
133 | EXTERN xfs_agblock_t inobt_root; | |
134 | ||
135 | /* configuration vars -- fs geometry dependent */ | |
136 | ||
137 | EXTERN int inodes_per_block; | |
2556c98b | 138 | EXTERN int inodes_per_cluster; |
2bd0ea18 NS |
139 | EXTERN unsigned int glob_agcount; |
140 | EXTERN int chunks_pblock; /* # of 64-ino chunks per allocation */ | |
141 | EXTERN int max_symlink_blocks; | |
14f8b681 | 142 | EXTERN int64_t fs_max_file_offset; |
2bd0ea18 | 143 | |
2bd0ea18 NS |
144 | /* realtime info */ |
145 | ||
146 | EXTERN xfs_rtword_t *btmcompute; | |
147 | EXTERN xfs_suminfo_t *sumcompute; | |
148 | ||
149 | /* inode tree records have full or partial backptr fields ? */ | |
150 | ||
0f012a4c BN |
151 | EXTERN int full_ino_ex_data;/* |
152 | * if 1, use ino_ex_data_t component | |
153 | * of ino_un union, if 0, use | |
154 | * parent_list_t component. see | |
155 | * incore.h for more details | |
156 | */ | |
2bd0ea18 NS |
157 | |
158 | #define ORPHANAGE "lost+found" | |
159 | ||
160 | /* superblock counters */ | |
161 | ||
14f8b681 DW |
162 | EXTERN uint64_t sb_icount; /* allocated (made) inodes */ |
163 | EXTERN uint64_t sb_ifree; /* free inodes */ | |
164 | EXTERN uint64_t sb_fdblocks; /* free data blocks */ | |
165 | EXTERN uint64_t sb_frextents; /* free realtime extents */ | |
2bd0ea18 | 166 | |
2bd0ea18 NS |
167 | /* superblock geometry info */ |
168 | ||
169 | EXTERN xfs_extlen_t sb_inoalignmt; | |
14f8b681 DW |
170 | EXTERN uint32_t sb_unit; |
171 | EXTERN uint32_t sb_width; | |
2bd0ea18 | 172 | |
586f8abf DC |
173 | struct aglock { |
174 | pthread_mutex_t lock __attribute__((__aligned__(64))); | |
175 | }; | |
176 | EXTERN struct aglock *ag_locks; | |
2814f3d6 | 177 | |
14f8b681 DW |
178 | EXTERN int report_interval; |
179 | EXTERN uint64_t *prog_rpt_done; | |
2556c98b | 180 | |
add3cb90 | 181 | EXTERN int ag_stride; |
2556c98b | 182 | EXTERN int thread_count; |
add3cb90 | 183 | |
2bd0ea18 | 184 | #endif /* _XFS_REPAIR_GLOBAL_H */ |