0001
0002 #ifndef _ASM_GENERIC_ERROR_INJECTION_H
0003 #define _ASM_GENERIC_ERROR_INJECTION_H
0004
0005 #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
0006 enum {
0007 EI_ETYPE_NONE,
0008 EI_ETYPE_NULL,
0009 EI_ETYPE_ERRNO,
0010 EI_ETYPE_ERRNO_NULL,
0011 EI_ETYPE_TRUE,
0012 };
0013
0014 struct error_injection_entry {
0015 unsigned long addr;
0016 int etype;
0017 };
0018
0019 struct pt_regs;
0020
0021 #ifdef CONFIG_FUNCTION_ERROR_INJECTION
0022
0023
0024
0025
0026 #define ALLOW_ERROR_INJECTION(fname, _etype) \
0027 static struct error_injection_entry __used \
0028 __section("_error_injection_whitelist") \
0029 _eil_addr_##fname = { \
0030 .addr = (unsigned long)fname, \
0031 .etype = EI_ETYPE_##_etype, \
0032 }
0033
0034 void override_function_with_return(struct pt_regs *regs);
0035 #else
0036 #define ALLOW_ERROR_INJECTION(fname, _etype)
0037
0038 static inline void override_function_with_return(struct pt_regs *regs) { }
0039 #endif
0040 #endif
0041
0042 #endif