Tejun Heo f6acf8bb6a 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>
2013-11-29 17:35:05 -08:00
..
2013-10-24 23:43:27 -04:00
2013-11-13 12:09:12 +09:00
2013-10-27 16:27:07 -07:00
2013-09-16 18:20:25 -07:00
2013-11-16 13:14:56 -08:00
2013-11-09 00:16:32 -05:00
2013-11-29 17:35:05 -08:00
2013-11-22 08:37:47 -08:00
2013-11-22 08:42:14 -08:00
2013-10-24 23:34:54 -04:00
2013-09-13 23:06:40 -04:00
2013-10-24 23:34:54 -04:00
2013-09-10 18:56:31 -04:00
2013-10-24 23:34:54 -04:00
2013-11-09 00:16:20 -05:00
2013-10-24 23:34:54 -04:00
2013-11-09 00:16:19 -05:00
2013-11-09 00:16:19 -05:00
2013-10-24 23:35:00 -04:00
2013-10-24 23:34:54 -04:00
2013-10-24 23:34:54 -04:00
2013-10-24 23:34:54 -04:00
2013-11-09 00:16:31 -05:00
2013-11-09 00:16:20 -05:00