[PATCH 12/12] cgroup: unify pidlist and other file handling

Tejun Heo tj at kernel.org
Wed Dec 4 13:08:53 UTC 2013


On Wed, Dec 04, 2013 at 02:20:22PM +0800, Li Zefan wrote:
> > +static void *cgroup_seqfile_start(struct seq_file *seq, loff_t *ppos)
> > +{
> > +	struct cftype *cft = seq_cft(seq);
> > +
> > +	if (cft->seq_start) {
> > +		return cft->seq_start(seq, ppos);
> > +	} else {
> > +		/*
> > +		 * The same behavior and code as single_open().  Returns
> > +		 * !NULL if pos is at the beginning; otherwise, NULL.
> > +		 */
> 
> Isn't it simpler to choose between seq_open() and single_open() depending
> on if cft->seq_start is implemented?

This is primarily to duplicate and match kernfs implementation and
will be removed when cgroup transitions to kernfs.  As for whether
kernfs could have used different open paths.  Maybe.  I don't think
either way is particularly better tho especially given that
seq_open*() and single_open*() interfaces don't match each other.  It
gets confusing pretty fast once you start mixing the two variants.

Thanks.

-- 
tejun


More information about the Containers mailing list