Commit d61005a6855160091dca44b718db93fe7aa9876f

Authored by Al Viro
Committed by Linus Torvalds
1 parent 9d787a75a0

[PATCH] xdr annotations: NFSv3

on-the-wire data is big-endian

[in large part pulled from Alexey's patch]

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 57 additions and 57 deletions Side-by-side Diff

... ... @@ -105,14 +105,14 @@
105 105 /*
106 106 * Common NFS XDR functions as inlines
107 107 */
108   -static inline u32 *
109   -xdr_encode_fhandle(u32 *p, struct nfs_fh *fh)
  108 +static inline __be32 *
  109 +xdr_encode_fhandle(__be32 *p, struct nfs_fh *fh)
110 110 {
111 111 return xdr_encode_array(p, fh->data, fh->size);
112 112 }
113 113  
114   -static inline u32 *
115   -xdr_decode_fhandle(u32 *p, struct nfs_fh *fh)
  114 +static inline __be32 *
  115 +xdr_decode_fhandle(__be32 *p, struct nfs_fh *fh)
116 116 {
117 117 if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) {
118 118 memcpy(fh->data, p, fh->size);
119 119  
120 120  
... ... @@ -124,24 +124,24 @@
124 124 /*
125 125 * Encode/decode time.
126 126 */
127   -static inline u32 *
128   -xdr_encode_time3(u32 *p, struct timespec *timep)
  127 +static inline __be32 *
  128 +xdr_encode_time3(__be32 *p, struct timespec *timep)
129 129 {
130 130 *p++ = htonl(timep->tv_sec);
131 131 *p++ = htonl(timep->tv_nsec);
132 132 return p;
133 133 }
134 134  
135   -static inline u32 *
136   -xdr_decode_time3(u32 *p, struct timespec *timep)
  135 +static inline __be32 *
  136 +xdr_decode_time3(__be32 *p, struct timespec *timep)
137 137 {
138 138 timep->tv_sec = ntohl(*p++);
139 139 timep->tv_nsec = ntohl(*p++);
140 140 return p;
141 141 }
142 142  
143   -static u32 *
144   -xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
  143 +static __be32 *
  144 +xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr)
145 145 {
146 146 unsigned int type, major, minor;
147 147 int fmode;
... ... @@ -177,8 +177,8 @@
177 177 return p;
178 178 }
179 179  
180   -static inline u32 *
181   -xdr_encode_sattr(u32 *p, struct iattr *attr)
  180 +static inline __be32 *
  181 +xdr_encode_sattr(__be32 *p, struct iattr *attr)
182 182 {
183 183 if (attr->ia_valid & ATTR_MODE) {
184 184 *p++ = xdr_one;
... ... @@ -223,8 +223,8 @@
223 223 return p;
224 224 }
225 225  
226   -static inline u32 *
227   -xdr_decode_wcc_attr(u32 *p, struct nfs_fattr *fattr)
  226 +static inline __be32 *
  227 +xdr_decode_wcc_attr(__be32 *p, struct nfs_fattr *fattr)
228 228 {
229 229 p = xdr_decode_hyper(p, &fattr->pre_size);
230 230 p = xdr_decode_time3(p, &fattr->pre_mtime);
231 231  
... ... @@ -233,16 +233,16 @@
233 233 return p;
234 234 }
235 235  
236   -static inline u32 *
237   -xdr_decode_post_op_attr(u32 *p, struct nfs_fattr *fattr)
  236 +static inline __be32 *
  237 +xdr_decode_post_op_attr(__be32 *p, struct nfs_fattr *fattr)
238 238 {
239 239 if (*p++)
240 240 p = xdr_decode_fattr(p, fattr);
241 241 return p;
242 242 }
243 243  
244   -static inline u32 *
245   -xdr_decode_pre_op_attr(u32 *p, struct nfs_fattr *fattr)
  244 +static inline __be32 *
  245 +xdr_decode_pre_op_attr(__be32 *p, struct nfs_fattr *fattr)
246 246 {
247 247 if (*p++)
248 248 return xdr_decode_wcc_attr(p, fattr);
... ... @@ -250,8 +250,8 @@
250 250 }
251 251  
252 252  
253   -static inline u32 *
254   -xdr_decode_wcc_data(u32 *p, struct nfs_fattr *fattr)
  253 +static inline __be32 *
  254 +xdr_decode_wcc_data(__be32 *p, struct nfs_fattr *fattr)
255 255 {
256 256 p = xdr_decode_pre_op_attr(p, fattr);
257 257 return xdr_decode_post_op_attr(p, fattr);
... ... @@ -265,7 +265,7 @@
265 265 * Encode file handle argument
266 266 */
267 267 static int
268   -nfs3_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh)
  268 +nfs3_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
269 269 {
270 270 p = xdr_encode_fhandle(p, fh);
271 271 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
... ... @@ -276,7 +276,7 @@
276 276 * Encode SETATTR arguments
277 277 */
278 278 static int
279   -nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args)
  279 +nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
280 280 {
281 281 p = xdr_encode_fhandle(p, args->fh);
282 282 p = xdr_encode_sattr(p, args->sattr);
... ... @@ -291,7 +291,7 @@
291 291 * Encode directory ops argument
292 292 */
293 293 static int
294   -nfs3_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs3_diropargs *args)
  294 +nfs3_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs3_diropargs *args)
295 295 {
296 296 p = xdr_encode_fhandle(p, args->fh);
297 297 p = xdr_encode_array(p, args->name, args->len);
... ... @@ -303,7 +303,7 @@
303 303 * Encode access() argument
304 304 */
305 305 static int
306   -nfs3_xdr_accessargs(struct rpc_rqst *req, u32 *p, struct nfs3_accessargs *args)
  306 +nfs3_xdr_accessargs(struct rpc_rqst *req, __be32 *p, struct nfs3_accessargs *args)
307 307 {
308 308 p = xdr_encode_fhandle(p, args->fh);
309 309 *p++ = htonl(args->access);
... ... @@ -317,7 +317,7 @@
317 317 * exactly to the page we want to fetch.
318 318 */
319 319 static int
320   -nfs3_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args)
  320 +nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
321 321 {
322 322 struct rpc_auth *auth = req->rq_task->tk_auth;
323 323 unsigned int replen;
... ... @@ -339,7 +339,7 @@
339 339 * Write arguments. Splice the buffer to be written into the iovec.
340 340 */
341 341 static int
342   -nfs3_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
  342 +nfs3_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
343 343 {
344 344 struct xdr_buf *sndbuf = &req->rq_snd_buf;
345 345 u32 count = args->count;
... ... @@ -360,7 +360,7 @@
360 360 * Encode CREATE arguments
361 361 */
362 362 static int
363   -nfs3_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs3_createargs *args)
  363 +nfs3_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs3_createargs *args)
364 364 {
365 365 p = xdr_encode_fhandle(p, args->fh);
366 366 p = xdr_encode_array(p, args->name, args->len);
... ... @@ -380,7 +380,7 @@
380 380 * Encode MKDIR arguments
381 381 */
382 382 static int
383   -nfs3_xdr_mkdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_mkdirargs *args)
  383 +nfs3_xdr_mkdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mkdirargs *args)
384 384 {
385 385 p = xdr_encode_fhandle(p, args->fh);
386 386 p = xdr_encode_array(p, args->name, args->len);
... ... @@ -393,7 +393,7 @@
393 393 * Encode SYMLINK arguments
394 394 */
395 395 static int
396   -nfs3_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_symlinkargs *args)
  396 +nfs3_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_symlinkargs *args)
