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

Seth Jennings sjenning at linux.vnet.ibm.com
Tue Jan 29 20:49:10 UTC 2013


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 at linux.vnet.ibm.com>
>> Acked-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>> ---
>>  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




More information about the devel mailing list