diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-12-14 09:59:29 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-12-16 12:37:25 -0500 |
commit | bf2695516db982e90a22fc94f93491b481796bb1 (patch) | |
tree | 367bf134ef892bfc3fcd2c4fe676b14102d97467 /fs/nfs/nfs3xdr.c | |
parent | 9f06c719f474be7003763284a990bed6377bb0d4 (diff) |
SUNRPC: New xdr_streams XDR decoder API
Now that all client-side XDR decoder routines use xdr_streams, there
should be no need to support the legacy calling sequence [rpc_rqst *,
__be32 *, RPC res *] anywhere. We can construct an xdr_stream in the
generic RPC code, instead of in each decoder function.
This is a refactoring change. It should not cause different behavior.
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/nfs3xdr.c')
-rw-r--r-- | fs/nfs/nfs3xdr.c | 195 |
1 files changed, 87 insertions, 108 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index ae1b1a43f05e..df30a26cc4fa 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -1366,20 +1366,19 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, | |||
1366 | * void; | 1366 | * void; |
1367 | * }; | 1367 | * }; |
1368 | */ | 1368 | */ |
1369 | static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req, __be32 *p, | 1369 | static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req, |
1370 | struct xdr_stream *xdr, | ||
1370 | struct nfs_fattr *result) | 1371 | struct nfs_fattr *result) |
1371 | { | 1372 | { |
1372 | struct xdr_stream xdr; | ||
1373 | enum nfs_stat status; | 1373 | enum nfs_stat status; |
1374 | int error; | 1374 | int error; |
1375 | 1375 | ||
1376 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1376 | error = decode_nfsstat3(xdr, &status); |
1377 | error = decode_nfsstat3(&xdr, &status); | ||
1378 | if (unlikely(error)) | 1377 | if (unlikely(error)) |
1379 | goto out; | 1378 | goto out; |
1380 | if (status != NFS3_OK) | 1379 | if (status != NFS3_OK) |
1381 | goto out_default; | 1380 | goto out_default; |
1382 | error = decode_fattr3(&xdr, result); | 1381 | error = decode_fattr3(xdr, result); |
1383 | out: | 1382 | out: |
1384 | return error; | 1383 | return error; |
1385 | out_default: | 1384 | out_default: |
@@ -1404,18 +1403,17 @@ out_default: | |||
1404 | * SETATTR3resfail resfail; | 1403 | * SETATTR3resfail resfail; |
1405 | * }; | 1404 | * }; |
1406 | */ | 1405 | */ |
1407 | static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req, __be32 *p, | 1406 | static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req, |
1407 | struct xdr_stream *xdr, | ||
1408 | struct nfs_fattr *result) | 1408 | struct nfs_fattr *result) |
1409 | { | 1409 | { |
1410 | struct xdr_stream xdr; | ||
1411 | enum nfs_stat status; | 1410 | enum nfs_stat status; |
1412 | int error; | 1411 | int error; |
1413 | 1412 | ||
1414 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1413 | error = decode_nfsstat3(xdr, &status); |
1415 | error = decode_nfsstat3(&xdr, &status); | ||
1416 | if (unlikely(error)) | 1414 | if (unlikely(error)) |
1417 | goto out; | 1415 | goto out; |
1418 | error = decode_wcc_data(&xdr, result); | 1416 | error = decode_wcc_data(xdr, result); |
1419 | if (unlikely(error)) | 1417 | if (unlikely(error)) |
1420 | goto out; | 1418 | goto out; |
1421 | if (status != NFS3_OK) | 1419 | if (status != NFS3_OK) |
@@ -1446,30 +1444,29 @@ out_status: | |||
1446 | * LOOKUP3resfail resfail; | 1444 | * LOOKUP3resfail resfail; |
1447 | * }; | 1445 | * }; |
1448 | */ | 1446 | */ |
1449 | static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req, __be32 *p, | 1447 | static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req, |
1448 | struct xdr_stream *xdr, | ||
1450 | struct nfs3_diropres *result) | 1449 | struct nfs3_diropres *result) |
1451 | { | 1450 | { |
1452 | struct xdr_stream xdr; | ||
1453 | enum nfs_stat status; | 1451 | enum nfs_stat status; |
1454 | int error; | 1452 | int error; |
1455 | 1453 | ||
1456 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1454 | error = decode_nfsstat3(xdr, &status); |
1457 | error = decode_nfsstat3(&xdr, &status); | ||
1458 | if (unlikely(error)) | 1455 | if (unlikely(error)) |
1459 | goto out; | 1456 | goto out; |
1460 | if (status != NFS3_OK) | 1457 | if (status != NFS3_OK) |
1461 | goto out_default; | 1458 | goto out_default; |
1462 | error = decode_nfs_fh3(&xdr, result->fh); | 1459 | error = decode_nfs_fh3(xdr, result->fh); |
1463 | if (unlikely(error)) | 1460 | if (unlikely(error)) |
1464 | goto out; | 1461 | goto out; |
1465 | error = decode_post_op_attr(&xdr, result->fattr); | 1462 | error = decode_post_op_attr(xdr, result->fattr); |
1466 | if (unlikely(error)) | 1463 | if (unlikely(error)) |
1467 | goto out; | 1464 | goto out; |
1468 | error = decode_post_op_attr(&xdr, result->dir_attr); | 1465 | error = decode_post_op_attr(xdr, result->dir_attr); |
1469 | out: | 1466 | out: |
1470 | return error; | 1467 | return error; |
1471 | out_default: | 1468 | out_default: |
1472 | error = decode_post_op_attr(&xdr, result->dir_attr); | 1469 | error = decode_post_op_attr(xdr, result->dir_attr); |
1473 | if (unlikely(error)) | 1470 | if (unlikely(error)) |
1474 | goto out; | 1471 | goto out; |
1475 | return nfs_stat_to_errno(status); | 1472 | return nfs_stat_to_errno(status); |
@@ -1494,23 +1491,22 @@ out_default: | |||
1494 | * ACCESS3resfail resfail; | 1491 | * ACCESS3resfail resfail; |
1495 | * }; | 1492 | * }; |
1496 | */ | 1493 | */ |
1497 | static int nfs3_xdr_dec_access3res(struct rpc_rqst *req, __be32 *p, | 1494 | static int nfs3_xdr_dec_access3res(struct rpc_rqst *req, |
1495 | struct xdr_stream *xdr, | ||
1498 | struct nfs3_accessres *result) | 1496 | struct nfs3_accessres *result) |
1499 | { | 1497 | { |
1500 | struct xdr_stream xdr; | ||
1501 | enum nfs_stat status; | 1498 | enum nfs_stat status; |
1502 | int error; | 1499 | int error; |
1503 | 1500 | ||
1504 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1501 | error = decode_nfsstat3(xdr, &status); |
1505 | error = decode_nfsstat3(&xdr, &status); | ||
1506 | if (unlikely(error)) | 1502 | if (unlikely(error)) |
1507 | goto out; | 1503 | goto out; |
1508 | error = decode_post_op_attr(&xdr, result->fattr); | 1504 | error = decode_post_op_attr(xdr, result->fattr); |
1509 | if (unlikely(error)) | 1505 | if (unlikely(error)) |
1510 | goto out; | 1506 | goto out; |
1511 | if (status != NFS3_OK) | 1507 | if (status != NFS3_OK) |
1512 | goto out_default; | 1508 | goto out_default; |
1513 | error = decode_uint32(&xdr, &result->access); | 1509 | error = decode_uint32(xdr, &result->access); |
1514 | out: | 1510 | out: |
1515 | return error; | 1511 | return error; |
1516 | out_default: | 1512 | out_default: |
@@ -1536,23 +1532,22 @@ out_default: | |||
1536 | * READLINK3resfail resfail; | 1532 | * READLINK3resfail resfail; |
1537 | * }; | 1533 | * }; |
1538 | */ | 1534 | */ |
1539 | static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req, __be32 *p, | 1535 | static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req, |
1536 | struct xdr_stream *xdr, | ||
1540 | struct nfs_fattr *result) | 1537 | struct nfs_fattr *result) |
1541 | { | 1538 | { |
1542 | struct xdr_stream xdr; | ||
1543 | enum nfs_stat status; | 1539 | enum nfs_stat status; |
1544 | int error; | 1540 | int error; |
1545 | 1541 | ||
1546 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1542 | error = decode_nfsstat3(xdr, &status); |
1547 | error = decode_nfsstat3(&xdr, &status); | ||
1548 | if (unlikely(error)) | 1543 | if (unlikely(error)) |
1549 | goto out; | 1544 | goto out; |
1550 | error = decode_post_op_attr(&xdr, result); | 1545 | error = decode_post_op_attr(xdr, result); |
1551 | if (unlikely(error)) | 1546 | if (unlikely(error)) |
1552 | goto out; | 1547 | goto out; |
1553 | if (status != NFS3_OK) | 1548 | if (status != NFS3_OK) |
1554 | goto out_default; | 1549 | goto out_default; |
1555 | error = decode_nfspath3(&xdr); | 1550 | error = decode_nfspath3(xdr); |
1556 | out: | 1551 | out: |
1557 | return error; | 1552 | return error; |
1558 | out_default: | 1553 | out_default: |
@@ -1620,23 +1615,21 @@ out_overflow: | |||
1620 | return -EIO; | 1615 | return -EIO; |
1621 | } | 1616 | } |
1622 | 1617 | ||
1623 | static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, __be32 *p, | 1618 | static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr, |
1624 | struct nfs_readres *result) | 1619 | struct nfs_readres *result) |
1625 | { | 1620 | { |
1626 | struct xdr_stream xdr; | ||
1627 | enum nfs_stat status; | 1621 | enum nfs_stat status; |
1628 | int error; | 1622 | int error; |
1629 | 1623 | ||
1630 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1624 | error = decode_nfsstat3(xdr, &status); |
1631 | error = decode_nfsstat3(&xdr, &status); | ||
1632 | if (unlikely(error)) | 1625 | if (unlikely(error)) |
1633 | goto out; | 1626 | goto out; |
1634 | error = decode_post_op_attr(&xdr, result->fattr); | 1627 | error = decode_post_op_attr(xdr, result->fattr); |
1635 | if (unlikely(error)) | 1628 | if (unlikely(error)) |
1636 | goto out; | 1629 | goto out; |
1637 | if (status != NFS3_OK) | 1630 | if (status != NFS3_OK) |
1638 | goto out_status; | 1631 | goto out_status; |
1639 | error = decode_read3resok(&xdr, result); | 1632 | error = decode_read3resok(xdr, result); |
1640 | out: | 1633 | out: |
1641 | return error; | 1634 | return error; |
1642 | out_status: | 1635 | out_status: |
@@ -1692,23 +1685,21 @@ out_overflow: | |||
1692 | return -EIO; | 1685 | return -EIO; |
1693 | } | 1686 | } |
1694 | 1687 | ||
1695 | static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, __be32 *p, | 1688 | static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr, |
1696 | struct nfs_writeres *result) | 1689 | struct nfs_writeres *result) |
1697 | { | 1690 | { |
1698 | struct xdr_stream xdr; | ||
1699 | enum nfs_stat status; | 1691 | enum nfs_stat status; |
1700 | int error; | 1692 | int error; |
1701 | 1693 | ||
1702 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1694 | error = decode_nfsstat3(xdr, &status); |
1703 | error = decode_nfsstat3(&xdr, &status); | ||
1704 | if (unlikely(error)) | 1695 | if (unlikely(error)) |
1705 | goto out; | 1696 | goto out; |
1706 | error = decode_wcc_data(&xdr, result->fattr); | 1697 | error = decode_wcc_data(xdr, result->fattr); |
1707 | if (unlikely(error)) | 1698 | if (unlikely(error)) |
1708 | goto out; | 1699 | goto out; |
1709 | if (status != NFS3_OK) | 1700 | if (status != NFS3_OK) |
1710 | goto out_status; | 1701 | goto out_status; |
1711 | error = decode_write3resok(&xdr, result); | 1702 | error = decode_write3resok(xdr, result); |
1712 | out: | 1703 | out: |
1713 | return error; | 1704 | return error; |
1714 | out_status: | 1705 | out_status: |
@@ -1757,24 +1748,23 @@ out: | |||
1757 | return error; | 1748 | return error; |
1758 | } | 1749 | } |
1759 | 1750 | ||
1760 | static int nfs3_xdr_dec_create3res(struct rpc_rqst *req, __be32 *p, | 1751 | static int nfs3_xdr_dec_create3res(struct rpc_rqst *req, |
1752 | struct xdr_stream *xdr, | ||
1761 | struct nfs3_diropres *result) | 1753 | struct nfs3_diropres *result) |
1762 | { | 1754 | { |
1763 | struct xdr_stream xdr; | ||
1764 | enum nfs_stat status; | 1755 | enum nfs_stat status; |
1765 | int error; | 1756 | int error; |
1766 | 1757 | ||
1767 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1758 | error = decode_nfsstat3(xdr, &status); |
1768 | error = decode_nfsstat3(&xdr, &status); | ||
1769 | if (unlikely(error)) | 1759 | if (unlikely(error)) |
1770 | goto out; | 1760 | goto out; |
1771 | if (status != NFS3_OK) | 1761 | if (status != NFS3_OK) |
1772 | goto out_default; | 1762 | goto out_default; |
1773 | error = decode_create3resok(&xdr, result); | 1763 | error = decode_create3resok(xdr, result); |
1774 | out: | 1764 | out: |
1775 | return error; | 1765 | return error; |
1776 | out_default: | 1766 | out_default: |
1777 | error = decode_wcc_data(&xdr, result->dir_attr); | 1767 | error = decode_wcc_data(xdr, result->dir_attr); |
1778 | if (unlikely(error)) | 1768 | if (unlikely(error)) |
1779 | goto out; | 1769 | goto out; |
1780 | return nfs_stat_to_errno(status); | 1770 | return nfs_stat_to_errno(status); |
@@ -1798,18 +1788,17 @@ out_default: | |||
1798 | * REMOVE3resfail resfail; | 1788 | * REMOVE3resfail resfail; |
1799 | * }; | 1789 | * }; |
1800 | */ | 1790 | */ |
1801 | static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req, __be32 *p, | 1791 | static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req, |
1792 | struct xdr_stream *xdr, | ||
1802 | struct nfs_removeres *result) | 1793 | struct nfs_removeres *result) |
1803 | { | 1794 | { |
1804 | struct xdr_stream xdr; | ||
1805 | enum nfs_stat status; | 1795 | enum nfs_stat status; |
1806 | int error; | 1796 | int error; |
1807 | 1797 | ||
1808 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1798 | error = decode_nfsstat3(xdr, &status); |
1809 | error = decode_nfsstat3(&xdr, &status); | ||
1810 | if (unlikely(error)) | 1799 | if (unlikely(error)) |
1811 | goto out; | 1800 | goto out; |
1812 | error = decode_wcc_data(&xdr, result->dir_attr); | 1801 | error = decode_wcc_data(xdr, result->dir_attr); |
1813 | if (unlikely(error)) | 1802 | if (unlikely(error)) |
1814 | goto out; | 1803 | goto out; |
1815 | if (status != NFS3_OK) | 1804 | if (status != NFS3_OK) |
@@ -1840,21 +1829,20 @@ out_status: | |||
1840 | * RENAME3resfail resfail; | 1829 | * RENAME3resfail resfail; |
1841 | * }; | 1830 | * }; |
1842 | */ | 1831 | */ |
1843 | static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req, __be32 *p, | 1832 | static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req, |
1833 | struct xdr_stream *xdr, | ||
1844 | struct nfs_renameres *result) | 1834 | struct nfs_renameres *result) |
1845 | { | 1835 | { |
1846 | struct xdr_stream xdr; | ||
1847 | enum nfs_stat status; | 1836 | enum nfs_stat status; |
1848 | int error; | 1837 | int error; |
1849 | 1838 | ||
1850 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1839 | error = decode_nfsstat3(xdr, &status); |
1851 | error = decode_nfsstat3(&xdr, &status); | ||
1852 | if (unlikely(error)) | 1840 | if (unlikely(error)) |
1853 | goto out; | 1841 | goto out; |
1854 | error = decode_wcc_data(&xdr, result->old_fattr); | 1842 | error = decode_wcc_data(xdr, result->old_fattr); |
1855 | if (unlikely(error)) | 1843 | if (unlikely(error)) |
1856 | goto out; | 1844 | goto out; |
1857 | error = decode_wcc_data(&xdr, result->new_fattr); | 1845 | error = decode_wcc_data(xdr, result->new_fattr); |
1858 | if (unlikely(error)) | 1846 | if (unlikely(error)) |
1859 | goto out; | 1847 | goto out; |
1860 | if (status != NFS3_OK) | 1848 | if (status != NFS3_OK) |
@@ -1885,21 +1873,19 @@ out_status: | |||
1885 | * LINK3resfail resfail; | 1873 | * LINK3resfail resfail; |
1886 | * }; | 1874 | * }; |
1887 | */ | 1875 | */ |
1888 | static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, __be32 *p, | 1876 | static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr, |
1889 | struct nfs3_linkres *result) | 1877 | struct nfs3_linkres *result) |
1890 | { | 1878 | { |
1891 | struct xdr_stream xdr; | ||
1892 | enum nfs_stat status; | 1879 | enum nfs_stat status; |
1893 | int error; | 1880 | int error; |
1894 | 1881 | ||
1895 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 1882 | error = decode_nfsstat3(xdr, &status); |
1896 | error = decode_nfsstat3(&xdr, &status); | ||
1897 | if (unlikely(error)) | 1883 | if (unlikely(error)) |
1898 | goto out; | 1884 | goto out; |
1899 | error = decode_post_op_attr(&xdr, result->fattr); | 1885 | error = decode_post_op_attr(xdr, result->fattr); |
1900 | if (unlikely(error)) | 1886 | if (unlikely(error)) |
1901 | goto out; | 1887 | goto out; |
1902 | error = decode_wcc_data(&xdr, result->dir_attr); | 1888 | error = decode_wcc_data(xdr, result->dir_attr); |
1903 | if (unlikely(error)) | 1889 | if (unlikely(error)) |
1904 | goto out; | 1890 | goto out; |
1905 | if (status != NFS3_OK) | 1891 | if (status != NFS3_OK) |
@@ -2085,24 +2071,23 @@ out: | |||
2085 | return error; | 2071 | return error; |
2086 | } | 2072 | } |
2087 | 2073 | ||
2088 | static int nfs3_xdr_dec_readdir3res(struct rpc_rqst *req, __be32 *p, | 2074 | static int nfs3_xdr_dec_readdir3res(struct rpc_rqst *req, |
2075 | struct xdr_stream *xdr, | ||
2089 | struct nfs3_readdirres *result) | 2076 | struct nfs3_readdirres *result) |
2090 | { | 2077 | { |
2091 | struct xdr_stream xdr; | ||
2092 | enum nfs_stat status; | 2078 | enum nfs_stat status; |
2093 | int error; | 2079 | int error; |
2094 | 2080 | ||
2095 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 2081 | error = decode_nfsstat3(xdr, &status); |
2096 | error = decode_nfsstat3(&xdr, &status); | ||
2097 | if (unlikely(error)) | 2082 | if (unlikely(error)) |
2098 | goto out; | 2083 | goto out; |
2099 | if (status != NFS3_OK) | 2084 | if (status != NFS3_OK) |
2100 | goto out_default; | 2085 | goto out_default; |
2101 | error = decode_readdir3resok(&xdr, result); | 2086 | error = decode_readdir3resok(xdr, result); |
2102 | out: | 2087 | out: |
2103 | return error; | 2088 | return error; |
2104 | out_default: | 2089 | out_default: |
2105 | error = decode_post_op_attr(&xdr, result->dir_attr); | 2090 | error = decode_post_op_attr(xdr, result->dir_attr); |
2106 | if (unlikely(error)) | 2091 | if (unlikely(error)) |
2107 | goto out; | 2092 | goto out; |
2108 | return nfs_stat_to_errno(status); | 2093 | return nfs_stat_to_errno(status); |
@@ -2154,23 +2139,22 @@ out_overflow: | |||
2154 | return -EIO; | 2139 | return -EIO; |
2155 | } | 2140 | } |
2156 | 2141 | ||
2157 | static int nfs3_xdr_dec_fsstat3res(struct rpc_rqst *req, __be32 *p, | 2142 | static int nfs3_xdr_dec_fsstat3res(struct rpc_rqst *req, |
2143 | struct xdr_stream *xdr, | ||
2158 | struct nfs_fsstat *result) | 2144 | struct nfs_fsstat *result) |
2159 | { | 2145 | { |
2160 | struct xdr_stream xdr; | ||
2161 | enum nfs_stat status; | 2146 | enum nfs_stat status; |
2162 | int error; | 2147 | int error; |
2163 | 2148 | ||
2164 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 2149 | error = decode_nfsstat3(xdr, &status); |
2165 | error = decode_nfsstat3(&xdr, &status); | ||
2166 | if (unlikely(error)) | 2150 | if (unlikely(error)) |
2167 | goto out; | 2151 | goto out; |
2168 | error = decode_post_op_attr(&xdr, result->fattr); | 2152 | error = decode_post_op_attr(xdr, result->fattr); |
2169 | if (unlikely(error)) | 2153 | if (unlikely(error)) |
2170 | goto out; | 2154 | goto out; |
2171 | if (status != NFS3_OK) | 2155 | if (status != NFS3_OK) |
2172 | goto out_status; | 2156 | goto out_status; |
2173 | error = decode_fsstat3resok(&xdr, result); | 2157 | error = decode_fsstat3resok(xdr, result); |
2174 | out: | 2158 | out: |
2175 | return error; | 2159 | return error; |
2176 | out_status: | 2160 | out_status: |
@@ -2231,23 +2215,22 @@ out_overflow: | |||
2231 | return -EIO; | 2215 | return -EIO; |
2232 | } | 2216 | } |
2233 | 2217 | ||
2234 | static int nfs3_xdr_dec_fsinfo3res(struct rpc_rqst *req, __be32 *p, | 2218 | static int nfs3_xdr_dec_fsinfo3res(struct rpc_rqst *req, |
2219 | struct xdr_stream *xdr, | ||
2235 | struct nfs_fsinfo *result) | 2220 | struct nfs_fsinfo *result) |
2236 | { | 2221 | { |
2237 | struct xdr_stream xdr; | ||
2238 | enum nfs_stat status; | 2222 | enum nfs_stat status; |
2239 | int error; | 2223 | int error; |
2240 | 2224 | ||
2241 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 2225 | error = decode_nfsstat3(xdr, &status); |
2242 | error = decode_nfsstat3(&xdr, &status); | ||
2243 | if (unlikely(error)) | 2226 | if (unlikely(error)) |
2244 | goto out; | 2227 | goto out; |
2245 | error = decode_post_op_attr(&xdr, result->fattr); | 2228 | error = decode_post_op_attr(xdr, result->fattr); |
2246 | if (unlikely(error)) | 2229 | if (unlikely(error)) |
2247 | goto out; | 2230 | goto out; |
2248 | if (status != NFS3_OK) | 2231 | if (status != NFS3_OK) |
2249 | goto out_status; | 2232 | goto out_status; |
2250 | error = decode_fsinfo3resok(&xdr, result); | 2233 | error = decode_fsinfo3resok(xdr, result); |
2251 | out: | 2234 | out: |
2252 | return error; | 2235 | return error; |
2253 | out_status: | 2236 | out_status: |
@@ -2295,23 +2278,22 @@ out_overflow: | |||
2295 | return -EIO; | 2278 | return -EIO; |
2296 | } | 2279 | } |
2297 | 2280 | ||
2298 | static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req, __be32 *p, | 2281 | static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req, |
2282 | struct xdr_stream *xdr, | ||
2299 | struct nfs_pathconf *result) | 2283 | struct nfs_pathconf *result) |
2300 | { | 2284 | { |
2301 | struct xdr_stream xdr; | ||
2302 | enum nfs_stat status; | 2285 | enum nfs_stat status; |
2303 | int error; | 2286 | int error; |
2304 | 2287 | ||
2305 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 2288 | error = decode_nfsstat3(xdr, &status); |
2306 | error = decode_nfsstat3(&xdr, &status); | ||
2307 | if (unlikely(error)) | 2289 | if (unlikely(error)) |
2308 | goto out; | 2290 | goto out; |
2309 | error = decode_post_op_attr(&xdr, result->fattr); | 2291 | error = decode_post_op_attr(xdr, result->fattr); |
2310 | if (unlikely(error)) | 2292 | if (unlikely(error)) |
2311 | goto out; | 2293 | goto out; |
2312 | if (status != NFS3_OK) | 2294 | if (status != NFS3_OK) |
2313 | goto out_status; | 2295 | goto out_status; |
2314 | error = decode_pathconf3resok(&xdr, result); | 2296 | error = decode_pathconf3resok(xdr, result); |
2315 | out: | 2297 | out: |
2316 | return error; | 2298 | return error; |
2317 | out_status: | 2299 | out_status: |
@@ -2337,23 +2319,22 @@ out_status: | |||
2337 | * COMMIT3resfail resfail; | 2319 | * COMMIT3resfail resfail; |
2338 | * }; | 2320 | * }; |
2339 | */ | 2321 | */ |
2340 | static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, __be32 *p, | 2322 | static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, |
2323 | struct xdr_stream *xdr, | ||
2341 | struct nfs_writeres *result) | 2324 | struct nfs_writeres *result) |
2342 | { | 2325 | { |
2343 | struct xdr_stream xdr; | ||
2344 | enum nfs_stat status; | 2326 | enum nfs_stat status; |
2345 | int error; | 2327 | int error; |
2346 | 2328 | ||
2347 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 2329 | error = decode_nfsstat3(xdr, &status); |
2348 | error = decode_nfsstat3(&xdr, &status); | ||
2349 | if (unlikely(error)) | 2330 | if (unlikely(error)) |
2350 | goto out; | 2331 | goto out; |
2351 | error = decode_wcc_data(&xdr, result->fattr); | 2332 | error = decode_wcc_data(xdr, result->fattr); |
2352 | if (unlikely(error)) | 2333 | if (unlikely(error)) |
2353 | goto out; | 2334 | goto out; |
2354 | if (status != NFS3_OK) | 2335 | if (status != NFS3_OK) |
2355 | goto out_status; | 2336 | goto out_status; |
2356 | error = decode_writeverf3(&xdr, result->verf->verifier); | 2337 | error = decode_writeverf3(xdr, result->verf->verifier); |
2357 | out: | 2338 | out: |
2358 | return error; | 2339 | return error; |
2359 | out_status: | 2340 | out_status: |
@@ -2406,40 +2387,38 @@ out: | |||
2406 | return error; | 2387 | return error; |
2407 | } | 2388 | } |
2408 | 2389 | ||
2409 | static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req, __be32 *p, | 2390 | static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req, |
2391 | struct xdr_stream *xdr, | ||
2410 | struct nfs3_getaclres *result) | 2392 | struct nfs3_getaclres *result) |
2411 | { | 2393 | { |
2412 | struct xdr_stream xdr; | ||
2413 | enum nfs_stat status; | 2394 | enum nfs_stat status; |
2414 | int error; | 2395 | int error; |
2415 | 2396 | ||
2416 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 2397 | error = decode_nfsstat3(xdr, &status); |
2417 | error = decode_nfsstat3(&xdr, &status); | ||
2418 | if (unlikely(error)) | 2398 | if (unlikely(error)) |
2419 | goto out; | 2399 | goto out; |
2420 | if (status != NFS3_OK) | 2400 | if (status != NFS3_OK) |
2421 | goto out_default; | 2401 | goto out_default; |
2422 | error = decode_getacl3resok(&xdr, result); | 2402 | error = decode_getacl3resok(xdr, result); |
2423 | out: | 2403 | out: |
2424 | return error; | 2404 | return error; |
2425 | out_default: | 2405 | out_default: |
2426 | return nfs_stat_to_errno(status); | 2406 | return nfs_stat_to_errno(status); |
2427 | } | 2407 | } |
2428 | 2408 | ||
2429 | static int nfs3_xdr_dec_setacl3res(struct rpc_rqst *req, __be32 *p, | 2409 | static int nfs3_xdr_dec_setacl3res(struct rpc_rqst *req, |
2410 | struct xdr_stream *xdr, | ||
2430 | struct nfs_fattr *result) | 2411 | struct nfs_fattr *result) |
2431 | { | 2412 | { |
2432 | struct xdr_stream xdr; | ||
2433 | enum nfs_stat status; | 2413 | enum nfs_stat status; |
2434 | int error; | 2414 | int error; |
2435 | 2415 | ||
2436 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 2416 | error = decode_nfsstat3(xdr, &status); |
2437 | error = decode_nfsstat3(&xdr, &status); | ||
2438 | if (unlikely(error)) | 2417 | if (unlikely(error)) |
2439 | goto out; | 2418 | goto out; |
2440 | if (status != NFS3_OK) | 2419 | if (status != NFS3_OK) |
2441 | goto out_default; | 2420 | goto out_default; |
2442 | error = decode_post_op_attr(&xdr, result); | 2421 | error = decode_post_op_attr(xdr, result); |
2443 | out: | 2422 | out: |
2444 | return error; | 2423 | return error; |
2445 | out_default: | 2424 | out_default: |
@@ -2452,7 +2431,7 @@ out_default: | |||
2452 | [NFS3PROC_##proc] = { \ | 2431 | [NFS3PROC_##proc] = { \ |
2453 | .p_proc = NFS3PROC_##proc, \ | 2432 | .p_proc = NFS3PROC_##proc, \ |
2454 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_##argtype##3args, \ | 2433 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_##argtype##3args, \ |
2455 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_##restype##3res, \ | 2434 | .p_decode = (kxdrdproc_t)nfs3_xdr_dec_##restype##3res, \ |
2456 | .p_arglen = NFS3_##argtype##args_sz, \ | 2435 | .p_arglen = NFS3_##argtype##args_sz, \ |
2457 | .p_replen = NFS3_##restype##res_sz, \ | 2436 | .p_replen = NFS3_##restype##res_sz, \ |
2458 | .p_timer = timer, \ | 2437 | .p_timer = timer, \ |
@@ -2495,7 +2474,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = { | |||
2495 | [ACLPROC3_GETACL] = { | 2474 | [ACLPROC3_GETACL] = { |
2496 | .p_proc = ACLPROC3_GETACL, | 2475 | .p_proc = ACLPROC3_GETACL, |
2497 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_getacl3args, | 2476 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_getacl3args, |
2498 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_getacl3res, | 2477 | .p_decode = (kxdrdproc_t)nfs3_xdr_dec_getacl3res, |
2499 | .p_arglen = ACL3_getaclargs_sz, | 2478 | .p_arglen = ACL3_getaclargs_sz, |
2500 | .p_replen = ACL3_getaclres_sz, | 2479 | .p_replen = ACL3_getaclres_sz, |
2501 | .p_timer = 1, | 2480 | .p_timer = 1, |
@@ -2504,7 +2483,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = { | |||
2504 | [ACLPROC3_SETACL] = { | 2483 | [ACLPROC3_SETACL] = { |
2505 | .p_proc = ACLPROC3_SETACL, | 2484 | .p_proc = ACLPROC3_SETACL, |
2506 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_setacl3args, | 2485 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_setacl3args, |
2507 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_setacl3res, | 2486 | .p_decode = (kxdrdproc_t)nfs3_xdr_dec_setacl3res, |
2508 | .p_arglen = ACL3_setaclargs_sz, | 2487 | .p_arglen = ACL3_setaclargs_sz, |
2509 | .p_replen = ACL3_setaclres_sz, | 2488 | .p_replen = ACL3_setaclres_sz, |
2510 | .p_timer = 0, | 2489 | .p_timer = 0, |