397 397 {
398 398 p = xdr_encode_fhandle(p, args->fromfh);
399 399 p = xdr_encode_array(p, args->fromname, args->fromlen);
... ... @@ -410,7 +410,7 @@
410 410 * Encode MKNOD arguments
411 411 */
412 412 static int
413   -nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args)
  413 +nfs3_xdr_mknodargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mknodargs *args)
414 414 {
415 415 p = xdr_encode_fhandle(p, args->fh);
416 416 p = xdr_encode_array(p, args->name, args->len);
... ... @@ -429,7 +429,7 @@
429 429 * Encode RENAME arguments
430 430 */
431 431 static int
432   -nfs3_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs3_renameargs *args)
  432 +nfs3_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs3_renameargs *args)
433 433 {
434 434 p = xdr_encode_fhandle(p, args->fromfh);
435 435 p = xdr_encode_array(p, args->fromname, args->fromlen);
... ... @@ -443,7 +443,7 @@
443 443 * Encode LINK arguments
444 444 */
445 445 static int
446   -nfs3_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs3_linkargs *args)
  446 +nfs3_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_linkargs *args)
447 447 {
448 448 p = xdr_encode_fhandle(p, args->fromfh);
449 449 p = xdr_encode_fhandle(p, args->tofh);
... ... @@ -456,7 +456,7 @@
456 456 * Encode arguments to readdir call
457 457 */
458 458 static int
459   -nfs3_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_readdirargs *args)
  459 +nfs3_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirargs *args)
