Blame view
include/asm-generic/error-injection.h
1.13 KB
540adea38
|
1 2 3 4 5 |
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_ERROR_INJECTION_H #define _ASM_GENERIC_ERROR_INJECTION_H #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
663faf9f7
|
6 7 8 9 10 |
enum { EI_ETYPE_NONE, /* Dummy value for undefined case */ EI_ETYPE_NULL, /* Return NULL if failure */ EI_ETYPE_ERRNO, /* Return -ERRNO if failure */ EI_ETYPE_ERRNO_NULL, /* Return -ERRNO or NULL if failure */ |
af3b85449
|
11 |
EI_ETYPE_TRUE, /* Return true if failure */ |
663faf9f7
|
12 13 14 15 16 17 |
}; struct error_injection_entry { unsigned long addr; int etype; }; |
45880f7b7
|
18 |
struct pt_regs; |
540adea38
|
19 20 21 22 23 |
#ifdef CONFIG_FUNCTION_ERROR_INJECTION /* * Whitelist ganerating macro. Specify functions which can be * error-injectable using this macro. */ |
663faf9f7
|
24 25 |
#define ALLOW_ERROR_INJECTION(fname, _etype) \ static struct error_injection_entry __used \ |
33def8498
|
26 |
__section("_error_injection_whitelist") \ |
663faf9f7
|
27 28 29 30 |
_eil_addr_##fname = { \ .addr = (unsigned long)fname, \ .etype = EI_ETYPE_##_etype, \ }; |
45880f7b7
|
31 32 |
void override_function_with_return(struct pt_regs *regs); |
540adea38
|
33 |
#else |
663faf9f7
|
34 |
#define ALLOW_ERROR_INJECTION(fname, _etype) |
45880f7b7
|
35 36 |
static inline void override_function_with_return(struct pt_regs *regs) { } |
540adea38
|
37 38 39 40 |
#endif #endif #endif /* _ASM_GENERIC_ERROR_INJECTION_H */ |