[PATCH] sysfs: Add __ATTR_RELAY() helper for relay attributes.
From: Paul Mundt
Date: Tue Feb 21 2006 - 10:09:38 EST
On Mon, Feb 20, 2006 at 02:24:49PM -0800, Greg KH wrote:
> One thing to note, a lot of people forgot to set that field for binary
> attribute files, while "normal" attributes get it set "automatically"
> due to the macro that was used to create them. You might consider also
> creating a macro for this struture so people can not forget to set the
> field.
>
Good point, how about this?
This adds a simple __ATTR_RELAY() to help people define relay attributes,
this takes care of things like getting the module owner right.
Signed-off-by: Paul Mundt <lethal@xxxxxxxxxxxx>
---
include/linux/sysfs.h | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
5a1440482f48b3ab4b8365a8081295869992bad2
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 0faca48..36a078e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -44,6 +44,16 @@ struct attribute_group {
.show = _name##_show, \
}
+#define __ATTR_RELAY(_name,_buffer_size,_nr_buffers) { \
+ .attr = { \
+ .owner = THIS_MODULE, \
+ .name = __stringify(_name), \
+ .mode = 0400, \
+ }, \
+ .subbuf_size = _buffer_size, \
+ .n_subbufs = _nr_buffers, \
+}
+
#define __ATTR_NULL { .attr = { .name = NULL } }
#define attr_name(_attr) (_attr).attr.name
-
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/