460 460 {
461 461 struct rpc_auth *auth = req->rq_task->tk_auth;
462 462 unsigned int replen;
... ... @@ -485,7 +485,7 @@
485 485 * We just check for syntactical correctness.
486 486 */
487 487 static int
488   -nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res)
  488 +nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res)
489 489 {
490 490 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
491 491 struct kvec *iov = rcvbuf->head;
... ... @@ -493,7 +493,7 @@
493 493 int hdrlen, recvd;
494 494 int status, nr;
495 495 unsigned int len, pglen;
496   - u32 *entry, *end, *kaddr;
  496 + __be32 *entry, *end, *kaddr;
497 497  
498 498 status = ntohl(*p++);
499 499 /* Decode post_op_attrs */
... ... @@ -523,8 +523,8 @@
523 523 if (pglen > recvd)
524 524 pglen = recvd;
525 525 page = rcvbuf->pages;
526   - kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0);
527   - end = (u32 *)((char *)p + pglen);
  526 + kaddr = p = kmap_atomic(*page, KM_USER0);
  527 + end = (__be32 *)((char *)p + pglen);
528 528 entry = p;
529 529 for (nr = 0; *p++; nr++) {
530 530 if (p + 3 > end)
... ... @@ -626,7 +626,7 @@
626 626 * Encode COMMIT arguments
627 627 */
628 628 static int
629   -nfs3_xdr_commitargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
  629 +nfs3_xdr_commitargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
630 630 {
631 631 p = xdr_encode_fhandle(p, args->fh);
632 632 p = xdr_encode_hyper(p, args->offset);
... ... @@ -640,7 +640,7 @@
640 640 * Encode GETACL arguments
641 641 */
642 642 static int
643   -nfs3_xdr_getaclargs(struct rpc_rqst *req, u32 *p,
  643 +nfs3_xdr_getaclargs(struct rpc_rqst *req, __be32 *p,
644 644 struct nfs3_getaclargs *args)
645 645 {
646 646 struct rpc_auth *auth = req->rq_task->tk_auth;
... ... @@ -664,7 +664,7 @@
664 664 * Encode SETACL arguments
665 665 */
666 666 static int
667   -nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p,
  667 +nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
668 668 struct nfs3_setaclargs *args)
669 669 {
670 670 struct xdr_buf *buf = &req->rq_snd_buf;
... ... @@ -711,7 +711,7 @@
711 711 * Decode attrstat reply.
712 712 */
713 713 static int
714   -nfs3_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
  714 +nfs3_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
715 715 {
716 716 int status;
717 717  
... ... @@ -726,7 +726,7 @@
726 726 * SATTR, REMOVE, RMDIR
727 727 */
728 728 static int
729   -nfs3_xdr_wccstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
  729 +nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
730 730 {
731 731 int status;
732 732  
... ... @@ -740,7 +740,7 @@
740 740 * Decode LOOKUP reply
741 741 */
742 742 static int
743   -nfs3_xdr_lookupres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res)
  743 +nfs3_xdr_lookupres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
744 744 {
745 745 int status;
746 746  
... ... @@ -759,7 +759,7 @@
759 759 * Decode ACCESS reply
760 760 */
761 761 static int
762   -nfs3_xdr_accessres(struct rpc_rqst *req, u32 *p, struct nfs3_accessres *res)
  762 +nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res)
763 763 {
764 764 int status = ntohl(*p++);
765 765  
... ... @@ -771,7 +771,7 @@
771 771 }
772 772  
773 773 static int
774   -nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *args)
  774 +nfs3_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readlinkargs *args)
775 775 {
776 776 struct rpc_auth *auth = req->rq_task->tk_auth;
777 777 unsigned int replen;
... ... @@ -789,7 +789,7 @@
789 789 * Decode READLINK reply
790 790 */
791 791 static int
792   -nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
  792 +nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
793 793 {
794 794 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
795 795 struct kvec *iov = rcvbuf->head;
... ... @@ -837,7 +837,7 @@
837 837 * Decode READ reply
838 838 */
839 839 static int
840   -nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res)
  840 +nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
841 841 {
842 842 struct kvec *iov = req->rq_rcv_buf.head;
843 843 int status, count, ocount, recvd, hdrlen;
... ... @@ -888,7 +888,7 @@
888 888 * Decode WRITE response
889 889 */
890 890 static int
891   -nfs3_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
  891 +nfs3_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
892 892 {
893 893 int status;
894 894  
... ... @@ -910,7 +910,7 @@
910 910 * Decode a CREATE response
911 911 */
912 912 static int
913   -nfs3_xdr_createres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res)
  913 +nfs3_xdr_createres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
914 914 {
915 915 int status;
916 916  
... ... @@ -937,7 +937,7 @@
937 937 * Decode RENAME reply
938 938 */
939 939 static int
940   -nfs3_xdr_renameres(struct rpc_rqst *req, u32 *p, struct nfs3_renameres *res)
  940 +nfs3_xdr_renameres(struct rpc_rqst *req, __be32 *p, struct nfs3_renameres *res)
941 941 {
942 942 int status;
943 943  
... ... @@ -952,7 +952,7 @@
952 952 * Decode LINK reply
953 953 */
954 954 static int
955   -nfs3_xdr_linkres(struct rpc_rqst *req, u32 *p, struct nfs3_linkres *res)
  955 +nfs3_xdr_linkres(struct rpc_rqst *req, __be32 *p, struct nfs3_linkres *res)
956 956 {
957 957 int status;
958 958  
... ... @@ -967,7 +967,7 @@
967 967 * Decode FSSTAT reply
968 968 */
969 969 static int
970   -nfs3_xdr_fsstatres(struct rpc_rqst *req, u32 *p, struct nfs_fsstat *res)
  970 +nfs3_xdr_fsstatres(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *res)
971 971 {
972 972 int status;
973 973  
... ... @@ -992,7 +992,7 @@
992 992 * Decode FSINFO reply
993 993 */
994 994 static int
995   -nfs3_xdr_fsinfores(struct rpc_rqst *req, u32 *p, struct nfs_fsinfo *res)
  995 +nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res)
996 996 {
997 997 int status;
998 998  
... ... @@ -1020,7 +1020,7 @@
1020 1020 * Decode PATHCONF reply
1021 1021 */
1022 1022 static int
1023   -nfs3_xdr_pathconfres(struct rpc_rqst *req, u32 *p, struct nfs_pathconf *res)
  1023 +nfs3_xdr_pathconfres(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *res)
1024 1024 {
1025 1025 int status;
1026 1026  
... ... @@ -1040,7 +1040,7 @@
1040 1040 * Decode COMMIT reply
1041 1041 */
1042 1042 static int
1043   -nfs3_xdr_commitres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
  1043 +nfs3_xdr_commitres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
1044 1044 {
1045 1045 int status;
1046 1046  
... ... @@ -1059,7 +1059,7 @@
1059 1059 * Decode GETACL reply
1060 1060 */
1061 1061 static int
1062   -nfs3_xdr_getaclres(struct rpc_rqst *req, u32 *p,
  1062 +nfs3_xdr_getaclres(struct rpc_rqst *req, __be32 *p,
1063 1063 struct nfs3_getaclres *res)
1064 1064 {
1065 1065 struct xdr_buf *buf = &req->rq_rcv_buf;
... ... @@ -1091,7 +1091,7 @@
1091 1091 * Decode setacl reply.
1092 1092 */
1093 1093 static int
1094   -nfs3_xdr_setaclres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
  1094 +nfs3_xdr_setaclres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
1095 1095 {
1096 1096 int status = ntohl(*p++);
1097 1097