From: William Lee Irwin III <wli@holomorphy.com>
To: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: viro@parcelfarce.linux.theplanet.co.uk, linux-kernel@vger.kernel.org
Subject: Re: seq_file and exporting dynamically allocated data
Date: Mon, 17 Nov 2003 00:48:04 -0800 [thread overview]
Message-ID: <20031117084804.GB22764@holomorphy.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0311170832030.1089-100000@einstein.homenet>
On Mon, Nov 17, 2003 at 08:38:24AM +0000, Tigran Aivazian wrote:
> The reason why I didn't use pread(2) is because I have to do multiple
> calls to read(2). There is no way that I know of to pack more than a
> single page into a single read(2) with seq_file API.
Well, one way to do it is to say that if you don't get a short read,
then the file is longer.
On Mon, Nov 17, 2003 at 08:38:24AM +0000, Tigran Aivazian wrote:
> Yes, I remember Al saying "it's not a page" but in practice it still
> appears to be limited to a page unless someone shows a sample seq_file
> module which can provide more than a page of data on a single read(2). The
> implementations I have looked at in the kernel (e.g. mm/slab.c) are
> limited to a single page per read(2).
There's a retry loop where the buffer size is doubled each iteration
that looks to me like automagic sizing in the code for seq_read(). I
can't say I've actually tried to rely on getting more than a page
at a time through seq_read(), though.
-- wli
The retry loop:
while (1) {
pos = m->index;
p = m->op->start(m, &pos);
err = PTR_ERR(p);
if (!p || IS_ERR(p))
break;
err = m->op->show(m, p);
if (err)
break;
if (m->count < m->size)
goto Fill;
m->op->stop(m, p);
kfree(m->buf);
m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
if (!m->buf)
goto Enomem;
m->count = 0;
}
next prev parent reply other threads:[~2003-11-17 8:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-14 20:42 seq_file and exporting dynamically allocated data Harald Welte
2003-11-14 21:01 ` Tigran Aivazian
2003-11-15 9:38 ` Harald Welte
2003-11-15 17:18 ` viro
2003-11-15 17:33 ` Harald Welte
2003-11-15 19:49 ` Tigran Aivazian
2003-11-15 20:14 ` viro
2003-11-15 20:41 ` Tigran Aivazian
2003-11-15 21:30 ` viro
2003-11-15 20:50 ` Tigran Aivazian
2003-11-15 21:33 ` viro
2003-11-15 21:54 ` Tigran Aivazian
2003-11-16 7:27 ` Tigran Aivazian
2003-11-17 5:48 ` viro
2003-11-17 8:21 ` Tigran Aivazian
2003-11-17 8:30 ` William Lee Irwin III
2003-11-17 8:38 ` Tigran Aivazian
2003-11-17 8:48 ` William Lee Irwin III [this message]
2003-11-17 9:03 ` William Lee Irwin III
2003-11-17 9:42 ` Tigran Aivazian
2003-11-17 9:50 ` William Lee Irwin III
2003-11-17 9:55 ` viro
2003-11-17 10:08 ` Tigran Aivazian
2003-11-17 10:35 ` viro
2003-11-17 9:48 ` viro
2003-11-16 20:45 ` Harald Welte
2003-11-15 20:36 ` viro
2003-11-16 20:42 ` Harald Welte
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=20031117084804.GB22764@holomorphy.com \
--to=wli@holomorphy.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tigran@aivazian.fsnet.co.uk \
--cc=viro@parcelfarce.linux.theplanet.co.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.