help-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: io_read() semantics


From: Marcus Brinkmann
Subject: Re: io_read() semantics
Date: Mon, 10 Jun 2002 15:21:58 +0200
User-agent: Mutt/1.3.28i

On Mon, Jun 10, 2002 at 02:45:15PM +0200, Ludovic Courtès wrote:
> I have a question about how io_read() should work, and I couldn't find the
> answer in io.def. From what I've seen in libdiskfs/io-read.c , a diskfs server
> is supposed to reallocate a new buffer if the provided buffer is smaller than
> the requested amount of data:

This is not a strict requirement.  A server can do any of the following:

1. Allocate a new, large enough buffer.
2. Just return fewer data.

and a server can even:

3. Return a new buffer although the old one was large enough.

> Therefore, I would not expect io_read() to provide a new buffer with the
> following code, since the buffer size if the same as the requested amount of
> data (*len == size):
> 
>     void* d = data;
> 
>     size = (size > *len)?(*len):size;
>     *len = size;
>     err  = io_read (mbox, (data_t*)&data, len, start + offset, size);
>     assert (data == d);       // this assertion should not fail!
> 
> However, the last assertion does sometimes fail.

Well, I would not expect it to fail with a canonical diskfs server.  It is
not a protocol violation, but if it "shouldn't happen" then it might be
worth to investigate why it happens anyway.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]