- remove a ufs dependency.

- bump readdir block size to 1024.  (the same value as userland DIRBLKSIZ)
This commit is contained in:
yamt 2005-10-06 10:23:01 +00:00
parent e10443f324
commit 793a63d824

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_serv.c,v 1.97 2005/09/06 09:36:28 jmmv Exp $ */ /* $NetBSD: nfs_serv.c,v 1.98 2005/10/06 10:23:01 yamt Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -55,7 +55,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.97 2005/09/06 09:36:28 jmmv Exp $"); __KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.98 2005/10/06 10:23:01 yamt Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -70,7 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.97 2005/09/06 09:36:28 jmmv Exp $");
#include <sys/dirent.h> #include <sys/dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <ufs/ufs/dir.h>
#include <uvm/uvm.h> #include <uvm/uvm.h>
@ -2532,7 +2531,7 @@ out:
/* /*
* nfs readdir service * nfs readdir service
* - mallocs what it thinks is enough to read * - mallocs what it thinks is enough to read
* count rounded up to a multiple of NFS_DIRBLKSIZ <= NFS_MAXREADDIR * count rounded up to a multiple of NFS_SRVDIRBLKSIZ <= NFS_MAXREADDIR
* - calls VOP_READDIR() * - calls VOP_READDIR()
* - loops around building the reply * - loops around building the reply
* if the output generated exceeds count break out of loop * if the output generated exceeds count break out of loop
@ -2560,6 +2559,9 @@ out:
* to including the status longwords that are not a part of the dir. * to including the status longwords that are not a part of the dir.
* "entry" structures, but are in the rpc. * "entry" structures, but are in the rpc.
*/ */
#define NFS_SRVDIRBLKSIZ 1024
struct flrep { struct flrep {
nfsuint64 fl_off; nfsuint64 fl_off;
u_int32_t fl_postopok; u_int32_t fl_postopok;
@ -2616,7 +2618,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq)
} }
off = toff; off = toff;
cnt = fxdr_unsigned(int, *tl); cnt = fxdr_unsigned(int, *tl);
siz = ((cnt + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1)); siz = ((cnt + NFS_SRVDIRBLKSIZ - 1) & ~(NFS_SRVDIRBLKSIZ - 1));
xfer = NFS_SRVMAXDATA(nfsd); xfer = NFS_SRVMAXDATA(nfsd);
if (siz > xfer) if (siz > xfer)
siz = xfer; siz = xfer;
@ -2875,7 +2877,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq)
siz = fxdr_unsigned(int, *tl++); siz = fxdr_unsigned(int, *tl++);
cnt = fxdr_unsigned(int, *tl); cnt = fxdr_unsigned(int, *tl);
off = toff; off = toff;
siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1)); siz = ((siz + NFS_SRVDIRBLKSIZ - 1) & ~(NFS_SRVDIRBLKSIZ - 1));
xfer = NFS_SRVMAXDATA(nfsd); xfer = NFS_SRVMAXDATA(nfsd);
if (siz > xfer) if (siz > xfer)
siz = xfer; siz = xfer;