From 1a80c3c64ad4e648f94af848380590455fd85bf4 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 15 Oct 2002 18:40:30 -0700 Subject: [PATCH] kNFSd: Reorganise rpc program version management. An rpc service like NFSD knows about a number of versions (2,3,4) and needs to know the max and min valid version numbers, and also the maximum xdr buffer size used by any version. These max/mins are currently computed at compile time which means we need to include all the xdr*.h headers into nfssvc.c just for computing a couple of numbers. With this patch, these max/mins are calculated at run time from information in the svc_version structure which has been extended to include per-version xdrsize. Also the nfsd_version2, nfsd_version3, and nfsd_version4 structures are moved from nfssvc.c to their more correct home of nfs*proc.c Code gets neated, xdr*.h are no-longer included in nfssvc.c, and the ugly ifdef can be removed fom xdr4.h --- include/linux/nfsd/nfsd.h | 13 +++---------- include/linux/nfsd/xdr4.h | 2 -- include/linux/sunrpc/svc.h | 3 ++- 3 files changed, 5 insertions(+), 13 deletions(-) (limited to 'include/linux') diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 5a42d60f8290..c72354852e2b 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -63,22 +63,15 @@ typedef int (*encode_dent_fn)(struct readdir_cd *, const char *, int, loff_t, ino_t, unsigned int); typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); -/* - * Procedure table for NFSv2 - */ -extern struct svc_procedure nfsd_procedures2[]; -#ifdef CONFIG_NFSD_V3 -extern struct svc_procedure nfsd_procedures3[]; -#endif /* CONFIG_NFSD_V3 */ -#ifdef CONFIG_NFSD_V4 -extern struct svc_procedure nfsd_procedures4[]; -#endif /* CONFIG_NFSD_V4 */ extern struct svc_program nfsd_program; +extern struct svc_version nfsd_version2, nfsd_version3, + nfsd_version4; /* * Function prototypes. */ int nfsd_svc(unsigned short port, int nrservs); +int nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp); /* nfsd/vfs.c */ int fh_lock_parent(struct svc_fh *, struct dentry *); diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index fb4b105fc637..5a5542c1a8c0 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h @@ -298,7 +298,6 @@ struct nfsd4_compoundres { #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) -#if CONFIG_NFSD_V3 static inline void set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) { @@ -309,7 +308,6 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) cinfo->after_size = fhp->fh_post_size; cinfo->after_ctime = fhp->fh_post_ctime; } -#endif int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *); int nfs4svc_decode_compoundargs(struct svc_rqst *, u32 *, struct nfsd4_compoundargs *); diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 36fde12f8d3e..9ad879d9bea7 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -167,6 +167,7 @@ struct svc_version { u32 vs_vers; /* version number */ u32 vs_nproc; /* number of procedures */ struct svc_procedure * vs_proc; /* per-procedure info */ + u32 vs_xdrsize; /* xdrsize needed for this version */ /* Override dispatch function (e.g. when caching replies). * A return value of 0 means drop the request. @@ -199,7 +200,7 @@ typedef void (*svc_thread_fn)(struct svc_rqst *); /* * Function prototypes. */ -struct svc_serv * svc_create(struct svc_program *, unsigned int, unsigned int); +struct svc_serv * svc_create(struct svc_program *, unsigned int); int svc_create_thread(svc_thread_fn, struct svc_serv *); void svc_exit_thread(struct svc_rqst *); void svc_destroy(struct svc_serv *); -- cgit v1.2.3