aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs2xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2008-03-31 10:39:06 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-04-19 16:54:47 -0400
commit856dff3d3875bdc8b88e4a65779873af76776a69 (patch)
tree03f10cfa3319df59987fa20b1e96902d96fdb4ee /fs/nfs/nfs2xdr.c
parentd11d10cc05c94a32632d6928d15a1034200dd9a5 (diff)
nfs: return negative error value from nfs{,4}_stat_to_errno
All use sites for nfs{,4}_stat_to_errno negate their return value. It's more efficient to return a negative error from the stat_to_errno convertors rather than negating its return value everywhere. This also produces slightly smaller code. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs2xdr.c')
-rw-r--r--fs/nfs/nfs2xdr.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 86a80b33ec82..28bab67d1519 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -267,7 +267,7 @@ nfs_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
267 int status; 267 int status;
268 268
269 if ((status = ntohl(*p++))) 269 if ((status = ntohl(*p++)))
270 return -nfs_stat_to_errno(status); 270 return nfs_stat_to_errno(status);
271 p = xdr_decode_fattr(p, res->fattr); 271 p = xdr_decode_fattr(p, res->fattr);
272 272
273 count = ntohl(*p++); 273 count = ntohl(*p++);
@@ -432,7 +432,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy)
432 __be32 *end, *entry, *kaddr; 432 __be32 *end, *entry, *kaddr;
433 433
434 if ((status = ntohl(*p++))) 434 if ((status = ntohl(*p++)))
435 return -nfs_stat_to_errno(status); 435 return nfs_stat_to_errno(status);
436 436
437 hdrlen = (u8 *) p - (u8 *) iov->iov_base; 437 hdrlen = (u8 *) p - (u8 *) iov->iov_base;
438 if (iov->iov_len < hdrlen) { 438 if (iov->iov_len < hdrlen) {
@@ -537,7 +537,7 @@ nfs_xdr_stat(struct rpc_rqst *req, __be32 *p, void *dummy)
537 int status; 537 int status;
538 538
539 if ((status = ntohl(*p++)) != 0) 539 if ((status = ntohl(*p++)) != 0)
540 status = -nfs_stat_to_errno(status); 540 status = nfs_stat_to_errno(status);
541 return status; 541 return status;
542} 542}
543 543
@@ -551,7 +551,7 @@ nfs_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
551 int status; 551 int status;
552 552
553 if ((status = ntohl(*p++))) 553 if ((status = ntohl(*p++)))
554 return -nfs_stat_to_errno(status); 554 return nfs_stat_to_errno(status);
555 xdr_decode_fattr(p, fattr); 555 xdr_decode_fattr(p, fattr);
556 return 0; 556 return 0;
557} 557}
@@ -566,7 +566,7 @@ nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res)
566 int status; 566 int status;
567 567
568 if ((status = ntohl(*p++))) 568 if ((status = ntohl(*p++)))
569 return -nfs_stat_to_errno(status); 569 return nfs_stat_to_errno(status);
570 p = xdr_decode_fhandle(p, res->fh); 570 p = xdr_decode_fhandle(p, res->fh);
571 xdr_decode_fattr(p, res->fattr); 571 xdr_decode_fattr(p, res->fattr);
572 return 0; 572 return 0;
@@ -604,7 +604,7 @@ nfs_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, void *dummy)
604 int status; 604 int status;
605 605
606 if ((status = ntohl(*p++))) 606 if ((status = ntohl(*p++)))
607 return -nfs_stat_to_errno(status); 607 return nfs_stat_to_errno(status);
608 /* Convert length of symlink */ 608 /* Convert length of symlink */
609 len = ntohl(*p++); 609 len = ntohl(*p++);
610 if (len >= rcvbuf->page_len) { 610 if (len >= rcvbuf->page_len) {
@@ -653,7 +653,7 @@ nfs_xdr_statfsres(struct rpc_rqst *req, __be32 *p, struct nfs2_fsstat *res)
653 int status; 653 int status;
654 654
655 if ((status = ntohl(*p++))) 655 if ((status = ntohl(*p++)))
656 return -nfs_stat_to_errno(status); 656 return nfs_stat_to_errno(status);
657 657
658 res->tsize = ntohl(*p++); 658 res->tsize = ntohl(*p++);
659 res->bsize = ntohl(*p++); 659 res->bsize = ntohl(*p++);
@@ -672,39 +672,39 @@ static struct {
672 int errno; 672 int errno;
673} nfs_errtbl[] = { 673} nfs_errtbl[] = {
674 { NFS_OK, 0 }, 674 { NFS_OK, 0 },
675 { NFSERR_PERM, EPERM }, 675 { NFSERR_PERM, -EPERM },
676 { NFSERR_NOENT, ENOENT }, 676 { NFSERR_NOENT, -ENOENT },
677 { NFSERR_IO, errno_NFSERR_IO }, 677 { NFSERR_IO, -errno_NFSERR_IO},
678 { NFSERR_NXIO, ENXIO }, 678 { NFSERR_NXIO, -ENXIO },
679/* { NFSERR_EAGAIN, EAGAIN }, */ 679/* { NFSERR_EAGAIN, -EAGAIN }, */
680 { NFSERR_ACCES, EACCES }, 680 { NFSERR_ACCES, -EACCES },
681 { NFSERR_EXIST, EEXIST }, 681 { NFSERR_EXIST, -EEXIST },
682 { NFSERR_XDEV, EXDEV }, 682 { NFSERR_XDEV, -EXDEV },
683 { NFSERR_NODEV, ENODEV }, 683 { NFSERR_NODEV, -ENODEV },
684 { NFSERR_NOTDIR, ENOTDIR }, 684 { NFSERR_NOTDIR, -ENOTDIR },
685 { NFSERR_ISDIR, EISDIR }, 685 { NFSERR_ISDIR, -EISDIR },
686 { NFSERR_INVAL, EINVAL }, 686 { NFSERR_INVAL, -EINVAL },
687 { NFSERR_FBIG, EFBIG }, 687 { NFSERR_FBIG, -EFBIG },
688 { NFSERR_NOSPC, ENOSPC }, 688 { NFSERR_NOSPC, -ENOSPC },
689 { NFSERR_ROFS, EROFS }, 689 { NFSERR_ROFS, -EROFS },
690 { NFSERR_MLINK, EMLINK }, 690 { NFSERR_MLINK, -EMLINK },
691 { NFSERR_NAMETOOLONG, ENAMETOOLONG }, 691 { NFSERR_NAMETOOLONG, -ENAMETOOLONG },
692 { NFSERR_NOTEMPTY, ENOTEMPTY }, 692 { NFSERR_NOTEMPTY, -ENOTEMPTY },
693 { NFSERR_DQUOT, EDQUOT }, 693 { NFSERR_DQUOT, -EDQUOT },
694 { NFSERR_STALE, ESTALE }, 694 { NFSERR_STALE, -ESTALE },
695 { NFSERR_REMOTE, EREMOTE }, 695 { NFSERR_REMOTE, -EREMOTE },
696#ifdef EWFLUSH 696#ifdef EWFLUSH
697 { NFSERR_WFLUSH, EWFLUSH }, 697 { NFSERR_WFLUSH, -EWFLUSH },
698#endif 698#endif
699 { NFSERR_BADHANDLE, EBADHANDLE }, 699 { NFSERR_BADHANDLE, -EBADHANDLE },
700 { NFSERR_NOT_SYNC, ENOTSYNC }, 700 { NFSERR_NOT_SYNC, -ENOTSYNC },
701 { NFSERR_BAD_COOKIE, EBADCOOKIE }, 701 { NFSERR_BAD_COOKIE, -EBADCOOKIE },
702 { NFSERR_NOTSUPP, ENOTSUPP }, 702 { NFSERR_NOTSUPP, -ENOTSUPP },
703 { NFSERR_TOOSMALL, ETOOSMALL }, 703 { NFSERR_TOOSMALL, -ETOOSMALL },
704 { NFSERR_SERVERFAULT, ESERVERFAULT }, 704 { NFSERR_SERVERFAULT, -ESERVERFAULT },
705 { NFSERR_BADTYPE, EBADTYPE }, 705 { NFSERR_BADTYPE, -EBADTYPE },
706 { NFSERR_JUKEBOX, EJUKEBOX }, 706 { NFSERR_JUKEBOX, -EJUKEBOX },
707 { -1, EIO } 707 { -1, -EIO }
708}; 708};
709 709
710/* 710/*