Re: [PATCH] seq_file.h: introduce DECLARE_SEQ_FOPS_{RO,RW}
From: Arnd Bergmann
Date: Mon Jun 06 2011 - 17:26:57 EST
On Monday 06 June 2011 23:19:15 H Hartley Sweeten wrote:
> 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, \
> };
The main difference here is that the arguments to the macro are used directly
in the file operations, which makes it possible to grep for them.
Arnd
--
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/