nfs42xdr.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /*
  2. * Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp.com>
  3. */
  4. #ifndef __LINUX_FS_NFS_NFS4_2XDR_H
  5. #define __LINUX_FS_NFS_NFS4_2XDR_H
  6. #include "nfs42.h"
  7. #define encode_fallocate_maxsz (encode_stateid_maxsz + \
  8. 2 /* offset */ + \
  9. 2 /* length */)
  10. #define NFS42_WRITE_RES_SIZE (1 /* wr_callback_id size */ +\
  11. XDR_QUADLEN(NFS4_STATEID_SIZE) + \
  12. 2 /* wr_count */ + \
  13. 1 /* wr_committed */ + \
  14. XDR_QUADLEN(NFS4_VERIFIER_SIZE))
  15. #define encode_allocate_maxsz (op_encode_hdr_maxsz + \
  16. encode_fallocate_maxsz)
  17. #define decode_allocate_maxsz (op_decode_hdr_maxsz)
  18. #define encode_copy_maxsz (op_encode_hdr_maxsz + \
  19. XDR_QUADLEN(NFS4_STATEID_SIZE) + \
  20. XDR_QUADLEN(NFS4_STATEID_SIZE) + \
  21. 2 + 2 + 2 + 1 + 1 + 1)
  22. #define decode_copy_maxsz (op_decode_hdr_maxsz + \
  23. NFS42_WRITE_RES_SIZE + \
  24. 1 /* cr_consecutive */ + \
  25. 1 /* cr_synchronous */)
  26. #define encode_deallocate_maxsz (op_encode_hdr_maxsz + \
  27. encode_fallocate_maxsz)
  28. #define decode_deallocate_maxsz (op_decode_hdr_maxsz)
  29. #define encode_seek_maxsz (op_encode_hdr_maxsz + \
  30. encode_stateid_maxsz + \
  31. 2 /* offset */ + \
  32. 1 /* whence */)
  33. #define decode_seek_maxsz (op_decode_hdr_maxsz + \
  34. 1 /* eof */ + \
  35. 1 /* whence */ + \
  36. 2 /* offset */ + \
  37. 2 /* length */)
  38. #define encode_io_info_maxsz 4
  39. #define encode_layoutstats_maxsz (op_decode_hdr_maxsz + \
  40. 2 /* offset */ + \
  41. 2 /* length */ + \
  42. encode_stateid_maxsz + \
  43. encode_io_info_maxsz + \
  44. encode_io_info_maxsz + \
  45. 1 /* opaque devaddr4 length */ + \
  46. XDR_QUADLEN(PNFS_LAYOUTSTATS_MAXSIZE))
  47. #define decode_layoutstats_maxsz (op_decode_hdr_maxsz)
  48. #define encode_clone_maxsz (encode_stateid_maxsz + \
  49. encode_stateid_maxsz + \
  50. 2 /* src offset */ + \
  51. 2 /* dst offset */ + \
  52. 2 /* count */)
  53. #define decode_clone_maxsz (op_decode_hdr_maxsz)
  54. #define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \
  55. encode_putfh_maxsz + \
  56. encode_allocate_maxsz + \
  57. encode_getattr_maxsz)
  58. #define NFS4_dec_allocate_sz (compound_decode_hdr_maxsz + \
  59. decode_putfh_maxsz + \
  60. decode_allocate_maxsz + \
  61. decode_getattr_maxsz)
  62. #define NFS4_enc_copy_sz (compound_encode_hdr_maxsz + \
  63. encode_putfh_maxsz + \
  64. encode_savefh_maxsz + \
  65. encode_putfh_maxsz + \
  66. encode_copy_maxsz + \
  67. encode_commit_maxsz)
  68. #define NFS4_dec_copy_sz (compound_decode_hdr_maxsz + \
  69. decode_putfh_maxsz + \
  70. decode_savefh_maxsz + \
  71. decode_putfh_maxsz + \
  72. decode_copy_maxsz + \
  73. decode_commit_maxsz)
  74. #define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \
  75. encode_putfh_maxsz + \
  76. encode_deallocate_maxsz + \
  77. encode_getattr_maxsz)
  78. #define NFS4_dec_deallocate_sz (compound_decode_hdr_maxsz + \
  79. decode_putfh_maxsz + \
  80. decode_deallocate_maxsz + \
  81. decode_getattr_maxsz)
  82. #define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \
  83. encode_putfh_maxsz + \
  84. encode_seek_maxsz)
  85. #define NFS4_dec_seek_sz (compound_decode_hdr_maxsz + \
  86. decode_putfh_maxsz + \
  87. decode_seek_maxsz)
  88. #define NFS4_enc_layoutstats_sz (compound_encode_hdr_maxsz + \
  89. encode_sequence_maxsz + \
  90. encode_putfh_maxsz + \
  91. PNFS_LAYOUTSTATS_MAXDEV * encode_layoutstats_maxsz)
  92. #define NFS4_dec_layoutstats_sz (compound_decode_hdr_maxsz + \
  93. decode_sequence_maxsz + \
  94. decode_putfh_maxsz + \
  95. PNFS_LAYOUTSTATS_MAXDEV * decode_layoutstats_maxsz)
  96. #define NFS4_enc_clone_sz (compound_encode_hdr_maxsz + \
  97. encode_sequence_maxsz + \
  98. encode_putfh_maxsz + \
  99. encode_savefh_maxsz + \
  100. encode_putfh_maxsz + \
  101. encode_clone_maxsz + \
  102. encode_getattr_maxsz)
  103. #define NFS4_dec_clone_sz (compound_decode_hdr_maxsz + \
  104. decode_sequence_maxsz + \
  105. decode_putfh_maxsz + \
  106. decode_savefh_maxsz + \
  107. decode_putfh_maxsz + \
  108. decode_clone_maxsz + \
  109. decode_getattr_maxsz)
  110. static void encode_fallocate(struct xdr_stream *xdr,
  111. const struct nfs42_falloc_args *args)
  112. {
  113. encode_nfs4_stateid(xdr, &args->falloc_stateid);
  114. encode_uint64(xdr, args->falloc_offset);
  115. encode_uint64(xdr, args->falloc_length);
  116. }
  117. static void encode_allocate(struct xdr_stream *xdr,
  118. const struct nfs42_falloc_args *args,
  119. struct compound_hdr *hdr)
  120. {
  121. encode_op_hdr(xdr, OP_ALLOCATE, decode_allocate_maxsz, hdr);
  122. encode_fallocate(xdr, args);
  123. }
  124. static void encode_copy(struct xdr_stream *xdr,
  125. const struct nfs42_copy_args *args,
  126. struct compound_hdr *hdr)
  127. {
  128. encode_op_hdr(xdr, OP_COPY, decode_copy_maxsz, hdr);
  129. encode_nfs4_stateid(xdr, &args->src_stateid);
  130. encode_nfs4_stateid(xdr, &args->dst_stateid);
  131. encode_uint64(xdr, args->src_pos);
  132. encode_uint64(xdr, args->dst_pos);
  133. encode_uint64(xdr, args->count);
  134. encode_uint32(xdr, 1); /* consecutive = true */
  135. encode_uint32(xdr, 1); /* synchronous = true */
  136. encode_uint32(xdr, 0); /* src server list */
  137. }
  138. static void encode_deallocate(struct xdr_stream *xdr,
  139. const struct nfs42_falloc_args *args,
  140. struct compound_hdr *hdr)
  141. {
  142. encode_op_hdr(xdr, OP_DEALLOCATE, decode_deallocate_maxsz, hdr);
  143. encode_fallocate(xdr, args);
  144. }
  145. static void encode_seek(struct xdr_stream *xdr,
  146. const struct nfs42_seek_args *args,
  147. struct compound_hdr *hdr)
  148. {
  149. encode_op_hdr(xdr, OP_SEEK, decode_seek_maxsz, hdr);
  150. encode_nfs4_stateid(xdr, &args->sa_stateid);
  151. encode_uint64(xdr, args->sa_offset);
  152. encode_uint32(xdr, args->sa_what);
  153. }
  154. static void encode_layoutstats(struct xdr_stream *xdr,
  155. const struct nfs42_layoutstat_args *args,
  156. struct nfs42_layoutstat_devinfo *devinfo,
  157. struct compound_hdr *hdr)
  158. {
  159. __be32 *p;
  160. encode_op_hdr(xdr, OP_LAYOUTSTATS, decode_layoutstats_maxsz, hdr);
  161. p = reserve_space(xdr, 8 + 8);
  162. p = xdr_encode_hyper(p, devinfo->offset);
  163. p = xdr_encode_hyper(p, devinfo->length);
  164. encode_nfs4_stateid(xdr, &args->stateid);
  165. p = reserve_space(xdr, 4*8 + NFS4_DEVICEID4_SIZE + 4);
  166. p = xdr_encode_hyper(p, devinfo->read_count);
  167. p = xdr_encode_hyper(p, devinfo->read_bytes);
  168. p = xdr_encode_hyper(p, devinfo->write_count);
  169. p = xdr_encode_hyper(p, devinfo->write_bytes);
  170. p = xdr_encode_opaque_fixed(p, devinfo->dev_id.data,
  171. NFS4_DEVICEID4_SIZE);
  172. /* Encode layoutupdate4 */
  173. *p++ = cpu_to_be32(devinfo->layout_type);
  174. if (devinfo->ld_private.ops)
  175. devinfo->ld_private.ops->encode(xdr, args,
  176. &devinfo->ld_private);
  177. else
  178. encode_uint32(xdr, 0);
  179. }
  180. static void encode_clone(struct xdr_stream *xdr,
  181. const struct nfs42_clone_args *args,
  182. struct compound_hdr *hdr)
  183. {
  184. __be32 *p;
  185. encode_op_hdr(xdr, OP_CLONE, decode_clone_maxsz, hdr);
  186. encode_nfs4_stateid(xdr, &args->src_stateid);
  187. encode_nfs4_stateid(xdr, &args->dst_stateid);
  188. p = reserve_space(xdr, 3*8);
  189. p = xdr_encode_hyper(p, args->src_offset);
  190. p = xdr_encode_hyper(p, args->dst_offset);
  191. xdr_encode_hyper(p, args->count);
  192. }
  193. /*
  194. * Encode ALLOCATE request
  195. */
  196. static void nfs4_xdr_enc_allocate(struct rpc_rqst *req,
  197. struct xdr_stream *xdr,
  198. const void *data)
  199. {
  200. const struct nfs42_falloc_args *args = data;
  201. struct compound_hdr hdr = {
  202. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  203. };
  204. encode_compound_hdr(xdr, req, &hdr);
  205. encode_sequence(xdr, &args->seq_args, &hdr);
  206. encode_putfh(xdr, args->falloc_fh, &hdr);
  207. encode_allocate(xdr, args, &hdr);
  208. encode_getfattr(xdr, args->falloc_bitmask, &hdr);
  209. encode_nops(&hdr);
  210. }
  211. static void encode_copy_commit(struct xdr_stream *xdr,
  212. const struct nfs42_copy_args *args,
  213. struct compound_hdr *hdr)
  214. {
  215. __be32 *p;
  216. encode_op_hdr(xdr, OP_COMMIT, decode_commit_maxsz, hdr);
  217. p = reserve_space(xdr, 12);
  218. p = xdr_encode_hyper(p, args->dst_pos);
  219. *p = cpu_to_be32(args->count);
  220. }
  221. /*
  222. * Encode COPY request
  223. */
  224. static void nfs4_xdr_enc_copy(struct rpc_rqst *req,
  225. struct xdr_stream *xdr,
  226. const void *data)
  227. {
  228. const struct nfs42_copy_args *args = data;
  229. struct compound_hdr hdr = {
  230. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  231. };
  232. encode_compound_hdr(xdr, req, &hdr);
  233. encode_sequence(xdr, &args->seq_args, &hdr);
  234. encode_putfh(xdr, args->src_fh, &hdr);
  235. encode_savefh(xdr, &hdr);
  236. encode_putfh(xdr, args->dst_fh, &hdr);
  237. encode_copy(xdr, args, &hdr);
  238. encode_copy_commit(xdr, args, &hdr);
  239. encode_nops(&hdr);
  240. }
  241. /*
  242. * Encode DEALLOCATE request
  243. */
  244. static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req,
  245. struct xdr_stream *xdr,
  246. const void *data)
  247. {
  248. const struct nfs42_falloc_args *args = data;
  249. struct compound_hdr hdr = {
  250. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  251. };
  252. encode_compound_hdr(xdr, req, &hdr);
  253. encode_sequence(xdr, &args->seq_args, &hdr);
  254. encode_putfh(xdr, args->falloc_fh, &hdr);
  255. encode_deallocate(xdr, args, &hdr);
  256. encode_getfattr(xdr, args->falloc_bitmask, &hdr);
  257. encode_nops(&hdr);
  258. }
  259. /*
  260. * Encode SEEK request
  261. */
  262. static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
  263. struct xdr_stream *xdr,
  264. const void *data)
  265. {
  266. const struct nfs42_seek_args *args = data;
  267. struct compound_hdr hdr = {
  268. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  269. };
  270. encode_compound_hdr(xdr, req, &hdr);
  271. encode_sequence(xdr, &args->seq_args, &hdr);
  272. encode_putfh(xdr, args->sa_fh, &hdr);
  273. encode_seek(xdr, args, &hdr);
  274. encode_nops(&hdr);
  275. }
  276. /*
  277. * Encode LAYOUTSTATS request
  278. */
  279. static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req,
  280. struct xdr_stream *xdr,
  281. const void *data)
  282. {
  283. const struct nfs42_layoutstat_args *args = data;
  284. int i;
  285. struct compound_hdr hdr = {
  286. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  287. };
  288. encode_compound_hdr(xdr, req, &hdr);
  289. encode_sequence(xdr, &args->seq_args, &hdr);
  290. encode_putfh(xdr, args->fh, &hdr);
  291. WARN_ON(args->num_dev > PNFS_LAYOUTSTATS_MAXDEV);
  292. for (i = 0; i < args->num_dev; i++)
  293. encode_layoutstats(xdr, args, &args->devinfo[i], &hdr);
  294. encode_nops(&hdr);
  295. }
  296. /*
  297. * Encode CLONE request
  298. */
  299. static void nfs4_xdr_enc_clone(struct rpc_rqst *req,
  300. struct xdr_stream *xdr,
  301. const void *data)
  302. {
  303. const struct nfs42_clone_args *args = data;
  304. struct compound_hdr hdr = {
  305. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  306. };
  307. encode_compound_hdr(xdr, req, &hdr);
  308. encode_sequence(xdr, &args->seq_args, &hdr);
  309. encode_putfh(xdr, args->src_fh, &hdr);
  310. encode_savefh(xdr, &hdr);
  311. encode_putfh(xdr, args->dst_fh, &hdr);
  312. encode_clone(xdr, args, &hdr);
  313. encode_getfattr(xdr, args->dst_bitmask, &hdr);
  314. encode_nops(&hdr);
  315. }
  316. static int decode_allocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
  317. {
  318. return decode_op_hdr(xdr, OP_ALLOCATE);
  319. }
  320. static int decode_write_response(struct xdr_stream *xdr,
  321. struct nfs42_write_res *res)
  322. {
  323. __be32 *p;
  324. p = xdr_inline_decode(xdr, 4 + 8 + 4);
  325. if (unlikely(!p))
  326. goto out_overflow;
  327. /*
  328. * We never use asynchronous mode, so warn if a server returns
  329. * a stateid.
  330. */
  331. if (unlikely(*p != 0)) {
  332. pr_err_once("%s: server has set unrequested "
  333. "asynchronous mode\n", __func__);
  334. return -EREMOTEIO;
  335. }
  336. p++;
  337. p = xdr_decode_hyper(p, &res->count);
  338. res->verifier.committed = be32_to_cpup(p);
  339. return decode_verifier(xdr, &res->verifier.verifier);
  340. out_overflow:
  341. print_overflow_msg(__func__, xdr);
  342. return -EIO;
  343. }
  344. static int decode_copy_requirements(struct xdr_stream *xdr,
  345. struct nfs42_copy_res *res) {
  346. __be32 *p;
  347. p = xdr_inline_decode(xdr, 4 + 4);
  348. if (unlikely(!p))
  349. goto out_overflow;
  350. res->consecutive = be32_to_cpup(p++);
  351. res->synchronous = be32_to_cpup(p++);
  352. return 0;
  353. out_overflow:
  354. print_overflow_msg(__func__, xdr);
  355. return -EIO;
  356. }
  357. static int decode_copy(struct xdr_stream *xdr, struct nfs42_copy_res *res)
  358. {
  359. int status;
  360. status = decode_op_hdr(xdr, OP_COPY);
  361. if (status == NFS4ERR_OFFLOAD_NO_REQS) {
  362. status = decode_copy_requirements(xdr, res);
  363. if (status)
  364. return status;
  365. return NFS4ERR_OFFLOAD_NO_REQS;
  366. } else if (status)
  367. return status;
  368. status = decode_write_response(xdr, &res->write_res);
  369. if (status)
  370. return status;
  371. return decode_copy_requirements(xdr, res);
  372. }
  373. static int decode_deallocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
  374. {
  375. return decode_op_hdr(xdr, OP_DEALLOCATE);
  376. }
  377. static int decode_seek(struct xdr_stream *xdr, struct nfs42_seek_res *res)
  378. {
  379. int status;
  380. __be32 *p;
  381. status = decode_op_hdr(xdr, OP_SEEK);
  382. if (status)
  383. return status;
  384. p = xdr_inline_decode(xdr, 4 + 8);
  385. if (unlikely(!p))
  386. goto out_overflow;
  387. res->sr_eof = be32_to_cpup(p++);
  388. p = xdr_decode_hyper(p, &res->sr_offset);
  389. return 0;
  390. out_overflow:
  391. print_overflow_msg(__func__, xdr);
  392. return -EIO;
  393. }
  394. static int decode_layoutstats(struct xdr_stream *xdr)
  395. {
  396. return decode_op_hdr(xdr, OP_LAYOUTSTATS);
  397. }
  398. static int decode_clone(struct xdr_stream *xdr)
  399. {
  400. return decode_op_hdr(xdr, OP_CLONE);
  401. }
  402. /*
  403. * Decode ALLOCATE request
  404. */
  405. static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
  406. struct xdr_stream *xdr,
  407. void *data)
  408. {
  409. struct nfs42_falloc_res *res = data;
  410. struct compound_hdr hdr;
  411. int status;
  412. status = decode_compound_hdr(xdr, &hdr);
  413. if (status)
  414. goto out;
  415. status = decode_sequence(xdr, &res->seq_res, rqstp);
  416. if (status)
  417. goto out;
  418. status = decode_putfh(xdr);
  419. if (status)
  420. goto out;
  421. status = decode_allocate(xdr, res);
  422. if (status)
  423. goto out;
  424. decode_getfattr(xdr, res->falloc_fattr, res->falloc_server);
  425. out:
  426. return status;
  427. }
  428. /*
  429. * Decode COPY response
  430. */
  431. static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
  432. struct xdr_stream *xdr,
  433. void *data)
  434. {
  435. struct nfs42_copy_res *res = data;
  436. struct compound_hdr hdr;
  437. int status;
  438. status = decode_compound_hdr(xdr, &hdr);
  439. if (status)
  440. goto out;
  441. status = decode_sequence(xdr, &res->seq_res, rqstp);
  442. if (status)
  443. goto out;
  444. status = decode_putfh(xdr);
  445. if (status)
  446. goto out;
  447. status = decode_savefh(xdr);
  448. if (status)
  449. goto out;
  450. status = decode_putfh(xdr);
  451. if (status)
  452. goto out;
  453. status = decode_copy(xdr, res);
  454. if (status)
  455. goto out;
  456. status = decode_commit(xdr, &res->commit_res);
  457. out:
  458. return status;
  459. }
  460. /*
  461. * Decode DEALLOCATE request
  462. */
  463. static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
  464. struct xdr_stream *xdr,
  465. void *data)
  466. {
  467. struct nfs42_falloc_res *res = data;
  468. struct compound_hdr hdr;
  469. int status;
  470. status = decode_compound_hdr(xdr, &hdr);
  471. if (status)
  472. goto out;
  473. status = decode_sequence(xdr, &res->seq_res, rqstp);
  474. if (status)
  475. goto out;
  476. status = decode_putfh(xdr);
  477. if (status)
  478. goto out;
  479. status = decode_deallocate(xdr, res);
  480. if (status)
  481. goto out;
  482. decode_getfattr(xdr, res->falloc_fattr, res->falloc_server);
  483. out:
  484. return status;
  485. }
  486. /*
  487. * Decode SEEK request
  488. */
  489. static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
  490. struct xdr_stream *xdr,
  491. void *data)
  492. {
  493. struct nfs42_seek_res *res = data;
  494. struct compound_hdr hdr;
  495. int status;
  496. status = decode_compound_hdr(xdr, &hdr);
  497. if (status)
  498. goto out;
  499. status = decode_sequence(xdr, &res->seq_res, rqstp);
  500. if (status)
  501. goto out;
  502. status = decode_putfh(xdr);
  503. if (status)
  504. goto out;
  505. status = decode_seek(xdr, res);
  506. out:
  507. return status;
  508. }
  509. /*
  510. * Decode LAYOUTSTATS request
  511. */
  512. static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
  513. struct xdr_stream *xdr,
  514. void *data)
  515. {
  516. struct nfs42_layoutstat_res *res = data;
  517. struct compound_hdr hdr;
  518. int status, i;
  519. status = decode_compound_hdr(xdr, &hdr);
  520. if (status)
  521. goto out;
  522. status = decode_sequence(xdr, &res->seq_res, rqstp);
  523. if (status)
  524. goto out;
  525. status = decode_putfh(xdr);
  526. if (status)
  527. goto out;
  528. WARN_ON(res->num_dev > PNFS_LAYOUTSTATS_MAXDEV);
  529. for (i = 0; i < res->num_dev; i++) {
  530. status = decode_layoutstats(xdr);
  531. if (status)
  532. goto out;
  533. }
  534. out:
  535. res->rpc_status = status;
  536. return status;
  537. }
  538. /*
  539. * Decode CLONE request
  540. */
  541. static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp,
  542. struct xdr_stream *xdr,
  543. void *data)
  544. {
  545. struct nfs42_clone_res *res = data;
  546. struct compound_hdr hdr;
  547. int status;
  548. status = decode_compound_hdr(xdr, &hdr);
  549. if (status)
  550. goto out;
  551. status = decode_sequence(xdr, &res->seq_res, rqstp);
  552. if (status)
  553. goto out;
  554. status = decode_putfh(xdr);
  555. if (status)
  556. goto out;
  557. status = decode_savefh(xdr);
  558. if (status)
  559. goto out;
  560. status = decode_putfh(xdr);
  561. if (status)
  562. goto out;
  563. status = decode_clone(xdr);
  564. if (status)
  565. goto out;
  566. status = decode_getfattr(xdr, res->dst_fattr, res->server);
  567. out:
  568. res->rpc_status = status;
  569. return status;
  570. }
  571. #endif /* __LINUX_FS_NFS_NFS4_2XDR_H */