[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libtrivfs/glibc questions
From: |
Neal H Walfield |
Subject: |
Re: libtrivfs/glibc questions |
Date: |
Wed, 3 Jan 2001 10:29:21 -0500 |
User-agent: |
Mutt/1.2.5i |
> Sorry, i still don't understand this.
>
> If i do a normal read() on a Trivfs translator, trivfs_S_io_read in my
> translator gets called. OK. But, in the read() call, i haven't
> specified a datalen. Now, at which point does this datalen parameter
> get "created"?
>
> I guess, it's a quiet silly question. I just don't understand yet how
> all these things interact with each other..
You fill it in based on the amount _actually_ read. For instance, amount
is 1024, the file size is 4096 there are 256 bytes until the end of file.
You would:
if (po->pos + amount > po->filesize)
amount = po->filesize - po->pos;
memcpy (data, file_buffer + po->pos, amount);
*datalen = amount;
-Neal
pgpDNLhTCN1lW.pgp
Description: PGP signature