aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2008-07-02 04:13:41 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-07-02 15:58:20 -0400
commit347e0ad9c91b5bd7506d61f236048cc72b7fc151 (patch)
tree9ea53c7bfa2fc19389fe9c4bcbfe66bb49360aa0 /fs/nfsd/nfs4xdr.c
parent30cff1ffff3981c8d96dc33870b652e70190ba37 (diff)
nfsd: tabulate nfs4 xdr decoding functions
In preparation for minorversion 1 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.c153
1 files changed, 48 insertions, 105 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 413a15332177..de1fd9db26f0 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -986,6 +986,51 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel
986} 986}
987 987
988static __be32 988static __be32
989nfsd4_decode_noop(struct nfsd4_compoundargs *argp, void *p)
990{
991 return nfs_ok;
992}
993
994typedef __be32(*nfsd4_dec)(struct nfsd4_compoundargs *argp, void *);
995
996static nfsd4_dec nfsd4_dec_ops[] = {
997 [OP_ACCESS] (nfsd4_dec)nfsd4_decode_access,
998 [OP_CLOSE] (nfsd4_dec)nfsd4_decode_close,
999 [OP_COMMIT] (nfsd4_dec)nfsd4_decode_commit,
1000 [OP_CREATE] (nfsd4_dec)nfsd4_decode_create,
1001 [OP_DELEGRETURN] (nfsd4_dec)nfsd4_decode_delegreturn,
1002 [OP_GETATTR] (nfsd4_dec)nfsd4_decode_getattr,
1003 [OP_GETFH] (nfsd4_dec)nfsd4_decode_noop,
1004 [OP_LINK] (nfsd4_dec)nfsd4_decode_link,
1005 [OP_LOCK] (nfsd4_dec)nfsd4_decode_lock,
1006 [OP_LOCKT] (nfsd4_dec)nfsd4_decode_lockt,
1007 [OP_LOCKU] (nfsd4_dec)nfsd4_decode_locku,
1008 [OP_LOOKUP] (nfsd4_dec)nfsd4_decode_lookup,
1009 [OP_LOOKUPP] (nfsd4_dec)nfsd4_decode_noop,
1010 [OP_NVERIFY] (nfsd4_dec)nfsd4_decode_verify,
1011 [OP_OPEN] (nfsd4_dec)nfsd4_decode_open,
1012 [OP_OPEN_CONFIRM] (nfsd4_dec)nfsd4_decode_open_confirm,
1013 [OP_OPEN_DOWNGRADE] (nfsd4_dec)nfsd4_decode_open_downgrade,
1014 [OP_PUTFH] (nfsd4_dec)nfsd4_decode_putfh,
1015 [OP_PUTROOTFH] (nfsd4_dec)nfsd4_decode_noop,
1016 [OP_READ] (nfsd4_dec)nfsd4_decode_read,
1017 [OP_READDIR] (nfsd4_dec)nfsd4_decode_readdir,
1018 [OP_READLINK] (nfsd4_dec)nfsd4_decode_noop,
1019 [OP_REMOVE] (nfsd4_dec)nfsd4_decode_remove,
1020 [OP_RENAME] (nfsd4_dec)nfsd4_decode_rename,
1021 [OP_RENEW] (nfsd4_dec)nfsd4_decode_renew,
1022 [OP_RESTOREFH] (nfsd4_dec)nfsd4_decode_noop,
1023 [OP_SAVEFH] (nfsd4_dec)nfsd4_decode_noop,
1024 [OP_SECINFO] (nfsd4_dec)nfsd4_decode_secinfo,
1025 [OP_SETATTR] (nfsd4_dec)nfsd4_decode_setattr,
1026 [OP_SETCLIENTID] (nfsd4_dec)nfsd4_decode_setclientid,
1027 [OP_SETCLIENTID_CONFIRM](nfsd4_dec)nfsd4_decode_setclientid_confirm,
1028 [OP_VERIFY] (nfsd4_dec)nfsd4_decode_verify,
1029 [OP_WRITE] (nfsd4_dec)nfsd4_decode_write,
1030 [OP_RELEASE_LOCKOWNER] (nfsd4_dec)nfsd4_decode_release_lockowner,
1031};
1032
1033static __be32
989nfsd4_decode_compound(struct nfsd4_compoundargs *argp) 1034nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
990{ 1035{
991 DECODE_HEAD; 1036 DECODE_HEAD;
@@ -1059,113 +1104,11 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1059 } 1104 }
1060 op->opnum = ntohl(*argp->p++); 1105 op->opnum = ntohl(*argp->p++);
1061 1106
1062 switch (op->opnum) { 1107 if (op->opnum >= OP_ACCESS && op->opnum < ARRAY_SIZE(nfsd4_dec_ops))
1063 case OP_ACCESS: 1108 op->status = nfsd4_dec_ops[op->opnum](argp, &op->u);
1064 op->status = nfsd4_decode_access(argp, &op->u.access); 1109 else {
1065 break;
1066 case OP_CLOSE:
1067 op->status = nfsd4_decode_close(argp, &op->u.close);
1068 break;
1069 case OP_COMMIT:
1070 op->status = nfsd4_decode_commit(argp, &op->u.commit);
1071 break;
1072 case OP_CREATE:
1073 op->status = nfsd4_decode_create(argp, &op->u.create);
1074 break;
1075 case OP_DELEGRETURN:
1076 op->status = nfsd4_decode_delegreturn(argp, &op->u.delegreturn);
1077 break;
1078 case OP_GETATTR:
1079 op->status = nfsd4_decode_getattr(argp, &op->u.getattr);
1080 break;
1081 case OP_GETFH:
1082 op->status = nfs_ok;
1083 break;
1084 case OP_LINK:
1085 op->status = nfsd4_decode_link(argp, &op->u.link);
1086 break;
1087 case OP_LOCK:
1088 op->status = nfsd4_decode_lock(argp, &op->u.lock);
1089 break;
1090 case OP_LOCKT:
1091 op->status = nfsd4_decode_lockt(argp, &op->u.lockt);
1092 break;
1093 case OP_LOCKU:
1094 op->status = nfsd4_decode_locku(argp, &op->u.locku);
1095 break;
1096 case OP_LOOKUP:
1097 op->status = nfsd4_decode_lookup(argp, &op->u.lookup);
1098 break;
1099 case OP_LOOKUPP:
1100 op->status = nfs_ok;
1101 break;
1102 case OP_NVERIFY:
1103 op->status = nfsd4_decode_verify(argp, &op->u.nverify);
1104 break;
1105 case OP_OPEN:
1106 op->status = nfsd4_decode_open(argp, &op->u.open);
1107 break;
1108 case OP_OPEN_CONFIRM:
1109 op->status = nfsd4_decode_open_confirm(argp, &op->u.open_confirm);
1110 break;
1111 case OP_OPEN_DOWNGRADE:
1112 op->status = nfsd4_decode_open_downgrade(argp, &op->u.open_downgrade);
1113 break;
1114 case OP_PUTFH:
1115 op->status = nfsd4_decode_putfh(argp, &op->u.putfh);
1116 break;
1117 case OP_PUTROOTFH:
1118 op->status = nfs_ok;
1119 break;
1120 case OP_READ:
1121 op->status = nfsd4_decode_read(argp, &op->u.read);
1122 break;
1123 case OP_READDIR:
1124 op->status = nfsd4_decode_readdir(argp, &op->u.readdir);
1125 break;
1126 case OP_READLINK:
1127 op->status = nfs_ok;
1128 break;
1129 case OP_REMOVE:
1130 op->status = nfsd4_decode_remove(argp, &op->u.remove);
1131 break;
1132 case OP_RENAME:
1133 op->status = nfsd4_decode_rename(argp, &op->u.rename);
1134 break;
1135 case OP_RESTOREFH:
1136 op->status = nfs_ok;
1137 break;
1138 case OP_RENEW:
1139 op->status = nfsd4_decode_renew(argp, &op->u.renew);
1140 break;
1141 case OP_SAVEFH:
1142 op->status = nfs_ok;
1143 break;
1144 case OP_SECINFO:
1145 op->status = nfsd4_decode_secinfo(argp, &op->u.secinfo);
1146 break;
1147 case OP_SETATTR:
1148 op->status = nfsd4_decode_setattr(argp, &op->u.setattr);
1149 break;
1150 case OP_SETCLIENTID:
1151 op->status = nfsd4_decode_setclientid(argp, &op->u.setclientid);
1152 break;
1153 case OP_SETCLIENTID_CONFIRM:
1154 op->status = nfsd4_decode_setclientid_confirm(argp, &op->u.setclientid_confirm);
1155 break;
1156 case OP_VERIFY:
1157 op->status = nfsd4_decode_verify(argp, &op->u.verify);
1158 break;
1159 case OP_WRITE:
1160 op->status = nfsd4_decode_write(argp, &op->u.write);
1161 break;
1162 case OP_RELEASE_LOCKOWNER:
1163 op->status = nfsd4_decode_release_lockowner(argp, &op->u.release_lockowner);
1164 break;
1165 default:
1166 op->opnum = OP_ILLEGAL; 1110 op->opnum = OP_ILLEGAL;
1167 op->status = nfserr_op_illegal; 1111 op->status = nfserr_op_illegal;
1168 break;
1169 } 1112 }
1170 1113
1171 if (op->status) { 1114 if (op->status) {