Oops, the cookies for nfs of course represent the *next* directory

entry offset, not the current one.
This commit is contained in:
pooka 2007-07-19 10:14:53 +00:00
parent b2a23735c5
commit 87429c840c
3 changed files with 30 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtfs_vnops.c,v 1.34 2007/07/17 16:33:27 pooka Exp $ */
/* $NetBSD: dtfs_vnops.c,v 1.35 2007/07/19 10:14:53 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -246,8 +246,8 @@ dtfs_node_readdir(struct puffs_cc *pcc, void *opc,
again:
if (*readoff == DENT_DOT || *readoff == DENT_DOTDOT) {
puffs_gendotdent(&dent, pn->pn_va.va_fileid, *readoff, reslen);
PUFFS_STORE_DCOOKIE(cookies, ncookies, *readoff);
(*readoff)++;
PUFFS_STORE_DCOOKIE(cookies, ncookies, *readoff);
goto again;
}
@ -265,8 +265,8 @@ dtfs_node_readdir(struct puffs_cc *pcc, void *opc,
reslen))
break;
PUFFS_STORE_DCOOKIE(cookies, ncookies, *readoff);
(*readoff)++;
PUFFS_STORE_DCOOKIE(cookies, ncookies, *readoff);
}
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctlfs.c,v 1.29 2007/07/17 12:03:46 pooka Exp $ */
/* $NetBSD: sysctlfs.c,v 1.30 2007/07/19 10:14:53 pooka Exp $ */
/*
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
@ -543,8 +543,8 @@ sysctlfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
again:
if (*readoff == DENT_DOT || *readoff == DENT_DOTDOT) {
puffs_gendotdent(&dent, sfs_dir->myid, *readoff, reslen);
PUFFS_STORE_DCOOKIE(cookies, ncookies, *readoff);
(*readoff)++;
PUFFS_STORE_DCOOKIE(cookies, ncookies, *readoff);
goto again;
}
@ -561,9 +561,7 @@ sysctlfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
po.po_path = sname;
po.po_len = PNPLEN(pn_dir)+1;
for (i = DENT_ADJ(*readoff);
i < sl / sizeof(struct sysctlnode);
i++, (*readoff)++) {
for (i = DENT_ADJ(*readoff); i < sl / sizeof(struct sysctlnode); i++) {
if (SYSCTL_TYPE(sn[i].sysctl_flags) == CTLTYPE_NODE)
vt = VDIR;
else
@ -585,6 +583,8 @@ sysctlfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
if (!puffs_nextdent(&dent, sn[i].sysctl_name, id,
puffs_vtype2dt(vt), reslen))
return 0;
(*readoff)++;
PUFFS_STORE_DCOOKIE(cookies, ncookies, *readoff);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: node.c,v 1.34 2007/07/16 09:36:06 pooka Exp $ */
/* $NetBSD: node.c,v 1.35 2007/07/19 10:14:53 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: node.c,v 1.34 2007/07/16 09:36:06 pooka Exp $");
__RCSID("$NetBSD: node.c,v 1.35 2007/07/19 10:14:53 pooka Exp $");
#endif /* !lint */
#include <assert.h>
@ -289,15 +289,31 @@ psshfs_node_readdir(struct puffs_cc *pcc, void *opc, struct dirent *dent,
if (rv)
return rv;
for (i = *readoff; i < psn->dentnext; i++) {
/* find next dirent */
for (i = *readoff;;i++) {
if (i == psn->dentnext)
goto out;
pd = &psn->dir[i];
if (pd->valid == 0)
continue;
if (pd->valid)
break;
}
for (;;) {
*readoff = i;
if (!puffs_nextdent(&dent, pd->entryname,
pd->va.va_fileid, puffs_vtype2dt(pd->va.va_type), reslen))
break;
return 0;
/* find next entry, store possible nfs key */
do {
if (++i == psn->dentnext)
goto out;
pd = &psn->dir[i];
} while (pd->valid == 0);
PUFFS_STORE_DCOOKIE(cookies, ncookies, (off_t)i);
}
out:
if (i == psn->dentnext)
*eofflag = 1;