1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp.com>
5 #ifndef __LINUX_FS_NFS_NFS4_2XDR_H
6 #define __LINUX_FS_NFS_NFS4_2XDR_H
10 #define encode_fallocate_maxsz (encode_stateid_maxsz + \
13 #define NFS42_WRITE_RES_SIZE (1 /* wr_callback_id size */ +\
14 XDR_QUADLEN(NFS4_STATEID_SIZE) + \
16 1 /* wr_committed */ + \
17 XDR_QUADLEN(NFS4_VERIFIER_SIZE))
18 #define encode_allocate_maxsz (op_encode_hdr_maxsz + \
19 encode_fallocate_maxsz)
20 #define decode_allocate_maxsz (op_decode_hdr_maxsz)
21 #define encode_copy_maxsz (op_encode_hdr_maxsz + \
22 XDR_QUADLEN(NFS4_STATEID_SIZE) + \
23 XDR_QUADLEN(NFS4_STATEID_SIZE) + \
24 2 + 2 + 2 + 1 + 1 + 1)
25 #define decode_copy_maxsz (op_decode_hdr_maxsz + \
26 NFS42_WRITE_RES_SIZE + \
27 1 /* cr_consecutive */ + \
28 1 /* cr_synchronous */)
29 #define encode_offload_cancel_maxsz (op_encode_hdr_maxsz + \
30 XDR_QUADLEN(NFS4_STATEID_SIZE))
31 #define decode_offload_cancel_maxsz (op_decode_hdr_maxsz)
32 #define encode_deallocate_maxsz (op_encode_hdr_maxsz + \
33 encode_fallocate_maxsz)
34 #define decode_deallocate_maxsz (op_decode_hdr_maxsz)
35 #define encode_seek_maxsz (op_encode_hdr_maxsz + \
36 encode_stateid_maxsz + \
39 #define decode_seek_maxsz (op_decode_hdr_maxsz + \
44 #define encode_io_info_maxsz 4
45 #define encode_layoutstats_maxsz (op_decode_hdr_maxsz + \
48 encode_stateid_maxsz + \
49 encode_io_info_maxsz + \
50 encode_io_info_maxsz + \
51 1 /* opaque devaddr4 length */ + \
52 XDR_QUADLEN(PNFS_LAYOUTSTATS_MAXSIZE))
53 #define decode_layoutstats_maxsz (op_decode_hdr_maxsz)
54 #define encode_device_error_maxsz (XDR_QUADLEN(NFS4_DEVICEID4_SIZE) + \
55 1 /* status */ + 1 /* opnum */)
56 #define encode_layouterror_maxsz (op_decode_hdr_maxsz + \
59 encode_stateid_maxsz + \
60 1 /* Array size */ + \
61 encode_device_error_maxsz)
62 #define decode_layouterror_maxsz (op_decode_hdr_maxsz)
63 #define encode_clone_maxsz (encode_stateid_maxsz + \
64 encode_stateid_maxsz + \
65 2 /* src offset */ + \
66 2 /* dst offset */ + \
68 #define decode_clone_maxsz (op_decode_hdr_maxsz)
70 #define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \
71 encode_sequence_maxsz + \
72 encode_putfh_maxsz + \
73 encode_allocate_maxsz + \
75 #define NFS4_dec_allocate_sz (compound_decode_hdr_maxsz + \
76 decode_sequence_maxsz + \
77 decode_putfh_maxsz + \
78 decode_allocate_maxsz + \
80 #define NFS4_enc_copy_sz (compound_encode_hdr_maxsz + \
81 encode_sequence_maxsz + \
82 encode_putfh_maxsz + \
83 encode_savefh_maxsz + \
84 encode_putfh_maxsz + \
87 #define NFS4_dec_copy_sz (compound_decode_hdr_maxsz + \
88 decode_sequence_maxsz + \
89 decode_putfh_maxsz + \
90 decode_savefh_maxsz + \
91 decode_putfh_maxsz + \
94 #define NFS4_enc_offload_cancel_sz (compound_encode_hdr_maxsz + \
95 encode_sequence_maxsz + \
96 encode_putfh_maxsz + \
97 encode_offload_cancel_maxsz)
98 #define NFS4_dec_offload_cancel_sz (compound_decode_hdr_maxsz + \
99 decode_sequence_maxsz + \
100 decode_putfh_maxsz + \
101 decode_offload_cancel_maxsz)
102 #define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \
103 encode_sequence_maxsz + \
104 encode_putfh_maxsz + \
105 encode_deallocate_maxsz + \
106 encode_getattr_maxsz)
107 #define NFS4_dec_deallocate_sz (compound_decode_hdr_maxsz + \
108 decode_sequence_maxsz + \
109 decode_putfh_maxsz + \
110 decode_deallocate_maxsz + \
111 decode_getattr_maxsz)
112 #define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \
113 encode_sequence_maxsz + \
114 encode_putfh_maxsz + \
116 #define NFS4_dec_seek_sz (compound_decode_hdr_maxsz + \
117 decode_sequence_maxsz + \
118 decode_putfh_maxsz + \
120 #define NFS4_enc_layoutstats_sz (compound_encode_hdr_maxsz + \
121 encode_sequence_maxsz + \
122 encode_putfh_maxsz + \
123 PNFS_LAYOUTSTATS_MAXDEV * encode_layoutstats_maxsz)
124 #define NFS4_dec_layoutstats_sz (compound_decode_hdr_maxsz + \
125 decode_sequence_maxsz + \
126 decode_putfh_maxsz + \
127 PNFS_LAYOUTSTATS_MAXDEV * decode_layoutstats_maxsz)
128 #define NFS4_enc_layouterror_sz (compound_encode_hdr_maxsz + \
129 encode_sequence_maxsz + \
130 encode_putfh_maxsz + \
131 NFS42_LAYOUTERROR_MAX * \
132 encode_layouterror_maxsz)
133 #define NFS4_dec_layouterror_sz (compound_decode_hdr_maxsz + \
134 decode_sequence_maxsz + \
135 decode_putfh_maxsz + \
136 NFS42_LAYOUTERROR_MAX * \
137 decode_layouterror_maxsz)
138 #define NFS4_enc_clone_sz (compound_encode_hdr_maxsz + \
139 encode_sequence_maxsz + \
140 encode_putfh_maxsz + \
141 encode_savefh_maxsz + \
142 encode_putfh_maxsz + \
143 encode_clone_maxsz + \
144 encode_getattr_maxsz)
145 #define NFS4_dec_clone_sz (compound_decode_hdr_maxsz + \
146 decode_sequence_maxsz + \
147 decode_putfh_maxsz + \
148 decode_savefh_maxsz + \
149 decode_putfh_maxsz + \
150 decode_clone_maxsz + \
151 decode_getattr_maxsz)
153 static void encode_fallocate(struct xdr_stream
*xdr
,
154 const struct nfs42_falloc_args
*args
)
156 encode_nfs4_stateid(xdr
, &args
->falloc_stateid
);
157 encode_uint64(xdr
, args
->falloc_offset
);
158 encode_uint64(xdr
, args
->falloc_length
);
161 static void encode_allocate(struct xdr_stream
*xdr
,
162 const struct nfs42_falloc_args
*args
,
163 struct compound_hdr
*hdr
)
165 encode_op_hdr(xdr
, OP_ALLOCATE
, decode_allocate_maxsz
, hdr
);
166 encode_fallocate(xdr
, args
);
169 static void encode_copy(struct xdr_stream
*xdr
,
170 const struct nfs42_copy_args
*args
,
171 struct compound_hdr
*hdr
)
173 encode_op_hdr(xdr
, OP_COPY
, decode_copy_maxsz
, hdr
);
174 encode_nfs4_stateid(xdr
, &args
->src_stateid
);
175 encode_nfs4_stateid(xdr
, &args
->dst_stateid
);
177 encode_uint64(xdr
, args
->src_pos
);
178 encode_uint64(xdr
, args
->dst_pos
);
179 encode_uint64(xdr
, args
->count
);
181 encode_uint32(xdr
, 1); /* consecutive = true */
182 encode_uint32(xdr
, args
->sync
);
183 encode_uint32(xdr
, 0); /* src server list */
186 static void encode_offload_cancel(struct xdr_stream
*xdr
,
187 const struct nfs42_offload_status_args
*args
,
188 struct compound_hdr
*hdr
)
190 encode_op_hdr(xdr
, OP_OFFLOAD_CANCEL
, decode_offload_cancel_maxsz
, hdr
);
191 encode_nfs4_stateid(xdr
, &args
->osa_stateid
);
194 static void encode_deallocate(struct xdr_stream
*xdr
,
195 const struct nfs42_falloc_args
*args
,
196 struct compound_hdr
*hdr
)
198 encode_op_hdr(xdr
, OP_DEALLOCATE
, decode_deallocate_maxsz
, hdr
);
199 encode_fallocate(xdr
, args
);
202 static void encode_seek(struct xdr_stream
*xdr
,
203 const struct nfs42_seek_args
*args
,
204 struct compound_hdr
*hdr
)
206 encode_op_hdr(xdr
, OP_SEEK
, decode_seek_maxsz
, hdr
);
207 encode_nfs4_stateid(xdr
, &args
->sa_stateid
);
208 encode_uint64(xdr
, args
->sa_offset
);
209 encode_uint32(xdr
, args
->sa_what
);
212 static void encode_layoutstats(struct xdr_stream
*xdr
,
213 const struct nfs42_layoutstat_args
*args
,
214 struct nfs42_layoutstat_devinfo
*devinfo
,
215 struct compound_hdr
*hdr
)
219 encode_op_hdr(xdr
, OP_LAYOUTSTATS
, decode_layoutstats_maxsz
, hdr
);
220 p
= reserve_space(xdr
, 8 + 8);
221 p
= xdr_encode_hyper(p
, devinfo
->offset
);
222 p
= xdr_encode_hyper(p
, devinfo
->length
);
223 encode_nfs4_stateid(xdr
, &args
->stateid
);
224 p
= reserve_space(xdr
, 4*8 + NFS4_DEVICEID4_SIZE
+ 4);
225 p
= xdr_encode_hyper(p
, devinfo
->read_count
);
226 p
= xdr_encode_hyper(p
, devinfo
->read_bytes
);
227 p
= xdr_encode_hyper(p
, devinfo
->write_count
);
228 p
= xdr_encode_hyper(p
, devinfo
->write_bytes
);
229 p
= xdr_encode_opaque_fixed(p
, devinfo
->dev_id
.data
,
230 NFS4_DEVICEID4_SIZE
);
231 /* Encode layoutupdate4 */
232 *p
++ = cpu_to_be32(devinfo
->layout_type
);
233 if (devinfo
->ld_private
.ops
)
234 devinfo
->ld_private
.ops
->encode(xdr
, args
,
235 &devinfo
->ld_private
);
237 encode_uint32(xdr
, 0);
240 static void encode_clone(struct xdr_stream
*xdr
,
241 const struct nfs42_clone_args
*args
,
242 struct compound_hdr
*hdr
)
246 encode_op_hdr(xdr
, OP_CLONE
, decode_clone_maxsz
, hdr
);
247 encode_nfs4_stateid(xdr
, &args
->src_stateid
);
248 encode_nfs4_stateid(xdr
, &args
->dst_stateid
);
249 p
= reserve_space(xdr
, 3*8);
250 p
= xdr_encode_hyper(p
, args
->src_offset
);
251 p
= xdr_encode_hyper(p
, args
->dst_offset
);
252 xdr_encode_hyper(p
, args
->count
);
255 static void encode_device_error(struct xdr_stream
*xdr
,
256 const struct nfs42_device_error
*error
)
260 p
= reserve_space(xdr
, NFS4_DEVICEID4_SIZE
+ 2*4);
261 p
= xdr_encode_opaque_fixed(p
, error
->dev_id
.data
,
262 NFS4_DEVICEID4_SIZE
);
263 *p
++ = cpu_to_be32(error
->status
);
264 *p
= cpu_to_be32(error
->opnum
);
267 static void encode_layouterror(struct xdr_stream
*xdr
,
268 const struct nfs42_layout_error
*args
,
269 struct compound_hdr
*hdr
)
273 encode_op_hdr(xdr
, OP_LAYOUTERROR
, decode_layouterror_maxsz
, hdr
);
274 p
= reserve_space(xdr
, 8 + 8);
275 p
= xdr_encode_hyper(p
, args
->offset
);
276 p
= xdr_encode_hyper(p
, args
->length
);
277 encode_nfs4_stateid(xdr
, &args
->stateid
);
278 p
= reserve_space(xdr
, 4);
280 encode_device_error(xdr
, &args
->errors
[0]);
284 * Encode ALLOCATE request
286 static void nfs4_xdr_enc_allocate(struct rpc_rqst
*req
,
287 struct xdr_stream
*xdr
,
290 const struct nfs42_falloc_args
*args
= data
;
291 struct compound_hdr hdr
= {
292 .minorversion
= nfs4_xdr_minorversion(&args
->seq_args
),
295 encode_compound_hdr(xdr
, req
, &hdr
);
296 encode_sequence(xdr
, &args
->seq_args
, &hdr
);
297 encode_putfh(xdr
, args
->falloc_fh
, &hdr
);
298 encode_allocate(xdr
, args
, &hdr
);
299 encode_getfattr(xdr
, args
->falloc_bitmask
, &hdr
);
303 static void encode_copy_commit(struct xdr_stream
*xdr
,
304 const struct nfs42_copy_args
*args
,
305 struct compound_hdr
*hdr
)
309 encode_op_hdr(xdr
, OP_COMMIT
, decode_commit_maxsz
, hdr
);
310 p
= reserve_space(xdr
, 12);
311 p
= xdr_encode_hyper(p
, args
->dst_pos
);
312 *p
= cpu_to_be32(args
->count
);
316 * Encode COPY request
318 static void nfs4_xdr_enc_copy(struct rpc_rqst
*req
,
319 struct xdr_stream
*xdr
,
322 const struct nfs42_copy_args
*args
= data
;
323 struct compound_hdr hdr
= {
324 .minorversion
= nfs4_xdr_minorversion(&args
->seq_args
),
327 encode_compound_hdr(xdr
, req
, &hdr
);
328 encode_sequence(xdr
, &args
->seq_args
, &hdr
);
329 encode_putfh(xdr
, args
->src_fh
, &hdr
);
330 encode_savefh(xdr
, &hdr
);
331 encode_putfh(xdr
, args
->dst_fh
, &hdr
);
332 encode_copy(xdr
, args
, &hdr
);
334 encode_copy_commit(xdr
, args
, &hdr
);
339 * Encode OFFLOAD_CANEL request
341 static void nfs4_xdr_enc_offload_cancel(struct rpc_rqst
*req
,
342 struct xdr_stream
*xdr
,
345 const struct nfs42_offload_status_args
*args
= data
;
346 struct compound_hdr hdr
= {
347 .minorversion
= nfs4_xdr_minorversion(&args
->osa_seq_args
),
350 encode_compound_hdr(xdr
, req
, &hdr
);
351 encode_sequence(xdr
, &args
->osa_seq_args
, &hdr
);
352 encode_putfh(xdr
, args
->osa_src_fh
, &hdr
);
353 encode_offload_cancel(xdr
, args
, &hdr
);
358 * Encode DEALLOCATE request
360 static void nfs4_xdr_enc_deallocate(struct rpc_rqst
*req
,
361 struct xdr_stream
*xdr
,
364 const struct nfs42_falloc_args
*args
= data
;
365 struct compound_hdr hdr
= {
366 .minorversion
= nfs4_xdr_minorversion(&args
->seq_args
),
369 encode_compound_hdr(xdr
, req
, &hdr
);
370 encode_sequence(xdr
, &args
->seq_args
, &hdr
);
371 encode_putfh(xdr
, args
->falloc_fh
, &hdr
);
372 encode_deallocate(xdr
, args
, &hdr
);
373 encode_getfattr(xdr
, args
->falloc_bitmask
, &hdr
);
378 * Encode SEEK request
380 static void nfs4_xdr_enc_seek(struct rpc_rqst
*req
,
381 struct xdr_stream
*xdr
,
384 const struct nfs42_seek_args
*args
= data
;
385 struct compound_hdr hdr
= {
386 .minorversion
= nfs4_xdr_minorversion(&args
->seq_args
),
389 encode_compound_hdr(xdr
, req
, &hdr
);
390 encode_sequence(xdr
, &args
->seq_args
, &hdr
);
391 encode_putfh(xdr
, args
->sa_fh
, &hdr
);
392 encode_seek(xdr
, args
, &hdr
);
397 * Encode LAYOUTSTATS request
399 static void nfs4_xdr_enc_layoutstats(struct rpc_rqst
*req
,
400 struct xdr_stream
*xdr
,
403 const struct nfs42_layoutstat_args
*args
= data
;
406 struct compound_hdr hdr
= {
407 .minorversion
= nfs4_xdr_minorversion(&args
->seq_args
),
410 encode_compound_hdr(xdr
, req
, &hdr
);
411 encode_sequence(xdr
, &args
->seq_args
, &hdr
);
412 encode_putfh(xdr
, args
->fh
, &hdr
);
413 WARN_ON(args
->num_dev
> PNFS_LAYOUTSTATS_MAXDEV
);
414 for (i
= 0; i
< args
->num_dev
; i
++)
415 encode_layoutstats(xdr
, args
, &args
->devinfo
[i
], &hdr
);
420 * Encode CLONE request
422 static void nfs4_xdr_enc_clone(struct rpc_rqst
*req
,
423 struct xdr_stream
*xdr
,
426 const struct nfs42_clone_args
*args
= data
;
427 struct compound_hdr hdr
= {
428 .minorversion
= nfs4_xdr_minorversion(&args
->seq_args
),
431 encode_compound_hdr(xdr
, req
, &hdr
);
432 encode_sequence(xdr
, &args
->seq_args
, &hdr
);
433 encode_putfh(xdr
, args
->src_fh
, &hdr
);
434 encode_savefh(xdr
, &hdr
);
435 encode_putfh(xdr
, args
->dst_fh
, &hdr
);
436 encode_clone(xdr
, args
, &hdr
);
437 encode_getfattr(xdr
, args
->dst_bitmask
, &hdr
);
442 * Encode LAYOUTERROR request
444 static void nfs4_xdr_enc_layouterror(struct rpc_rqst
*req
,
445 struct xdr_stream
*xdr
,
448 const struct nfs42_layouterror_args
*args
= data
;
449 struct compound_hdr hdr
= {
450 .minorversion
= nfs4_xdr_minorversion(&args
->seq_args
),
454 encode_compound_hdr(xdr
, req
, &hdr
);
455 encode_sequence(xdr
, &args
->seq_args
, &hdr
);
456 encode_putfh(xdr
, NFS_FH(args
->inode
), &hdr
);
457 for (i
= 0; i
< args
->num_errors
; i
++)
458 encode_layouterror(xdr
, &args
->errors
[i
], &hdr
);
462 static int decode_allocate(struct xdr_stream
*xdr
, struct nfs42_falloc_res
*res
)
464 return decode_op_hdr(xdr
, OP_ALLOCATE
);
467 static int decode_write_response(struct xdr_stream
*xdr
,
468 struct nfs42_write_res
*res
)
473 p
= xdr_inline_decode(xdr
, 4);
476 count
= be32_to_cpup(p
);
479 else if (count
== 1) {
480 status
= decode_opaque_fixed(xdr
, &res
->stateid
,
482 if (unlikely(status
))
485 p
= xdr_inline_decode(xdr
, 8 + 4);
488 p
= xdr_decode_hyper(p
, &res
->count
);
489 res
->verifier
.committed
= be32_to_cpup(p
);
490 return decode_verifier(xdr
, &res
->verifier
.verifier
);
493 static int decode_copy_requirements(struct xdr_stream
*xdr
,
494 struct nfs42_copy_res
*res
) {
497 p
= xdr_inline_decode(xdr
, 4 + 4);
501 res
->consecutive
= be32_to_cpup(p
++);
502 res
->synchronous
= be32_to_cpup(p
++);
506 static int decode_copy(struct xdr_stream
*xdr
, struct nfs42_copy_res
*res
)
510 status
= decode_op_hdr(xdr
, OP_COPY
);
511 if (status
== NFS4ERR_OFFLOAD_NO_REQS
) {
512 status
= decode_copy_requirements(xdr
, res
);
515 return NFS4ERR_OFFLOAD_NO_REQS
;
519 status
= decode_write_response(xdr
, &res
->write_res
);
523 return decode_copy_requirements(xdr
, res
);
526 static int decode_offload_cancel(struct xdr_stream
*xdr
,
527 struct nfs42_offload_status_res
*res
)
529 return decode_op_hdr(xdr
, OP_OFFLOAD_CANCEL
);
532 static int decode_deallocate(struct xdr_stream
*xdr
, struct nfs42_falloc_res
*res
)
534 return decode_op_hdr(xdr
, OP_DEALLOCATE
);
537 static int decode_seek(struct xdr_stream
*xdr
, struct nfs42_seek_res
*res
)
542 status
= decode_op_hdr(xdr
, OP_SEEK
);
546 p
= xdr_inline_decode(xdr
, 4 + 8);
550 res
->sr_eof
= be32_to_cpup(p
++);
551 p
= xdr_decode_hyper(p
, &res
->sr_offset
);
555 static int decode_layoutstats(struct xdr_stream
*xdr
)
557 return decode_op_hdr(xdr
, OP_LAYOUTSTATS
);
560 static int decode_clone(struct xdr_stream
*xdr
)
562 return decode_op_hdr(xdr
, OP_CLONE
);
565 static int decode_layouterror(struct xdr_stream
*xdr
)
567 return decode_op_hdr(xdr
, OP_LAYOUTERROR
);
571 * Decode ALLOCATE request
573 static int nfs4_xdr_dec_allocate(struct rpc_rqst
*rqstp
,
574 struct xdr_stream
*xdr
,
577 struct nfs42_falloc_res
*res
= data
;
578 struct compound_hdr hdr
;
581 status
= decode_compound_hdr(xdr
, &hdr
);
584 status
= decode_sequence(xdr
, &res
->seq_res
, rqstp
);
587 status
= decode_putfh(xdr
);
590 status
= decode_allocate(xdr
, res
);
593 decode_getfattr(xdr
, res
->falloc_fattr
, res
->falloc_server
);
599 * Decode COPY response
601 static int nfs4_xdr_dec_copy(struct rpc_rqst
*rqstp
,
602 struct xdr_stream
*xdr
,
605 struct nfs42_copy_res
*res
= data
;
606 struct compound_hdr hdr
;
609 status
= decode_compound_hdr(xdr
, &hdr
);
612 status
= decode_sequence(xdr
, &res
->seq_res
, rqstp
);
615 status
= decode_putfh(xdr
);
618 status
= decode_savefh(xdr
);
621 status
= decode_putfh(xdr
);
624 status
= decode_copy(xdr
, res
);
627 if (res
->commit_res
.verf
)
628 status
= decode_commit(xdr
, &res
->commit_res
);
634 * Decode OFFLOAD_CANCEL response
636 static int nfs4_xdr_dec_offload_cancel(struct rpc_rqst
*rqstp
,
637 struct xdr_stream
*xdr
,
640 struct nfs42_offload_status_res
*res
= data
;
641 struct compound_hdr hdr
;
644 status
= decode_compound_hdr(xdr
, &hdr
);
647 status
= decode_sequence(xdr
, &res
->osr_seq_res
, rqstp
);
650 status
= decode_putfh(xdr
);
653 status
= decode_offload_cancel(xdr
, res
);
660 * Decode DEALLOCATE request
662 static int nfs4_xdr_dec_deallocate(struct rpc_rqst
*rqstp
,
663 struct xdr_stream
*xdr
,
666 struct nfs42_falloc_res
*res
= data
;
667 struct compound_hdr hdr
;
670 status
= decode_compound_hdr(xdr
, &hdr
);
673 status
= decode_sequence(xdr
, &res
->seq_res
, rqstp
);
676 status
= decode_putfh(xdr
);
679 status
= decode_deallocate(xdr
, res
);
682 decode_getfattr(xdr
, res
->falloc_fattr
, res
->falloc_server
);
688 * Decode SEEK request
690 static int nfs4_xdr_dec_seek(struct rpc_rqst
*rqstp
,
691 struct xdr_stream
*xdr
,
694 struct nfs42_seek_res
*res
= data
;
695 struct compound_hdr hdr
;
698 status
= decode_compound_hdr(xdr
, &hdr
);
701 status
= decode_sequence(xdr
, &res
->seq_res
, rqstp
);
704 status
= decode_putfh(xdr
);
707 status
= decode_seek(xdr
, res
);
713 * Decode LAYOUTSTATS request
715 static int nfs4_xdr_dec_layoutstats(struct rpc_rqst
*rqstp
,
716 struct xdr_stream
*xdr
,
719 struct nfs42_layoutstat_res
*res
= data
;
720 struct compound_hdr hdr
;
723 status
= decode_compound_hdr(xdr
, &hdr
);
726 status
= decode_sequence(xdr
, &res
->seq_res
, rqstp
);
729 status
= decode_putfh(xdr
);
732 WARN_ON(res
->num_dev
> PNFS_LAYOUTSTATS_MAXDEV
);
733 for (i
= 0; i
< res
->num_dev
; i
++) {
734 status
= decode_layoutstats(xdr
);
739 res
->rpc_status
= status
;
744 * Decode CLONE request
746 static int nfs4_xdr_dec_clone(struct rpc_rqst
*rqstp
,
747 struct xdr_stream
*xdr
,
750 struct nfs42_clone_res
*res
= data
;
751 struct compound_hdr hdr
;
754 status
= decode_compound_hdr(xdr
, &hdr
);
757 status
= decode_sequence(xdr
, &res
->seq_res
, rqstp
);
760 status
= decode_putfh(xdr
);
763 status
= decode_savefh(xdr
);
766 status
= decode_putfh(xdr
);
769 status
= decode_clone(xdr
);
772 status
= decode_getfattr(xdr
, res
->dst_fattr
, res
->server
);
775 res
->rpc_status
= status
;
780 * Decode LAYOUTERROR request
782 static int nfs4_xdr_dec_layouterror(struct rpc_rqst
*rqstp
,
783 struct xdr_stream
*xdr
,
786 struct nfs42_layouterror_res
*res
= data
;
787 struct compound_hdr hdr
;
790 status
= decode_compound_hdr(xdr
, &hdr
);
793 status
= decode_sequence(xdr
, &res
->seq_res
, rqstp
);
796 status
= decode_putfh(xdr
);
798 for (i
= 0; i
< res
->num_errors
&& status
== 0; i
++)
799 status
= decode_layouterror(xdr
);
801 res
->rpc_status
= status
;
805 #endif /* __LINUX_FS_NFS_NFS4_2XDR_H */