aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/configfs.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-10-03 09:32:59 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-10-14 01:17:57 -0400
commit517982229f78b2aebf00a8a337e84e8eeea70b8e (patch)
tree6f5f093837a26d5b56874689234dc818951779ac /include/linux/configfs.h
parent45b997737a8025be2825e464e9e9dd5d07160dc3 (diff)
configfs: remove old API
Remove the old show_attribute and store_attribute methods and update the documentation. Also replace the two C samples with a single new one in the proper samples directory where people expect to find it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/linux/configfs.h')
-rw-r--r--include/linux/configfs.h82
1 files changed, 0 insertions, 82 deletions
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 85e9956a86de..a8a335b7fce0 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -155,86 +155,6 @@ static struct configfs_attribute _pfx##attr_##_name = { \
155} 155}
156 156
157/* 157/*
158 * Users often need to create attribute structures for their configurable
159 * attributes, containing a configfs_attribute member and function pointers
160 * for the show() and store() operations on that attribute. If they don't
161 * need anything else on the extended attribute structure, they can use
162 * this macro to define it The argument _item is the name of the
163 * config_item structure.
164 */
165#define CONFIGFS_ATTR_STRUCT(_item) \
166struct _item##_attribute { \
167 struct configfs_attribute attr; \
168 ssize_t (*show)(struct _item *, char *); \
169 ssize_t (*store)(struct _item *, const char *, size_t); \
170}
171
172/*
173 * With the extended attribute structure, users can use this macro
174 * (similar to sysfs' __ATTR) to make defining attributes easier.
175 * An example:
176 * #define MYITEM_ATTR(_name, _mode, _show, _store) \
177 * struct myitem_attribute childless_attr_##_name = \
178 * __CONFIGFS_ATTR(_name, _mode, _show, _store)
179 */
180#define __CONFIGFS_ATTR(_name, _mode, _show, _store) \
181{ \
182 .attr = { \
183 .ca_name = __stringify(_name), \
184 .ca_mode = _mode, \
185 .ca_owner = THIS_MODULE, \
186 }, \
187 .show = _show, \
188 .store = _store, \
189}
190/* Here is a readonly version, only requiring a show() operation */
191#define __CONFIGFS_ATTR_RO(_name, _show) \
192{ \
193 .attr = { \
194 .ca_name = __stringify(_name), \
195 .ca_mode = 0444, \
196 .ca_owner = THIS_MODULE, \
197 }, \
198 .show = _show, \
199}
200
201/*
202 * With these extended attributes, the simple show_attribute() and
203 * store_attribute() operations need to call the show() and store() of the
204 * attributes. This is a common pattern, so we provide a macro to define
205 * them. The argument _item is the name of the config_item structure.
206 * This macro expects the attributes to be named "struct <name>_attribute"
207 * and the function to_<name>() to exist;
208 */
209#define CONFIGFS_ATTR_OPS(_item) \
210static ssize_t _item##_attr_show(struct config_item *item, \
211 struct configfs_attribute *attr, \
212 char *page) \
213{ \
214 struct _item *_item = to_##_item(item); \
215 struct _item##_attribute *_item##_attr = \
216 container_of(attr, struct _item##_attribute, attr); \
217 ssize_t ret = 0; \
218 \
219 if (_item##_attr->show) \
220 ret = _item##_attr->show(_item, page); \
221 return ret; \
222} \
223static ssize_t _item##_attr_store(struct config_item *item, \
224 struct configfs_attribute *attr, \
225 const char *page, size_t count) \
226{ \
227 struct _item *_item = to_##_item(item); \
228 struct _item##_attribute *_item##_attr = \
229 container_of(attr, struct _item##_attribute, attr); \
230 ssize_t ret = -EINVAL; \
231 \
232 if (_item##_attr->store) \
233 ret = _item##_attr->store(_item, page, count); \
234 return ret; \
235}
236
237/*
238 * If allow_link() exists, the item can symlink(2) out to other 158 * If allow_link() exists, the item can symlink(2) out to other
239 * items. If the item is a group, it may support mkdir(2). 159 * items. If the item is a group, it may support mkdir(2).
240 * Groups supply one of make_group() and make_item(). If the 160 * Groups supply one of make_group() and make_item(). If the
@@ -250,8 +170,6 @@ static ssize_t _item##_attr_store(struct config_item *item, \
250 */ 170 */
251struct configfs_item_operations { 171struct configfs_item_operations {
252 void (*release)(struct config_item *); 172 void (*release)(struct config_item *);
253 ssize_t (*show_attribute)(struct config_item *, struct configfs_attribute *,char *);
254 ssize_t (*store_attribute)(struct config_item *,struct configfs_attribute *,const char *, size_t);
255 int (*allow_link)(struct config_item *src, struct config_item *target); 173 int (*allow_link)(struct config_item *src, struct config_item *target);
256 int (*drop_link)(struct config_item *src, struct config_item *target); 174 int (*drop_link)(struct config_item *src, struct config_item *target);
257}; 175};