Blame view
include/linux/fault-inject.h
1.84 KB
6ff1cb355
|
1 2 3 4 5 6 7 |
#ifndef _LINUX_FAULT_INJECT_H #define _LINUX_FAULT_INJECT_H #ifdef CONFIG_FAULT_INJECTION #include <linux/types.h> #include <linux/debugfs.h> |
6adc4a22f
|
8 |
#include <linux/ratelimit.h> |
60063497a
|
9 |
#include <linux/atomic.h> |
6ff1cb355
|
10 11 12 13 14 15 16 17 18 19 20 |
/* * For explanation of the elements of this struct, see * Documentation/fault-injection/fault-injection.txt */ struct fault_attr { unsigned long probability; unsigned long interval; atomic_t times; atomic_t space; unsigned long verbose; |
621a5f7ad
|
21 |
bool task_filter; |
329409aed
|
22 23 24 25 26 |
unsigned long stacktrace_depth; unsigned long require_start; unsigned long require_end; unsigned long reject_start; unsigned long reject_end; |
6ff1cb355
|
27 28 |
unsigned long count; |
6adc4a22f
|
29 30 |
struct ratelimit_state ratelimit_state; struct dentry *dname; |
6ff1cb355
|
31 |
}; |
6adc4a22f
|
32 33 34 35 36 37 38 39 |
#define FAULT_ATTR_INITIALIZER { \ .interval = 1, \ .times = ATOMIC_INIT(1), \ .require_end = ULONG_MAX, \ .stacktrace_depth = 32, \ .ratelimit_state = RATELIMIT_STATE_INIT_DISABLED, \ .verbose = 2, \ .dname = NULL, \ |
6ff1cb355
|
40 41 42 43 |
} #define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER int setup_fault_attr(struct fault_attr *attr, char *str); |
08b3df2d1
|
44 |
bool should_fail(struct fault_attr *attr, ssize_t size); |
6ff1cb355
|
45 46 |
#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS |
dd48c085c
|
47 48 |
struct dentry *fault_create_debugfs_attr(const char *name, struct dentry *parent, struct fault_attr *attr); |
6ff1cb355
|
49 50 |
#else /* CONFIG_FAULT_INJECTION_DEBUG_FS */ |
dd48c085c
|
51 52 |
static inline struct dentry *fault_create_debugfs_attr(const char *name, struct dentry *parent, struct fault_attr *attr) |
6ff1cb355
|
53 |
{ |
dd48c085c
|
54 |
return ERR_PTR(-ENODEV); |
6ff1cb355
|
55 56 57 58 59 |
} #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ #endif /* CONFIG_FAULT_INJECTION */ |
773ff60e8
|
60 |
#ifdef CONFIG_FAILSLAB |
4c13dd3b4
|
61 |
extern bool should_failslab(size_t size, gfp_t gfpflags, unsigned long flags); |
773ff60e8
|
62 |
#else |
4c13dd3b4
|
63 64 |
static inline bool should_failslab(size_t size, gfp_t gfpflags, unsigned long flags) |
773ff60e8
|
65 66 67 68 |
{ return false; } #endif /* CONFIG_FAILSLAB */ |
6ff1cb355
|
69 |
#endif /* _LINUX_FAULT_INJECT_H */ |