]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - repair/globals.h
xfs_repair: don't leak buffer on xattr remote buf verifier error
[thirdparty/xfsprogs-dev.git] / repair / globals.h
CommitLineData
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
67EXTERN char *fs_name; /* name of filesystem */
68EXTERN int verbose; /* verbose flag, mostly for debugging */
69
70
71/* for reading stuff in manually (bypassing libsim) */
72
73EXTERN char *iobuf; /* large buffer */
74EXTERN int iobuf_size;
75EXTERN char *smallbuf; /* small (1-4 page) buffer */
76EXTERN int smallbuf_size;
2bd0ea18
NS
77EXTERN int sbbuf_size;
78
79/* direct I/O info */
80
81EXTERN int minio_align; /* min I/O size and alignment */
82EXTERN int mem_align; /* memory alignment */
83EXTERN int max_iosize; /* max I/O size */
84
85/* file descriptors */
86
87EXTERN int fs_fd; /* filesystem fd */
88
89/* command-line flags */
90
91EXTERN int verbose;
92EXTERN int no_modify;
32a82561 93EXTERN int dangerously; /* live dangerously ... fix ro mount */
2bd0ea18 94EXTERN int isa_file;
d321ceac 95EXTERN int zap_log;
2bd0ea18 96EXTERN int dumpcore; /* abort, not exit on fatal errs */
2bd0ea18
NS
97EXTERN int force_geo; /* can set geo on low confidence info */
98EXTERN int assume_xfs; /* assume we have an xfs fs */
42a564ab
ES
99EXTERN char *log_name; /* Name of log device */
100EXTERN int log_spec; /* Log dev specified as option */
101EXTERN char *rt_name; /* Name of realtime device */
102EXTERN int rt_spec; /* Realtime dev specified as option */
4af916f8
BN
103EXTERN int convert_lazy_count; /* Convert lazy-count mode on/off */
104EXTERN int lazy_count; /* What to set if to if converting */
2bd0ea18
NS
105
106/* misc status variables */
107
108EXTERN int primary_sb_modified;
109EXTERN int bad_ino_btree;
6bf4721d 110EXTERN int copied_sunit;
2bd0ea18
NS
111EXTERN int fs_is_dirty;
112
113/* for hunting down the root inode */
114
115EXTERN int need_root_inode;
116EXTERN int need_root_dotdot;
117
118EXTERN int need_rbmino;
119EXTERN int need_rsumino;
120
121EXTERN int lost_quotas;
122EXTERN int have_uquotino;
b36eef04 123EXTERN int have_gquotino;
0340d706 124EXTERN int have_pquotino;
2bd0ea18 125EXTERN int lost_uquotino;
b36eef04 126EXTERN int lost_gquotino;
9b27bdbb 127EXTERN int lost_pquotino;
2bd0ea18
NS
128
129EXTERN xfs_agino_t first_prealloc_ino;
130EXTERN xfs_agino_t last_prealloc_ino;
131EXTERN xfs_agblock_t bnobt_root;
132EXTERN xfs_agblock_t bcntbt_root;
133EXTERN xfs_agblock_t inobt_root;
134
135/* configuration vars -- fs geometry dependent */
136
137EXTERN int inodes_per_block;
2556c98b 138EXTERN int inodes_per_cluster;
2bd0ea18
NS
139EXTERN unsigned int glob_agcount;
140EXTERN int chunks_pblock; /* # of 64-ino chunks per allocation */
141EXTERN int max_symlink_blocks;
14f8b681 142EXTERN int64_t fs_max_file_offset;
2bd0ea18 143
2bd0ea18
NS
144/* realtime info */
145
146EXTERN xfs_rtword_t *btmcompute;
147EXTERN xfs_suminfo_t *sumcompute;
148
149/* inode tree records have full or partial backptr fields ? */
150
0f012a4c
BN
151EXTERN 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
162EXTERN uint64_t sb_icount; /* allocated (made) inodes */
163EXTERN uint64_t sb_ifree; /* free inodes */
164EXTERN uint64_t sb_fdblocks; /* free data blocks */
165EXTERN uint64_t sb_frextents; /* free realtime extents */
2bd0ea18 166
2bd0ea18
NS
167/* superblock geometry info */
168
169EXTERN xfs_extlen_t sb_inoalignmt;
14f8b681
DW
170EXTERN uint32_t sb_unit;
171EXTERN uint32_t sb_width;
2bd0ea18 172
586f8abf
DC
173struct aglock {
174 pthread_mutex_t lock __attribute__((__aligned__(64)));
175};
176EXTERN struct aglock *ag_locks;
2814f3d6 177
14f8b681
DW
178EXTERN int report_interval;
179EXTERN uint64_t *prog_rpt_done;
2556c98b 180
add3cb90 181EXTERN int ag_stride;
2556c98b 182EXTERN int thread_count;
add3cb90 183
2bd0ea18 184#endif /* _XFS_REPAIR_GLOBAL_H */