linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: linux-mtd@lists.infradead.org, akpm@linux-foundation.org,
	dwmw2@infradead.org
Subject: Re: [PATCH] mtd: convert to seq_file interface
Date: Sat, 14 May 2011 00:03:55 +0300	[thread overview]
Message-ID: <20110513210354.GC29261@p183> (raw)
In-Reply-To: <BANLkTinAx_wd2NtVPR5nw7K4Ga7_ij3M4A@mail.gmail.com>

On Fri, May 13, 2011 at 04:57:41PM -0400, Mike Frysinger wrote:
> On Fri, May 13, 2011 at 16:34, Alexey Dobriyan wrote:
> > ->read_proc interface is going away, switch to seq_file.
> 
> while i like converting to seq_file in general, i'm not sure this
> conversion is correct ... or maybe it's just incomplete ?
> 
> > +static int mtd_proc_show(struct seq_file *m, void *v)
> >  {
> >        struct mtd_info *mtd;
> >
> > +       seq_puts(m, "dev:    size   erasesize  name\n");
> >        mutex_lock(&mtd_table_mutex);
> >        mtd_for_each_device(mtd) {
> > +               seq_printf(m, "mtd%d: %8.8llx %8.8x \"%s\"\n",
> > +                          mtd->index, (unsigned long long)mtd->size,
> > +                          mtd->erasesize, mtd->name);
> >         }
> >        mutex_unlock(&mtd_table_mutex);
> > +        return 0;
> >  }
> 
> this is the new version of the func.  the old one handled
> offsets/seeks while the new one doesnt seem to.  am i mistaken ?

seq_file does all this for developer, see fs/seq_file.c
All you have to do is to fill buffer with data, this is why it's so cool.

> in particular, it seems like this is missing the seq_operations set of
> funcs for walking the list of mtd devices ...

Yes and no.
seq_operations aren't mandatory, because it doesn't matter much
how exactly buffer is filled. In this case we go for simpler code.

  reply	other threads:[~2011-05-13 21:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 20:34 [PATCH] mtd: convert to seq_file interface Alexey Dobriyan
2011-05-13 20:57 ` Mike Frysinger
2011-05-13 21:03   ` Alexey Dobriyan [this message]
2011-05-13 21:09   ` Alexey Dobriyan
2011-05-13 21:10     ` Mike Frysinger
2011-05-16 13:25 ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110513210354.GC29261@p183 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vapier.adi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).