Commit f2feb96b authored by Benny Halevy's avatar Benny Halevy Committed by J. Bruce Fields

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: default avatarBenny Halevy <bhalevy@panasas.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 3c375c6f
...@@ -1039,11 +1039,21 @@ static nfsd4_dec nfsd4_dec_ops[] = { ...@@ -1039,11 +1039,21 @@ static nfsd4_dec nfsd4_dec_ops[] = {
[OP_RELEASE_LOCKOWNER] (nfsd4_dec)nfsd4_decode_release_lockowner, [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 static __be32
nfsd4_decode_compound(struct nfsd4_compoundargs *argp) nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
{ {
DECODE_HEAD; DECODE_HEAD;
struct nfsd4_op *op; struct nfsd4_op *op;
struct nfsd4_minorversion_ops *ops;
int i; int i;
/* /*
...@@ -1073,9 +1083,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -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; argp->opcnt = 0;
ops = &nfsd4_minorversion[argp->minorversion];
for (i = 0; i < argp->opcnt; i++) { for (i = 0; i < argp->opcnt; i++) {
op = &argp->ops[i]; op = &argp->ops[i];
op->replay = NULL; op->replay = NULL;
...@@ -1113,8 +1124,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -1113,8 +1124,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
} }
op->opnum = ntohl(*argp->p++); op->opnum = ntohl(*argp->p++);
if (op->opnum >= OP_ACCESS && op->opnum < ARRAY_SIZE(nfsd4_dec_ops)) if (op->opnum >= OP_ACCESS && op->opnum < ops->nops)
op->status = nfsd4_dec_ops[op->opnum](argp, &op->u); op->status = ops->decoders[op->opnum](argp, &op->u);
else { else {
op->opnum = OP_ILLEGAL; op->opnum = OP_ILLEGAL;
op->status = nfserr_op_illegal; op->status = nfserr_op_illegal;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment