aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/sysfs.h
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2017-08-08 04:30:22 +0000
committerMark Johnston <markj@FreeBSD.org>2017-08-08 04:30:22 +0000
commit48dac28d6397ac336eb703562b25792041270944 (patch)
tree0e17f540ec1178b0d48dc33f48901f99432ea201 /sys/compat/linuxkpi/common/include/linux/sysfs.h
parenta4a801688c909ef39cbcbc3488bc4fdbabd69d66 (diff)
Notes
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/sysfs.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/sysfs.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h
index f16c38b90efc..ea7acff8a45d 100644
--- a/sys/compat/linuxkpi/common/include/linux/sysfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h
@@ -54,14 +54,21 @@ struct attribute_group {
.attr = { .name = __stringify(_name), .mode = _mode }, \
.show = _show, .store = _store, \
}
-
-#define __ATTR_RO(_name) { \
- .attr = { .name = __stringify(_name), .mode = 0444 }, \
- .show = _name##_show, \
-}
+#define __ATTR_RO(_name) __ATTR(_name, 0444, _name##_show, NULL)
+#define __ATTR_WO(_name) __ATTR(_name, 0200, NULL, _name##_store)
+#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
#define __ATTR_NULL { .attr = { .name = NULL } }
+#define ATTRIBUTE_GROUPS(_name) \
+ static struct attribute_group _name##_group = { \
+ .attrs = _name##_attrs, \
+ }; \
+ static struct attribute_group *_name##_groups[] = { \
+ &_name##_group, \
+ NULL, \
+ };
+
/*
* Handle our generic '\0' terminated 'C' string.
* Two cases: