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