diff options
| author | Christoph Hellwig <[email protected]> | 2008-02-08 12:20:26 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2008-02-08 17:22:34 +0000 |
| commit | 8b88b0998e35d239e74446cc30f354bdab86df89 (patch) | |
| tree | c13773b744cf12b1e30ec9336a4acaf21e46c6d9 /lib/fault-inject.c | |
| parent | Nuke duplicate header from sysctl.c (diff) | |
| download | kernel-8b88b0998e35d239e74446cc30f354bdab86df89.tar.gz kernel-8b88b0998e35d239e74446cc30f354bdab86df89.zip | |
libfs: allow error return from simple attributes
Sometimes simple attributes might need to return an error, e.g. for
acquiring a mutex interruptibly. In fact we have that situation in
spufs already which is the original user of the simple attributes. This
patch merged the temporarily forked attributes in spufs back into the
main ones and allows to return errors.
[[email protected]: build fix]
Signed-off-by: Christoph Hellwig <[email protected]>
Cc: <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/fault-inject.c')
| -rw-r--r-- | lib/fault-inject.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c index 23985a278bbb..a50a311554cc 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c @@ -134,23 +134,26 @@ bool should_fail(struct fault_attr *attr, ssize_t size) #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS -static void debugfs_ul_set(void *data, u64 val) +static int debugfs_ul_set(void *data, u64 val) { *(unsigned long *)data = val; + return 0; } #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER -static void debugfs_ul_set_MAX_STACK_TRACE_DEPTH(void *data, u64 val) +static int debugfs_ul_set_MAX_STACK_TRACE_DEPTH(void *data, u64 val) { *(unsigned long *)data = val < MAX_STACK_TRACE_DEPTH ? val : MAX_STACK_TRACE_DEPTH; + return 0; } #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ -static u64 debugfs_ul_get(void *data) +static int debugfs_ul_get(void *data, u64 *val) { - return *(unsigned long *)data; + *val = *(unsigned long *)data; + return 0; } DEFINE_SIMPLE_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n"); @@ -174,14 +177,16 @@ static struct dentry *debugfs_create_ul_MAX_STACK_TRACE_DEPTH( } #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ -static void debugfs_atomic_t_set(void *data, u64 val) +static int debugfs_atomic_t_set(void *data, u64 val) { atomic_set((atomic_t *)data, val); + return 0; } -static u64 debugfs_atomic_t_get(void *data) +static int debugfs_atomic_t_get(void *data, u64 *val) { - return atomic_read((atomic_t *)data); + *val = atomic_read((atomic_t *)data); + return 0; } DEFINE_SIMPLE_ATTRIBUTE(fops_atomic_t, debugfs_atomic_t_get, |
