diff options
author | Benny Halevy <bhalevy@panasas.com> | 2008-07-02 11:14:22 +0300 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-07-02 15:58:21 -0400 |
commit | f2feb96bc3d18e50cab7de9eab142f99d91aa5f6 (patch) | |
tree | d4e665a8208f3fb18aa7b9346c0dcf79eb2060a7 /fs/nfsd/nfs4xdr.c | |
parent | 3c375c6f3a809d0d999d6dc933634f0b97ed7ae9 (diff) | |
download | linux-f2feb96bc3d18e50cab7de9eab142f99d91aa5f6.tar.bz2 |
nfsd: nfs4 minorversion decoder vectors
Have separate vectors of operation decoders for each minorversion.
Obsolete ops in newer minorversions have default implementation returning
nfserr_opnotsupp.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 653951c73e31..a40bec53fa66 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -1039,11 +1039,21 @@ static nfsd4_dec nfsd4_dec_ops[] = { [OP_RELEASE_LOCKOWNER] (nfsd4_dec)nfsd4_decode_release_lockowner, }; +struct nfsd4_minorversion_ops { + nfsd4_dec *decoders; + int nops; +}; + +static struct nfsd4_minorversion_ops nfsd4_minorversion[] = { + [0] { nfsd4_dec_ops, ARRAY_SIZE(nfsd4_dec_ops) }, +}; + static __be32 nfsd4_decode_compound(struct nfsd4_compoundargs *argp) { DECODE_HEAD; struct nfsd4_op *op; + struct nfsd4_minorversion_ops *ops; int i; /* @@ -1073,9 +1083,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) } } - if (argp->minorversion != 0) + if (argp->minorversion >= ARRAY_SIZE(nfsd4_minorversion)) argp->opcnt = 0; + ops = &nfsd4_minorversion[argp->minorversion]; for (i = 0; i < argp->opcnt; i++) { op = &argp->ops[i]; op->replay = NULL; @@ -1113,8 +1124,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) } op->opnum = ntohl(*argp->p++); - if (op->opnum >= OP_ACCESS && op->opnum < ARRAY_SIZE(nfsd4_dec_ops)) - op->status = nfsd4_dec_ops[op->opnum](argp, &op->u); + if (op->opnum >= OP_ACCESS && op->opnum < ops->nops) + op->status = ops->decoders[op->opnum](argp, &op->u); else { op->opnum = OP_ILLEGAL; op->status = nfserr_op_illegal; |