diff options
-rw-r--r-- | fs/nfs/nfs4xdr.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 9a03b24ead5f..5d80766fc672 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -712,10 +712,6 @@ struct compound_hdr { | |||
712 | * task to translate them into Linux-specific versions which are more | 712 | * task to translate them into Linux-specific versions which are more |
713 | * consistent with the style used in NFSv2/v3... | 713 | * consistent with the style used in NFSv2/v3... |
714 | */ | 714 | */ |
715 | #define WRITE64(n) do { \ | ||
716 | *p++ = htonl((uint32_t)((n) >> 32)); \ | ||
717 | *p++ = htonl((uint32_t)(n)); \ | ||
718 | } while (0) | ||
719 | #define WRITEMEM(ptr,nbytes) do { \ | 715 | #define WRITEMEM(ptr,nbytes) do { \ |
720 | p = xdr_encode_opaque_fixed(p, ptr, nbytes); \ | 716 | p = xdr_encode_opaque_fixed(p, ptr, nbytes); \ |
721 | } while (0) | 717 | } while (0) |
@@ -840,7 +836,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
840 | 836 | ||
841 | if (iap->ia_valid & ATTR_SIZE) { | 837 | if (iap->ia_valid & ATTR_SIZE) { |
842 | bmval0 |= FATTR4_WORD0_SIZE; | 838 | bmval0 |= FATTR4_WORD0_SIZE; |
843 | WRITE64(iap->ia_size); | 839 | p = xdr_encode_hyper(p, iap->ia_size); |
844 | } | 840 | } |
845 | if (iap->ia_valid & ATTR_MODE) { | 841 | if (iap->ia_valid & ATTR_MODE) { |
846 | bmval1 |= FATTR4_WORD1_MODE; | 842 | bmval1 |= FATTR4_WORD1_MODE; |
@@ -924,7 +920,7 @@ static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *ar | |||
924 | 920 | ||
925 | RESERVE_SPACE(16); | 921 | RESERVE_SPACE(16); |
926 | *p++ = cpu_to_be32(OP_COMMIT); | 922 | *p++ = cpu_to_be32(OP_COMMIT); |
927 | WRITE64(args->offset); | 923 | p = xdr_encode_hyper(p, args->offset); |
928 | *p++ = cpu_to_be32(args->count); | 924 | *p++ = cpu_to_be32(args->count); |
929 | hdr->nops++; | 925 | hdr->nops++; |
930 | hdr->replen += decode_commit_maxsz; | 926 | hdr->replen += decode_commit_maxsz; |
@@ -1055,18 +1051,18 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args | |||
1055 | *p++ = cpu_to_be32(OP_LOCK); | 1051 | *p++ = cpu_to_be32(OP_LOCK); |
1056 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, args->block)); | 1052 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, args->block)); |
1057 | *p++ = cpu_to_be32(args->reclaim); | 1053 | *p++ = cpu_to_be32(args->reclaim); |
1058 | WRITE64(args->fl->fl_start); | 1054 | p = xdr_encode_hyper(p, args->fl->fl_start); |
1059 | WRITE64(nfs4_lock_length(args->fl)); | 1055 | p = xdr_encode_hyper(p, nfs4_lock_length(args->fl)); |
1060 | *p++ = cpu_to_be32(args->new_lock_owner); | 1056 | *p++ = cpu_to_be32(args->new_lock_owner); |
1061 | if (args->new_lock_owner){ | 1057 | if (args->new_lock_owner){ |
1062 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+32); | 1058 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+32); |
1063 | *p++ = cpu_to_be32(args->open_seqid->sequence->counter); | 1059 | *p++ = cpu_to_be32(args->open_seqid->sequence->counter); |
1064 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); | 1060 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); |
1065 | *p++ = cpu_to_be32(args->lock_seqid->sequence->counter); | 1061 | *p++ = cpu_to_be32(args->lock_seqid->sequence->counter); |
1066 | WRITE64(args->lock_owner.clientid); | 1062 | p = xdr_encode_hyper(p, args->lock_owner.clientid); |
1067 | *p++ = cpu_to_be32(16); | 1063 | *p++ = cpu_to_be32(16); |
1068 | WRITEMEM("lock id:", 8); | 1064 | WRITEMEM("lock id:", 8); |
1069 | WRITE64(args->lock_owner.id); | 1065 | p = xdr_encode_hyper(p, args->lock_owner.id); |
1070 | } | 1066 | } |
1071 | else { | 1067 | else { |
1072 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); | 1068 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); |
@@ -1084,12 +1080,12 @@ static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *ar | |||
1084 | RESERVE_SPACE(52); | 1080 | RESERVE_SPACE(52); |
1085 | *p++ = cpu_to_be32(OP_LOCKT); | 1081 | *p++ = cpu_to_be32(OP_LOCKT); |
1086 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0)); | 1082 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0)); |
1087 | WRITE64(args->fl->fl_start); | 1083 | p = xdr_encode_hyper(p, args->fl->fl_start); |
1088 | WRITE64(nfs4_lock_length(args->fl)); | 1084 | p = xdr_encode_hyper(p, nfs4_lock_length(args->fl)); |
1089 | WRITE64(args->lock_owner.clientid); | 1085 | p = xdr_encode_hyper(p, args->lock_owner.clientid); |
1090 | *p++ = cpu_to_be32(16); | 1086 | *p++ = cpu_to_be32(16); |
1091 | WRITEMEM("lock id:", 8); | 1087 | WRITEMEM("lock id:", 8); |
1092 | WRITE64(args->lock_owner.id); | 1088 | p = xdr_encode_hyper(p, args->lock_owner.id); |
1093 | hdr->nops++; | 1089 | hdr->nops++; |
1094 | hdr->replen += decode_lockt_maxsz; | 1090 | hdr->replen += decode_lockt_maxsz; |
1095 | } | 1091 | } |
@@ -1103,8 +1099,8 @@ static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *ar | |||
1103 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0)); | 1099 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0)); |
1104 | *p++ = cpu_to_be32(args->seqid->sequence->counter); | 1100 | *p++ = cpu_to_be32(args->seqid->sequence->counter); |
1105 | WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE); | 1101 | WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE); |
1106 | WRITE64(args->fl->fl_start); | 1102 | p = xdr_encode_hyper(p, args->fl->fl_start); |
1107 | WRITE64(nfs4_lock_length(args->fl)); | 1103 | p = xdr_encode_hyper(p, nfs4_lock_length(args->fl)); |
1108 | hdr->nops++; | 1104 | hdr->nops++; |
1109 | hdr->replen += decode_locku_maxsz; | 1105 | hdr->replen += decode_locku_maxsz; |
1110 | } | 1106 | } |
@@ -1155,10 +1151,10 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
1155 | *p++ = cpu_to_be32(arg->seqid->sequence->counter); | 1151 | *p++ = cpu_to_be32(arg->seqid->sequence->counter); |
1156 | encode_share_access(xdr, arg->fmode); | 1152 | encode_share_access(xdr, arg->fmode); |
1157 | RESERVE_SPACE(28); | 1153 | RESERVE_SPACE(28); |
1158 | WRITE64(arg->clientid); | 1154 | p = xdr_encode_hyper(p, arg->clientid); |
1159 | *p++ = cpu_to_be32(16); | 1155 | *p++ = cpu_to_be32(16); |
1160 | WRITEMEM("open id:", 8); | 1156 | WRITEMEM("open id:", 8); |
1161 | WRITE64(arg->id); | 1157 | p = xdr_encode_hyper(p, arg->id); |
1162 | } | 1158 | } |
1163 | 1159 | ||
1164 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 1160 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
@@ -1334,7 +1330,7 @@ static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, | |||
1334 | encode_stateid(xdr, args->context); | 1330 | encode_stateid(xdr, args->context); |
1335 | 1331 | ||
1336 | RESERVE_SPACE(12); | 1332 | RESERVE_SPACE(12); |
1337 | WRITE64(args->offset); | 1333 | p = xdr_encode_hyper(p, args->offset); |
1338 | *p++ = cpu_to_be32(args->count); | 1334 | *p++ = cpu_to_be32(args->count); |
1339 | hdr->nops++; | 1335 | hdr->nops++; |
1340 | hdr->replen += decode_read_maxsz; | 1336 | hdr->replen += decode_read_maxsz; |
@@ -1350,7 +1346,7 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg | |||
1350 | 1346 | ||
1351 | RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); | 1347 | RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); |
1352 | *p++ = cpu_to_be32(OP_READDIR); | 1348 | *p++ = cpu_to_be32(OP_READDIR); |
1353 | WRITE64(readdir->cookie); | 1349 | p = xdr_encode_hyper(p, readdir->cookie); |
1354 | WRITEMEM(readdir->verifier.data, NFS4_VERIFIER_SIZE); | 1350 | WRITEMEM(readdir->verifier.data, NFS4_VERIFIER_SIZE); |
1355 | *p++ = cpu_to_be32(readdir->count >> 1); /* We're not doing readdirplus */ | 1351 | *p++ = cpu_to_be32(readdir->count >> 1); /* We're not doing readdirplus */ |
1356 | *p++ = cpu_to_be32(readdir->count); | 1352 | *p++ = cpu_to_be32(readdir->count); |
@@ -1417,7 +1413,7 @@ static void encode_renew(struct xdr_stream *xdr, const struct nfs_client *client | |||
1417 | 1413 | ||
1418 | RESERVE_SPACE(12); | 1414 | RESERVE_SPACE(12); |
1419 | *p++ = cpu_to_be32(OP_RENEW); | 1415 | *p++ = cpu_to_be32(OP_RENEW); |
1420 | WRITE64(client_stateid->cl_clientid); | 1416 | p = xdr_encode_hyper(p, client_stateid->cl_clientid); |
1421 | hdr->nops++; | 1417 | hdr->nops++; |
1422 | hdr->replen += decode_renew_maxsz; | 1418 | hdr->replen += decode_renew_maxsz; |
1423 | } | 1419 | } |
@@ -1502,7 +1498,7 @@ static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_ | |||
1502 | 1498 | ||
1503 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); | 1499 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); |
1504 | *p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM); | 1500 | *p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM); |
1505 | WRITE64(client_state->cl_clientid); | 1501 | p = xdr_encode_hyper(p, client_state->cl_clientid); |
1506 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); | 1502 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); |
1507 | hdr->nops++; | 1503 | hdr->nops++; |
1508 | hdr->replen += decode_setclientid_confirm_maxsz; | 1504 | hdr->replen += decode_setclientid_confirm_maxsz; |
@@ -1518,7 +1514,7 @@ static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *arg | |||
1518 | encode_stateid(xdr, args->context); | 1514 | encode_stateid(xdr, args->context); |
1519 | 1515 | ||
1520 | RESERVE_SPACE(16); | 1516 | RESERVE_SPACE(16); |
1521 | WRITE64(args->offset); | 1517 | p = xdr_encode_hyper(p, args->offset); |
1522 | *p++ = cpu_to_be32(args->stable); | 1518 | *p++ = cpu_to_be32(args->stable); |
1523 | *p++ = cpu_to_be32(args->count); | 1519 | *p++ = cpu_to_be32(args->count); |
1524 | 1520 | ||
@@ -1574,7 +1570,7 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1574 | *p++ = cpu_to_be32(OP_CREATE_SESSION); | 1570 | *p++ = cpu_to_be32(OP_CREATE_SESSION); |
1575 | 1571 | ||
1576 | RESERVE_SPACE(8); | 1572 | RESERVE_SPACE(8); |
1577 | WRITE64(clp->cl_ex_clid); | 1573 | p = xdr_encode_hyper(p, clp->cl_ex_clid); |
1578 | 1574 | ||
1579 | RESERVE_SPACE(8); | 1575 | RESERVE_SPACE(8); |
1580 | *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */ | 1576 | *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */ |