diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-12-14 09:54:40 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-12-16 12:37:20 -0500 |
commit | 2d70f533eab0a0cabd05ee878b6709707bf63c86 (patch) | |
tree | c3ea35e01301e56a87dcdd970647592ffeb009fd /fs/nfs/nfs2xdr.c | |
parent | 25a0866cc63281b480cc0c11ddeaccb2ffc57dc9 (diff) |
NFS: Remove old NFSv2 encoder functions
Clean up: Remove unused legacy argument encoder functions, and any
now unused encoder helper functions.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs2xdr.c')
-rw-r--r-- | fs/nfs/nfs2xdr.c | 249 |
1 files changed, 4 insertions, 245 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index 869e2151a2b1..f5ea9dcf08d6 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -82,13 +82,6 @@ static void prepare_reply_buffer(struct rpc_rqst *req, struct page **pages, | |||
82 | * Common NFS XDR functions as inlines | 82 | * Common NFS XDR functions as inlines |
83 | */ | 83 | */ |
84 | static inline __be32 * | 84 | static inline __be32 * |
85 | xdr_encode_fhandle(__be32 *p, const struct nfs_fh *fhandle) | ||
86 | { | ||
87 | memcpy(p, fhandle->data, NFS2_FHSIZE); | ||
88 | return p + XDR_QUADLEN(NFS2_FHSIZE); | ||
89 | } | ||
90 | |||
91 | static inline __be32 * | ||
92 | xdr_decode_fhandle(__be32 *p, struct nfs_fh *fhandle) | 85 | xdr_decode_fhandle(__be32 *p, struct nfs_fh *fhandle) |
93 | { | 86 | { |
94 | /* NFSv2 handles have a fixed length */ | 87 | /* NFSv2 handles have a fixed length */ |
@@ -160,36 +153,6 @@ xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr) | |||
160 | return p; | 153 | return p; |
161 | } | 154 | } |
162 | 155 | ||
163 | static inline __be32 * | ||
164 | xdr_encode_sattr(__be32 *p, struct iattr *attr) | ||
165 | { | ||
166 | const __be32 not_set = __constant_htonl(0xFFFFFFFF); | ||
167 | |||
168 | *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set; | ||
169 | *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set; | ||
170 | *p++ = (attr->ia_valid & ATTR_GID) ? htonl(attr->ia_gid) : not_set; | ||
171 | *p++ = (attr->ia_valid & ATTR_SIZE) ? htonl(attr->ia_size) : not_set; | ||
172 | |||
173 | if (attr->ia_valid & ATTR_ATIME_SET) { | ||
174 | p = xdr_encode_time(p, &attr->ia_atime); | ||
175 | } else if (attr->ia_valid & ATTR_ATIME) { | ||
176 | p = xdr_encode_current_server_time(p, &attr->ia_atime); | ||
177 | } else { | ||
178 | *p++ = not_set; | ||
179 | *p++ = not_set; | ||
180 | } | ||
181 | |||
182 | if (attr->ia_valid & ATTR_MTIME_SET) { | ||
183 | p = xdr_encode_time(p, &attr->ia_mtime); | ||
184 | } else if (attr->ia_valid & ATTR_MTIME) { | ||
185 | p = xdr_encode_current_server_time(p, &attr->ia_mtime); | ||
186 | } else { | ||
187 | *p++ = not_set; | ||
188 | *p++ = not_set; | ||
189 | } | ||
190 | return p; | ||
191 | } | ||
192 | |||
193 | /* | 156 | /* |
194 | * Encode/decode NFSv2 basic data types | 157 | * Encode/decode NFSv2 basic data types |
195 | * | 158 | * |
@@ -321,19 +284,11 @@ static void encode_diropargs(struct xdr_stream *xdr, const struct nfs_fh *fh, | |||
321 | 284 | ||
322 | 285 | ||
323 | /* | 286 | /* |
324 | * NFS encode functions | 287 | * NFSv2 XDR encode functions |
325 | */ | 288 | * |
326 | /* | 289 | * NFSv2 argument types are defined in section 2.2 of RFC 1094: |
327 | * Encode file handle argument | 290 | * "NFS: Network File System Protocol Specification". |
328 | * GETATTR, READLINK, STATFS | ||
329 | */ | 291 | */ |
330 | static int | ||
331 | nfs_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh) | ||
332 | { | ||
333 | p = xdr_encode_fhandle(p, fh); | ||
334 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
335 | return 0; | ||
336 | } | ||
337 | 292 | ||
338 | static int nfs2_xdr_enc_fhandle(struct rpc_rqst *req, __be32 *p, | 293 | static int nfs2_xdr_enc_fhandle(struct rpc_rqst *req, __be32 *p, |
339 | const struct nfs_fh *fh) | 294 | const struct nfs_fh *fh) |
@@ -346,18 +301,6 @@ static int nfs2_xdr_enc_fhandle(struct rpc_rqst *req, __be32 *p, | |||
346 | } | 301 | } |
347 | 302 | ||
348 | /* | 303 | /* |
349 | * Encode SETATTR arguments | ||
350 | */ | ||
351 | static int | ||
352 | nfs_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs_sattrargs *args) | ||
353 | { | ||
354 | p = xdr_encode_fhandle(p, args->fh); | ||
355 | p = xdr_encode_sattr(p, args->sattr); | ||
356 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | /* | ||
361 | * 2.2.3. sattrargs | 304 | * 2.2.3. sattrargs |
362 | * | 305 | * |
363 | * struct sattrargs { | 306 | * struct sattrargs { |
@@ -376,19 +319,6 @@ static int nfs2_xdr_enc_sattrargs(struct rpc_rqst *req, __be32 *p, | |||
376 | return 0; | 319 | return 0; |
377 | } | 320 | } |
378 | 321 | ||
379 | /* | ||
380 | * Encode directory ops argument | ||
381 | * LOOKUP, RMDIR | ||
382 | */ | ||
383 | static int | ||
384 | nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args) | ||
385 | { | ||
386 | p = xdr_encode_fhandle(p, args->fh); | ||
387 | p = xdr_encode_array(p, args->name, args->len); | ||
388 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static int nfs2_xdr_enc_diropargs(struct rpc_rqst *req, __be32 *p, | 322 | static int nfs2_xdr_enc_diropargs(struct rpc_rqst *req, __be32 *p, |
393 | const struct nfs_diropargs *args) | 323 | const struct nfs_diropargs *args) |
394 | { | 324 | { |
@@ -399,18 +329,6 @@ static int nfs2_xdr_enc_diropargs(struct rpc_rqst *req, __be32 *p, | |||
399 | return 0; | 329 | return 0; |
400 | } | 330 | } |
401 | 331 | ||
402 | /* | ||
403 | * Encode REMOVE argument | ||
404 | */ | ||
405 | static int | ||
406 | nfs_xdr_removeargs(struct rpc_rqst *req, __be32 *p, const struct nfs_removeargs *args) | ||
407 | { | ||
408 | p = xdr_encode_fhandle(p, args->fh); | ||
409 | p = xdr_encode_array(p, args->name.name, args->name.len); | ||
410 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static int nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, __be32 *p, | 332 | static int nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, __be32 *p, |
415 | const struct nfs_readlinkargs *args) | 333 | const struct nfs_readlinkargs *args) |
416 | { | 334 | { |
@@ -424,33 +342,6 @@ static int nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, __be32 *p, | |||
424 | } | 342 | } |
425 | 343 | ||
426 | /* | 344 | /* |
427 | * Arguments to a READ call. Since we read data directly into the page | ||
428 | * cache, we also set up the reply iovec here so that iov[1] points | ||
429 | * exactly to the page we want to fetch. | ||
430 | */ | ||
431 | static int | ||
432 | nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) | ||
433 | { | ||
434 | struct rpc_auth *auth = req->rq_cred->cr_auth; | ||
435 | unsigned int replen; | ||
436 | u32 offset = (u32)args->offset; | ||
437 | u32 count = args->count; | ||
438 | |||
439 | p = xdr_encode_fhandle(p, args->fh); | ||
440 | *p++ = htonl(offset); | ||
441 | *p++ = htonl(count); | ||
442 | *p++ = htonl(count); | ||
443 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
444 | |||
445 | /* Inline the page array */ | ||
446 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS_readres_sz) << 2; | ||
447 | xdr_inline_pages(&req->rq_rcv_buf, replen, | ||
448 | args->pages, args->pgbase, count); | ||
449 | req->rq_rcv_buf.flags |= XDRBUF_READ; | ||
450 | return 0; | ||
451 | } | ||
452 | |||
453 | /* | ||
454 | * 2.2.7. readargs | 345 | * 2.2.7. readargs |
455 | * | 346 | * |
456 | * struct readargs { | 347 | * struct readargs { |
@@ -531,29 +422,6 @@ nfs_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res) | |||
531 | 422 | ||
532 | 423 | ||
533 | /* | 424 | /* |
534 | * Write arguments. Splice the buffer to be written into the iovec. | ||
535 | */ | ||
536 | static int | ||
537 | nfs_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) | ||
538 | { | ||
539 | struct xdr_buf *sndbuf = &req->rq_snd_buf; | ||
540 | u32 offset = (u32)args->offset; | ||
541 | u32 count = args->count; | ||
542 | |||
543 | p = xdr_encode_fhandle(p, args->fh); | ||
544 | *p++ = htonl(offset); | ||
545 | *p++ = htonl(offset); | ||
546 | *p++ = htonl(count); | ||
547 | *p++ = htonl(count); | ||
548 | sndbuf->len = xdr_adjust_iovec(sndbuf->head, p); | ||
549 | |||
550 | /* Copy the page array */ | ||
551 | xdr_encode_pages(sndbuf, args->pages, args->pgbase, count); | ||
552 | sndbuf->flags |= XDRBUF_WRITE; | ||
553 | return 0; | ||
554 | } | ||
555 | |||
556 | /* | ||
557 | * 2.2.9. writeargs | 425 | * 2.2.9. writeargs |
558 | * | 426 | * |
559 | * struct writeargs { | 427 | * struct writeargs { |
@@ -595,20 +463,6 @@ static int nfs2_xdr_enc_writeargs(struct rpc_rqst *req, __be32 *p, | |||
595 | } | 463 | } |
596 | 464 | ||
597 | /* | 465 | /* |
598 | * Encode create arguments | ||
599 | * CREATE, MKDIR | ||
600 | */ | ||
601 | static int | ||
602 | nfs_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs_createargs *args) | ||
603 | { | ||
604 | p = xdr_encode_fhandle(p, args->fh); | ||
605 | p = xdr_encode_array(p, args->name, args->len); | ||
606 | p = xdr_encode_sattr(p, args->sattr); | ||
607 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | /* | ||
612 | * 2.2.10. createargs | 466 | * 2.2.10. createargs |
613 | * | 467 | * |
614 | * struct createargs { | 468 | * struct createargs { |
@@ -638,20 +492,6 @@ static int nfs2_xdr_enc_removeargs(struct rpc_rqst *req, __be32 *p, | |||
638 | } | 492 | } |
639 | 493 | ||
640 | /* | 494 | /* |
641 | * Encode RENAME arguments | ||
642 | */ | ||
643 | static int | ||
644 | nfs_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args) | ||
645 | { | ||
646 | p = xdr_encode_fhandle(p, args->old_dir); | ||
647 | p = xdr_encode_array(p, args->old_name->name, args->old_name->len); | ||
648 | p = xdr_encode_fhandle(p, args->new_dir); | ||
649 | p = xdr_encode_array(p, args->new_name->name, args->new_name->len); | ||
650 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
651 | return 0; | ||
652 | } | ||
653 | |||
654 | /* | ||
655 | * 2.2.12. renameargs | 495 | * 2.2.12. renameargs |
656 | * | 496 | * |
657 | * struct renameargs { | 497 | * struct renameargs { |
@@ -673,19 +513,6 @@ static int nfs2_xdr_enc_renameargs(struct rpc_rqst *req, __be32 *p, | |||
673 | } | 513 | } |
674 | 514 | ||
675 | /* | 515 | /* |
676 | * Encode LINK arguments | ||
677 | */ | ||
678 | static int | ||
679 | nfs_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs_linkargs *args) | ||
680 | { | ||
681 | p = xdr_encode_fhandle(p, args->fromfh); | ||
682 | p = xdr_encode_fhandle(p, args->tofh); | ||
683 | p = xdr_encode_array(p, args->toname, args->tolen); | ||
684 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
685 | return 0; | ||
686 | } | ||
687 | |||
688 | /* | ||
689 | * 2.2.13. linkargs | 516 | * 2.2.13. linkargs |
690 | * | 517 | * |
691 | * struct linkargs { | 518 | * struct linkargs { |
@@ -705,35 +532,6 @@ static int nfs2_xdr_enc_linkargs(struct rpc_rqst *req, __be32 *p, | |||
705 | } | 532 | } |
706 | 533 | ||
707 | /* | 534 | /* |
708 | * Encode SYMLINK arguments | ||
709 | */ | ||
710 | static int | ||
711 | nfs_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_symlinkargs *args) | ||
712 | { | ||
713 | struct xdr_buf *sndbuf = &req->rq_snd_buf; | ||
714 | size_t pad; | ||
715 | |||
716 | p = xdr_encode_fhandle(p, args->fromfh); | ||
717 | p = xdr_encode_array(p, args->fromname, args->fromlen); | ||
718 | *p++ = htonl(args->pathlen); | ||
719 | sndbuf->len = xdr_adjust_iovec(sndbuf->head, p); | ||
720 | |||
721 | xdr_encode_pages(sndbuf, args->pages, 0, args->pathlen); | ||
722 | |||
723 | /* | ||
724 | * xdr_encode_pages may have added a few bytes to ensure the | ||
725 | * pathname ends on a 4-byte boundary. Start encoding the | ||
726 | * attributes after the pad bytes. | ||
727 | */ | ||
728 | pad = sndbuf->tail->iov_len; | ||
729 | if (pad > 0) | ||
730 | p++; | ||
731 | p = xdr_encode_sattr(p, args->sattr); | ||
732 | sndbuf->len += xdr_adjust_iovec(sndbuf->tail, p) - pad; | ||
733 | return 0; | ||
734 | } | ||
735 | |||
736 | /* | ||
737 | * 2.2.14. symlinkargs | 535 | * 2.2.14. symlinkargs |
738 | * | 536 | * |
739 | * struct symlinkargs { | 537 | * struct symlinkargs { |
@@ -755,27 +553,6 @@ static int nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req, __be32 *p, | |||
755 | } | 553 | } |
756 | 554 | ||
757 | /* | 555 | /* |
758 | * Encode arguments to readdir call | ||
759 | */ | ||
760 | static int | ||
761 | nfs_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs_readdirargs *args) | ||
762 | { | ||
763 | struct rpc_auth *auth = req->rq_cred->cr_auth; | ||
764 | unsigned int replen; | ||
765 | u32 count = args->count; | ||
766 | |||
767 | p = xdr_encode_fhandle(p, args->fh); | ||
768 | *p++ = htonl(args->cookie); | ||
769 | *p++ = htonl(count); /* see above */ | ||
770 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
771 | |||
772 | /* Inline the page array */ | ||
773 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS_readdirres_sz) << 2; | ||
774 | xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, 0, count); | ||
775 | return 0; | ||
776 | } | ||
777 | |||
778 | /* | ||
779 | * 2.2.17. readdirargs | 556 | * 2.2.17. readdirargs |
780 | * | 557 | * |
781 | * struct readdirargs { | 558 | * struct readdirargs { |
@@ -948,24 +725,6 @@ nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res) | |||
948 | } | 725 | } |
949 | 726 | ||
950 | /* | 727 | /* |
951 | * Encode READLINK args | ||
952 | */ | ||
953 | static int | ||
954 | nfs_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_readlinkargs *args) | ||
955 | { | ||
956 | struct rpc_auth *auth = req->rq_cred->cr_auth; | ||
957 | unsigned int replen; | ||
958 | |||
959 | p = xdr_encode_fhandle(p, args->fh); | ||
960 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | ||
961 | |||
962 | /* Inline the page array */ | ||
963 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS_readlinkres_sz) << 2; | ||
964 | xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, args->pgbase, args->pglen); | ||
965 | return 0; | ||
966 | } | ||
967 | |||
968 | /* | ||
969 | * Decode READLINK reply | 728 | * Decode READLINK reply |
970 | */ | 729 | */ |
971 | static int | 730 | static int |