All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@ftp.linux.org.uk>,
	linux-kernel@vger.kernel.org, Martin Bligh <mbligh@google.com>,
	"Randy.Dunlap" <rdunlap@xenotime.net>
Subject: Re: [PATCH] Sort module list - use ppos instead of m->private
Date: Fri, 24 Aug 2007 20:05:13 -0400	[thread overview]
Message-ID: <20070825000513.GA9811@Krystal> (raw)
In-Reply-To: <20070824163448.a48dadc2.akpm@linux-foundation.org>

* Andrew Morton (akpm@linux-foundation.org) wrote:
> On Fri, 24 Aug 2007 11:39:33 -0400
> Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > Sort modules list - use ppos instead of m->private
> > 
> > When reading the data by small chunks (i.e. byte by byte), the index (ppos) is
> > incremented by seq_read() directly and no "next" callback is called when going
> > to the next module.
> > 
> > Therefore, use ppos instead of m->private to deal with the fact that this index
> > is incremented directly to pass to the next module in seq_read() after the
> > buffer has been emptied.
> 
> Confused.  What problem is this patch fixing?  I'm guessing that something
> is going wrong when /proc/modules is read one-byte-at-a-time?
> 
> <tests that>
> 
> <nope>
> 
> Better changelogs, please.
> 

Ok, will append this in the changelog (I sent this to Rusty earlier
today):

Small test program for this:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define BUFSIZE 1024

int main()
{
        int fd = open("/proc/modules", O_RDONLY);
        char buf[BUFSIZE];
        ssize_t size;

        do {
                size = read(fd, buf, 1);
                printf("%c", buf[0]);
                usleep(100000);
        } while(size > 0);

        close(fd);
        return 0;
}

Before fix, it prints the first module indefinitely. The patch fixes
this.

I will also append more detail to "Sort module list by pointer address
to get coherent sleepable seq_file iterators" changelog before the
2.6.23-rc3-mm1 repost.

Mathieu

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

      reply	other threads:[~2007-08-25  0:10 UTC|newest]

Thread overview: 14+ 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
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 [this message]

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=20070825000513.GA9811@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    --cc=rdunlap@xenotime.net \
    --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.