Skip to content

Commit

Permalink
configfs: remove old API
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
  • Loading branch information
Christoph Hellwig authored and Nicholas Bellinger committed Oct 14, 2015
1 parent 45b9977 commit 5179822
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 701 deletions.
2 changes: 0 additions & 2 deletions Documentation/filesystems/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
subdir-y := configfs

# List of programs to build
hostprogs-y := dnotify_test

Expand Down
3 changes: 0 additions & 3 deletions Documentation/filesystems/configfs/Makefile

This file was deleted.

38 changes: 11 additions & 27 deletions Documentation/filesystems/configfs/configfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ among other things. For that, it needs a type.

struct configfs_item_operations {
void (*release)(struct config_item *);
ssize_t (*show_attribute)(struct config_item *,
struct configfs_attribute *,
char *);
ssize_t (*store_attribute)(struct config_item *,
struct configfs_attribute *,
const char *, size_t);
int (*allow_link)(struct config_item *src,
struct config_item *target);
int (*drop_link)(struct config_item *src,
Expand All @@ -183,16 +177,16 @@ The most basic function of a config_item_type is to define what
operations can be performed on a config_item. All items that have been
allocated dynamically will need to provide the ct_item_ops->release()
method. This method is called when the config_item's reference count
reaches zero. Items that wish to display an attribute need to provide
the ct_item_ops->show_attribute() method. Similarly, storing a new
attribute value uses the store_attribute() method.
reaches zero.

[struct configfs_attribute]

struct configfs_attribute {
char *ca_name;
struct module *ca_owner;
umode_t ca_mode;
ssize_t (*show)(struct config_item *, char *);
ssize_t (*store)(struct config_item *, const char *, size_t);
};

When a config_item wants an attribute to appear as a file in the item's
Expand All @@ -202,10 +196,10 @@ config_item_type->ct_attrs. When the item appears in configfs, the
attribute file will appear with the configfs_attribute->ca_name
filename. configfs_attribute->ca_mode specifies the file permissions.

If an attribute is readable and the config_item provides a
ct_item_ops->show_attribute() method, that method will be called
whenever userspace asks for a read(2) on the attribute. The converse
will happen for write(2).
If an attribute is readable and provides a ->show method, that method will
be called whenever userspace asks for a read(2) on the attribute. If an
attribute is writable and provides a ->store method, that method will be
be called whenever userspace asks for a write(2) on the attribute.

[struct config_group]

Expand Down Expand Up @@ -311,20 +305,10 @@ the subsystem must be ready for it.
[An Example]

The best example of these basic concepts is the simple_children
subsystem/group and the simple_child item in configfs_example_explicit.c
and configfs_example_macros.c. It shows a trivial object displaying and
storing an attribute, and a simple group creating and destroying these
children.

The only difference between configfs_example_explicit.c and
configfs_example_macros.c is how the attributes of the childless item
are defined. The childless item has extended attributes, each with
their own show()/store() operation. This follows a convention commonly
used in sysfs. configfs_example_explicit.c creates these attributes
by explicitly defining the structures involved. Conversely
configfs_example_macros.c uses some convenience macros from configfs.h
to define the attributes. These macros are similar to their sysfs
counterparts.
subsystem/group and the simple_child item in
samples/configfs/configfs_sample.c. It shows a trivial object displaying
and storing an attribute, and a simple group creating and destroying
these children.

[Hierarchy Navigation and the Subsystem Mutex]

Expand Down
Loading

0 comments on commit 5179822

Please sign in to comment.