lkml.org 
[lkml]   [2011]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRE: [PATCH] seq_file.h: introduce DECLARE_SEQ_FOPS_{RO,RW}
On Monday, June 06, 2011 2:08 PM, Al Viro wrote:
> On Mon, Jun 06, 2011 at 01:19:45PM -0700, H Hartley Sweeten wrote:
>> Many of the procfs and debugfs attribute file_operations in the kernel are
>> missing the .owner information. Introduce some macro's to fill in the .owner
>> field as well as the common methods for virtual file file_operations. This
>> simplifies creating the attributes and makes sure all the fields are properly
>> initialized.
>>
>> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>
> Nacked-by: Al Viro <viro@zeniv.linux.org.uk>
> Nacked-because: too ugly
>
> Don't play that kind of games with preprocessor.

Just an FYI, the exact same thing is being done with DEFINE_SIMPLE_ATTRIBUTE
in fs.h:

#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \
static int __fops ## _open(struct inode *inode, struct file *file) \
{ \
__simple_attr_check_format(__fmt, 0ull); \
return simple_attr_open(inode, file, __get, __set, __fmt); \
} \
static const struct file_operations __fops = { \
.owner = THIS_MODULE, \
.open = __fops ## _open, \
.release = simple_attr_release, \
.read = simple_attr_read, \
.write = simple_attr_write, \
.llseek = generic_file_llseek, \
};

Regards,
Hartley


\
 
 \ /
  Last update: 2011-06-06 23:21    [W:0.049 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site