aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/configfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/configfs.h')
-rw-r--r--include/linux/configfs.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 758a029011b1..f7300d023dbe 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -51,6 +51,7 @@ struct module;
51struct configfs_item_operations; 51struct configfs_item_operations;
52struct configfs_group_operations; 52struct configfs_group_operations;
53struct configfs_attribute; 53struct configfs_attribute;
54struct configfs_bin_attribute;
54struct configfs_subsystem; 55struct configfs_subsystem;
55 56
56struct config_item { 57struct config_item {
@@ -84,6 +85,7 @@ struct config_item_type {
84 struct configfs_item_operations *ct_item_ops; 85 struct configfs_item_operations *ct_item_ops;
85 struct configfs_group_operations *ct_group_ops; 86 struct configfs_group_operations *ct_group_ops;
86 struct configfs_attribute **ct_attrs; 87 struct configfs_attribute **ct_attrs;
88 struct configfs_bin_attribute **ct_bin_attrs;
87}; 89};
88 90
89/** 91/**
@@ -154,6 +156,54 @@ static struct configfs_attribute _pfx##attr_##_name = { \
154 .store = _pfx##_name##_store, \ 156 .store = _pfx##_name##_store, \
155} 157}
156 158
159struct file;
160struct vm_area_struct;
161
162struct configfs_bin_attribute {
163 struct configfs_attribute cb_attr; /* std. attribute */
164 void *cb_private; /* for user */
165 size_t cb_max_size; /* max core size */
166 ssize_t (*read)(struct config_item *, void *, size_t);
167 ssize_t (*write)(struct config_item *, const void *, size_t);
168};
169
170#define CONFIGFS_BIN_ATTR(_pfx, _name, _priv, _maxsz) \
171static struct configfs_bin_attribute _pfx##attr_##_name = { \
172 .cb_attr = { \
173 .ca_name = __stringify(_name), \
174 .ca_mode = S_IRUGO | S_IWUSR, \
175 .ca_owner = THIS_MODULE, \
176 }, \
177 .cb_private = _priv, \
178 .cb_max_size = _maxsz, \
179 .read = _pfx##_name##_read, \
180 .write = _pfx##_name##_write, \
181}
182
183#define CONFIGFS_BIN_ATTR_RO(_pfx, _name, _priv, _maxsz) \
184static struct configfs_attribute _pfx##attr_##_name = { \
185 .cb_attr = { \
186 .ca_name = __stringify(_name), \
187 .ca_mode = S_IRUGO, \
188 .ca_owner = THIS_MODULE, \
189 }, \
190 .cb_private = _priv, \
191 .cb_max_size = _maxsz, \
192 .read = _pfx##_name##_read, \
193}
194
195#define CONFIGFS_BIN_ATTR_WO(_pfx, _name, _priv, _maxsz) \
196static struct configfs_attribute _pfx##attr_##_name = { \
197 .cb_attr = { \
198 .ca_name = __stringify(_name), \
199 .ca_mode = S_IWUSR, \
200 .ca_owner = THIS_MODULE, \
201 }, \
202 .cb_private = _priv, \
203 .cb_max_size = _maxsz, \
204 .write = _pfx##_name##_write, \
205}
206
157/* 207/*
158 * If allow_link() exists, the item can symlink(2) out to other 208 * If allow_link() exists, the item can symlink(2) out to other
159 * items. If the item is a group, it may support mkdir(2). 209 * items. If the item is a group, it may support mkdir(2).