@@ -160,12 +160,6 @@ among other things. For that, it needs a type.
160160
161161 struct configfs_item_operations {
162162 void (*release)(struct config_item *);
163- ssize_t (*show_attribute)(struct config_item *,
164- struct configfs_attribute *,
165- char *);
166- ssize_t (*store_attribute)(struct config_item *,
167- struct configfs_attribute *,
168- const char *, size_t);
169163 int (*allow_link)(struct config_item *src,
170164 struct config_item *target);
171165 int (*drop_link)(struct config_item *src,
@@ -183,16 +177,16 @@ The most basic function of a config_item_type is to define what
183177operations can be performed on a config_item. All items that have been
184178allocated dynamically will need to provide the ct_item_ops->release()
185179method. This method is called when the config_item's reference count
186- reaches zero. Items that wish to display an attribute need to provide
187- the ct_item_ops->show_attribute() method. Similarly, storing a new
188- attribute value uses the store_attribute() method.
180+ reaches zero.
189181
190182[struct configfs_attribute]
191183
192184 struct configfs_attribute {
193185 char *ca_name;
194186 struct module *ca_owner;
195187 umode_t ca_mode;
188+ ssize_t (*show)(struct config_item *, char *);
189+ ssize_t (*store)(struct config_item *, const char *, size_t);
196190 };
197191
198192When a config_item wants an attribute to appear as a file in the item's
@@ -202,10 +196,10 @@ config_item_type->ct_attrs. When the item appears in configfs, the
202196attribute file will appear with the configfs_attribute->ca_name
203197filename. configfs_attribute->ca_mode specifies the file permissions.
204198
205- If an attribute is readable and the config_item provides a
206- ct_item_ops->show_attribute() method, that method will be called
207- whenever userspace asks for a read(2) on the attribute. The converse
208- will happen for write(2).
199+ If an attribute is readable and provides a ->show method, that method will
200+ be called whenever userspace asks for a read(2) on the attribute. If an
201+ attribute is writable and provides a ->store method, that method will be
202+ be called whenever userspace asks for a write(2) on the attribute .
209203
210204[struct config_group]
211205
@@ -311,20 +305,10 @@ the subsystem must be ready for it.
311305[An Example]
312306
313307The best example of these basic concepts is the simple_children
314- subsystem/group and the simple_child item in configfs_example_explicit.c
315- and configfs_example_macros.c. It shows a trivial object displaying and
316- storing an attribute, and a simple group creating and destroying these
317- children.
318-
319- The only difference between configfs_example_explicit.c and
320- configfs_example_macros.c is how the attributes of the childless item
321- are defined. The childless item has extended attributes, each with
322- their own show()/store() operation. This follows a convention commonly
323- used in sysfs. configfs_example_explicit.c creates these attributes
324- by explicitly defining the structures involved. Conversely
325- configfs_example_macros.c uses some convenience macros from configfs.h
326- to define the attributes. These macros are similar to their sysfs
327- counterparts.
308+ subsystem/group and the simple_child item in
309+ samples/configfs/configfs_sample.c. It shows a trivial object displaying
310+ and storing an attribute, and a simple group creating and destroying
311+ these children.
328312
329313[Hierarchy Navigation and the Subsystem Mutex]
330314
0 commit comments