Merge to Fedora kernel-2.6.7-1.492
[linux-2.6.git] / include / linux / sysfs.h
index 4cb5437..f94c7ac 100644 (file)
@@ -24,6 +24,27 @@ struct attribute_group {
 };
 
 
+
+/**
+ * Use these macros to make defining attributes easier. See include/linux/device.h
+ * for examples..
+ */
+
+#define __ATTR(_name,_mode,_show,_store) { \
+       .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE },     \
+       .show   = _show,                                        \
+       .store  = _store,                                       \
+}
+
+#define __ATTR_RO(_name) { \
+       .attr   = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE },   \
+       .show   = _name##_show, \
+}
+
+#define __ATTR_NULL { .attr = { .name = NULL } }
+
+#define attr_name(_attr) (_attr).attr.name
+
 struct bin_attribute {
        struct attribute        attr;
        size_t                  size;