diff options
Diffstat (limited to 'fs/xfs/xfs_error.h')
-rw-r--r-- | fs/xfs/xfs_error.h | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h index 52ee2b90b5ed..66eef1beb0e5 100644 --- a/fs/xfs/xfs_error.h +++ b/fs/xfs/xfs_error.h | |||
@@ -54,24 +54,10 @@ extern int xfs_error_trap(int); | |||
54 | 54 | ||
55 | struct xfs_mount; | 55 | struct xfs_mount; |
56 | 56 | ||
57 | extern void | 57 | extern void xfs_error_report(char *tag, int level, struct xfs_mount *mp, |
58 | xfs_error_report( | 58 | char *fname, int linenum, inst_t *ra); |
59 | char *tag, | 59 | extern void xfs_corruption_error(char *tag, int level, struct xfs_mount *mp, |
60 | int level, | 60 | void *p, char *fname, int linenum, inst_t *ra); |
61 | struct xfs_mount *mp, | ||
62 | char *fname, | ||
63 | int linenum, | ||
64 | inst_t *ra); | ||
65 | |||
66 | extern void | ||
67 | xfs_corruption_error( | ||
68 | char *tag, | ||
69 | int level, | ||
70 | struct xfs_mount *mp, | ||
71 | void *p, | ||
72 | char *fname, | ||
73 | int linenum, | ||
74 | inst_t *ra); | ||
75 | 61 | ||
76 | #define XFS_ERROR_REPORT(e, lvl, mp) \ | 62 | #define XFS_ERROR_REPORT(e, lvl, mp) \ |
77 | xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address) | 63 | xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address) |
@@ -84,6 +70,32 @@ xfs_corruption_error( | |||
84 | #define XFS_ERRLEVEL_HIGH 5 | 70 | #define XFS_ERRLEVEL_HIGH 5 |
85 | 71 | ||
86 | /* | 72 | /* |
73 | * Macros to set EFSCORRUPTED & return/branch. | ||
74 | */ | ||
75 | #define XFS_WANT_CORRUPTED_GOTO(x,l) \ | ||
76 | { \ | ||
77 | int fs_is_ok = (x); \ | ||
78 | ASSERT(fs_is_ok); \ | ||
79 | if (unlikely(!fs_is_ok)) { \ | ||
80 | XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \ | ||
81 | XFS_ERRLEVEL_LOW, NULL); \ | ||
82 | error = XFS_ERROR(EFSCORRUPTED); \ | ||
83 | goto l; \ | ||
84 | } \ | ||
85 | } | ||
86 | |||
87 | #define XFS_WANT_CORRUPTED_RETURN(x) \ | ||
88 | { \ | ||
89 | int fs_is_ok = (x); \ | ||
90 | ASSERT(fs_is_ok); \ | ||
91 | if (unlikely(!fs_is_ok)) { \ | ||
92 | XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \ | ||
93 | XFS_ERRLEVEL_LOW, NULL); \ | ||
94 | return XFS_ERROR(EFSCORRUPTED); \ | ||
95 | } \ | ||
96 | } | ||
97 | |||
98 | /* | ||
87 | * error injection tags - the labels can be anything you want | 99 | * error injection tags - the labels can be anything you want |
88 | * but each tag should have its own unique number | 100 | * but each tag should have its own unique number |
89 | */ | 101 | */ |
@@ -139,8 +151,8 @@ xfs_corruption_error( | |||
139 | #define XFS_RANDOM_BMAPIFORMAT XFS_RANDOM_DEFAULT | 151 | #define XFS_RANDOM_BMAPIFORMAT XFS_RANDOM_DEFAULT |
140 | 152 | ||
141 | #if (defined(DEBUG) || defined(INDUCE_IO_ERROR)) | 153 | #if (defined(DEBUG) || defined(INDUCE_IO_ERROR)) |
142 | extern int xfs_error_test(int, int *, char *, int, char *, unsigned long); | 154 | extern int xfs_error_test(int, int *, char *, int, char *, unsigned long); |
143 | void xfs_error_test_init(void); | 155 | extern void xfs_error_test_init(void); |
144 | 156 | ||
145 | #define XFS_NUM_INJECT_ERROR 10 | 157 | #define XFS_NUM_INJECT_ERROR 10 |
146 | 158 | ||
@@ -156,12 +168,10 @@ void xfs_error_test_init(void); | |||
156 | (rf))) | 168 | (rf))) |
157 | #endif /* __ANSI_CPP__ */ | 169 | #endif /* __ANSI_CPP__ */ |
158 | 170 | ||
159 | int xfs_errortag_add(int error_tag, xfs_mount_t *mp); | 171 | extern int xfs_errortag_add(int error_tag, xfs_mount_t *mp); |
160 | int xfs_errortag_clear(int error_tag, xfs_mount_t *mp); | 172 | extern int xfs_errortag_clear(int error_tag, xfs_mount_t *mp); |
161 | 173 | extern int xfs_errortag_clearall(xfs_mount_t *mp); | |
162 | int xfs_errortag_clearall(xfs_mount_t *mp); | 174 | extern int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud); |
163 | int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, | ||
164 | int loud); | ||
165 | #else | 175 | #else |
166 | #define XFS_TEST_ERROR(expr, mp, tag, rf) (expr) | 176 | #define XFS_TEST_ERROR(expr, mp, tag, rf) (expr) |
167 | #define xfs_errortag_add(tag, mp) (ENOSYS) | 177 | #define xfs_errortag_add(tag, mp) (ENOSYS) |
@@ -185,9 +195,9 @@ int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, | |||
185 | 195 | ||
186 | struct xfs_mount; | 196 | struct xfs_mount; |
187 | /* PRINTFLIKE4 */ | 197 | /* PRINTFLIKE4 */ |
188 | void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp, | 198 | extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp, |
189 | char *fmt, ...); | 199 | char *fmt, ...); |
190 | /* PRINTFLIKE3 */ | 200 | /* PRINTFLIKE3 */ |
191 | void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...); | 201 | extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...); |
192 | 202 | ||
193 | #endif /* __XFS_ERROR_H__ */ | 203 | #endif /* __XFS_ERROR_H__ */ |