summaryrefslogtreecommitdiff
path: root/include/linux/kernfs.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 23:54:26 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-30 05:48:14 +0400
commitd19b9846df64d8845be682b6318bd1aee246cf60 (patch)
tree688842d196ae287bce080fe2e13ca00e796c8a06 /include/linux/kernfs.h
parent2d0cfbec2a95c16818960fda1dfa815fd1a62070 (diff)
downloadlinux-d19b9846df64d8845be682b6318bd1aee246cf60.tar.xz
sysfs, kernfs: add kernfs_ops->seq_{start|next|stop}()
kernfs_ops currently only supports single_open() behavior which is pretty restrictive. Add optional callbacks ->seq_{start|next|stop}() which, when implemented, are invoked for seq_file traversal. This allows full seq_file functionality for kernfs users. This currently doesn't have any user and doesn't change any behavior. v2: Refreshed on top of the updated "sysfs, kernfs: prepare read path for kernfs". Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/kernfs.h')
-rw-r--r--include/linux/kernfs.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index d0912cf02087..ba993ebcd81e 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -37,8 +37,9 @@ struct kernfs_ops {
/*
* Read is handled by either seq_file or raw_read().
*
- * If seq_show() is present, seq_file path is active. The behavior
- * is equivalent to single_open(). @sf->private points to the
+ * If seq_show() is present, seq_file path is active. Other seq
+ * operations are optional and if not implemented, the behavior is
+ * equivalent to single_open(). @sf->private points to the
* associated sysfs_open_file.
*
* read() is bounced through kernel buffer and a read larger than
@@ -46,6 +47,10 @@ struct kernfs_ops {
*/
int (*seq_show)(struct seq_file *sf, void *v);
+ void *(*seq_start)(struct seq_file *sf, loff_t *ppos);
+ void *(*seq_next)(struct seq_file *sf, void *v, loff_t *ppos);
+ void (*seq_stop)(struct seq_file *sf, void *v);
+
ssize_t (*read)(struct sysfs_open_file *of, char *buf, size_t bytes,
loff_t off);