aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4xdr.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b820c311931c..fe46edeab2f6 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1503,8 +1503,6 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1503 * task to translate them into Linux-specific versions which are more 1503 * task to translate them into Linux-specific versions which are more
1504 * consistent with the style used in NFSv2/v3... 1504 * consistent with the style used in NFSv2/v3...
1505 */ 1505 */
1506#define ENCODE_HEAD __be32 *p
1507
1508#define WRITE32(n) *p++ = htonl(n) 1506#define WRITE32(n) *p++ = htonl(n)
1509#define WRITE64(n) do { \ 1507#define WRITE64(n) do { \
1510 *p++ = htonl((u32)((n) >> 32)); \ 1508 *p++ = htonl((u32)((n) >> 32)); \
@@ -2334,7 +2332,7 @@ fail:
2334static void 2332static void
2335nfsd4_encode_stateid(struct nfsd4_compoundres *resp, stateid_t *sid) 2333nfsd4_encode_stateid(struct nfsd4_compoundres *resp, stateid_t *sid)
2336{ 2334{
2337 ENCODE_HEAD; 2335 __be32 *p;
2338 2336
2339 RESERVE_SPACE(sizeof(stateid_t)); 2337 RESERVE_SPACE(sizeof(stateid_t));
2340 WRITE32(sid->si_generation); 2338 WRITE32(sid->si_generation);
@@ -2345,7 +2343,7 @@ nfsd4_encode_stateid(struct nfsd4_compoundres *resp, stateid_t *sid)
2345static __be32 2343static __be32
2346nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access) 2344nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access)
2347{ 2345{
2348 ENCODE_HEAD; 2346 __be32 *p;
2349 2347
2350 if (!nfserr) { 2348 if (!nfserr) {
2351 RESERVE_SPACE(8); 2349 RESERVE_SPACE(8);
@@ -2372,7 +2370,7 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_c
2372static __be32 2370static __be32
2373nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit) 2371nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit)
2374{ 2372{
2375 ENCODE_HEAD; 2373 __be32 *p;
2376 2374
2377 if (!nfserr) { 2375 if (!nfserr) {
2378 RESERVE_SPACE(8); 2376 RESERVE_SPACE(8);
@@ -2385,7 +2383,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
2385static __be32 2383static __be32
2386nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_create *create) 2384nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_create *create)
2387{ 2385{
2388 ENCODE_HEAD; 2386 __be32 *p;
2389 2387
2390 if (!nfserr) { 2388 if (!nfserr) {
2391 RESERVE_SPACE(32); 2389 RESERVE_SPACE(32);
@@ -2421,7 +2419,7 @@ nfsd4_encode_getfh(struct nfsd4_compoundres *resp, __be32 nfserr, struct svc_fh
2421{ 2419{
2422 struct svc_fh *fhp = *fhpp; 2420 struct svc_fh *fhp = *fhpp;
2423 unsigned int len; 2421 unsigned int len;
2424 ENCODE_HEAD; 2422 __be32 *p;
2425 2423
2426 if (!nfserr) { 2424 if (!nfserr) {
2427 len = fhp->fh_handle.fh_size; 2425 len = fhp->fh_handle.fh_size;
@@ -2440,7 +2438,7 @@ nfsd4_encode_getfh(struct nfsd4_compoundres *resp, __be32 nfserr, struct svc_fh
2440static void 2438static void
2441nfsd4_encode_lock_denied(struct nfsd4_compoundres *resp, struct nfsd4_lock_denied *ld) 2439nfsd4_encode_lock_denied(struct nfsd4_compoundres *resp, struct nfsd4_lock_denied *ld)
2442{ 2440{
2443 ENCODE_HEAD; 2441 __be32 *p;
2444 2442
2445 RESERVE_SPACE(32 + XDR_LEN(ld->ld_sop ? ld->ld_sop->so_owner.len : 0)); 2443 RESERVE_SPACE(32 + XDR_LEN(ld->ld_sop ? ld->ld_sop->so_owner.len : 0));
2446 WRITE64(ld->ld_start); 2444 WRITE64(ld->ld_start);
@@ -2496,7 +2494,7 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_l
2496static __be32 2494static __be32
2497nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_link *link) 2495nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_link *link)
2498{ 2496{
2499 ENCODE_HEAD; 2497 __be32 *p;
2500 2498
2501 if (!nfserr) { 2499 if (!nfserr) {
2502 RESERVE_SPACE(20); 2500 RESERVE_SPACE(20);
@@ -2510,7 +2508,7 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_li
2510static __be32 2508static __be32
2511nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open) 2509nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open)
2512{ 2510{
2513 ENCODE_HEAD; 2511 __be32 *p;
2514 ENCODE_SEQID_OP_HEAD; 2512 ENCODE_SEQID_OP_HEAD;
2515 2513
2516 if (nfserr) 2514 if (nfserr)
@@ -2605,7 +2603,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
2605 int v, pn; 2603 int v, pn;
2606 unsigned long maxcount; 2604 unsigned long maxcount;
2607 long len; 2605 long len;
2608 ENCODE_HEAD; 2606 __be32 *p;
2609 2607
2610 if (nfserr) 2608 if (nfserr)
2611 return nfserr; 2609 return nfserr;
@@ -2667,7 +2665,7 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd
2667{ 2665{
2668 int maxcount; 2666 int maxcount;
2669 char *page; 2667 char *page;
2670 ENCODE_HEAD; 2668 __be32 *p;
2671 2669
2672 if (nfserr) 2670 if (nfserr)
2673 return nfserr; 2671 return nfserr;
@@ -2716,7 +2714,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
2716 int maxcount; 2714 int maxcount;
2717 loff_t offset; 2715 loff_t offset;
2718 __be32 *page, *savep, *tailbase; 2716 __be32 *page, *savep, *tailbase;
2719 ENCODE_HEAD; 2717 __be32 *p;
2720 2718
2721 if (nfserr) 2719 if (nfserr)
2722 return nfserr; 2720 return nfserr;
@@ -2792,7 +2790,7 @@ err_no_verf:
2792static __be32 2790static __be32
2793nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_remove *remove) 2791nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_remove *remove)
2794{ 2792{
2795 ENCODE_HEAD; 2793 __be32 *p;
2796 2794
2797 if (!nfserr) { 2795 if (!nfserr) {
2798 RESERVE_SPACE(20); 2796 RESERVE_SPACE(20);
@@ -2805,7 +2803,7 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
2805static __be32 2803static __be32
2806nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_rename *rename) 2804nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_rename *rename)
2807{ 2805{
2808 ENCODE_HEAD; 2806 __be32 *p;
2809 2807
2810 if (!nfserr) { 2808 if (!nfserr) {
2811 RESERVE_SPACE(40); 2809 RESERVE_SPACE(40);
@@ -2825,7 +2823,7 @@ nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, __be32 nfserr,
2825 u32 nflavs; 2823 u32 nflavs;
2826 struct exp_flavor_info *flavs; 2824 struct exp_flavor_info *flavs;
2827 struct exp_flavor_info def_flavs[2]; 2825 struct exp_flavor_info def_flavs[2];
2828 ENCODE_HEAD; 2826 __be32 *p;
2829 2827
2830 if (nfserr) 2828 if (nfserr)
2831 goto out; 2829 goto out;
@@ -2890,7 +2888,7 @@ out:
2890static __be32 2888static __be32
2891nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setattr *setattr) 2889nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setattr *setattr)
2892{ 2890{
2893 ENCODE_HEAD; 2891 __be32 *p;
2894 2892
2895 RESERVE_SPACE(12); 2893 RESERVE_SPACE(12);
2896 if (nfserr) { 2894 if (nfserr) {
@@ -2910,7 +2908,7 @@ nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
2910static __be32 2908static __be32
2911nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setclientid *scd) 2909nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setclientid *scd)
2912{ 2910{
2913 ENCODE_HEAD; 2911 __be32 *p;
2914 2912
2915 if (!nfserr) { 2913 if (!nfserr) {
2916 RESERVE_SPACE(8 + sizeof(nfs4_verifier)); 2914 RESERVE_SPACE(8 + sizeof(nfs4_verifier));
@@ -2930,7 +2928,7 @@ nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct n
2930static __be32 2928static __be32
2931nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_write *write) 2929nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_write *write)
2932{ 2930{
2933 ENCODE_HEAD; 2931 __be32 *p;
2934 2932
2935 if (!nfserr) { 2933 if (!nfserr) {
2936 RESERVE_SPACE(16); 2934 RESERVE_SPACE(16);
@@ -2946,7 +2944,7 @@ static __be32
2946nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, int nfserr, 2944nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, int nfserr,
2947 struct nfsd4_exchange_id *exid) 2945 struct nfsd4_exchange_id *exid)
2948{ 2946{
2949 ENCODE_HEAD; 2947 __be32 *p;
2950 char *major_id; 2948 char *major_id;
2951 char *server_scope; 2949 char *server_scope;
2952 int major_id_sz; 2950 int major_id_sz;
@@ -3001,7 +2999,7 @@ static __be32
3001nfsd4_encode_create_session(struct nfsd4_compoundres *resp, int nfserr, 2999nfsd4_encode_create_session(struct nfsd4_compoundres *resp, int nfserr,
3002 struct nfsd4_create_session *sess) 3000 struct nfsd4_create_session *sess)
3003{ 3001{
3004 ENCODE_HEAD; 3002 __be32 *p;
3005 3003
3006 if (nfserr) 3004 if (nfserr)
3007 return nfserr; 3005 return nfserr;
@@ -3057,7 +3055,7 @@ __be32
3057nfsd4_encode_sequence(struct nfsd4_compoundres *resp, int nfserr, 3055nfsd4_encode_sequence(struct nfsd4_compoundres *resp, int nfserr,
3058 struct nfsd4_sequence *seq) 3056 struct nfsd4_sequence *seq)
3059{ 3057{
3060 ENCODE_HEAD; 3058 __be32 *p;
3061 3059
3062 if (nfserr) 3060 if (nfserr)
3063 return nfserr; 3061 return nfserr;
@@ -3205,7 +3203,7 @@ void
3205nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) 3203nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
3206{ 3204{
3207 __be32 *statp; 3205 __be32 *statp;
3208 ENCODE_HEAD; 3206 __be32 *p;
3209 3207
3210 RESERVE_SPACE(8); 3208 RESERVE_SPACE(8);
3211 WRITE32(op->opnum); 3209 WRITE32(op->opnum);
@@ -3239,7 +3237,7 @@ status:
3239void 3237void
3240nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op) 3238nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
3241{ 3239{
3242 ENCODE_HEAD; 3240 __be32 *p;
3243 struct nfs4_replay *rp = op->replay; 3241 struct nfs4_replay *rp = op->replay;
3244 3242
3245 BUG_ON(!rp); 3243 BUG_ON(!rp);