From owner-freebsd-current Thu Dec 14 09:04:00 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA15088 for current-outgoing; Thu, 14 Dec 1995 09:04:00 -0800 (PST) Received: from minnow.render.com (render.demon.co.uk [158.152.30.118]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA15071 for ; Thu, 14 Dec 1995 09:03:53 -0800 (PST) Received: (from dfr@localhost) by minnow.render.com (8.6.9/8.6.9) id RAA16843; Thu, 14 Dec 1995 17:08:24 GMT Date: Thu, 14 Dec 1995 17:08:23 +0000 (GMT) From: Doug Rabson To: Terry Lambert cc: current@freebsd.org Subject: Re: VOP_READIR revisited In-Reply-To: <199512140137.SAA00700@phaeton.artisoft.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@freebsd.org Precedence: bulk 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