diff options
author | Tejun Heo <tj@kernel.org> | 2013-11-28 14:54:21 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-29 17:35:05 -0800 |
commit | f6acf8bb6a40ba3bfcf542e4c4c9e8968c8cb57a (patch) | |
tree | 63a9a946dd065f636a20a9435e2e502313bef178 /fs/xfs/xfs_log.h | |
parent | dd8a5b036b6e8d50854e130555f90f062c5eacec (diff) | |
download | linux-f6acf8bb6a40ba3bfcf542e4c4c9e8968c8cb57a.tar.gz linux-f6acf8bb6a40ba3bfcf542e4c4c9e8968c8cb57a.tar.bz2 linux-f6acf8bb6a40ba3bfcf542e4c4c9e8968c8cb57a.zip |
sysfs, kernfs: introduce kernfs_ops
We're in the process of separating out core sysfs functionality into
kernfs which will deal with sysfs_dirents directly. This patch
introduces kernfs_ops which hosts methods kernfs users implement and
updates fs/sysfs/file.c such that sysfs_kf_*() functions populate
kernfs_ops and kernfs_file_*() functions call the matching entries
from kernfs_ops.
kernfs_ops contains the following groups of methods.
* seq_show() - for kernfs files which use seq_file for reads.
* read() - for direct read implementations. Used iff seq_show() is
not implemented.
* write() - for writes.
* mmap() - for mmaps.
Notes:
* sysfs_elem_attr->ops is added so that kernfs_ops can be accessed
from sysfs_dirent. kernfs_ops() helper is added to verify locking
and access the field.
* SYSFS_FLAG_HAS_(SEQ_SHOW|MMAP) added. sd->s_attr->ops is accessible
only while holding active_ref and there are cases where we want to
take different actions depending on which ops are implemented.
These two flags cache whether the two ops are implemented for those.
* kernfs_file_*() no longer test sysfs type but chooses different
behaviors depending on which methods in kernfs_ops are implemented.
The conversions are trivial except for the open path. As
kernfs_file_open() now decides whether to allow read/write accesses
depending on the kernfs_ops implemented, the presence of methods in
kobjs and attribute_bin should be propagated to kernfs_ops.
sysfs_add_file_mode_ns() is updated so that it propagates presence /
absence of the callbacks through _empty, _ro, _wo, _rw kernfs_ops.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/xfs/xfs_log.h')
0 files changed, 0 insertions, 0 deletions