2 * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32 #ifndef __XFS_ERROR_H__
33 #define __XFS_ERROR_H__
35 #define prdev(fmt,targ,args...) \
36 printk("XFS: device %s- " fmt "\n", XFS_BUFTARG_NAME(targ), ## args)
38 #define XFS_ERECOVER 1 /* Failure to recover log */
39 #define XFS_ELOGSTAT 2 /* Failure to stat log in user space */
40 #define XFS_ENOLOGSPACE 3 /* Reservation too large */
41 #define XFS_ENOTSUP 4 /* Operation not supported */
42 #define XFS_ENOLSN 5 /* Can't find the lsn you asked for */
43 #define XFS_ENOTFOUND 6
44 #define XFS_ENOTXFS 7 /* Not XFS filesystem */
47 #define XFS_ERROR_NTRAP 10
48 extern int xfs_etrap
[XFS_ERROR_NTRAP
];
49 extern int xfs_error_trap(int);
50 #define XFS_ERROR(e) xfs_error_trap(e)
52 #define XFS_ERROR(e) (e)
76 #define XFS_ERROR_REPORT(e, lvl, mp) \
77 xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address)
78 #define XFS_CORRUPTION_ERROR(e, lvl, mp, mem) \
79 xfs_corruption_error(e, lvl, mp, mem, \
80 __FILE__, __LINE__, __return_address)
82 #define XFS_ERRLEVEL_OFF 0
83 #define XFS_ERRLEVEL_LOW 1
84 #define XFS_ERRLEVEL_HIGH 5
87 * error injection tags - the labels can be anything you want
88 * but each tag should have its own unique number
91 #define XFS_ERRTAG_NOERROR 0
92 #define XFS_ERRTAG_IFLUSH_1 1
93 #define XFS_ERRTAG_IFLUSH_2 2
94 #define XFS_ERRTAG_IFLUSH_3 3
95 #define XFS_ERRTAG_IFLUSH_4 4
96 #define XFS_ERRTAG_IFLUSH_5 5
97 #define XFS_ERRTAG_IFLUSH_6 6
98 #define XFS_ERRTAG_DA_READ_BUF 7
99 #define XFS_ERRTAG_BTREE_CHECK_LBLOCK 8
100 #define XFS_ERRTAG_BTREE_CHECK_SBLOCK 9
101 #define XFS_ERRTAG_ALLOC_READ_AGF 10
102 #define XFS_ERRTAG_IALLOC_READ_AGI 11
103 #define XFS_ERRTAG_ITOBP_INOTOBP 12
104 #define XFS_ERRTAG_IUNLINK 13
105 #define XFS_ERRTAG_IUNLINK_REMOVE 14
106 #define XFS_ERRTAG_DIR_INO_VALIDATE 15
107 #define XFS_ERRTAG_BULKSTAT_READ_CHUNK 16
108 #define XFS_ERRTAG_IODONE_IOERR 17
109 #define XFS_ERRTAG_STRATREAD_IOERR 18
110 #define XFS_ERRTAG_STRATCMPL_IOERR 19
111 #define XFS_ERRTAG_DIOWRITE_IOERR 20
112 #define XFS_ERRTAG_BMAPIFORMAT 21
113 #define XFS_ERRTAG_MAX 22
116 * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
118 #define XFS_RANDOM_DEFAULT 100
119 #define XFS_RANDOM_IFLUSH_1 XFS_RANDOM_DEFAULT
120 #define XFS_RANDOM_IFLUSH_2 XFS_RANDOM_DEFAULT
121 #define XFS_RANDOM_IFLUSH_3 XFS_RANDOM_DEFAULT
122 #define XFS_RANDOM_IFLUSH_4 XFS_RANDOM_DEFAULT
123 #define XFS_RANDOM_IFLUSH_5 XFS_RANDOM_DEFAULT
124 #define XFS_RANDOM_IFLUSH_6 XFS_RANDOM_DEFAULT
125 #define XFS_RANDOM_DA_READ_BUF XFS_RANDOM_DEFAULT
126 #define XFS_RANDOM_BTREE_CHECK_LBLOCK (XFS_RANDOM_DEFAULT/4)
127 #define XFS_RANDOM_BTREE_CHECK_SBLOCK XFS_RANDOM_DEFAULT
128 #define XFS_RANDOM_ALLOC_READ_AGF XFS_RANDOM_DEFAULT
129 #define XFS_RANDOM_IALLOC_READ_AGI XFS_RANDOM_DEFAULT
130 #define XFS_RANDOM_ITOBP_INOTOBP XFS_RANDOM_DEFAULT
131 #define XFS_RANDOM_IUNLINK XFS_RANDOM_DEFAULT
132 #define XFS_RANDOM_IUNLINK_REMOVE XFS_RANDOM_DEFAULT
133 #define XFS_RANDOM_DIR_INO_VALIDATE XFS_RANDOM_DEFAULT
134 #define XFS_RANDOM_BULKSTAT_READ_CHUNK XFS_RANDOM_DEFAULT
135 #define XFS_RANDOM_IODONE_IOERR (XFS_RANDOM_DEFAULT/10)
136 #define XFS_RANDOM_STRATREAD_IOERR (XFS_RANDOM_DEFAULT/10)
137 #define XFS_RANDOM_STRATCMPL_IOERR (XFS_RANDOM_DEFAULT/10)
138 #define XFS_RANDOM_DIOWRITE_IOERR (XFS_RANDOM_DEFAULT/10)
139 #define XFS_RANDOM_BMAPIFORMAT XFS_RANDOM_DEFAULT
141 #if (defined(DEBUG) || defined(INDUCE_IO_ERROR))
142 extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
143 void xfs_error_test_init(void);
145 #define XFS_NUM_INJECT_ERROR 10
148 #define XFS_TEST_ERROR(expr, mp, tag, rf) \
150 xfs_error_test((tag), (mp)->m_fixedfsid, #expr, __LINE__, __FILE__, \
153 #define XFS_TEST_ERROR(expr, mp, tag, rf) \
155 xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \
157 #endif /* __ANSI_CPP__ */
159 int xfs_errortag_add(int error_tag
, xfs_mount_t
*mp
);
160 int xfs_errortag_clear(int error_tag
, xfs_mount_t
*mp
);
162 int xfs_errortag_clearall(xfs_mount_t
*mp
);
163 int xfs_errortag_clearall_umount(int64_t fsid
, char *fsname
,
166 #define XFS_TEST_ERROR(expr, mp, tag, rf) (expr)
167 #define xfs_errortag_add(tag, mp) (ENOSYS)
168 #define xfs_errortag_clearall(mp) (ENOSYS)
169 #endif /* (DEBUG || INDUCE_IO_ERROR) */
172 * XFS panic tags -- allow a call to xfs_cmn_err() be turned into
173 * a panic by setting xfs_panic_mask in a
174 * sysctl. update xfs_max[XFS_PARAM] if
177 #define XFS_NO_PTAG 0
178 #define XFS_PTAG_IFLUSH 0x00000001
179 #define XFS_PTAG_LOGRES 0x00000002
180 #define XFS_PTAG_AILDELETE 0x00000004
181 #define XFS_PTAG_ERROR_REPORT 0x00000008
182 #define XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
183 #define XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
184 #define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
188 void xfs_cmn_err(int panic_tag
, int level
, struct xfs_mount
*mp
,
191 void xfs_fs_cmn_err(int level
, struct xfs_mount
*mp
, char *fmt
, ...);
193 #endif /* __XFS_ERROR_H__ */