diff options
author | Benny Halevy <bhalevy@panasas.com> | 2008-07-02 04:14:22 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-07-02 15:58:21 -0400 |
commit | f2feb96bc3d18e50cab7de9eab142f99d91aa5f6 (patch) | |
tree | d4e665a8208f3fb18aa7b9346c0dcf79eb2060a7 /fs/nfsd | |
parent | 3c375c6f3a809d0d999d6dc933634f0b97ed7ae9 (diff) |
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')
-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[] = { | |||
1039 | [OP_RELEASE_LOCKOWNER] (nfsd4_dec)nfsd4_decode_release_lockowner, | 1039 | [OP_RELEASE_LOCKOWNER] (nfsd4_dec)nfsd4_decode_release_lockowner, |
1040 | }; | 1040 | }; |
1041 | 1041 | ||
1042 | struct nfsd4_minorversion_ops { | ||
1043 | nfsd4_dec *decoders; | ||
1044 | int nops; | ||
1045 | }; | ||
1046 | |||
1047 | static struct nfsd4_minorversion_ops nfsd4_minorversion[] = { | ||
1048 | [0] { nfsd4_dec_ops, ARRAY_SIZE(nfsd4_dec_ops) }, | ||
1049 | }; | ||
1050 | |||
1042 | static __be32 | 1051 | static __be32 |
1043 | nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | 1052 | nfsd4_decode_compound(struct nfsd4_compoundargs *argp) |
1044 | { | 1053 | { |
1045 | DECODE_HEAD; | 1054 | DECODE_HEAD; |
1046 | struct nfsd4_op *op; | 1055 | struct nfsd4_op *op; |
1056 | struct nfsd4_minorversion_ops *ops; | ||
1047 | int i; | 1057 | int i; |
1048 | 1058 | ||
1049 | /* | 1059 | /* |
@@ -1073,9 +1083,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1073 | } | 1083 | } |
1074 | } | 1084 | } |
1075 | 1085 | ||
1076 | if (argp->minorversion != 0) | 1086 | if (argp->minorversion >= ARRAY_SIZE(nfsd4_minorversion)) |
1077 | argp->opcnt = 0; | 1087 | argp->opcnt = 0; |
1078 | 1088 | ||
1089 | ops = &nfsd4_minorversion[argp->minorversion]; | ||
1079 | for (i = 0; i < argp->opcnt; i++) { | 1090 | for (i = 0; i < argp->opcnt; i++) { |
1080 | op = &argp->ops[i]; | 1091 | op = &argp->ops[i]; |
1081 | op->replay = NULL; | 1092 | op->replay = NULL; |
@@ -1113,8 +1124,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1113 | } | 1124 | } |
1114 | op->opnum = ntohl(*argp->p++); | 1125 | op->opnum = ntohl(*argp->p++); |
1115 | 1126 | ||
1116 | if (op->opnum >= OP_ACCESS && op->opnum < ARRAY_SIZE(nfsd4_dec_ops)) | 1127 | if (op->opnum >= OP_ACCESS && op->opnum < ops->nops) |
1117 | op->status = nfsd4_dec_ops[op->opnum](argp, &op->u); | 1128 | op->status = ops->decoders[op->opnum](argp, &op->u); |
1118 | else { | 1129 | else { |
1119 | op->opnum = OP_ILLEGAL; | 1130 | op->opnum = OP_ILLEGAL; |
1120 | op->status = nfserr_op_illegal; | 1131 | op->status = nfserr_op_illegal; |