diff options
Diffstat (limited to 'Documentation/filesystems/configfs/configfs.txt')
| -rw-r--r-- | Documentation/filesystems/configfs/configfs.txt | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt index b40fec9d3f53..af68efdbbfad 100644 --- a/Documentation/filesystems/configfs/configfs.txt +++ b/Documentation/filesystems/configfs/configfs.txt | |||
| @@ -160,12 +160,6 @@ among other things. For that, it needs a type. | |||
| 160 | 160 | ||
| 161 | struct configfs_item_operations { | 161 | struct configfs_item_operations { |
| 162 | void (*release)(struct config_item *); | 162 | 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); | ||
| 169 | int (*allow_link)(struct config_item *src, | 163 | int (*allow_link)(struct config_item *src, |
| 170 | struct config_item *target); | 164 | struct config_item *target); |
| 171 | int (*drop_link)(struct config_item *src, | 165 | int (*drop_link)(struct config_item *src, |
| @@ -183,9 +177,7 @@ The most basic function of a config_item_type is to define what | |||
| 183 | operations can be performed on a config_item. All items that have been | 177 | operations can be performed on a config_item. All items that have been |
| 184 | allocated dynamically will need to provide the ct_item_ops->release() | 178 | allocated dynamically will need to provide the ct_item_ops->release() |
| 185 | method. This method is called when the config_item's reference count | 179 | method. This method is called when the config_item's reference count |
| 186 | reaches zero. Items that wish to display an attribute need to provide | 180 | reaches zero. |
| 187 | the ct_item_ops->show_attribute() method. Similarly, storing a new | ||
| 188 | attribute value uses the store_attribute() method. | ||
| 189 | 181 | ||
| 190 | [struct configfs_attribute] | 182 | [struct configfs_attribute] |
| 191 | 183 | ||
| @@ -193,6 +185,8 @@ attribute value uses the store_attribute() method. | |||
| 193 | char *ca_name; | 185 | char *ca_name; |
| 194 | struct module *ca_owner; | 186 | struct module *ca_owner; |
| 195 | umode_t ca_mode; | 187 | umode_t ca_mode; |
| 188 | ssize_t (*show)(struct config_item *, char *); | ||
| 189 | ssize_t (*store)(struct config_item *, const char *, size_t); | ||
| 196 | }; | 190 | }; |
| 197 | 191 | ||
| 198 | When a config_item wants an attribute to appear as a file in the item's | 192 | When 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 | |||
| 202 | attribute file will appear with the configfs_attribute->ca_name | 196 | attribute file will appear with the configfs_attribute->ca_name |
| 203 | filename. configfs_attribute->ca_mode specifies the file permissions. | 197 | filename. configfs_attribute->ca_mode specifies the file permissions. |
| 204 | 198 | ||
| 205 | If an attribute is readable and the config_item provides a | 199 | If an attribute is readable and provides a ->show method, that method will |
| 206 | ct_item_ops->show_attribute() method, that method will be called | 200 | be called whenever userspace asks for a read(2) on the attribute. If an |
| 207 | whenever userspace asks for a read(2) on the attribute. The converse | 201 | attribute is writable and provides a ->store method, that method will be |
| 208 | will happen for write(2). | 202 | be called whenever userspace asks for a write(2) on the attribute. |
| 209 | 203 | ||
| 210 | [struct config_group] | 204 | [struct config_group] |
| 211 | 205 | ||
| @@ -311,20 +305,10 @@ the subsystem must be ready for it. | |||
| 311 | [An Example] | 305 | [An Example] |
| 312 | 306 | ||
| 313 | The best example of these basic concepts is the simple_children | 307 | The best example of these basic concepts is the simple_children |
| 314 | subsystem/group and the simple_child item in configfs_example_explicit.c | 308 | subsystem/group and the simple_child item in |
| 315 | and configfs_example_macros.c. It shows a trivial object displaying and | 309 | samples/configfs/configfs_sample.c. It shows a trivial object displaying |
| 316 | storing an attribute, and a simple group creating and destroying these | 310 | and storing an attribute, and a simple group creating and destroying |
| 317 | children. | 311 | these 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. | ||
| 328 | 312 | ||
| 329 | [Hierarchy Navigation and the Subsystem Mutex] | 313 | [Hierarchy Navigation and the Subsystem Mutex] |
| 330 | 314 | ||
