Re: [PATCHv3 1/6] debugfs: add get/set for atomic types

From: Seth Jennings
Date: Tue Jan 29 2013 - 15:50:17 EST


On 01/29/2013 02:35 PM, Konrad Rzeszutek Wilk wrote:
> On Mon, Jan 28, 2013 at 03:49:22PM -0600, Seth Jennings wrote:
>> debugfs currently lack the ability to create attributes
>> that set/get atomic_t values.
>>
>> This patch adds support for this through a new
>> debugfs_create_atomic_t() function.
>>
>> Signed-off-by: Seth Jennings <sjenning@xxxxxxxxxxxxxxxxxx>
>> Acked-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>> ---
>> fs/debugfs/file.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>> include/linux/debugfs.h | 2 ++
>> 2 files changed, 44 insertions(+)
>>
>> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
>> index c5ca6ae..fa26d5b 100644
>> --- a/fs/debugfs/file.c
>> +++ b/fs/debugfs/file.c
>> @@ -21,6 +21,7 @@
>> #include <linux/debugfs.h>
>> #include <linux/io.h>
>> #include <linux/slab.h>
>> +#include <linux/atomic.h>
>>
>> static ssize_t default_read_file(struct file *file, char __user *buf,
>> size_t count, loff_t *ppos)
>> @@ -403,6 +404,47 @@ struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
>> }
>> EXPORT_SYMBOL_GPL(debugfs_create_size_t);
>>
>> +static int debugfs_atomic_t_set(void *data, u64 val)
>
> Should the 'data' be 'atomic_t *' just to make sure nobody messes this
> up? Or would that bring too much header changes?

DEFINE_SIMPLE_ATTRIBUTE() uses simple_attr_open() whose signature
requires the argument be a void *. So we can't change it (easily).

Seth

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/