1 #ifndef _LINUX_FAULT_INJECT_H
2 #define _LINUX_FAULT_INJECT_H
4 #ifdef CONFIG_FAULT_INJECTION
6 #include <linux/types.h>
7 #include <linux/debugfs.h>
8 #include <asm/atomic.h>
11 * For explanation of the elements of this struct, see
12 * Documentation/fault-injection/fault-injection.txt
15 unsigned long probability;
16 unsigned long interval;
19 unsigned long verbose;
23 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
28 struct dentry *probability_file;
29 struct dentry *interval_file;
30 struct dentry *times_file;
31 struct dentry *space_file;
32 struct dentry *verbose_file;
38 #define FAULT_ATTR_INITIALIZER { \
40 .times = ATOMIC_INIT(1), \
43 #define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
44 int setup_fault_attr(struct fault_attr *attr, char *str);
45 void should_fail_srandom(unsigned long entropy);
46 int should_fail(struct fault_attr *attr, ssize_t size);
48 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
50 int init_fault_attr_dentries(struct fault_attr *attr, const char *name);
51 void cleanup_fault_attr_dentries(struct fault_attr *attr);
53 #else /* CONFIG_FAULT_INJECTION_DEBUG_FS */
55 static inline int init_fault_attr_dentries(struct fault_attr *attr,
61 static inline void cleanup_fault_attr_dentries(struct fault_attr *attr)
65 #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
67 #endif /* CONFIG_FAULT_INJECTION */
69 #endif /* _LINUX_FAULT_INJECT_H */