diff options
-rw-r--r-- | lib/fault-inject.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c index e6430e1ce180..882fd3b6a6ad 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c | |||
@@ -139,16 +139,6 @@ static int debugfs_ul_set(void *data, u64 val) | |||
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | 141 | ||
142 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER | ||
143 | static int debugfs_ul_set_MAX_STACK_TRACE_DEPTH(void *data, u64 val) | ||
144 | { | ||
145 | *(unsigned long *)data = | ||
146 | val < MAX_STACK_TRACE_DEPTH ? | ||
147 | val : MAX_STACK_TRACE_DEPTH; | ||
148 | return 0; | ||
149 | } | ||
150 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ | ||
151 | |||
152 | static int debugfs_ul_get(void *data, u64 *val) | 142 | static int debugfs_ul_get(void *data, u64 *val) |
153 | { | 143 | { |
154 | *val = *(unsigned long *)data; | 144 | *val = *(unsigned long *)data; |
@@ -164,16 +154,26 @@ static struct dentry *debugfs_create_ul(const char *name, mode_t mode, | |||
164 | } | 154 | } |
165 | 155 | ||
166 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER | 156 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER |
167 | DEFINE_SIMPLE_ATTRIBUTE(fops_ul_MAX_STACK_TRACE_DEPTH, debugfs_ul_get, | ||
168 | debugfs_ul_set_MAX_STACK_TRACE_DEPTH, "%llu\n"); | ||
169 | 157 | ||
170 | static struct dentry *debugfs_create_ul_MAX_STACK_TRACE_DEPTH( | 158 | static int debugfs_stacktrace_depth_set(void *data, u64 val) |
159 | { | ||
160 | *(unsigned long *)data = | ||
161 | min_t(unsigned long, val, MAX_STACK_TRACE_DEPTH); | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | DEFINE_SIMPLE_ATTRIBUTE(fops_stacktrace_depth, debugfs_ul_get, | ||
167 | debugfs_stacktrace_depth_set, "%llu\n"); | ||
168 | |||
169 | static struct dentry *debugfs_create_stacktrace_depth( | ||
171 | const char *name, mode_t mode, | 170 | const char *name, mode_t mode, |
172 | struct dentry *parent, unsigned long *value) | 171 | struct dentry *parent, unsigned long *value) |
173 | { | 172 | { |
174 | return debugfs_create_file(name, mode, parent, value, | 173 | return debugfs_create_file(name, mode, parent, value, |
175 | &fops_ul_MAX_STACK_TRACE_DEPTH); | 174 | &fops_stacktrace_depth); |
176 | } | 175 | } |
176 | |||
177 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ | 177 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ |
178 | 178 | ||
179 | static int debugfs_atomic_t_set(void *data, u64 val) | 179 | static int debugfs_atomic_t_set(void *data, u64 val) |
@@ -281,7 +281,7 @@ int init_fault_attr_dentries(struct fault_attr *attr, const char *name) | |||
281 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER | 281 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER |
282 | 282 | ||
283 | attr->dentries.stacktrace_depth_file = | 283 | attr->dentries.stacktrace_depth_file = |
284 | debugfs_create_ul_MAX_STACK_TRACE_DEPTH( | 284 | debugfs_create_stacktrace_depth( |
285 | "stacktrace-depth", mode, dir, &attr->stacktrace_depth); | 285 | "stacktrace-depth", mode, dir, &attr->stacktrace_depth); |
286 | 286 | ||
287 | attr->dentries.require_start_file = | 287 | attr->dentries.require_start_file = |