Re: seq_file and exporting dynamically allocated data

From: Tigran Aivazian
Date: Mon Nov 17 2003 - 05:09:26 EST


On Mon, 17 Nov 2003 viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> EOF had been reached when read() returns 0. Until then read() returns
> an arbitrary amount of bytes between 1 and 'size' argument. Since you
> are using read(2) directly, use it correctly...

I know that for read(2) in general but I thought that the whole point of
using "sequential record" files (aka seq_file) is that they guarantee
read(2) to return a number of fixed-size records, hence the name
"sequential record". Especially since the ->show() function is packing
those records into m->buf as "whole" entities, not in "halves" or such.

I believe you of course (as you wrote seq_file) but it still seems that as
long as the implementation (i.e. my module) is working with whole records
it is ok to assume that read() will return them as whole, i.e. not break a
record between two calls to read(2). Is this really not true?

Kind regards
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/