mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
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. [akpm@linux-foundation.org: build fix] Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: <stefano.brivio@polimi.it> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg KH <greg@kroah.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
efae09f3e9
commit
8b88b0998e
7 changed files with 69 additions and 47 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue