aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/configfs/configfs.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems/configfs/configfs.txt')
-rw-r--r--Documentation/filesystems/configfs/configfs.txt38
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
183operations can be performed on a config_item. All items that have been 177operations can be performed on a config_item. All items that have been
184allocated dynamically will need to provide the ct_item_ops->release() 178allocated dynamically will need to provide the ct_item_ops->release()
185method. This method is called when the config_item's reference count 179method. This method is called when the config_item's reference count
186reaches zero. Items that wish to display an attribute need to provide 180reaches zero.
187the ct_item_ops->show_attribute() method. Similarly, storing a new
188attribute 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
198When a config_item wants an attribute to appear as a file in the item's 192When 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
202attribute file will appear with the configfs_attribute->ca_name 196attribute file will appear with the configfs_attribute->ca_name
203filename. configfs_attribute->ca_mode specifies the file permissions. 197filename. configfs_attribute->ca_mode specifies the file permissions.
204 198
205If an attribute is readable and the config_item provides a 199If an attribute is readable and provides a ->show method, that method will
206ct_item_ops->show_attribute() method, that method will be called 200be called whenever userspace asks for a read(2) on the attribute. If an
207whenever userspace asks for a read(2) on the attribute. The converse 201attribute is writable and provides a ->store method, that method will be
208will happen for write(2). 202be 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
313The best example of these basic concepts is the simple_children 307The best example of these basic concepts is the simple_children
314subsystem/group and the simple_child item in configfs_example_explicit.c 308subsystem/group and the simple_child item in
315and configfs_example_macros.c. It shows a trivial object displaying and 309samples/configfs/configfs_sample.c. It shows a trivial object displaying
316storing an attribute, and a simple group creating and destroying these 310and storing an attribute, and a simple group creating and destroying
317children. 311these children.
318
319The only difference between configfs_example_explicit.c and
320configfs_example_macros.c is how the attributes of the childless item
321are defined. The childless item has extended attributes, each with
322their own show()/store() operation. This follows a convention commonly
323used in sysfs. configfs_example_explicit.c creates these attributes
324by explicitly defining the structures involved. Conversely
325configfs_example_macros.c uses some convenience macros from configfs.h
326to define the attributes. These macros are similar to their sysfs
327counterparts.
328 312
329[Hierarchy Navigation and the Subsystem Mutex] 313[Hierarchy Navigation and the Subsystem Mutex]
330 314