Date: Thu, 14 Dec 1995 17:08:23 +0000 (GMT) From: Doug Rabson <dfr@render.com> To: Terry Lambert <terry@lambert.org> Cc: current@freebsd.org Subject: Re: VOP_READIR revisited Message-ID: <Pine.BSF.3.91.951214170028.457H-100000@minnow.render.com> In-Reply-To: <199512140137.SAA00700@phaeton.artisoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 13 Dec 1995, Terry Lambert wrote: > > This message is a revisit of the VOP_READDIR issues with cookies, NFS, > and user space exporting. > > > Background: > > The VOP_READDIR call implements the getdirentries (getdents if you are > a POSIX compliant OS) system call. It returns the entries in a file > system independent structure, and uses a "cookie" mechanism to allow > the search to restart on non-directory block entry boundries... this > is typically used for NFS single entry and repositioning operations. > > > The ufs_readdir version of VOP_READDIR for UFS derived file systems > MALLOC's cookie buffers, and in general wreaks havoc. > > > Proposal: > > After much consideration, it seems that the soloution would be to > have the VOP_READIR return the directory block in the file system > native format. > > This means that there would need to be an additional per-FS type > VOP_EXPORTDIR or VOP_DIRCVT or whatever that did the actual copy > to the user buffer before exporting it. > > [...] The UFS readdir mallocs space for the format conversion if BYTE_ORDER == LITTLE_ENDIAN && ap->a_vp->v_mount->mnt_maxsymlinklen > 0 As far as I can see, this is something to do with byte swapping the on-disc data structure which appears to be big-endian in this case. It has nothing to do with cookies. Cookies are only allocated if the readdir is called from the NFS server. The getdirentries syscall doesn't supply the cookie pointer, so no extra work is done for cookies. Why is it better to make the client perform 2 vop calls (READDIR in native format, then DIRCVT into getdirentries standard form)? -- Doug Rabson, Microsoft RenderMorphics Ltd. Mail: dfr@render.com Phone: +44 171 251 4411 FAX: +44 171 251 0939
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.951214170028.457H-100000>