@@ -543,8 +543,9 @@ struct cftype {
*/
s64 (*read_s64)(struct cgroup_subsys_state *css, struct cftype *cft);
- /* generic seq_file read interface */
+ /* generic seq_file read interfaces*/
int (*seq_show)(struct seq_file *sf, void *v);
+ int (*seq_show_cft)(struct seq_file *sf, struct cftype *cft, void *v);
/* optional ops, implement all or none */
void *(*seq_start)(struct seq_file *sf, loff_t *ppos);
@@ -1448,7 +1448,8 @@ static umode_t cgroup_file_mode(const struct cftype *cft)
{
umode_t mode = 0;
- if (cft->read_u64 || cft->read_s64 || cft->seq_show)
+ if (cft->read_u64 || cft->read_s64 || cft->seq_show ||
+ cft->seq_show_cft)
mode |= S_IRUGO;
if (cft->write_u64 || cft->write_s64 || cft->write) {
@@ -3549,17 +3550,19 @@ static int cgroup_seqfile_show(struct seq_file *m, void *arg)
{
struct cftype *cft = seq_cft(m);
struct cgroup_subsys_state *css = seq_css(m);
+ int ret = 0;
if (cft->seq_show)
- return cft->seq_show(m, arg);
-
- if (cft->read_u64)
+ ret = cft->seq_show(m, arg);
+ else if (cft->seq_show_cft)
+ ret = cft->seq_show_cft(m, cft, arg);
+ else if (cft->read_u64)
seq_printf(m, "%llu\n", cft->read_u64(css, cft));
else if (cft->read_s64)
seq_printf(m, "%lld\n", cft->read_s64(css, cft));
else
- return -EINVAL;
- return 0;
+ ret = -EINVAL;
+ return ret;
}
static struct kernfs_ops cgroup_kf_single_ops = {