Skip to content

Commit 9aa3d65

Browse files
committed
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "This series contains HCH's changes to absorb configfs attribute ->show() + ->store() function pointer usage from it's original tree-wide consumers, into common configfs code. It includes usb-gadget, target w/ drivers, netconsole and ocfs2 changes to realize the improved simplicity, that now renders the original include/target/configfs_macros.h CPP magic for fabric drivers and others, unnecessary and obsolete. And with common code in place, new configfs attributes can be added easier than ever before. Note, there are further improvements in-flight from other folks for v4.5 code in configfs land, plus number of target fixes for post -rc1 code" In the meantime, a new user of the now-removed old configfs API came in through the char/misc tree in commit 7bd1d40 ("stm class: Introduce an abstraction for System Trace Module devices"). This merge resolution comes from Alexander Shishkin, who updated his stm class tracing abstraction to account for the removal of the old show_attribute and store_attribute methods in commit 5179822 ("configfs: remove old API") from this pull. As Alexander says about that patch: "There's no need to keep an extra wrapper structure per item and the awkward show_attribute/store_attribute item ops are no longer needed. This patch converts policy code to the new api, all the while making the code quite a bit smaller and easier on the eyes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>" That patch was folded into the merge so that the tree should be fully bisectable. * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (23 commits) configfs: remove old API ocfs2/cluster: use per-attribute show and store methods ocfs2/cluster: move locking into attribute store methods netconsole: use per-attribute show and store methods target: use per-attribute show and store methods spear13xx_pcie_gadget: use per-attribute show and store methods dlm: use per-attribute show and store methods usb-gadget/f_serial: use per-attribute show and store methods usb-gadget/f_phonet: use per-attribute show and store methods usb-gadget/f_obex: use per-attribute show and store methods usb-gadget/f_uac2: use per-attribute show and store methods usb-gadget/f_uac1: use per-attribute show and store methods usb-gadget/f_mass_storage: use per-attribute show and store methods usb-gadget/f_sourcesink: use per-attribute show and store methods usb-gadget/f_printer: use per-attribute show and store methods usb-gadget/f_midi: use per-attribute show and store methods usb-gadget/f_loopback: use per-attribute show and store methods usb-gadget/ether: use per-attribute show and store methods usb-gadget/f_acm: use per-attribute show and store methods usb-gadget/f_hid: use per-attribute show and store methods ...
2 parents 5d2eb54 + 5179822 commit 9aa3d65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2676
-5515
lines changed

Documentation/filesystems/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
subdir-y := configfs
2-
31
# List of programs to build
42
hostprogs-y := dnotify_test
53

Documentation/filesystems/configfs/Makefile

Lines changed: 0 additions & 3 deletions
This file was deleted.

Documentation/filesystems/configfs/configfs.txt

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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
183177
operations can be performed on a config_item. All items that have been
184178
allocated dynamically will need to provide the ct_item_ops->release()
185179
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
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

198192
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
202196
attribute file will appear with the configfs_attribute->ca_name
203197
filename. 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

313307
The 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

Comments
 (0)