From 335c5fc746de61c7ef278eda451162e388b57d49 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 30 Oct 2002 00:24:44 -0800 Subject: [PATCH] kNFSd: nfsd_readdir changes. nfsd_readdir - the common readdir code for all version of nfsd, contains a number of version-specific things with appropriate checks, and also does some xdr-encoding which rightly belongs elsewhere. This patch simplifies nfsd_readdir to do just the core stuff, and moves the version specifics into version specific files, and the xdr encoding into xdr encoding files. --- include/linux/nfsd/nfsd.h | 22 +++++++--------------- include/linux/nfsd/xdr.h | 5 +++++ include/linux/nfsd/xdr3.h | 7 +++++++ include/linux/nfsd/xdr4.h | 5 +++++ 4 files changed, 24 insertions(+), 15 deletions(-) (limited to 'include/linux') diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index c72354852e2b..94fc6231004a 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -48,16 +48,7 @@ * Callback function for readdir */ struct readdir_cd { - struct svc_rqst * rqstp; - struct svc_fh * dirfh; - u32 * buffer; - int buflen; - u32 * offset; /* previous dirent->d_next */ - char plus; /* readdirplus */ - char eob; /* end of buffer */ - char dotonly; - int nfserr; /* v4 only */ - u32 bmval[2]; /* v4 only */ + int err; /* 0, nfserr, or nfserr_eof */ }; typedef int (*encode_dent_fn)(struct readdir_cd *, const char *, int, loff_t, ino_t, unsigned int); @@ -117,9 +108,7 @@ int nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, int nfsd_truncate(struct svc_rqst *, struct svc_fh *, unsigned long size); int nfsd_readdir(struct svc_rqst *, struct svc_fh *, - loff_t, encode_dent_fn, - u32 *buffer, int *countp, u32 *verf, - u32 *bmval); + loff_t *, struct readdir_cd *, encode_dent_fn); int nfsd_statfs(struct svc_rqst *, struct svc_fh *, struct statfs *); @@ -180,10 +169,13 @@ void nfsd_lockd_shutdown(void); #define nfserr_readdir_nospc __constant_htonl(NFSERR_READDIR_NOSPC) #define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR) -/* error code for internal use - if a request fails due to - * kmalloc failure, it gets dropped. Client should resend eventually +/* error codes for internal use */ +/* if a request fails due to kmalloc failure, it gets dropped. + * Client should resend eventually */ #define nfserr_dropit __constant_htonl(30000) +/* end-of-file indicator in readdir */ +#define nfserr_eof __constant_htonl(30001) /* Check for dir entries '.' and '..' */ #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h index d81b71fefe6d..dc6f850f3622 100644 --- a/include/linux/nfsd/xdr.h +++ b/include/linux/nfsd/xdr.h @@ -98,6 +98,11 @@ struct nfsd_readres { struct nfsd_readdirres { int count; + + struct readdir_cd common; + u32 * buffer; + int buflen; + u32 * offset; }; struct nfsd_statfsres { diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h index 35d167ad6cd2..83ec5bc2b542 100644 --- a/include/linux/nfsd/xdr3.h +++ b/include/linux/nfsd/xdr3.h @@ -156,6 +156,13 @@ struct nfsd3_readdirres { struct svc_fh fh; int count; __u32 verf[2]; + + struct readdir_cd common; + u32 * buffer; + int buflen; + u32 * offset; + struct svc_rqst * rqstp; + }; struct nfsd3_fsstatres { diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index 2bf2c5d3b24e..4238cb04ad90 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h @@ -185,6 +185,11 @@ struct nfsd4_readdir { u32 rd_bmval[2]; /* request */ struct svc_rqst *rd_rqstp; /* response */ struct svc_fh * rd_fhp; /* response */ + + struct readdir_cd common; + u32 * buffer; + int buflen; + u32 * offset; }; struct nfsd4_readlink { -- cgit v1.2.3