lkml.org 
[lkml]   [2013]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 14/34] sysfs, kernfs: prepare read path for kernfs
On Sat, Oct 26, 2013 at 01:32:21PM +0200, Pavel Machek wrote:
> Hi!
>
> > We're in the process of separating out core sysfs functionality into
> > kernfs which will deal with sysfs_dirents directly. This patch
> > rearranges read path so that the kernfs and sysfs parts are separate.
>
> > +static int sysfs_kf_seq_show(struct seq_file *sf, void *v)
> > {
> > struct sysfs_open_file *of = sf->private;
> > struct kobject *kobj = of->sd->s_parent->priv;
> > - const struct sysfs_ops *ops;
> > + const struct sysfs_ops *ops = sysfs_file_ops(of->sd);
> > + ssize_t count = 0;
> > char *buf;
> > - ssize_t count;
> >
> > /* acquire buffer and ensure that it's >= PAGE_SIZE */
> > count = seq_get_buf(sf, &buf);
>
> Initing count to zero is superfluous here.

Ooh, right.

> > + /* the same behavior as single_open() */
> > + return NULL + !*ppos;
> > +}
>
> That's certainly interesting code.

Directly copied from single_*() functions. Will add some comments but
what it's doing is inherently slightly tricky.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2013-10-27 12:41    [W:0.144 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site