aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/nfs/nfs2xdr.c76
-rw-r--r--fs/nfs/nfs3xdr.c34
-rw-r--r--fs/nfs/nfs4xdr.c80
3 files changed, 95 insertions, 95 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/*
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index fb03048ac650..11cdddec1432 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -515,7 +515,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res
515 /* Decode post_op_attrs */ 515 /* Decode post_op_attrs */
516 p = xdr_decode_post_op_attr(p, res->dir_attr); 516 p = xdr_decode_post_op_attr(p, res->dir_attr);
517 if (status) 517 if (status)
518 return -nfs_stat_to_errno(status); 518 return nfs_stat_to_errno(status);
519 /* Decode verifier cookie */ 519 /* Decode verifier cookie */
520 if (res->verf) { 520 if (res->verf) {
521 res->verf[0] = *p++; 521 res->verf[0] = *p++;
@@ -751,7 +751,7 @@ nfs3_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
751 int status; 751 int status;
752 752
753 if ((status = ntohl(*p++))) 753 if ((status = ntohl(*p++)))
754 return -nfs_stat_to_errno(status); 754 return nfs_stat_to_errno(status);
755 xdr_decode_fattr(p, fattr); 755 xdr_decode_fattr(p, fattr);
756 return 0; 756 return 0;
757} 757}
@@ -766,7 +766,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
766 int status; 766 int status;
767 767
768 if ((status = ntohl(*p++))) 768 if ((status = ntohl(*p++)))
769 status = -nfs_stat_to_errno(status); 769 status = nfs_stat_to_errno(status);
770 xdr_decode_wcc_data(p, fattr); 770 xdr_decode_wcc_data(p, fattr);
771 return status; 771 return status;
772} 772}
@@ -786,7 +786,7 @@ nfs3_xdr_lookupres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
786 int status; 786 int status;
787 787
788 if ((status = ntohl(*p++))) { 788 if ((status = ntohl(*p++))) {
789 status = -nfs_stat_to_errno(status); 789 status = nfs_stat_to_errno(status);
790 } else { 790 } else {
791 if (!(p = xdr_decode_fhandle(p, res->fh))) 791 if (!(p = xdr_decode_fhandle(p, res->fh)))
792 return -errno_NFSERR_IO; 792 return -errno_NFSERR_IO;
@@ -806,7 +806,7 @@ nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res)
806 806
807 p = xdr_decode_post_op_attr(p, res->fattr); 807 p = xdr_decode_post_op_attr(p, res->fattr);
808 if (status) 808 if (status)
809 return -nfs_stat_to_errno(status); 809 return nfs_stat_to_errno(status);
810 res->access = ntohl(*p++); 810 res->access = ntohl(*p++);
811 return 0; 811 return 0;
812} 812}
@@ -843,7 +843,7 @@ nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
843 p = xdr_decode_post_op_attr(p, fattr); 843 p = xdr_decode_post_op_attr(p, fattr);
844 844
845 if (status != 0) 845 if (status != 0)
846 return -nfs_stat_to_errno(status); 846 return nfs_stat_to_errno(status);
847 847
848 /* Convert length of symlink */ 848 /* Convert length of symlink */
849 len = ntohl(*p++); 849 len = ntohl(*p++);
@@ -891,7 +891,7 @@ nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
891 p = xdr_decode_post_op_attr(p, res->fattr); 891 p = xdr_decode_post_op_attr(p, res->fattr);
892 892
893 if (status != 0) 893 if (status != 0)
894 return -nfs_stat_to_errno(status); 894 return nfs_stat_to_errno(status);
895 895
896 /* Decode reply count and EOF flag. NFSv3 is somewhat redundant 896 /* Decode reply count and EOF flag. NFSv3 is somewhat redundant
897 * in that it puts the count both in the res struct and in the 897 * in that it puts the count both in the res struct and in the
@@ -941,7 +941,7 @@ nfs3_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
941 p = xdr_decode_wcc_data(p, res->fattr); 941 p = xdr_decode_wcc_data(p, res->fattr);
942 942
943 if (status != 0) 943 if (status != 0)
944 return -nfs_stat_to_errno(status); 944 return nfs_stat_to_errno(status);
945 945
946 res->count = ntohl(*p++); 946 res->count = ntohl(*p++);
947 res->verf->committed = (enum nfs3_stable_how)ntohl(*p++); 947 res->verf->committed = (enum nfs3_stable_how)ntohl(*p++);
@@ -972,7 +972,7 @@ nfs3_xdr_createres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
972 res->fattr->valid = 0; 972 res->fattr->valid = 0;
973 } 973 }
974 } else { 974 } else {
975 status = -nfs_stat_to_errno(status); 975 status = nfs_stat_to_errno(status);
976 } 976 }
977 p = xdr_decode_wcc_data(p, res->dir_attr); 977 p = xdr_decode_wcc_data(p, res->dir_attr);
978 return status; 978 return status;
@@ -987,7 +987,7 @@ nfs3_xdr_renameres(struct rpc_rqst *req, __be32 *p, struct nfs3_renameres *res)
987 int status; 987 int status;
988 988
989 if ((status = ntohl(*p++)) != 0) 989 if ((status = ntohl(*p++)) != 0)
990 status = -nfs_stat_to_errno(status); 990 status = nfs_stat_to_errno(status);
991 p = xdr_decode_wcc_data(p, res->fromattr); 991 p = xdr_decode_wcc_data(p, res->fromattr);
992 p = xdr_decode_wcc_data(p, res->toattr); 992 p = xdr_decode_wcc_data(p, res->toattr);
993 return status; 993 return status;
@@ -1002,7 +1002,7 @@ nfs3_xdr_linkres(struct rpc_rqst *req, __be32 *p, struct nfs3_linkres *res)
1002 int status; 1002 int status;
1003 1003
1004 if ((status = ntohl(*p++)) != 0) 1004 if ((status = ntohl(*p++)) != 0)
1005 status = -nfs_stat_to_errno(status); 1005 status = nfs_stat_to_errno(status);
1006 p = xdr_decode_post_op_attr(p, res->fattr); 1006 p = xdr_decode_post_op_attr(p, res->fattr);
1007 p = xdr_decode_wcc_data(p, res->dir_attr); 1007 p = xdr_decode_wcc_data(p, res->dir_attr);
1008 return status; 1008 return status;
@@ -1020,7 +1020,7 @@ nfs3_xdr_fsstatres(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *res)
1020 1020
1021 p = xdr_decode_post_op_attr(p, res->fattr); 1021 p = xdr_decode_post_op_attr(p, res->fattr);
1022 if (status != 0) 1022 if (status != 0)
1023 return -nfs_stat_to_errno(status); 1023 return nfs_stat_to_errno(status);
1024 1024
1025 p = xdr_decode_hyper(p, &res->tbytes); 1025 p = xdr_decode_hyper(p, &res->tbytes);
1026 p = xdr_decode_hyper(p, &res->fbytes); 1026 p = xdr_decode_hyper(p, &res->fbytes);
@@ -1045,7 +1045,7 @@ nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res)
1045 1045
1046 p = xdr_decode_post_op_attr(p, res->fattr); 1046 p = xdr_decode_post_op_attr(p, res->fattr);
1047 if (status != 0) 1047 if (status != 0)
1048 return -nfs_stat_to_errno(status); 1048 return nfs_stat_to_errno(status);
1049 1049
1050 res->rtmax = ntohl(*p++); 1050 res->rtmax = ntohl(*p++);
1051 res->rtpref = ntohl(*p++); 1051 res->rtpref = ntohl(*p++);
@@ -1073,7 +1073,7 @@ nfs3_xdr_pathconfres(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *res)
1073 1073
1074 p = xdr_decode_post_op_attr(p, res->fattr); 1074 p = xdr_decode_post_op_attr(p, res->fattr);
1075 if (status != 0) 1075 if (status != 0)
1076 return -nfs_stat_to_errno(status); 1076 return nfs_stat_to_errno(status);
1077 res->max_link = ntohl(*p++); 1077 res->max_link = ntohl(*p++);
1078 res->max_namelen = ntohl(*p++); 1078 res->max_namelen = ntohl(*p++);
1079 1079
@@ -1092,7 +1092,7 @@ nfs3_xdr_commitres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
1092 status = ntohl(*p++); 1092 status = ntohl(*p++);
1093 p = xdr_decode_wcc_data(p, res->fattr); 1093 p = xdr_decode_wcc_data(p, res->fattr);
1094 if (status != 0) 1094 if (status != 0)
1095 return -nfs_stat_to_errno(status); 1095 return nfs_stat_to_errno(status);
1096 1096
1097 res->verf->verifier[0] = *p++; 1097 res->verf->verifier[0] = *p++;
1098 res->verf->verifier[1] = *p++; 1098 res->verf->verifier[1] = *p++;
@@ -1114,7 +1114,7 @@ nfs3_xdr_getaclres(struct rpc_rqst *req, __be32 *p,
1114 int err, base; 1114 int err, base;
1115 1115
1116 if (status != 0) 1116 if (status != 0)
1117 return -nfs_stat_to_errno(status); 1117 return nfs_stat_to_errno(status);
1118 p = xdr_decode_post_op_attr(p, res->fattr); 1118 p = xdr_decode_post_op_attr(p, res->fattr);
1119 res->mask = ntohl(*p++); 1119 res->mask = ntohl(*p++);
1120 if (res->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 1120 if (res->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
@@ -1141,7 +1141,7 @@ nfs3_xdr_setaclres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
1141 int status = ntohl(*p++); 1141 int status = ntohl(*p++);
1142 1142
1143 if (status) 1143 if (status)
1144 return -nfs_stat_to_errno(status); 1144 return nfs_stat_to_errno(status);
1145 xdr_decode_post_op_attr(p, fattr); 1145 xdr_decode_post_op_attr(p, fattr);
1146 return 0; 1146 return 0;
1147} 1147}
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index b8b2e391d183..809ef0d787e3 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2241,7 +2241,7 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
2241 } 2241 }
2242 READ32(nfserr); 2242 READ32(nfserr);
2243 if (nfserr != NFS_OK) 2243 if (nfserr != NFS_OK)
2244 return -nfs4_stat_to_errno(nfserr); 2244 return nfs4_stat_to_errno(nfserr);
2245 return 0; 2245 return 0;
2246} 2246}
2247 2247
@@ -3760,7 +3760,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
3760 READ_BUF(len); 3760 READ_BUF(len);
3761 return -NFSERR_CLID_INUSE; 3761 return -NFSERR_CLID_INUSE;
3762 } else 3762 } else
3763 return -nfs4_stat_to_errno(nfserr); 3763 return nfs4_stat_to_errno(nfserr);
3764 3764
3765 return 0; 3765 return 0;
3766} 3766}
@@ -4422,7 +4422,7 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs_fsinf
4422 if (!status) 4422 if (!status)
4423 status = decode_fsinfo(&xdr, fsinfo); 4423 status = decode_fsinfo(&xdr, fsinfo);
4424 if (!status) 4424 if (!status)
4425 status = -nfs4_stat_to_errno(hdr.status); 4425 status = nfs4_stat_to_errno(hdr.status);
4426 return status; 4426 return status;
4427} 4427}
4428 4428
@@ -4512,7 +4512,7 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p,
4512 if (!status) 4512 if (!status)
4513 status = decode_setclientid(&xdr, clp); 4513 status = decode_setclientid(&xdr, clp);
4514 if (!status) 4514 if (!status)
4515 status = -nfs4_stat_to_errno(hdr.status); 4515 status = nfs4_stat_to_errno(hdr.status);
4516 return status; 4516 return status;
4517} 4517}
4518 4518
@@ -4534,7 +4534,7 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str
4534 if (!status) 4534 if (!status)
4535 status = decode_fsinfo(&xdr, fsinfo); 4535 status = decode_fsinfo(&xdr, fsinfo);
4536 if (!status) 4536 if (!status)
4537 status = -nfs4_stat_to_errno(hdr.status); 4537 status = nfs4_stat_to_errno(hdr.status);
4538 return status; 4538 return status;
4539} 4539}
4540 4540
@@ -4644,42 +4644,42 @@ static struct {
4644 int errno; 4644 int errno;
4645} nfs_errtbl[] = { 4645} nfs_errtbl[] = {
4646 { NFS4_OK, 0 }, 4646 { NFS4_OK, 0 },
4647 { NFS4ERR_PERM, EPERM }, 4647 { NFS4ERR_PERM, -EPERM },
4648 { NFS4ERR_NOENT, ENOENT }, 4648 { NFS4ERR_NOENT, -ENOENT },
4649 { NFS4ERR_IO, errno_NFSERR_IO }, 4649 { NFS4ERR_IO, -errno_NFSERR_IO},
4650 { NFS4ERR_NXIO, ENXIO }, 4650 { NFS4ERR_NXIO, -ENXIO },
4651 { NFS4ERR_ACCESS, EACCES }, 4651 { NFS4ERR_ACCESS, -EACCES },
4652 { NFS4ERR_EXIST, EEXIST }, 4652 { NFS4ERR_EXIST, -EEXIST },
4653 { NFS4ERR_XDEV, EXDEV }, 4653 { NFS4ERR_XDEV, -EXDEV },
4654 { NFS4ERR_NOTDIR, ENOTDIR }, 4654 { NFS4ERR_NOTDIR, -ENOTDIR },
4655 { NFS4ERR_ISDIR, EISDIR }, 4655 { NFS4ERR_ISDIR, -EISDIR },
4656 { NFS4ERR_INVAL, EINVAL }, 4656 { NFS4ERR_INVAL, -EINVAL },
4657 { NFS4ERR_FBIG, EFBIG }, 4657 { NFS4ERR_FBIG, -EFBIG },
4658 { NFS4ERR_NOSPC, ENOSPC }, 4658 { NFS4ERR_NOSPC, -ENOSPC },
4659 { NFS4ERR_ROFS, EROFS }, 4659 { NFS4ERR_ROFS, -EROFS },
4660 { NFS4ERR_MLINK, EMLINK }, 4660 { NFS4ERR_MLINK, -EMLINK },
4661 { NFS4ERR_NAMETOOLONG, ENAMETOOLONG }, 4661 { NFS4ERR_NAMETOOLONG, -ENAMETOOLONG },
4662 { NFS4ERR_NOTEMPTY, ENOTEMPTY }, 4662 { NFS4ERR_NOTEMPTY, -ENOTEMPTY },
4663 { NFS4ERR_DQUOT, EDQUOT }, 4663 { NFS4ERR_DQUOT, -EDQUOT },
4664 { NFS4ERR_STALE, ESTALE }, 4664 { NFS4ERR_STALE, -ESTALE },
4665 { NFS4ERR_BADHANDLE, EBADHANDLE }, 4665 { NFS4ERR_BADHANDLE, -EBADHANDLE },
4666 { NFS4ERR_BADOWNER, EINVAL }, 4666 { NFS4ERR_BADOWNER, -EINVAL },
4667 { NFS4ERR_BADNAME, EINVAL }, 4667 { NFS4ERR_BADNAME, -EINVAL },
4668 { NFS4ERR_BAD_COOKIE, EBADCOOKIE }, 4668 { NFS4ERR_BAD_COOKIE, -EBADCOOKIE },
4669 { NFS4ERR_NOTSUPP, ENOTSUPP }, 4669 { NFS4ERR_NOTSUPP, -ENOTSUPP },
4670 { NFS4ERR_TOOSMALL, ETOOSMALL }, 4670 { NFS4ERR_TOOSMALL, -ETOOSMALL },
4671 { NFS4ERR_SERVERFAULT, ESERVERFAULT }, 4671 { NFS4ERR_SERVERFAULT, -ESERVERFAULT },
4672 { NFS4ERR_BADTYPE, EBADTYPE }, 4672 { NFS4ERR_BADTYPE, -EBADTYPE },
4673 { NFS4ERR_LOCKED, EAGAIN }, 4673 { NFS4ERR_LOCKED, -EAGAIN },
4674 { NFS4ERR_RESOURCE, EREMOTEIO }, 4674 { NFS4ERR_RESOURCE, -EREMOTEIO },
4675 { NFS4ERR_SYMLINK, ELOOP }, 4675 { NFS4ERR_SYMLINK, -ELOOP },
4676 { NFS4ERR_OP_ILLEGAL, EOPNOTSUPP }, 4676 { NFS4ERR_OP_ILLEGAL, -EOPNOTSUPP },
4677 { NFS4ERR_DEADLOCK, EDEADLK }, 4677 { NFS4ERR_DEADLOCK, -EDEADLK },
4678 { NFS4ERR_WRONGSEC, EPERM }, /* FIXME: this needs 4678 { NFS4ERR_WRONGSEC, -EPERM }, /* FIXME: this needs
4679 * to be handled by a 4679 * to be handled by a
4680 * middle-layer. 4680 * middle-layer.
4681 */ 4681 */
4682 { -1, EIO } 4682 { -1, -EIO }
4683}; 4683};
4684 4684
4685/* 4685/*
@@ -4696,14 +4696,14 @@ nfs4_stat_to_errno(int stat)
4696 } 4696 }
4697 if (stat <= 10000 || stat > 10100) { 4697 if (stat <= 10000 || stat > 10100) {
4698 /* The server is looney tunes. */ 4698 /* The server is looney tunes. */
4699 return ESERVERFAULT; 4699 return -ESERVERFAULT;
4700 } 4700 }
4701 /* If we cannot translate the error, the recovery routines should 4701 /* If we cannot translate the error, the recovery routines should
4702 * handle it. 4702 * handle it.
4703 * Note: remaining NFSv4 error codes have values > 10000, so should 4703 * Note: remaining NFSv4 error codes have values > 10000, so should
4704 * not conflict with native Linux error codes. 4704 * not conflict with native Linux error codes.
4705 */ 4705 */
4706 return stat; 4706 return -stat;
4707} 4707}
4708 4708
4709#define PROC(proc, argtype, restype) \ 4709#define PROC(proc, argtype, restype) \