diff options
-rw-r--r-- | fs/nfs/nfs4xdr.c | 291 |
1 files changed, 145 insertions, 146 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 617273e7d47f..9a03b24ead5f 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -712,7 +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 WRITE32(n) *p++ = htonl(n) | ||
716 | #define WRITE64(n) do { \ | 715 | #define WRITE64(n) do { \ |
717 | *p++ = htonl((uint32_t)((n) >> 32)); \ | 716 | *p++ = htonl((uint32_t)((n) >> 32)); \ |
718 | *p++ = htonl((uint32_t)(n)); \ | 717 | *p++ = htonl((uint32_t)(n)); \ |
@@ -750,11 +749,11 @@ static void encode_compound_hdr(struct xdr_stream *xdr, | |||
750 | dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag); | 749 | dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag); |
751 | BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); | 750 | BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); |
752 | RESERVE_SPACE(12+(XDR_QUADLEN(hdr->taglen)<<2)); | 751 | RESERVE_SPACE(12+(XDR_QUADLEN(hdr->taglen)<<2)); |
753 | WRITE32(hdr->taglen); | 752 | *p++ = cpu_to_be32(hdr->taglen); |
754 | WRITEMEM(hdr->tag, hdr->taglen); | 753 | WRITEMEM(hdr->tag, hdr->taglen); |
755 | WRITE32(hdr->minorversion); | 754 | *p++ = cpu_to_be32(hdr->minorversion); |
756 | hdr->nops_p = p; | 755 | hdr->nops_p = p; |
757 | WRITE32(hdr->nops); | 756 | *p++ = cpu_to_be32(hdr->nops); |
758 | } | 757 | } |
759 | 758 | ||
760 | static void encode_nops(struct compound_hdr *hdr) | 759 | static void encode_nops(struct compound_hdr *hdr) |
@@ -835,7 +834,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
835 | * We write the bitmap length now, but leave the bitmap and the attribute | 834 | * We write the bitmap length now, but leave the bitmap and the attribute |
836 | * buffer length to be backfilled at the end of this routine. | 835 | * buffer length to be backfilled at the end of this routine. |
837 | */ | 836 | */ |
838 | WRITE32(2); | 837 | *p++ = cpu_to_be32(2); |
839 | q = p; | 838 | q = p; |
840 | p += 3; | 839 | p += 3; |
841 | 840 | ||
@@ -845,39 +844,39 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
845 | } | 844 | } |
846 | if (iap->ia_valid & ATTR_MODE) { | 845 | if (iap->ia_valid & ATTR_MODE) { |
847 | bmval1 |= FATTR4_WORD1_MODE; | 846 | bmval1 |= FATTR4_WORD1_MODE; |
848 | WRITE32(iap->ia_mode & S_IALLUGO); | 847 | *p++ = cpu_to_be32(iap->ia_mode & S_IALLUGO); |
849 | } | 848 | } |
850 | if (iap->ia_valid & ATTR_UID) { | 849 | if (iap->ia_valid & ATTR_UID) { |
851 | bmval1 |= FATTR4_WORD1_OWNER; | 850 | bmval1 |= FATTR4_WORD1_OWNER; |
852 | WRITE32(owner_namelen); | 851 | *p++ = cpu_to_be32(owner_namelen); |
853 | WRITEMEM(owner_name, owner_namelen); | 852 | WRITEMEM(owner_name, owner_namelen); |
854 | } | 853 | } |
855 | if (iap->ia_valid & ATTR_GID) { | 854 | if (iap->ia_valid & ATTR_GID) { |
856 | bmval1 |= FATTR4_WORD1_OWNER_GROUP; | 855 | bmval1 |= FATTR4_WORD1_OWNER_GROUP; |
857 | WRITE32(owner_grouplen); | 856 | *p++ = cpu_to_be32(owner_grouplen); |
858 | WRITEMEM(owner_group, owner_grouplen); | 857 | WRITEMEM(owner_group, owner_grouplen); |
859 | } | 858 | } |
860 | if (iap->ia_valid & ATTR_ATIME_SET) { | 859 | if (iap->ia_valid & ATTR_ATIME_SET) { |
861 | bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; | 860 | bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; |
862 | WRITE32(NFS4_SET_TO_CLIENT_TIME); | 861 | *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); |
863 | WRITE32(0); | 862 | *p++ = cpu_to_be32(0); |
864 | WRITE32(iap->ia_mtime.tv_sec); | 863 | *p++ = cpu_to_be32(iap->ia_mtime.tv_sec); |
865 | WRITE32(iap->ia_mtime.tv_nsec); | 864 | *p++ = cpu_to_be32(iap->ia_mtime.tv_nsec); |
866 | } | 865 | } |
867 | else if (iap->ia_valid & ATTR_ATIME) { | 866 | else if (iap->ia_valid & ATTR_ATIME) { |
868 | bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; | 867 | bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; |
869 | WRITE32(NFS4_SET_TO_SERVER_TIME); | 868 | *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); |
870 | } | 869 | } |
871 | if (iap->ia_valid & ATTR_MTIME_SET) { | 870 | if (iap->ia_valid & ATTR_MTIME_SET) { |
872 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; | 871 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; |
873 | WRITE32(NFS4_SET_TO_CLIENT_TIME); | 872 | *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); |
874 | WRITE32(0); | 873 | *p++ = cpu_to_be32(0); |
875 | WRITE32(iap->ia_mtime.tv_sec); | 874 | *p++ = cpu_to_be32(iap->ia_mtime.tv_sec); |
876 | WRITE32(iap->ia_mtime.tv_nsec); | 875 | *p++ = cpu_to_be32(iap->ia_mtime.tv_nsec); |
877 | } | 876 | } |
878 | else if (iap->ia_valid & ATTR_MTIME) { | 877 | else if (iap->ia_valid & ATTR_MTIME) { |
879 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; | 878 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; |
880 | WRITE32(NFS4_SET_TO_SERVER_TIME); | 879 | *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); |
881 | } | 880 | } |
882 | 881 | ||
883 | /* | 882 | /* |
@@ -901,8 +900,8 @@ static void encode_access(struct xdr_stream *xdr, u32 access, struct compound_hd | |||
901 | __be32 *p; | 900 | __be32 *p; |
902 | 901 | ||
903 | RESERVE_SPACE(8); | 902 | RESERVE_SPACE(8); |
904 | WRITE32(OP_ACCESS); | 903 | *p++ = cpu_to_be32(OP_ACCESS); |
905 | WRITE32(access); | 904 | *p++ = cpu_to_be32(access); |
906 | hdr->nops++; | 905 | hdr->nops++; |
907 | hdr->replen += decode_access_maxsz; | 906 | hdr->replen += decode_access_maxsz; |
908 | } | 907 | } |
@@ -912,8 +911,8 @@ static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg | |||
912 | __be32 *p; | 911 | __be32 *p; |
913 | 912 | ||
914 | RESERVE_SPACE(8+NFS4_STATEID_SIZE); | 913 | RESERVE_SPACE(8+NFS4_STATEID_SIZE); |
915 | WRITE32(OP_CLOSE); | 914 | *p++ = cpu_to_be32(OP_CLOSE); |
916 | WRITE32(arg->seqid->sequence->counter); | 915 | *p++ = cpu_to_be32(arg->seqid->sequence->counter); |
917 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); | 916 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
918 | hdr->nops++; | 917 | hdr->nops++; |
919 | hdr->replen += decode_close_maxsz; | 918 | hdr->replen += decode_close_maxsz; |
@@ -924,9 +923,9 @@ static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *ar | |||
924 | __be32 *p; | 923 | __be32 *p; |
925 | 924 | ||
926 | RESERVE_SPACE(16); | 925 | RESERVE_SPACE(16); |
927 | WRITE32(OP_COMMIT); | 926 | *p++ = cpu_to_be32(OP_COMMIT); |
928 | WRITE64(args->offset); | 927 | WRITE64(args->offset); |
929 | WRITE32(args->count); | 928 | *p++ = cpu_to_be32(args->count); |
930 | hdr->nops++; | 929 | hdr->nops++; |
931 | hdr->replen += decode_commit_maxsz; | 930 | hdr->replen += decode_commit_maxsz; |
932 | } | 931 | } |
@@ -936,20 +935,20 @@ static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg * | |||
936 | __be32 *p; | 935 | __be32 *p; |
937 | 936 | ||
938 | RESERVE_SPACE(8); | 937 | RESERVE_SPACE(8); |
939 | WRITE32(OP_CREATE); | 938 | *p++ = cpu_to_be32(OP_CREATE); |
940 | WRITE32(create->ftype); | 939 | *p++ = cpu_to_be32(create->ftype); |
941 | 940 | ||
942 | switch (create->ftype) { | 941 | switch (create->ftype) { |
943 | case NF4LNK: | 942 | case NF4LNK: |
944 | RESERVE_SPACE(4); | 943 | RESERVE_SPACE(4); |
945 | WRITE32(create->u.symlink.len); | 944 | *p++ = cpu_to_be32(create->u.symlink.len); |
946 | xdr_write_pages(xdr, create->u.symlink.pages, 0, create->u.symlink.len); | 945 | xdr_write_pages(xdr, create->u.symlink.pages, 0, create->u.symlink.len); |
947 | break; | 946 | break; |
948 | 947 | ||
949 | case NF4BLK: case NF4CHR: | 948 | case NF4BLK: case NF4CHR: |
950 | RESERVE_SPACE(8); | 949 | RESERVE_SPACE(8); |
951 | WRITE32(create->u.device.specdata1); | 950 | *p++ = cpu_to_be32(create->u.device.specdata1); |
952 | WRITE32(create->u.device.specdata2); | 951 | *p++ = cpu_to_be32(create->u.device.specdata2); |
953 | break; | 952 | break; |
954 | 953 | ||
955 | default: | 954 | default: |
@@ -957,7 +956,7 @@ static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg * | |||
957 | } | 956 | } |
958 | 957 | ||
959 | RESERVE_SPACE(4 + create->name->len); | 958 | RESERVE_SPACE(4 + create->name->len); |
960 | WRITE32(create->name->len); | 959 | *p++ = cpu_to_be32(create->name->len); |
961 | WRITEMEM(create->name->name, create->name->len); | 960 | WRITEMEM(create->name->name, create->name->len); |
962 | hdr->nops++; | 961 | hdr->nops++; |
963 | hdr->replen += decode_create_maxsz; | 962 | hdr->replen += decode_create_maxsz; |
@@ -970,9 +969,9 @@ static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct c | |||
970 | __be32 *p; | 969 | __be32 *p; |
971 | 970 | ||
972 | RESERVE_SPACE(12); | 971 | RESERVE_SPACE(12); |
973 | WRITE32(OP_GETATTR); | 972 | *p++ = cpu_to_be32(OP_GETATTR); |
974 | WRITE32(1); | 973 | *p++ = cpu_to_be32(1); |
975 | WRITE32(bitmap); | 974 | *p++ = cpu_to_be32(bitmap); |
976 | hdr->nops++; | 975 | hdr->nops++; |
977 | hdr->replen += decode_getattr_maxsz; | 976 | hdr->replen += decode_getattr_maxsz; |
978 | } | 977 | } |
@@ -982,10 +981,10 @@ static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm | |||
982 | __be32 *p; | 981 | __be32 *p; |
983 | 982 | ||
984 | RESERVE_SPACE(16); | 983 | RESERVE_SPACE(16); |
985 | WRITE32(OP_GETATTR); | 984 | *p++ = cpu_to_be32(OP_GETATTR); |
986 | WRITE32(2); | 985 | *p++ = cpu_to_be32(2); |
987 | WRITE32(bm0); | 986 | *p++ = cpu_to_be32(bm0); |
988 | WRITE32(bm1); | 987 | *p++ = cpu_to_be32(bm1); |
989 | hdr->nops++; | 988 | hdr->nops++; |
990 | hdr->replen += decode_getattr_maxsz; | 989 | hdr->replen += decode_getattr_maxsz; |
991 | } | 990 | } |
@@ -1013,7 +1012,7 @@ static void encode_getfh(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
1013 | __be32 *p; | 1012 | __be32 *p; |
1014 | 1013 | ||
1015 | RESERVE_SPACE(4); | 1014 | RESERVE_SPACE(4); |
1016 | WRITE32(OP_GETFH); | 1015 | *p++ = cpu_to_be32(OP_GETFH); |
1017 | hdr->nops++; | 1016 | hdr->nops++; |
1018 | hdr->replen += decode_getfh_maxsz; | 1017 | hdr->replen += decode_getfh_maxsz; |
1019 | } | 1018 | } |
@@ -1023,8 +1022,8 @@ static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct | |||
1023 | __be32 *p; | 1022 | __be32 *p; |
1024 | 1023 | ||
1025 | RESERVE_SPACE(8 + name->len); | 1024 | RESERVE_SPACE(8 + name->len); |
1026 | WRITE32(OP_LINK); | 1025 | *p++ = cpu_to_be32(OP_LINK); |
1027 | WRITE32(name->len); | 1026 | *p++ = cpu_to_be32(name->len); |
1028 | WRITEMEM(name->name, name->len); | 1027 | WRITEMEM(name->name, name->len); |
1029 | hdr->nops++; | 1028 | hdr->nops++; |
1030 | hdr->replen += decode_link_maxsz; | 1029 | hdr->replen += decode_link_maxsz; |
@@ -1053,26 +1052,26 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args | |||
1053 | __be32 *p; | 1052 | __be32 *p; |
1054 | 1053 | ||
1055 | RESERVE_SPACE(32); | 1054 | RESERVE_SPACE(32); |
1056 | WRITE32(OP_LOCK); | 1055 | *p++ = cpu_to_be32(OP_LOCK); |
1057 | WRITE32(nfs4_lock_type(args->fl, args->block)); | 1056 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, args->block)); |
1058 | WRITE32(args->reclaim); | 1057 | *p++ = cpu_to_be32(args->reclaim); |
1059 | WRITE64(args->fl->fl_start); | 1058 | WRITE64(args->fl->fl_start); |
1060 | WRITE64(nfs4_lock_length(args->fl)); | 1059 | WRITE64(nfs4_lock_length(args->fl)); |
1061 | WRITE32(args->new_lock_owner); | 1060 | *p++ = cpu_to_be32(args->new_lock_owner); |
1062 | if (args->new_lock_owner){ | 1061 | if (args->new_lock_owner){ |
1063 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+32); | 1062 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+32); |
1064 | WRITE32(args->open_seqid->sequence->counter); | 1063 | *p++ = cpu_to_be32(args->open_seqid->sequence->counter); |
1065 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); | 1064 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); |
1066 | WRITE32(args->lock_seqid->sequence->counter); | 1065 | *p++ = cpu_to_be32(args->lock_seqid->sequence->counter); |
1067 | WRITE64(args->lock_owner.clientid); | 1066 | WRITE64(args->lock_owner.clientid); |
1068 | WRITE32(16); | 1067 | *p++ = cpu_to_be32(16); |
1069 | WRITEMEM("lock id:", 8); | 1068 | WRITEMEM("lock id:", 8); |
1070 | WRITE64(args->lock_owner.id); | 1069 | WRITE64(args->lock_owner.id); |
1071 | } | 1070 | } |
1072 | else { | 1071 | else { |
1073 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); | 1072 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); |
1074 | WRITEMEM(args->lock_stateid->data, NFS4_STATEID_SIZE); | 1073 | WRITEMEM(args->lock_stateid->data, NFS4_STATEID_SIZE); |
1075 | WRITE32(args->lock_seqid->sequence->counter); | 1074 | *p++ = cpu_to_be32(args->lock_seqid->sequence->counter); |
1076 | } | 1075 | } |
1077 | hdr->nops++; | 1076 | hdr->nops++; |
1078 | hdr->replen += decode_lock_maxsz; | 1077 | hdr->replen += decode_lock_maxsz; |
@@ -1083,12 +1082,12 @@ static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *ar | |||
1083 | __be32 *p; | 1082 | __be32 *p; |
1084 | 1083 | ||
1085 | RESERVE_SPACE(52); | 1084 | RESERVE_SPACE(52); |
1086 | WRITE32(OP_LOCKT); | 1085 | *p++ = cpu_to_be32(OP_LOCKT); |
1087 | WRITE32(nfs4_lock_type(args->fl, 0)); | 1086 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0)); |
1088 | WRITE64(args->fl->fl_start); | 1087 | WRITE64(args->fl->fl_start); |
1089 | WRITE64(nfs4_lock_length(args->fl)); | 1088 | WRITE64(nfs4_lock_length(args->fl)); |
1090 | WRITE64(args->lock_owner.clientid); | 1089 | WRITE64(args->lock_owner.clientid); |
1091 | WRITE32(16); | 1090 | *p++ = cpu_to_be32(16); |
1092 | WRITEMEM("lock id:", 8); | 1091 | WRITEMEM("lock id:", 8); |
1093 | WRITE64(args->lock_owner.id); | 1092 | WRITE64(args->lock_owner.id); |
1094 | hdr->nops++; | 1093 | hdr->nops++; |
@@ -1100,9 +1099,9 @@ static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *ar | |||
1100 | __be32 *p; | 1099 | __be32 *p; |
1101 | 1100 | ||
1102 | RESERVE_SPACE(12+NFS4_STATEID_SIZE+16); | 1101 | RESERVE_SPACE(12+NFS4_STATEID_SIZE+16); |
1103 | WRITE32(OP_LOCKU); | 1102 | *p++ = cpu_to_be32(OP_LOCKU); |
1104 | WRITE32(nfs4_lock_type(args->fl, 0)); | 1103 | *p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0)); |
1105 | WRITE32(args->seqid->sequence->counter); | 1104 | *p++ = cpu_to_be32(args->seqid->sequence->counter); |
1106 | WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE); | 1105 | WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE); |
1107 | WRITE64(args->fl->fl_start); | 1106 | WRITE64(args->fl->fl_start); |
1108 | WRITE64(nfs4_lock_length(args->fl)); | 1107 | WRITE64(nfs4_lock_length(args->fl)); |
@@ -1116,8 +1115,8 @@ static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struc | |||
1116 | __be32 *p; | 1115 | __be32 *p; |
1117 | 1116 | ||
1118 | RESERVE_SPACE(8 + len); | 1117 | RESERVE_SPACE(8 + len); |
1119 | WRITE32(OP_LOOKUP); | 1118 | *p++ = cpu_to_be32(OP_LOOKUP); |
1120 | WRITE32(len); | 1119 | *p++ = cpu_to_be32(len); |
1121 | WRITEMEM(name->name, len); | 1120 | WRITEMEM(name->name, len); |
1122 | hdr->nops++; | 1121 | hdr->nops++; |
1123 | hdr->replen += decode_lookup_maxsz; | 1122 | hdr->replen += decode_lookup_maxsz; |
@@ -1130,18 +1129,18 @@ static void encode_share_access(struct xdr_stream *xdr, fmode_t fmode) | |||
1130 | RESERVE_SPACE(8); | 1129 | RESERVE_SPACE(8); |
1131 | switch (fmode & (FMODE_READ|FMODE_WRITE)) { | 1130 | switch (fmode & (FMODE_READ|FMODE_WRITE)) { |
1132 | case FMODE_READ: | 1131 | case FMODE_READ: |
1133 | WRITE32(NFS4_SHARE_ACCESS_READ); | 1132 | *p++ = cpu_to_be32(NFS4_SHARE_ACCESS_READ); |
1134 | break; | 1133 | break; |
1135 | case FMODE_WRITE: | 1134 | case FMODE_WRITE: |
1136 | WRITE32(NFS4_SHARE_ACCESS_WRITE); | 1135 | *p++ = cpu_to_be32(NFS4_SHARE_ACCESS_WRITE); |
1137 | break; | 1136 | break; |
1138 | case FMODE_READ|FMODE_WRITE: | 1137 | case FMODE_READ|FMODE_WRITE: |
1139 | WRITE32(NFS4_SHARE_ACCESS_BOTH); | 1138 | *p++ = cpu_to_be32(NFS4_SHARE_ACCESS_BOTH); |
1140 | break; | 1139 | break; |
1141 | default: | 1140 | default: |
1142 | WRITE32(0); | 1141 | *p++ = cpu_to_be32(0); |
1143 | } | 1142 | } |
1144 | WRITE32(0); /* for linux, share_deny = 0 always */ | 1143 | *p++ = cpu_to_be32(0); /* for linux, share_deny = 0 always */ |
1145 | } | 1144 | } |
1146 | 1145 | ||
1147 | static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 1146 | static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
@@ -1152,12 +1151,12 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
1152 | * owner 4 = 32 | 1151 | * owner 4 = 32 |
1153 | */ | 1152 | */ |
1154 | RESERVE_SPACE(8); | 1153 | RESERVE_SPACE(8); |
1155 | WRITE32(OP_OPEN); | 1154 | *p++ = cpu_to_be32(OP_OPEN); |
1156 | WRITE32(arg->seqid->sequence->counter); | 1155 | *p++ = cpu_to_be32(arg->seqid->sequence->counter); |
1157 | encode_share_access(xdr, arg->fmode); | 1156 | encode_share_access(xdr, arg->fmode); |
1158 | RESERVE_SPACE(28); | 1157 | RESERVE_SPACE(28); |
1159 | WRITE64(arg->clientid); | 1158 | WRITE64(arg->clientid); |
1160 | WRITE32(16); | 1159 | *p++ = cpu_to_be32(16); |
1161 | WRITEMEM("open id:", 8); | 1160 | WRITEMEM("open id:", 8); |
1162 | WRITE64(arg->id); | 1161 | WRITE64(arg->id); |
1163 | } | 1162 | } |
@@ -1169,11 +1168,11 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op | |||
1169 | RESERVE_SPACE(4); | 1168 | RESERVE_SPACE(4); |
1170 | switch(arg->open_flags & O_EXCL) { | 1169 | switch(arg->open_flags & O_EXCL) { |
1171 | case 0: | 1170 | case 0: |
1172 | WRITE32(NFS4_CREATE_UNCHECKED); | 1171 | *p++ = cpu_to_be32(NFS4_CREATE_UNCHECKED); |
1173 | encode_attrs(xdr, arg->u.attrs, arg->server); | 1172 | encode_attrs(xdr, arg->u.attrs, arg->server); |
1174 | break; | 1173 | break; |
1175 | default: | 1174 | default: |
1176 | WRITE32(NFS4_CREATE_EXCLUSIVE); | 1175 | *p++ = cpu_to_be32(NFS4_CREATE_EXCLUSIVE); |
1177 | encode_nfs4_verifier(xdr, &arg->u.verifier); | 1176 | encode_nfs4_verifier(xdr, &arg->u.verifier); |
1178 | } | 1177 | } |
1179 | } | 1178 | } |
@@ -1185,11 +1184,11 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a | |||
1185 | RESERVE_SPACE(4); | 1184 | RESERVE_SPACE(4); |
1186 | switch (arg->open_flags & O_CREAT) { | 1185 | switch (arg->open_flags & O_CREAT) { |
1187 | case 0: | 1186 | case 0: |
1188 | WRITE32(NFS4_OPEN_NOCREATE); | 1187 | *p++ = cpu_to_be32(NFS4_OPEN_NOCREATE); |
1189 | break; | 1188 | break; |
1190 | default: | 1189 | default: |
1191 | BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); | 1190 | BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); |
1192 | WRITE32(NFS4_OPEN_CREATE); | 1191 | *p++ = cpu_to_be32(NFS4_OPEN_CREATE); |
1193 | encode_createmode(xdr, arg); | 1192 | encode_createmode(xdr, arg); |
1194 | } | 1193 | } |
1195 | } | 1194 | } |
@@ -1201,13 +1200,13 @@ static inline void encode_delegation_type(struct xdr_stream *xdr, fmode_t delega | |||
1201 | RESERVE_SPACE(4); | 1200 | RESERVE_SPACE(4); |
1202 | switch (delegation_type) { | 1201 | switch (delegation_type) { |
1203 | case 0: | 1202 | case 0: |
1204 | WRITE32(NFS4_OPEN_DELEGATE_NONE); | 1203 | *p++ = cpu_to_be32(NFS4_OPEN_DELEGATE_NONE); |
1205 | break; | 1204 | break; |
1206 | case FMODE_READ: | 1205 | case FMODE_READ: |
1207 | WRITE32(NFS4_OPEN_DELEGATE_READ); | 1206 | *p++ = cpu_to_be32(NFS4_OPEN_DELEGATE_READ); |
1208 | break; | 1207 | break; |
1209 | case FMODE_WRITE|FMODE_READ: | 1208 | case FMODE_WRITE|FMODE_READ: |
1210 | WRITE32(NFS4_OPEN_DELEGATE_WRITE); | 1209 | *p++ = cpu_to_be32(NFS4_OPEN_DELEGATE_WRITE); |
1211 | break; | 1210 | break; |
1212 | default: | 1211 | default: |
1213 | BUG(); | 1212 | BUG(); |
@@ -1219,7 +1218,7 @@ static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr * | |||
1219 | __be32 *p; | 1218 | __be32 *p; |
1220 | 1219 | ||
1221 | RESERVE_SPACE(4); | 1220 | RESERVE_SPACE(4); |
1222 | WRITE32(NFS4_OPEN_CLAIM_NULL); | 1221 | *p++ = cpu_to_be32(NFS4_OPEN_CLAIM_NULL); |
1223 | encode_string(xdr, name->len, name->name); | 1222 | encode_string(xdr, name->len, name->name); |
1224 | } | 1223 | } |
1225 | 1224 | ||
@@ -1228,7 +1227,7 @@ static inline void encode_claim_previous(struct xdr_stream *xdr, fmode_t type) | |||
1228 | __be32 *p; | 1227 | __be32 *p; |
1229 | 1228 | ||
1230 | RESERVE_SPACE(4); | 1229 | RESERVE_SPACE(4); |
1231 | WRITE32(NFS4_OPEN_CLAIM_PREVIOUS); | 1230 | *p++ = cpu_to_be32(NFS4_OPEN_CLAIM_PREVIOUS); |
1232 | encode_delegation_type(xdr, type); | 1231 | encode_delegation_type(xdr, type); |
1233 | } | 1232 | } |
1234 | 1233 | ||
@@ -1237,7 +1236,7 @@ static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struc | |||
1237 | __be32 *p; | 1236 | __be32 *p; |
1238 | 1237 | ||
1239 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); | 1238 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1240 | WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR); | 1239 | *p++ = cpu_to_be32(NFS4_OPEN_CLAIM_DELEGATE_CUR); |
1241 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); | 1240 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); |
1242 | encode_string(xdr, name->len, name->name); | 1241 | encode_string(xdr, name->len, name->name); |
1243 | } | 1242 | } |
@@ -1268,9 +1267,9 @@ static void encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_co | |||
1268 | __be32 *p; | 1267 | __be32 *p; |
1269 | 1268 | ||
1270 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+4); | 1269 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+4); |
1271 | WRITE32(OP_OPEN_CONFIRM); | 1270 | *p++ = cpu_to_be32(OP_OPEN_CONFIRM); |
1272 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); | 1271 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
1273 | WRITE32(arg->seqid->sequence->counter); | 1272 | *p++ = cpu_to_be32(arg->seqid->sequence->counter); |
1274 | hdr->nops++; | 1273 | hdr->nops++; |
1275 | hdr->replen += decode_open_confirm_maxsz; | 1274 | hdr->replen += decode_open_confirm_maxsz; |
1276 | } | 1275 | } |
@@ -1280,9 +1279,9 @@ static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_close | |||
1280 | __be32 *p; | 1279 | __be32 *p; |
1281 | 1280 | ||
1282 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+4); | 1281 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+4); |
1283 | WRITE32(OP_OPEN_DOWNGRADE); | 1282 | *p++ = cpu_to_be32(OP_OPEN_DOWNGRADE); |
1284 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); | 1283 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
1285 | WRITE32(arg->seqid->sequence->counter); | 1284 | *p++ = cpu_to_be32(arg->seqid->sequence->counter); |
1286 | encode_share_access(xdr, arg->fmode); | 1285 | encode_share_access(xdr, arg->fmode); |
1287 | hdr->nops++; | 1286 | hdr->nops++; |
1288 | hdr->replen += decode_open_downgrade_maxsz; | 1287 | hdr->replen += decode_open_downgrade_maxsz; |
@@ -1295,8 +1294,8 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh, struct compound_hd | |||
1295 | __be32 *p; | 1294 | __be32 *p; |
1296 | 1295 | ||
1297 | RESERVE_SPACE(8 + len); | 1296 | RESERVE_SPACE(8 + len); |
1298 | WRITE32(OP_PUTFH); | 1297 | *p++ = cpu_to_be32(OP_PUTFH); |
1299 | WRITE32(len); | 1298 | *p++ = cpu_to_be32(len); |
1300 | WRITEMEM(fh->data, len); | 1299 | WRITEMEM(fh->data, len); |
1301 | hdr->nops++; | 1300 | hdr->nops++; |
1302 | hdr->replen += decode_putfh_maxsz; | 1301 | hdr->replen += decode_putfh_maxsz; |
@@ -1307,7 +1306,7 @@ static void encode_putrootfh(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
1307 | __be32 *p; | 1306 | __be32 *p; |
1308 | 1307 | ||
1309 | RESERVE_SPACE(4); | 1308 | RESERVE_SPACE(4); |
1310 | WRITE32(OP_PUTROOTFH); | 1309 | *p++ = cpu_to_be32(OP_PUTROOTFH); |
1311 | hdr->nops++; | 1310 | hdr->nops++; |
1312 | hdr->replen += decode_putrootfh_maxsz; | 1311 | hdr->replen += decode_putrootfh_maxsz; |
1313 | } | 1312 | } |
@@ -1330,13 +1329,13 @@ static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, | |||
1330 | __be32 *p; | 1329 | __be32 *p; |
1331 | 1330 | ||
1332 | RESERVE_SPACE(4); | 1331 | RESERVE_SPACE(4); |
1333 | WRITE32(OP_READ); | 1332 | *p++ = cpu_to_be32(OP_READ); |
1334 | 1333 | ||
1335 | encode_stateid(xdr, args->context); | 1334 | encode_stateid(xdr, args->context); |
1336 | 1335 | ||
1337 | RESERVE_SPACE(12); | 1336 | RESERVE_SPACE(12); |
1338 | WRITE64(args->offset); | 1337 | WRITE64(args->offset); |
1339 | WRITE32(args->count); | 1338 | *p++ = cpu_to_be32(args->count); |
1340 | hdr->nops++; | 1339 | hdr->nops++; |
1341 | hdr->replen += decode_read_maxsz; | 1340 | hdr->replen += decode_read_maxsz; |
1342 | } | 1341 | } |
@@ -1350,19 +1349,19 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg | |||
1350 | __be32 *p; | 1349 | __be32 *p; |
1351 | 1350 | ||
1352 | RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); | 1351 | RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); |
1353 | WRITE32(OP_READDIR); | 1352 | *p++ = cpu_to_be32(OP_READDIR); |
1354 | WRITE64(readdir->cookie); | 1353 | WRITE64(readdir->cookie); |
1355 | WRITEMEM(readdir->verifier.data, NFS4_VERIFIER_SIZE); | 1354 | WRITEMEM(readdir->verifier.data, NFS4_VERIFIER_SIZE); |
1356 | WRITE32(readdir->count >> 1); /* We're not doing readdirplus */ | 1355 | *p++ = cpu_to_be32(readdir->count >> 1); /* We're not doing readdirplus */ |
1357 | WRITE32(readdir->count); | 1356 | *p++ = cpu_to_be32(readdir->count); |
1358 | WRITE32(2); | 1357 | *p++ = cpu_to_be32(2); |
1359 | /* Switch to mounted_on_fileid if the server supports it */ | 1358 | /* Switch to mounted_on_fileid if the server supports it */ |
1360 | if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID) | 1359 | if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID) |
1361 | attrs[0] &= ~FATTR4_WORD0_FILEID; | 1360 | attrs[0] &= ~FATTR4_WORD0_FILEID; |
1362 | else | 1361 | else |
1363 | attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | 1362 | attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; |
1364 | WRITE32(attrs[0] & readdir->bitmask[0]); | 1363 | *p++ = cpu_to_be32(attrs[0] & readdir->bitmask[0]); |
1365 | WRITE32(attrs[1] & readdir->bitmask[1]); | 1364 | *p++ = cpu_to_be32(attrs[1] & readdir->bitmask[1]); |
1366 | hdr->nops++; | 1365 | hdr->nops++; |
1367 | hdr->replen += decode_readdir_maxsz; | 1366 | hdr->replen += decode_readdir_maxsz; |
1368 | dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n", | 1367 | dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n", |
@@ -1379,7 +1378,7 @@ static void encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink * | |||
1379 | __be32 *p; | 1378 | __be32 *p; |
1380 | 1379 | ||
1381 | RESERVE_SPACE(4); | 1380 | RESERVE_SPACE(4); |
1382 | WRITE32(OP_READLINK); | 1381 | *p++ = cpu_to_be32(OP_READLINK); |
1383 | hdr->nops++; | 1382 | hdr->nops++; |
1384 | hdr->replen += decode_readlink_maxsz; | 1383 | hdr->replen += decode_readlink_maxsz; |
1385 | } | 1384 | } |
@@ -1389,8 +1388,8 @@ static void encode_remove(struct xdr_stream *xdr, const struct qstr *name, struc | |||
1389 | __be32 *p; | 1388 | __be32 *p; |
1390 | 1389 | ||
1391 | RESERVE_SPACE(8 + name->len); | 1390 | RESERVE_SPACE(8 + name->len); |
1392 | WRITE32(OP_REMOVE); | 1391 | *p++ = cpu_to_be32(OP_REMOVE); |
1393 | WRITE32(name->len); | 1392 | *p++ = cpu_to_be32(name->len); |
1394 | WRITEMEM(name->name, name->len); | 1393 | WRITEMEM(name->name, name->len); |
1395 | hdr->nops++; | 1394 | hdr->nops++; |
1396 | hdr->replen += decode_remove_maxsz; | 1395 | hdr->replen += decode_remove_maxsz; |
@@ -1401,12 +1400,12 @@ static void encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, co | |||
1401 | __be32 *p; | 1400 | __be32 *p; |
1402 | 1401 | ||
1403 | RESERVE_SPACE(8 + oldname->len); | 1402 | RESERVE_SPACE(8 + oldname->len); |
1404 | WRITE32(OP_RENAME); | 1403 | *p++ = cpu_to_be32(OP_RENAME); |
1405 | WRITE32(oldname->len); | 1404 | *p++ = cpu_to_be32(oldname->len); |
1406 | WRITEMEM(oldname->name, oldname->len); | 1405 | WRITEMEM(oldname->name, oldname->len); |
1407 | 1406 | ||
1408 | RESERVE_SPACE(4 + newname->len); | 1407 | RESERVE_SPACE(4 + newname->len); |
1409 | WRITE32(newname->len); | 1408 | *p++ = cpu_to_be32(newname->len); |
1410 | WRITEMEM(newname->name, newname->len); | 1409 | WRITEMEM(newname->name, newname->len); |
1411 | hdr->nops++; | 1410 | hdr->nops++; |
1412 | hdr->replen += decode_rename_maxsz; | 1411 | hdr->replen += decode_rename_maxsz; |
@@ -1417,7 +1416,7 @@ static void encode_renew(struct xdr_stream *xdr, const struct nfs_client *client | |||
1417 | __be32 *p; | 1416 | __be32 *p; |
1418 | 1417 | ||
1419 | RESERVE_SPACE(12); | 1418 | RESERVE_SPACE(12); |
1420 | WRITE32(OP_RENEW); | 1419 | *p++ = cpu_to_be32(OP_RENEW); |
1421 | WRITE64(client_stateid->cl_clientid); | 1420 | WRITE64(client_stateid->cl_clientid); |
1422 | hdr->nops++; | 1421 | hdr->nops++; |
1423 | hdr->replen += decode_renew_maxsz; | 1422 | hdr->replen += decode_renew_maxsz; |
@@ -1429,7 +1428,7 @@ encode_restorefh(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
1429 | __be32 *p; | 1428 | __be32 *p; |
1430 | 1429 | ||
1431 | RESERVE_SPACE(4); | 1430 | RESERVE_SPACE(4); |
1432 | WRITE32(OP_RESTOREFH); | 1431 | *p++ = cpu_to_be32(OP_RESTOREFH); |
1433 | hdr->nops++; | 1432 | hdr->nops++; |
1434 | hdr->replen += decode_restorefh_maxsz; | 1433 | hdr->replen += decode_restorefh_maxsz; |
1435 | } | 1434 | } |
@@ -1440,15 +1439,15 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compoun | |||
1440 | __be32 *p; | 1439 | __be32 *p; |
1441 | 1440 | ||
1442 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); | 1441 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1443 | WRITE32(OP_SETATTR); | 1442 | *p++ = cpu_to_be32(OP_SETATTR); |
1444 | WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE); | 1443 | WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE); |
1445 | RESERVE_SPACE(2*4); | 1444 | RESERVE_SPACE(2*4); |
1446 | WRITE32(1); | 1445 | *p++ = cpu_to_be32(1); |
1447 | WRITE32(FATTR4_WORD0_ACL); | 1446 | *p++ = cpu_to_be32(FATTR4_WORD0_ACL); |
1448 | if (arg->acl_len % 4) | 1447 | if (arg->acl_len % 4) |
1449 | return -EINVAL; | 1448 | return -EINVAL; |
1450 | RESERVE_SPACE(4); | 1449 | RESERVE_SPACE(4); |
1451 | WRITE32(arg->acl_len); | 1450 | *p++ = cpu_to_be32(arg->acl_len); |
1452 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); | 1451 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); |
1453 | hdr->nops++; | 1452 | hdr->nops++; |
1454 | hdr->replen += decode_setacl_maxsz; | 1453 | hdr->replen += decode_setacl_maxsz; |
@@ -1461,7 +1460,7 @@ encode_savefh(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
1461 | __be32 *p; | 1460 | __be32 *p; |
1462 | 1461 | ||
1463 | RESERVE_SPACE(4); | 1462 | RESERVE_SPACE(4); |
1464 | WRITE32(OP_SAVEFH); | 1463 | *p++ = cpu_to_be32(OP_SAVEFH); |
1465 | hdr->nops++; | 1464 | hdr->nops++; |
1466 | hdr->replen += decode_savefh_maxsz; | 1465 | hdr->replen += decode_savefh_maxsz; |
1467 | } | 1466 | } |
@@ -1471,7 +1470,7 @@ static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs | |||
1471 | __be32 *p; | 1470 | __be32 *p; |
1472 | 1471 | ||
1473 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); | 1472 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1474 | WRITE32(OP_SETATTR); | 1473 | *p++ = cpu_to_be32(OP_SETATTR); |
1475 | WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); | 1474 | WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); |
1476 | hdr->nops++; | 1475 | hdr->nops++; |
1477 | hdr->replen += decode_setattr_maxsz; | 1476 | hdr->replen += decode_setattr_maxsz; |
@@ -1483,16 +1482,16 @@ static void encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclie | |||
1483 | __be32 *p; | 1482 | __be32 *p; |
1484 | 1483 | ||
1485 | RESERVE_SPACE(4 + NFS4_VERIFIER_SIZE); | 1484 | RESERVE_SPACE(4 + NFS4_VERIFIER_SIZE); |
1486 | WRITE32(OP_SETCLIENTID); | 1485 | *p++ = cpu_to_be32(OP_SETCLIENTID); |
1487 | WRITEMEM(setclientid->sc_verifier->data, NFS4_VERIFIER_SIZE); | 1486 | WRITEMEM(setclientid->sc_verifier->data, NFS4_VERIFIER_SIZE); |
1488 | 1487 | ||
1489 | encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name); | 1488 | encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name); |
1490 | RESERVE_SPACE(4); | 1489 | RESERVE_SPACE(4); |
1491 | WRITE32(setclientid->sc_prog); | 1490 | *p++ = cpu_to_be32(setclientid->sc_prog); |
1492 | encode_string(xdr, setclientid->sc_netid_len, setclientid->sc_netid); | 1491 | encode_string(xdr, setclientid->sc_netid_len, setclientid->sc_netid); |
1493 | encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr); | 1492 | encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr); |
1494 | RESERVE_SPACE(4); | 1493 | RESERVE_SPACE(4); |
1495 | WRITE32(setclientid->sc_cb_ident); | 1494 | *p++ = cpu_to_be32(setclientid->sc_cb_ident); |
1496 | hdr->nops++; | 1495 | hdr->nops++; |
1497 | hdr->replen += decode_setclientid_maxsz; | 1496 | hdr->replen += decode_setclientid_maxsz; |
1498 | } | 1497 | } |
@@ -1502,7 +1501,7 @@ static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_ | |||
1502 | __be32 *p; | 1501 | __be32 *p; |
1503 | 1502 | ||
1504 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); | 1503 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); |
1505 | WRITE32(OP_SETCLIENTID_CONFIRM); | 1504 | *p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM); |
1506 | WRITE64(client_state->cl_clientid); | 1505 | WRITE64(client_state->cl_clientid); |
1507 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); | 1506 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); |
1508 | hdr->nops++; | 1507 | hdr->nops++; |
@@ -1514,14 +1513,14 @@ static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *arg | |||
1514 | __be32 *p; | 1513 | __be32 *p; |
1515 | 1514 | ||
1516 | RESERVE_SPACE(4); | 1515 | RESERVE_SPACE(4); |
1517 | WRITE32(OP_WRITE); | 1516 | *p++ = cpu_to_be32(OP_WRITE); |
1518 | 1517 | ||
1519 | encode_stateid(xdr, args->context); | 1518 | encode_stateid(xdr, args->context); |
1520 | 1519 | ||
1521 | RESERVE_SPACE(16); | 1520 | RESERVE_SPACE(16); |
1522 | WRITE64(args->offset); | 1521 | WRITE64(args->offset); |
1523 | WRITE32(args->stable); | 1522 | *p++ = cpu_to_be32(args->stable); |
1524 | WRITE32(args->count); | 1523 | *p++ = cpu_to_be32(args->count); |
1525 | 1524 | ||
1526 | xdr_write_pages(xdr, args->pages, args->pgbase, args->count); | 1525 | xdr_write_pages(xdr, args->pages, args->pgbase, args->count); |
1527 | hdr->nops++; | 1526 | hdr->nops++; |
@@ -1534,7 +1533,7 @@ static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *state | |||
1534 | 1533 | ||
1535 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); | 1534 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1536 | 1535 | ||
1537 | WRITE32(OP_DELEGRETURN); | 1536 | *p++ = cpu_to_be32(OP_DELEGRETURN); |
1538 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); | 1537 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); |
1539 | hdr->nops++; | 1538 | hdr->nops++; |
1540 | hdr->replen += decode_delegreturn_maxsz; | 1539 | hdr->replen += decode_delegreturn_maxsz; |
@@ -1549,15 +1548,15 @@ static void encode_exchange_id(struct xdr_stream *xdr, | |||
1549 | __be32 *p; | 1548 | __be32 *p; |
1550 | 1549 | ||
1551 | RESERVE_SPACE(4 + sizeof(args->verifier->data)); | 1550 | RESERVE_SPACE(4 + sizeof(args->verifier->data)); |
1552 | WRITE32(OP_EXCHANGE_ID); | 1551 | *p++ = cpu_to_be32(OP_EXCHANGE_ID); |
1553 | WRITEMEM(args->verifier->data, sizeof(args->verifier->data)); | 1552 | WRITEMEM(args->verifier->data, sizeof(args->verifier->data)); |
1554 | 1553 | ||
1555 | encode_string(xdr, args->id_len, args->id); | 1554 | encode_string(xdr, args->id_len, args->id); |
1556 | 1555 | ||
1557 | RESERVE_SPACE(12); | 1556 | RESERVE_SPACE(12); |
1558 | WRITE32(args->flags); | 1557 | *p++ = cpu_to_be32(args->flags); |
1559 | WRITE32(0); /* zero length state_protect4_a */ | 1558 | *p++ = cpu_to_be32(0); /* zero length state_protect4_a */ |
1560 | WRITE32(0); /* zero length implementation id array */ | 1559 | *p++ = cpu_to_be32(0); /* zero length implementation id array */ |
1561 | hdr->nops++; | 1560 | hdr->nops++; |
1562 | hdr->replen += decode_exchange_id_maxsz; | 1561 | hdr->replen += decode_exchange_id_maxsz; |
1563 | } | 1562 | } |
@@ -1572,54 +1571,54 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1572 | struct nfs_client *clp = args->client; | 1571 | struct nfs_client *clp = args->client; |
1573 | 1572 | ||
1574 | RESERVE_SPACE(4); | 1573 | RESERVE_SPACE(4); |
1575 | WRITE32(OP_CREATE_SESSION); | 1574 | *p++ = cpu_to_be32(OP_CREATE_SESSION); |
1576 | 1575 | ||
1577 | RESERVE_SPACE(8); | 1576 | RESERVE_SPACE(8); |
1578 | WRITE64(clp->cl_ex_clid); | 1577 | WRITE64(clp->cl_ex_clid); |
1579 | 1578 | ||
1580 | RESERVE_SPACE(8); | 1579 | RESERVE_SPACE(8); |
1581 | WRITE32(clp->cl_seqid); /*Sequence id */ | 1580 | *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */ |
1582 | WRITE32(args->flags); /*flags */ | 1581 | *p++ = cpu_to_be32(args->flags); /*flags */ |
1583 | 1582 | ||
1584 | RESERVE_SPACE(2*28); /* 2 channel_attrs */ | 1583 | RESERVE_SPACE(2*28); /* 2 channel_attrs */ |
1585 | /* Fore Channel */ | 1584 | /* Fore Channel */ |
1586 | WRITE32(args->fc_attrs.headerpadsz); /* header padding size */ | 1585 | *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ |
1587 | WRITE32(args->fc_attrs.max_rqst_sz); /* max req size */ | 1586 | *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */ |
1588 | WRITE32(args->fc_attrs.max_resp_sz); /* max resp size */ | 1587 | *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz); /* max resp size */ |
1589 | WRITE32(args->fc_attrs.max_resp_sz_cached); /* Max resp sz cached */ | 1588 | *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz_cached); /* Max resp sz cached */ |
1590 | WRITE32(args->fc_attrs.max_ops); /* max operations */ | 1589 | *p++ = cpu_to_be32(args->fc_attrs.max_ops); /* max operations */ |
1591 | WRITE32(args->fc_attrs.max_reqs); /* max requests */ | 1590 | *p++ = cpu_to_be32(args->fc_attrs.max_reqs); /* max requests */ |
1592 | WRITE32(0); /* rdmachannel_attrs */ | 1591 | *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ |
1593 | 1592 | ||
1594 | /* Back Channel */ | 1593 | /* Back Channel */ |
1595 | WRITE32(args->fc_attrs.headerpadsz); /* header padding size */ | 1594 | *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ |
1596 | WRITE32(args->bc_attrs.max_rqst_sz); /* max req size */ | 1595 | *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */ |
1597 | WRITE32(args->bc_attrs.max_resp_sz); /* max resp size */ | 1596 | *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */ |
1598 | WRITE32(args->bc_attrs.max_resp_sz_cached); /* Max resp sz cached */ | 1597 | *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached); /* Max resp sz cached */ |
1599 | WRITE32(args->bc_attrs.max_ops); /* max operations */ | 1598 | *p++ = cpu_to_be32(args->bc_attrs.max_ops); /* max operations */ |
1600 | WRITE32(args->bc_attrs.max_reqs); /* max requests */ | 1599 | *p++ = cpu_to_be32(args->bc_attrs.max_reqs); /* max requests */ |
1601 | WRITE32(0); /* rdmachannel_attrs */ | 1600 | *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ |
1602 | 1601 | ||
1603 | RESERVE_SPACE(4); | 1602 | RESERVE_SPACE(4); |
1604 | WRITE32(args->cb_program); /* cb_program */ | 1603 | *p++ = cpu_to_be32(args->cb_program); /* cb_program */ |
1605 | 1604 | ||
1606 | RESERVE_SPACE(4); /* # of security flavors */ | 1605 | RESERVE_SPACE(4); /* # of security flavors */ |
1607 | WRITE32(1); | 1606 | *p++ = cpu_to_be32(1); |
1608 | 1607 | ||
1609 | RESERVE_SPACE(4); | 1608 | RESERVE_SPACE(4); |
1610 | WRITE32(RPC_AUTH_UNIX); /* auth_sys */ | 1609 | *p++ = cpu_to_be32(RPC_AUTH_UNIX); /* auth_sys */ |
1611 | 1610 | ||
1612 | /* authsys_parms rfc1831 */ | 1611 | /* authsys_parms rfc1831 */ |
1613 | RESERVE_SPACE(4); | 1612 | RESERVE_SPACE(4); |
1614 | WRITE32((u32)clp->cl_boot_time.tv_nsec); /* stamp */ | 1613 | *p++ = cpu_to_be32((u32)clp->cl_boot_time.tv_nsec); /* stamp */ |
1615 | len = scnprintf(machine_name, sizeof(machine_name), "%s", | 1614 | len = scnprintf(machine_name, sizeof(machine_name), "%s", |
1616 | clp->cl_ipaddr); | 1615 | clp->cl_ipaddr); |
1617 | RESERVE_SPACE(16 + len); | 1616 | RESERVE_SPACE(16 + len); |
1618 | WRITE32(len); | 1617 | *p++ = cpu_to_be32(len); |
1619 | WRITEMEM(machine_name, len); | 1618 | WRITEMEM(machine_name, len); |
1620 | WRITE32(0); /* UID */ | 1619 | *p++ = cpu_to_be32(0); /* UID */ |
1621 | WRITE32(0); /* GID */ | 1620 | *p++ = cpu_to_be32(0); /* GID */ |
1622 | WRITE32(0); /* No more gids */ | 1621 | *p++ = cpu_to_be32(0); /* No more gids */ |
1623 | hdr->nops++; | 1622 | hdr->nops++; |
1624 | hdr->replen += decode_create_session_maxsz; | 1623 | hdr->replen += decode_create_session_maxsz; |
1625 | } | 1624 | } |
@@ -1630,7 +1629,7 @@ static void encode_destroy_session(struct xdr_stream *xdr, | |||
1630 | { | 1629 | { |
1631 | __be32 *p; | 1630 | __be32 *p; |
1632 | RESERVE_SPACE(4 + NFS4_MAX_SESSIONID_LEN); | 1631 | RESERVE_SPACE(4 + NFS4_MAX_SESSIONID_LEN); |
1633 | WRITE32(OP_DESTROY_SESSION); | 1632 | *p++ = cpu_to_be32(OP_DESTROY_SESSION); |
1634 | WRITEMEM(session->sess_id.data, NFS4_MAX_SESSIONID_LEN); | 1633 | WRITEMEM(session->sess_id.data, NFS4_MAX_SESSIONID_LEN); |
1635 | hdr->nops++; | 1634 | hdr->nops++; |
1636 | hdr->replen += decode_destroy_session_maxsz; | 1635 | hdr->replen += decode_destroy_session_maxsz; |
@@ -1656,7 +1655,7 @@ static void encode_sequence(struct xdr_stream *xdr, | |||
1656 | slot = tp->slots + args->sa_slotid; | 1655 | slot = tp->slots + args->sa_slotid; |
1657 | 1656 | ||
1658 | RESERVE_SPACE(4); | 1657 | RESERVE_SPACE(4); |
1659 | WRITE32(OP_SEQUENCE); | 1658 | *p++ = cpu_to_be32(OP_SEQUENCE); |
1660 | 1659 | ||
1661 | /* | 1660 | /* |
1662 | * Sessionid + seqid + slotid + max slotid + cache_this | 1661 | * Sessionid + seqid + slotid + max slotid + cache_this |
@@ -1672,10 +1671,10 @@ static void encode_sequence(struct xdr_stream *xdr, | |||
1672 | tp->highest_used_slotid, args->sa_cache_this); | 1671 | tp->highest_used_slotid, args->sa_cache_this); |
1673 | RESERVE_SPACE(NFS4_MAX_SESSIONID_LEN + 16); | 1672 | RESERVE_SPACE(NFS4_MAX_SESSIONID_LEN + 16); |
1674 | WRITEMEM(session->sess_id.data, NFS4_MAX_SESSIONID_LEN); | 1673 | WRITEMEM(session->sess_id.data, NFS4_MAX_SESSIONID_LEN); |
1675 | WRITE32(slot->seq_nr); | 1674 | *p++ = cpu_to_be32(slot->seq_nr); |
1676 | WRITE32(args->sa_slotid); | 1675 | *p++ = cpu_to_be32(args->sa_slotid); |
1677 | WRITE32(tp->highest_used_slotid); | 1676 | *p++ = cpu_to_be32(tp->highest_used_slotid); |
1678 | WRITE32(args->sa_cache_this); | 1677 | *p++ = cpu_to_be32(args->sa_cache_this); |
1679 | hdr->nops++; | 1678 | hdr->nops++; |
1680 | hdr->replen += decode_sequence_maxsz; | 1679 | hdr->replen += decode_sequence_maxsz; |
1681 | #endif /* CONFIG_NFS_V4_1 */ | 1680 | #endif /* CONFIG_NFS_V4_1 */ |