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