NFSv4: kill off complicated macro 'PROC'

J. Bruce Fields wrote:
...
> (This is extremely confusing code to track down: note that
> proc->pc_decode is set to nfs4svc_decode_compoundargs() by the PROC()
> macro at the end of fs/nfsd/nfs4proc.c.  Which means, for example, that
> grepping for nfs4svc_decode_compoundargs() gets you nowhere.  Patches to
> kill off that macro would be welcomed....)

the macro 'PROC' is complicated and obscure, it had better
be killed off in order to make the code more clear.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
This commit is contained in:
Yu Zhiguo 2009-05-19 14:09:54 +08:00 коммит произвёл J. Bruce Fields
Родитель 3c8e03166a
Коммит 0a93a47f04
1 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -1313,24 +1313,9 @@ static const char *nfsd4_op_name(unsigned opnum)
return "unknown_operation";
}
#define nfs4svc_decode_voidargs NULL
#define nfs4svc_release_void NULL
#define nfsd4_voidres nfsd4_voidargs
#define nfs4svc_release_compound NULL
struct nfsd4_voidargs { int dummy; };
#define PROC(name, argt, rest, relt, cache, respsize) \
{ (svc_procfunc) nfsd4_proc_##name, \
(kxdrproc_t) nfs4svc_decode_##argt##args, \
(kxdrproc_t) nfs4svc_encode_##rest##res, \
(kxdrproc_t) nfs4svc_release_##relt, \
sizeof(struct nfsd4_##argt##args), \
sizeof(struct nfsd4_##rest##res), \
0, \
cache, \
respsize, \
}
/*
* TODO: At the present time, the NFSv4 server does not do XID caching
* of requests. Implementing XID caching would not be a serious problem,
@ -1342,8 +1327,23 @@ struct nfsd4_voidargs { int dummy; };
* better XID's.
*/
static struct svc_procedure nfsd_procedures4[2] = {
PROC(null, void, void, void, RC_NOCACHE, 1),
PROC(compound, compound, compound, compound, RC_NOCACHE, NFSD_BUFSIZE/4)
[NFSPROC4_NULL] = {
.pc_func = (svc_procfunc) nfsd4_proc_null,
.pc_encode = (kxdrproc_t) nfs4svc_encode_voidres,
.pc_argsize = sizeof(struct nfsd4_voidargs),
.pc_ressize = sizeof(struct nfsd4_voidres),
.pc_cachetype = RC_NOCACHE,
.pc_xdrressize = 1,
},
[NFSPROC4_COMPOUND] = {
.pc_func = (svc_procfunc) nfsd4_proc_compound,
.pc_decode = (kxdrproc_t) nfs4svc_decode_compoundargs,
.pc_encode = (kxdrproc_t) nfs4svc_encode_compoundres,
.pc_argsize = sizeof(struct nfsd4_compoundargs),
.pc_ressize = sizeof(struct nfsd4_compoundres),
.pc_cachetype = RC_NOCACHE,
.pc_xdrressize = NFSD_BUFSIZE/4,
},
};
struct svc_version nfsd_version4 = {