All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Randy Dunlap <rddunlap@osdl.org>,
	Martin Bligh <mbligh@google.com>
Subject: Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators
Date: Wed, 15 Aug 2007 16:36:45 +0800	[thread overview]
Message-ID: <387167005.05651@ustc.edu.cn> (raw)
Message-ID: <20070815083645.GA6544@mail.ustc.edu.cn> (raw)
In-Reply-To: <20070815065301.GK21089@ftp.linux.org.uk>

On Wed, Aug 15, 2007 at 07:53:01AM +0100, Al Viro wrote:
> On Wed, Aug 15, 2007 at 02:37:41PM +0800, Fengguang Wu wrote:
> > static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
> > {
> >         loff_t *spos = (loff_t *) v;
> >         *pos = ++(*spos);
> >         return spos;
> > }
> > 
> > I mean 'pos' is sometimes increased in ct_seq_next(), and sometimes from
> > seq_file.c/seq_read(), too. Thus we cannot reliably do this:
> > 
> >         *pos = (*spos) + some_variable_offset;
> 
> Of course we can.  These guys can be sparse - note that ->start()
> takes a pointer, and for a good reason.  ->start(m, p, pos) should
> get the first entry with offset >= *pos (or NULL if we are done) and
> set *pos accordingly.
>
> That m->index++ is "we are done with the partial, step just past it, so
> that ->start() will pick the first real entry after it the next time it's
> called".
> 
> For dense case we don't need to update *pos in ->start() - either
> we already have one with offset == *pos (and no update is needed),
> or we are finished and should return NULL.
> 
> However, we have every right to live with sparse offsets; prototype of
> ->start() had been done the way it's done exactly to allow that kind
> of use.

So sparse offsets are supported, with some special cares on ->start.

My case is to scan the address space in ranges. The "object" is the
start offset of a range:

__________________#######______________________#############__________
                  ^start                       ^start

Now the solution can be:
        - ->show shows the current range
        - ->next seeks to next range
        - ->start must *also* do the seek

The last requirement is made clear by you, a fact I refused to accept :)
My old concept was that a ->next should be called to move pages
forward after a new start.


  reply	other threads:[~2007-08-15  8:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-12 15:08 [patch 0/2] Sorted seq_file Mathieu Desnoyers
2007-08-12 15:08 ` [patch 1/2] Seq_file add support for sorted list Mathieu Desnoyers
2007-08-12 15:08 ` [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2007-08-15  3:39   ` Fengguang Wu
2007-08-15  3:39     ` Fengguang Wu
2007-08-15  4:18     ` Al Viro
2007-08-15  6:37       ` Fengguang Wu
2007-08-15  6:37         ` Fengguang Wu
2007-08-15  6:53         ` Al Viro
2007-08-15  8:36           ` Fengguang Wu [this message]
2007-08-15  8:36             ` Fengguang Wu
2007-08-15  8:46           ` Fengguang Wu
2007-08-15  8:46             ` Fengguang Wu
2007-08-18 15:56             ` Mathieu Desnoyers
2007-08-18 16:09             ` [PATCH] Fix f_version type: should be u64 instead of unsigned long Mathieu Desnoyers
2007-08-24 15:39           ` [PATCH] Sort module list - use ppos instead of m->private Mathieu Desnoyers
2007-08-24 23:34             ` Andrew Morton
2007-08-25  0:05               ` Mathieu Desnoyers
  -- strict thread matches above, loose matches on Subject: below --
2007-08-20 20:26 [patch 0/2] Sort module list Mathieu Desnoyers
2007-08-20 20:26 ` [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2007-08-21  0:08   ` Rusty Russell
2007-08-24 15:45     ` Mathieu Desnoyers
2007-08-25 21:44       ` Rusty Russell
2007-08-25 21:53         ` Mathieu Desnoyers
2007-08-27 16:02 [patch 0/2] Sort module list for /proc/modules seq file reads Mathieu Desnoyers
2007-08-27 16:02 ` [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2007-09-06 20:05 [patch 0/2] Sort module list for /proc/modules Mathieu Desnoyers
2007-09-06 20:05 ` [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2007-09-17 18:43 [patch 0/2] Sort module list Mathieu Desnoyers
2007-09-17 18:43 ` [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2007-09-18 21:09 [patch 0/2] Sorted Module List for 2.6.23-rc6-mm1 Mathieu Desnoyers
2007-09-18 21:09 ` [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers

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=387167005.05651@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mbligh@google.com \
    --cc=rddunlap@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.