fault-injection: use debugfs_remove_recursive
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / fault-inject.h
bloba842db6383809cf41522424350573205f47226fd
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
14 struct fault_attr {
15 unsigned long probability;
16 unsigned long interval;
17 atomic_t times;
18 atomic_t space;
19 unsigned long verbose;
20 u32 task_filter;
21 unsigned long stacktrace_depth;
22 unsigned long require_start;
23 unsigned long require_end;
24 unsigned long reject_start;
25 unsigned long reject_end;
27 unsigned long count;
29 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
30 struct dentry *dir;
31 #endif
34 #define FAULT_ATTR_INITIALIZER { \
35 .interval = 1, \
36 .times = ATOMIC_INIT(1), \
37 .require_end = ULONG_MAX, \
38 .stacktrace_depth = 32, \
39 .verbose = 2, \
42 #define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
43 int setup_fault_attr(struct fault_attr *attr, char *str);
44 bool should_fail(struct fault_attr *attr, ssize_t size);
46 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
48 int init_fault_attr_dentries(struct fault_attr *attr, const char *name);
49 void cleanup_fault_attr_dentries(struct fault_attr *attr);
51 #else /* CONFIG_FAULT_INJECTION_DEBUG_FS */
53 static inline int init_fault_attr_dentries(struct fault_attr *attr,
54 const char *name)
56 return -ENODEV;
59 static inline void cleanup_fault_attr_dentries(struct fault_attr *attr)
63 #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
65 #endif /* CONFIG_FAULT_INJECTION */
67 #ifdef CONFIG_FAILSLAB
68 extern bool should_failslab(size_t size, gfp_t gfpflags, unsigned long flags);
69 #else
70 static inline bool should_failslab(size_t size, gfp_t gfpflags,
71 unsigned long flags)
73 return false;
75 #endif /* CONFIG_FAILSLAB */
77 #endif /* _LINUX_FAULT_INJECT_H */