nfs42xdr.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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. struct nfs42_falloc_res *res)
  408. {
  409. struct compound_hdr hdr;
  410. int status;
  411. status = decode_compound_hdr(xdr, &hdr);
  412. if (status)
  413. goto out;
  414. status = decode_sequence(xdr, &res->seq_res, rqstp);
  415. if (status)
  416. goto out;
  417. status = decode_putfh(xdr);
  418. if (status)
  419. goto out;
  420. status = decode_allocate(xdr, res);
  421. if (status)
  422. goto out;
  423. decode_getfattr(xdr, res->falloc_fattr, res->falloc_server);
  424. out:
  425. return status;
  426. }
  427. /*
  428. * Decode COPY response
  429. */
  430. static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
  431. struct xdr_stream *xdr,
  432. struct nfs42_copy_res *res)
  433. {
  434. struct compound_hdr hdr;
  435. int status;
  436. status = decode_compound_hdr(xdr, &hdr);
  437. if (status)
  438. goto out;
  439. status = decode_sequence(xdr, &res->seq_res, rqstp);
  440. if (status)
  441. goto out;
  442. status = decode_putfh(xdr);
  443. if (status)
  444. goto out;
  445. status = decode_savefh(xdr);
  446. if (status)
  447. goto out;
  448. status = decode_putfh(xdr);
  449. if (status)
  450. goto out;
  451. status = decode_copy(xdr, res);
  452. if (status)
  453. goto out;
  454. status = decode_commit(xdr, &res->commit_res);
  455. out:
  456. return status;
  457. }
  458. /*
  459. * Decode DEALLOCATE request
  460. */
  461. static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
  462. struct xdr_stream *xdr,
  463. struct nfs42_falloc_res *res)
  464. {
  465. struct compound_hdr hdr;
  466. int status;
  467. status = decode_compound_hdr(xdr, &hdr);
  468. if (status)
  469. goto out;
  470. status = decode_sequence(xdr, &res->seq_res, rqstp);
  471. if (status)
  472. goto out;
  473. status = decode_putfh(xdr);
  474. if (status)
  475. goto out;
  476. status = decode_deallocate(xdr, res);
  477. if (status)
  478. goto out;
  479. decode_getfattr(xdr, res->falloc_fattr, res->falloc_server);
  480. out:
  481. return status;
  482. }
  483. /*
  484. * Decode SEEK request
  485. */
  486. static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
  487. struct xdr_stream *xdr,
  488. struct nfs42_seek_res *res)
  489. {
  490. struct compound_hdr hdr;
  491. int status;
  492. status = decode_compound_hdr(xdr, &hdr);
  493. if (status)
  494. goto out;
  495. status = decode_sequence(xdr, &res->seq_res, rqstp);
  496. if (status)
  497. goto out;
  498. status = decode_putfh(xdr);
  499. if (status)
  500. goto out;
  501. status = decode_seek(xdr, res);
  502. out:
  503. return status;
  504. }
  505. /*
  506. * Decode LAYOUTSTATS request
  507. */
  508. static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
  509. struct xdr_stream *xdr,
  510. struct nfs42_layoutstat_res *res)
  511. {
  512. struct compound_hdr hdr;
  513. int status, i;
  514. status = decode_compound_hdr(xdr, &hdr);
  515. if (status)
  516. goto out;
  517. status = decode_sequence(xdr, &res->seq_res, rqstp);
  518. if (status)
  519. goto out;
  520. status = decode_putfh(xdr);
  521. if (status)
  522. goto out;
  523. WARN_ON(res->num_dev > PNFS_LAYOUTSTATS_MAXDEV);
  524. for (i = 0; i < res->num_dev; i++) {
  525. status = decode_layoutstats(xdr);
  526. if (status)
  527. goto out;
  528. }
  529. out:
  530. res->rpc_status = status;
  531. return status;
  532. }
  533. /*
  534. * Decode CLONE request
  535. */
  536. static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp,
  537. struct xdr_stream *xdr,
  538. struct nfs42_clone_res *res)
  539. {
  540. struct compound_hdr hdr;
  541. int status;
  542. status = decode_compound_hdr(xdr, &hdr);
  543. if (status)
  544. goto out;
  545. status = decode_sequence(xdr, &res->seq_res, rqstp);
  546. if (status)
  547. goto out;
  548. status = decode_putfh(xdr);
  549. if (status)
  550. goto out;
  551. status = decode_savefh(xdr);
  552. if (status)
  553. goto out;
  554. status = decode_putfh(xdr);
  555. if (status)
  556. goto out;
  557. status = decode_clone(xdr);
  558. if (status)
  559. goto out;
  560. status = decode_getfattr(xdr, res->dst_fattr, res->server);
  561. out:
  562. res->rpc_status = status;
  563. return status;
  564. }
  565. #endif /* __LINUX_FS_NFS_NFS4_2XDR_H */