[OpenAFS-devel] afs_buffer.c:DRead()

Nickolai Zeldovich kolya@MIT.EDU
Tue, 12 Nov 2002 21:07:01 -0500


Jim Rees wrote:

> I'm still taking it out.  It breaks OpenBSD.  Maybe something to do with
> struct alignment?

Probably it's because of this in src/afs/OBSD/osi_file.c:

    void *osi_UFSOpen(afs_int32 ainode)
    {
        ..
        afile->size = 0;
        ..
        return (void *)afile;
    }

so the size is always zero.  Perhaps borrowing (and adjusting for OpenBSD)
the following code from src/afs/FBSD/osi_file.c would work:

        afile->size = VTOI(afile->vnode)->i_size;

On the other hand, I'm not sure if anything else really uses the
size field.  From a few samples, it seems you're probably right
about osi_read -- read-past-EOF errors are caught in afs_MemReadBlk,
and in afs_osi_Read on FreeBSD, Solaris, Linux and UKERNEL.

-- kolya