From b60d6eae12deaeee8b66f6771289ae3fcab832b6 Mon Sep 17 00:00:00 2001 From: pk Date: Wed, 11 Oct 1995 12:50:23 +0000 Subject: [PATCH] Gets NFS-mounted /emul/sunos going again by faking readdir cookies if not supported by VOP_READDIR(). --- sys/compat/sunos/sunos_misc.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/sys/compat/sunos/sunos_misc.c b/sys/compat/sunos/sunos_misc.c index 0b30140ea18b..43f1932518fc 100644 --- a/sys/compat/sunos/sunos_misc.c +++ b/sys/compat/sunos/sunos_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunos_misc.c,v 1.56 1995/10/09 11:24:12 mycroft Exp $ */ +/* $NetBSD: sunos_misc.c,v 1.57 1995/10/11 12:50:23 pk Exp $ */ /* * Copyright (c) 1992, 1993 @@ -372,8 +372,30 @@ again: */ error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, cookiebuf, ncookies); - if (error) - goto out; + if (error) { + off_t coff; + + if (error != EINVAL) + goto out; + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, 0, 0); + if (error) + goto out; + + /* Fake the cookies */ + error = 0; + inp = buf; + len = buflen - auio.uio_resid; + coff = off; + cookie = cookiebuf; + for (; len > 0; len -= reclen) { + reclen = ((struct dirent *)inp)->d_reclen; + if (reclen & 3) + panic("sunos_getdents"); + coff += reclen; /* each entry points to next */ + *cookie++ = coff; + inp += reclen; + } + } inp = buf; outp = SCARG(uap, buf);