]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - scrub/common.h
2 * Copyright (C) 2018 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef XFS_SCRUB_COMMON_H_
21 #define XFS_SCRUB_COMMON_H_
24 * When reporting a defective metadata object to the console, this
25 * is the size of the buffer to use to store the description of that
28 #define DESCR_BUFSZ 256
30 bool xfs_scrub_excessive_errors(struct scrub_ctx
*ctx
);
38 void __str_out(struct scrub_ctx
*ctx
, const char *descr
, enum error_level level
,
39 int error
, const char *file
, int line
, const char *format
, ...);
41 #define str_errno(ctx, str) \
42 __str_out(ctx, str, S_ERROR, errno, __FILE__, __LINE__, NULL)
43 #define str_error(ctx, str, ...) \
44 __str_out(ctx, str, S_ERROR, 0, __FILE__, __LINE__, __VA_ARGS__)
45 #define str_warn(ctx, str, ...) \
46 __str_out(ctx, str, S_WARN, 0, __FILE__, __LINE__, __VA_ARGS__)
47 #define str_info(ctx, str, ...) \
48 __str_out(ctx, str, S_INFO, 0, __FILE__, __LINE__, __VA_ARGS__)
50 #define dbg_printf(fmt, ...) \
51 do {if (debug > 1) {printf(fmt, __VA_ARGS__);}} while (0)
53 /* Is this debug tweak enabled? */
58 return debug
&& getenv(name
) != NULL
;
61 double timeval_subtract(struct timeval
*tv1
, struct timeval
*tv2
);
62 double auto_space_units(unsigned long long kilobytes
, char **units
);
63 double auto_units(unsigned long long number
, char **units
);
64 unsigned int scrub_nproc(struct scrub_ctx
*ctx
);
65 unsigned int scrub_nproc_workqueue(struct scrub_ctx
*ctx
);
67 #endif /* XFS_SCRUB_COMMON_H_ */