diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-03-22 17:11:35 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-30 17:32:14 -0400 |
commit | b64c7f3bdfbb468d9026ca91d55c57675724f516 (patch) | |
tree | 0af584eb30c9196600d211157e99d2f56b8db26c | |
parent | c373b0a4289ebf1ca6fbf4614d8b457b5f1b489f (diff) |
nfsd4: kill WRITE64
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 1dca513a1e46..094a7c585f1e 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1683,10 +1683,6 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1683 | DECODE_TAIL; | 1683 | DECODE_TAIL; |
1684 | } | 1684 | } |
1685 | 1685 | ||
1686 | #define WRITE64(n) do { \ | ||
1687 | *p++ = htonl((u32)((n) >> 32)); \ | ||
1688 | *p++ = htonl((u32)(n)); \ | ||
1689 | } while (0) | ||
1690 | #define WRITEMEM(ptr,nbytes) do { if (nbytes > 0) { \ | 1686 | #define WRITEMEM(ptr,nbytes) do { if (nbytes > 0) { \ |
1691 | *(p + XDR_QUADLEN(nbytes) -1) = 0; \ | 1687 | *(p + XDR_QUADLEN(nbytes) -1) = 0; \ |
1692 | memcpy(p, ptr, nbytes); \ | 1688 | memcpy(p, ptr, nbytes); \ |
@@ -2204,7 +2200,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
2204 | p = xdr_reserve_space(xdr, 8); | 2200 | p = xdr_reserve_space(xdr, 8); |
2205 | if (!p) | 2201 | if (!p) |
2206 | goto out_resource; | 2202 | goto out_resource; |
2207 | WRITE64(stat.size); | 2203 | p = xdr_encode_hyper(p, stat.size); |
2208 | } | 2204 | } |
2209 | if (bmval0 & FATTR4_WORD0_LINK_SUPPORT) { | 2205 | if (bmval0 & FATTR4_WORD0_LINK_SUPPORT) { |
2210 | p = xdr_reserve_space(xdr, 4); | 2206 | p = xdr_reserve_space(xdr, 4); |
@@ -2229,12 +2225,12 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
2229 | if (!p) | 2225 | if (!p) |
2230 | goto out_resource; | 2226 | goto out_resource; |
2231 | if (exp->ex_fslocs.migrated) { | 2227 | if (exp->ex_fslocs.migrated) { |
2232 | WRITE64(NFS4_REFERRAL_FSID_MAJOR); | 2228 | p = xdr_encode_hyper(p, NFS4_REFERRAL_FSID_MAJOR); |
2233 | WRITE64(NFS4_REFERRAL_FSID_MINOR); | 2229 | p = xdr_encode_hyper(p, NFS4_REFERRAL_FSID_MINOR); |
2234 | } else switch(fsid_source(fhp)) { | 2230 | } else switch(fsid_source(fhp)) { |
2235 | case FSIDSOURCE_FSID: | 2231 | case FSIDSOURCE_FSID: |
2236 | WRITE64((u64)exp->ex_fsid); | 2232 | p = xdr_encode_hyper(p, (u64)exp->ex_fsid); |
2237 | WRITE64((u64)0); | 2233 | p = xdr_encode_hyper(p, (u64)0); |
2238 | break; | 2234 | break; |
2239 | case FSIDSOURCE_DEV: | 2235 | case FSIDSOURCE_DEV: |
2240 | *p++ = cpu_to_be32(0); | 2236 | *p++ = cpu_to_be32(0); |
@@ -2337,25 +2333,25 @@ out_acl: | |||
2337 | p = xdr_reserve_space(xdr, 8); | 2333 | p = xdr_reserve_space(xdr, 8); |
2338 | if (!p) | 2334 | if (!p) |
2339 | goto out_resource; | 2335 | goto out_resource; |
2340 | WRITE64(stat.ino); | 2336 | p = xdr_encode_hyper(p, stat.ino); |
2341 | } | 2337 | } |
2342 | if (bmval0 & FATTR4_WORD0_FILES_AVAIL) { | 2338 | if (bmval0 & FATTR4_WORD0_FILES_AVAIL) { |
2343 | p = xdr_reserve_space(xdr, 8); | 2339 | p = xdr_reserve_space(xdr, 8); |
2344 | if (!p) | 2340 | if (!p) |
2345 | goto out_resource; | 2341 | goto out_resource; |
2346 | WRITE64((u64) statfs.f_ffree); | 2342 | p = xdr_encode_hyper(p, (u64) statfs.f_ffree); |
2347 | } | 2343 | } |
2348 | if (bmval0 & FATTR4_WORD0_FILES_FREE) { | 2344 | if (bmval0 & FATTR4_WORD0_FILES_FREE) { |
2349 | p = xdr_reserve_space(xdr, 8); | 2345 | p = xdr_reserve_space(xdr, 8); |
2350 | if (!p) | 2346 | if (!p) |
2351 | goto out_resource; | 2347 | goto out_resource; |
2352 | WRITE64((u64) statfs.f_ffree); | 2348 | p = xdr_encode_hyper(p, (u64) statfs.f_ffree); |
2353 | } | 2349 | } |
2354 | if (bmval0 & FATTR4_WORD0_FILES_TOTAL) { | 2350 | if (bmval0 & FATTR4_WORD0_FILES_TOTAL) { |
2355 | p = xdr_reserve_space(xdr, 8); | 2351 | p = xdr_reserve_space(xdr, 8); |
2356 | if (!p) | 2352 | if (!p) |
2357 | goto out_resource; | 2353 | goto out_resource; |
2358 | WRITE64((u64) statfs.f_files); | 2354 | p = xdr_encode_hyper(p, (u64) statfs.f_files); |
2359 | } | 2355 | } |
2360 | if (bmval0 & FATTR4_WORD0_FS_LOCATIONS) { | 2356 | if (bmval0 & FATTR4_WORD0_FS_LOCATIONS) { |
2361 | status = nfsd4_encode_fs_locations(xdr, rqstp, exp); | 2357 | status = nfsd4_encode_fs_locations(xdr, rqstp, exp); |
@@ -2372,7 +2368,7 @@ out_acl: | |||
2372 | p = xdr_reserve_space(xdr, 8); | 2368 | p = xdr_reserve_space(xdr, 8); |
2373 | if (!p) | 2369 | if (!p) |
2374 | goto out_resource; | 2370 | goto out_resource; |
2375 | WRITE64(exp->ex_path.mnt->mnt_sb->s_maxbytes); | 2371 | p = xdr_encode_hyper(p, exp->ex_path.mnt->mnt_sb->s_maxbytes); |
2376 | } | 2372 | } |
2377 | if (bmval0 & FATTR4_WORD0_MAXLINK) { | 2373 | if (bmval0 & FATTR4_WORD0_MAXLINK) { |
2378 | p = xdr_reserve_space(xdr, 4); | 2374 | p = xdr_reserve_space(xdr, 4); |
@@ -2390,13 +2386,13 @@ out_acl: | |||
2390 | p = xdr_reserve_space(xdr, 8); | 2386 | p = xdr_reserve_space(xdr, 8); |
2391 | if (!p) | 2387 | if (!p) |
2392 | goto out_resource; | 2388 | goto out_resource; |
2393 | WRITE64((u64) svc_max_payload(rqstp)); | 2389 | p = xdr_encode_hyper(p, (u64) svc_max_payload(rqstp)); |
2394 | } | 2390 | } |
2395 | if (bmval0 & FATTR4_WORD0_MAXWRITE) { | 2391 | if (bmval0 & FATTR4_WORD0_MAXWRITE) { |
2396 | p = xdr_reserve_space(xdr, 8); | 2392 | p = xdr_reserve_space(xdr, 8); |
2397 | if (!p) | 2393 | if (!p) |
2398 | goto out_resource; | 2394 | goto out_resource; |
2399 | WRITE64((u64) svc_max_payload(rqstp)); | 2395 | p = xdr_encode_hyper(p, (u64) svc_max_payload(rqstp)); |
2400 | } | 2396 | } |
2401 | if (bmval1 & FATTR4_WORD1_MODE) { | 2397 | if (bmval1 & FATTR4_WORD1_MODE) { |
2402 | p = xdr_reserve_space(xdr, 4); | 2398 | p = xdr_reserve_space(xdr, 4); |
@@ -2438,34 +2434,34 @@ out_acl: | |||
2438 | if (!p) | 2434 | if (!p) |
2439 | goto out_resource; | 2435 | goto out_resource; |
2440 | dummy64 = (u64)statfs.f_bavail * (u64)statfs.f_bsize; | 2436 | dummy64 = (u64)statfs.f_bavail * (u64)statfs.f_bsize; |
2441 | WRITE64(dummy64); | 2437 | p = xdr_encode_hyper(p, dummy64); |
2442 | } | 2438 | } |
2443 | if (bmval1 & FATTR4_WORD1_SPACE_FREE) { | 2439 | if (bmval1 & FATTR4_WORD1_SPACE_FREE) { |
2444 | p = xdr_reserve_space(xdr, 8); | 2440 | p = xdr_reserve_space(xdr, 8); |
2445 | if (!p) | 2441 | if (!p) |
2446 | goto out_resource; | 2442 | goto out_resource; |
2447 | dummy64 = (u64)statfs.f_bfree * (u64)statfs.f_bsize; | 2443 | dummy64 = (u64)statfs.f_bfree * (u64)statfs.f_bsize; |
2448 | WRITE64(dummy64); | 2444 | p = xdr_encode_hyper(p, dummy64); |
2449 | } | 2445 | } |
2450 | if (bmval1 & FATTR4_WORD1_SPACE_TOTAL) { | 2446 | if (bmval1 & FATTR4_WORD1_SPACE_TOTAL) { |
2451 | p = xdr_reserve_space(xdr, 8); | 2447 | p = xdr_reserve_space(xdr, 8); |
2452 | if (!p) | 2448 | if (!p) |
2453 | goto out_resource; | 2449 | goto out_resource; |
2454 | dummy64 = (u64)statfs.f_blocks * (u64)statfs.f_bsize; | 2450 | dummy64 = (u64)statfs.f_blocks * (u64)statfs.f_bsize; |
2455 | WRITE64(dummy64); | 2451 | p = xdr_encode_hyper(p, dummy64); |
2456 | } | 2452 | } |
2457 | if (bmval1 & FATTR4_WORD1_SPACE_USED) { | 2453 | if (bmval1 & FATTR4_WORD1_SPACE_USED) { |
2458 | p = xdr_reserve_space(xdr, 8); | 2454 | p = xdr_reserve_space(xdr, 8); |
2459 | if (!p) | 2455 | if (!p) |
2460 | goto out_resource; | 2456 | goto out_resource; |
2461 | dummy64 = (u64)stat.blocks << 9; | 2457 | dummy64 = (u64)stat.blocks << 9; |
2462 | WRITE64(dummy64); | 2458 | p = xdr_encode_hyper(p, dummy64); |
2463 | } | 2459 | } |
2464 | if (bmval1 & FATTR4_WORD1_TIME_ACCESS) { | 2460 | if (bmval1 & FATTR4_WORD1_TIME_ACCESS) { |
2465 | p = xdr_reserve_space(xdr, 12); | 2461 | p = xdr_reserve_space(xdr, 12); |
2466 | if (!p) | 2462 | if (!p) |
2467 | goto out_resource; | 2463 | goto out_resource; |
2468 | WRITE64((s64)stat.atime.tv_sec); | 2464 | p = xdr_encode_hyper(p, (s64)stat.atime.tv_sec); |
2469 | *p++ = cpu_to_be32(stat.atime.tv_nsec); | 2465 | *p++ = cpu_to_be32(stat.atime.tv_nsec); |
2470 | } | 2466 | } |
2471 | if (bmval1 & FATTR4_WORD1_TIME_DELTA) { | 2467 | if (bmval1 & FATTR4_WORD1_TIME_DELTA) { |
@@ -2480,14 +2476,14 @@ out_acl: | |||
2480 | p = xdr_reserve_space(xdr, 12); | 2476 | p = xdr_reserve_space(xdr, 12); |
2481 | if (!p) | 2477 | if (!p) |
2482 | goto out_resource; | 2478 | goto out_resource; |
2483 | WRITE64((s64)stat.ctime.tv_sec); | 2479 | p = xdr_encode_hyper(p, (s64)stat.ctime.tv_sec); |
2484 | *p++ = cpu_to_be32(stat.ctime.tv_nsec); | 2480 | *p++ = cpu_to_be32(stat.ctime.tv_nsec); |
2485 | } | 2481 | } |
2486 | if (bmval1 & FATTR4_WORD1_TIME_MODIFY) { | 2482 | if (bmval1 & FATTR4_WORD1_TIME_MODIFY) { |
2487 | p = xdr_reserve_space(xdr, 12); | 2483 | p = xdr_reserve_space(xdr, 12); |
2488 | if (!p) | 2484 | if (!p) |
2489 | goto out_resource; | 2485 | goto out_resource; |
2490 | WRITE64((s64)stat.mtime.tv_sec); | 2486 | p = xdr_encode_hyper(p, (s64)stat.mtime.tv_sec); |
2491 | *p++ = cpu_to_be32(stat.mtime.tv_nsec); | 2487 | *p++ = cpu_to_be32(stat.mtime.tv_nsec); |
2492 | } | 2488 | } |
2493 | if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) { | 2489 | if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) { |
@@ -2501,7 +2497,7 @@ out_acl: | |||
2501 | if (ignore_crossmnt == 0 && | 2497 | if (ignore_crossmnt == 0 && |
2502 | dentry == exp->ex_path.mnt->mnt_root) | 2498 | dentry == exp->ex_path.mnt->mnt_root) |
2503 | get_parent_attributes(exp, &stat); | 2499 | get_parent_attributes(exp, &stat); |
2504 | WRITE64(stat.ino); | 2500 | p = xdr_encode_hyper(p, stat.ino); |
2505 | } | 2501 | } |
2506 | if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { | 2502 | if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { |
2507 | status = nfsd4_encode_security_label(xdr, rqstp, context, | 2503 | status = nfsd4_encode_security_label(xdr, rqstp, context, |
@@ -2892,15 +2888,15 @@ again: | |||
2892 | } | 2888 | } |
2893 | return nfserr_resource; | 2889 | return nfserr_resource; |
2894 | } | 2890 | } |
2895 | WRITE64(ld->ld_start); | 2891 | p = xdr_encode_hyper(p, ld->ld_start); |
2896 | WRITE64(ld->ld_length); | 2892 | p = xdr_encode_hyper(p, ld->ld_length); |
2897 | *p++ = cpu_to_be32(ld->ld_type); | 2893 | *p++ = cpu_to_be32(ld->ld_type); |
2898 | if (conf->len) { | 2894 | if (conf->len) { |
2899 | WRITEMEM(&ld->ld_clientid, 8); | 2895 | WRITEMEM(&ld->ld_clientid, 8); |
2900 | *p++ = cpu_to_be32(conf->len); | 2896 | *p++ = cpu_to_be32(conf->len); |
2901 | WRITEMEM(conf->data, conf->len); | 2897 | WRITEMEM(conf->data, conf->len); |
2902 | } else { /* non - nfsv4 lock in conflict, no clientid nor owner */ | 2898 | } else { /* non - nfsv4 lock in conflict, no clientid nor owner */ |
2903 | WRITE64((u64)0); /* clientid */ | 2899 | p = xdr_encode_hyper(p, (u64)0); /* clientid */ |
2904 | *p++ = cpu_to_be32(0); /* length of owner name */ | 2900 | *p++ = cpu_to_be32(0); /* length of owner name */ |
2905 | } | 2901 | } |
2906 | return nfserr_denied; | 2902 | return nfserr_denied; |
@@ -3650,7 +3646,7 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
3650 | return nfserr_resource; | 3646 | return nfserr_resource; |
3651 | 3647 | ||
3652 | /* The server_owner struct */ | 3648 | /* The server_owner struct */ |
3653 | WRITE64(minor_id); /* Minor id */ | 3649 | p = xdr_encode_hyper(p, minor_id); /* Minor id */ |
3654 | /* major id */ | 3650 | /* major id */ |
3655 | *p++ = cpu_to_be32(major_id_sz); | 3651 | *p++ = cpu_to_be32(major_id_sz); |
3656 | WRITEMEM(major_id, major_id_sz); | 3652 | WRITEMEM(major_id, major_id_sz); |