2 * linux/fs/nfs/callback_xdr.c
4 * Copyright (C) 2004 Trond Myklebust
6 * NFSv4 callback encode/decode procedures
8 #include <linux/kernel.h>
9 #include <linux/sunrpc/svc.h>
10 #include <linux/nfs4.h>
11 #include <linux/nfs_fs.h>
12 #include <linux/slab.h>
16 #define CB_OP_TAGLEN_MAXSZ (512)
17 #define CB_OP_HDR_RES_MAXSZ (2 + CB_OP_TAGLEN_MAXSZ)
18 #define CB_OP_GETATTR_BITMAP_MAXSZ (4)
19 #define CB_OP_GETATTR_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \
20 CB_OP_GETATTR_BITMAP_MAXSZ + \
22 #define CB_OP_RECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
24 #if defined(CONFIG_NFS_V4_1)
25 #define CB_OP_SEQUENCE_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \
27 #define CB_OP_RECALLANY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
28 #define CB_OP_RECALLSLOT_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
29 #endif /* CONFIG_NFS_V4_1 */
31 #define NFSDBG_FACILITY NFSDBG_CALLBACK
33 /* Internal error code */
34 #define NFS4ERR_RESOURCE_HDR 11050
36 typedef __be32 (*callback_process_op_t
)(void *, void *);
37 typedef __be32 (*callback_decode_arg_t
)(struct svc_rqst
*, struct xdr_stream
*, void *);
38 typedef __be32 (*callback_encode_res_t
)(struct svc_rqst
*, struct xdr_stream
*, void *);
42 callback_process_op_t process_op
;
43 callback_decode_arg_t decode_args
;
44 callback_encode_res_t encode_res
;
48 static struct callback_op callback_ops
[];
50 static __be32
nfs4_callback_null(struct svc_rqst
*rqstp
, void *argp
, void *resp
)
52 return htonl(NFS4_OK
);
55 static int nfs4_decode_void(struct svc_rqst
*rqstp
, __be32
*p
, void *dummy
)
57 return xdr_argsize_check(rqstp
, p
);
60 static int nfs4_encode_void(struct svc_rqst
*rqstp
, __be32
*p
, void *dummy
)
62 return xdr_ressize_check(rqstp
, p
);
65 static __be32
*read_buf(struct xdr_stream
*xdr
, int nbytes
)
69 p
= xdr_inline_decode(xdr
, nbytes
);
70 if (unlikely(p
== NULL
))
71 printk(KERN_WARNING
"NFSv4 callback reply buffer overflowed!\n");
75 static __be32
decode_string(struct xdr_stream
*xdr
, unsigned int *len
, const char **str
)
80 if (unlikely(p
== NULL
))
81 return htonl(NFS4ERR_RESOURCE
);
85 p
= read_buf(xdr
, *len
);
86 if (unlikely(p
== NULL
))
87 return htonl(NFS4ERR_RESOURCE
);
88 *str
= (const char *)p
;
95 static __be32
decode_fh(struct xdr_stream
*xdr
, struct nfs_fh
*fh
)
100 if (unlikely(p
== NULL
))
101 return htonl(NFS4ERR_RESOURCE
);
102 fh
->size
= ntohl(*p
);
103 if (fh
->size
> NFS4_FHSIZE
)
104 return htonl(NFS4ERR_BADHANDLE
);
105 p
= read_buf(xdr
, fh
->size
);
106 if (unlikely(p
== NULL
))
107 return htonl(NFS4ERR_RESOURCE
);
108 memcpy(&fh
->data
[0], p
, fh
->size
);
109 memset(&fh
->data
[fh
->size
], 0, sizeof(fh
->data
) - fh
->size
);
113 static __be32
decode_bitmap(struct xdr_stream
*xdr
, uint32_t *bitmap
)
116 unsigned int attrlen
;
118 p
= read_buf(xdr
, 4);
119 if (unlikely(p
== NULL
))
120 return htonl(NFS4ERR_RESOURCE
);
122 p
= read_buf(xdr
, attrlen
<< 2);
123 if (unlikely(p
== NULL
))
124 return htonl(NFS4ERR_RESOURCE
);
125 if (likely(attrlen
> 0))
126 bitmap
[0] = ntohl(*p
++);
128 bitmap
[1] = ntohl(*p
);
132 static __be32
decode_stateid(struct xdr_stream
*xdr
, nfs4_stateid
*stateid
)
136 p
= read_buf(xdr
, 16);
137 if (unlikely(p
== NULL
))
138 return htonl(NFS4ERR_RESOURCE
);
139 memcpy(stateid
->data
, p
, 16);
143 static __be32
decode_compound_hdr_arg(struct xdr_stream
*xdr
, struct cb_compound_hdr_arg
*hdr
)
148 status
= decode_string(xdr
, &hdr
->taglen
, &hdr
->tag
);
149 if (unlikely(status
!= 0))
151 /* We do not like overly long tags! */
152 if (hdr
->taglen
> CB_OP_TAGLEN_MAXSZ
- 12) {
153 printk("NFSv4 CALLBACK %s: client sent tag of length %u\n",
154 __func__
, hdr
->taglen
);
155 return htonl(NFS4ERR_RESOURCE
);
157 p
= read_buf(xdr
, 12);
158 if (unlikely(p
== NULL
))
159 return htonl(NFS4ERR_RESOURCE
);
160 hdr
->minorversion
= ntohl(*p
++);
161 /* Check minor version is zero or one. */
162 if (hdr
->minorversion
<= 1) {
163 p
++; /* skip callback_ident */
165 printk(KERN_WARNING
"%s: NFSv4 server callback with "
166 "illegal minor version %u!\n",
167 __func__
, hdr
->minorversion
);
168 return htonl(NFS4ERR_MINOR_VERS_MISMATCH
);
170 hdr
->nops
= ntohl(*p
);
171 dprintk("%s: minorversion %d nops %d\n", __func__
,
172 hdr
->minorversion
, hdr
->nops
);
176 static __be32
decode_op_hdr(struct xdr_stream
*xdr
, unsigned int *op
)
179 p
= read_buf(xdr
, 4);
180 if (unlikely(p
== NULL
))
181 return htonl(NFS4ERR_RESOURCE_HDR
);
186 static __be32
decode_getattr_args(struct svc_rqst
*rqstp
, struct xdr_stream
*xdr
, struct cb_getattrargs
*args
)
190 status
= decode_fh(xdr
, &args
->fh
);
191 if (unlikely(status
!= 0))
193 args
->addr
= svc_addr(rqstp
);
194 status
= decode_bitmap(xdr
, args
->bitmap
);
196 dprintk("%s: exit with status = %d\n", __func__
, ntohl(status
));
200 static __be32
decode_recall_args(struct svc_rqst
*rqstp
, struct xdr_stream
*xdr
, struct cb_recallargs
*args
)
205 args
->addr
= svc_addr(rqstp
);
206 status
= decode_stateid(xdr
, &args
->stateid
);
207 if (unlikely(status
!= 0))
209 p
= read_buf(xdr
, 4);
210 if (unlikely(p
== NULL
)) {
211 status
= htonl(NFS4ERR_RESOURCE
);
214 args
->truncate
= ntohl(*p
);
215 status
= decode_fh(xdr
, &args
->fh
);
217 dprintk("%s: exit with status = %d\n", __func__
, ntohl(status
));
221 #if defined(CONFIG_NFS_V4_1)
223 static __be32
decode_sessionid(struct xdr_stream
*xdr
,
224 struct nfs4_sessionid
*sid
)
227 int len
= NFS4_MAX_SESSIONID_LEN
;
229 p
= read_buf(xdr
, len
);
230 if (unlikely(p
== NULL
))
231 return htonl(NFS4ERR_RESOURCE
);
233 memcpy(sid
->data
, p
, len
);
237 static __be32
decode_rc_list(struct xdr_stream
*xdr
,
238 struct referring_call_list
*rc_list
)
244 status
= decode_sessionid(xdr
, &rc_list
->rcl_sessionid
);
248 status
= htonl(NFS4ERR_RESOURCE
);
249 p
= read_buf(xdr
, sizeof(uint32_t));
250 if (unlikely(p
== NULL
))
253 rc_list
->rcl_nrefcalls
= ntohl(*p
++);
254 if (rc_list
->rcl_nrefcalls
) {
256 rc_list
->rcl_nrefcalls
* 2 * sizeof(uint32_t));
257 if (unlikely(p
== NULL
))
259 rc_list
->rcl_refcalls
= kmalloc(rc_list
->rcl_nrefcalls
*
260 sizeof(*rc_list
->rcl_refcalls
),
262 if (unlikely(rc_list
->rcl_refcalls
== NULL
))
264 for (i
= 0; i
< rc_list
->rcl_nrefcalls
; i
++) {
265 rc_list
->rcl_refcalls
[i
].rc_sequenceid
= ntohl(*p
++);
266 rc_list
->rcl_refcalls
[i
].rc_slotid
= ntohl(*p
++);
275 static __be32
decode_cb_sequence_args(struct svc_rqst
*rqstp
,
276 struct xdr_stream
*xdr
,
277 struct cb_sequenceargs
*args
)
283 status
= decode_sessionid(xdr
, &args
->csa_sessionid
);
287 status
= htonl(NFS4ERR_RESOURCE
);
288 p
= read_buf(xdr
, 5 * sizeof(uint32_t));
289 if (unlikely(p
== NULL
))
292 args
->csa_addr
= svc_addr(rqstp
);
293 args
->csa_sequenceid
= ntohl(*p
++);
294 args
->csa_slotid
= ntohl(*p
++);
295 args
->csa_highestslotid
= ntohl(*p
++);
296 args
->csa_cachethis
= ntohl(*p
++);
297 args
->csa_nrclists
= ntohl(*p
++);
298 args
->csa_rclists
= NULL
;
299 if (args
->csa_nrclists
) {
300 args
->csa_rclists
= kmalloc(args
->csa_nrclists
*
301 sizeof(*args
->csa_rclists
),
303 if (unlikely(args
->csa_rclists
== NULL
))
306 for (i
= 0; i
< args
->csa_nrclists
; i
++) {
307 status
= decode_rc_list(xdr
, &args
->csa_rclists
[i
]);
314 dprintk("%s: sessionid %x:%x:%x:%x sequenceid %u slotid %u "
315 "highestslotid %u cachethis %d nrclists %u\n",
317 ((u32
*)&args
->csa_sessionid
)[0],
318 ((u32
*)&args
->csa_sessionid
)[1],
319 ((u32
*)&args
->csa_sessionid
)[2],
320 ((u32
*)&args
->csa_sessionid
)[3],
321 args
->csa_sequenceid
, args
->csa_slotid
,
322 args
->csa_highestslotid
, args
->csa_cachethis
,
325 dprintk("%s: exit with status = %d\n", __func__
, ntohl(status
));
329 for (i
= 0; i
< args
->csa_nrclists
; i
++)
330 kfree(args
->csa_rclists
[i
].rcl_refcalls
);
331 kfree(args
->csa_rclists
);
335 static __be32
decode_recallany_args(struct svc_rqst
*rqstp
,
336 struct xdr_stream
*xdr
,
337 struct cb_recallanyargs
*args
)
341 args
->craa_addr
= svc_addr(rqstp
);
342 p
= read_buf(xdr
, 4);
343 if (unlikely(p
== NULL
))
344 return htonl(NFS4ERR_BADXDR
);
345 args
->craa_objs_to_keep
= ntohl(*p
++);
346 p
= read_buf(xdr
, 4);
347 if (unlikely(p
== NULL
))
348 return htonl(NFS4ERR_BADXDR
);
349 args
->craa_type_mask
= ntohl(*p
);
354 static __be32
decode_recallslot_args(struct svc_rqst
*rqstp
,
355 struct xdr_stream
*xdr
,
356 struct cb_recallslotargs
*args
)
360 args
->crsa_addr
= svc_addr(rqstp
);
361 p
= read_buf(xdr
, 4);
362 if (unlikely(p
== NULL
))
363 return htonl(NFS4ERR_BADXDR
);
364 args
->crsa_target_max_slots
= ntohl(*p
++);
368 #endif /* CONFIG_NFS_V4_1 */
370 static __be32
encode_string(struct xdr_stream
*xdr
, unsigned int len
, const char *str
)
374 p
= xdr_reserve_space(xdr
, 4 + len
);
375 if (unlikely(p
== NULL
))
376 return htonl(NFS4ERR_RESOURCE
);
377 xdr_encode_opaque(p
, str
, len
);
381 #define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE)
382 #define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY)
383 static __be32
encode_attr_bitmap(struct xdr_stream
*xdr
, const uint32_t *bitmap
, __be32
**savep
)
388 bm
[0] = htonl(bitmap
[0] & CB_SUPPORTED_ATTR0
);
389 bm
[1] = htonl(bitmap
[1] & CB_SUPPORTED_ATTR1
);
391 p
= xdr_reserve_space(xdr
, 16);
392 if (unlikely(p
== NULL
))
393 return htonl(NFS4ERR_RESOURCE
);
397 } else if (bm
[0] != 0) {
398 p
= xdr_reserve_space(xdr
, 12);
399 if (unlikely(p
== NULL
))
400 return htonl(NFS4ERR_RESOURCE
);
404 p
= xdr_reserve_space(xdr
, 8);
405 if (unlikely(p
== NULL
))
406 return htonl(NFS4ERR_RESOURCE
);
413 static __be32
encode_attr_change(struct xdr_stream
*xdr
, const uint32_t *bitmap
, uint64_t change
)
417 if (!(bitmap
[0] & FATTR4_WORD0_CHANGE
))
419 p
= xdr_reserve_space(xdr
, 8);
421 return htonl(NFS4ERR_RESOURCE
);
422 p
= xdr_encode_hyper(p
, change
);
426 static __be32
encode_attr_size(struct xdr_stream
*xdr
, const uint32_t *bitmap
, uint64_t size
)
430 if (!(bitmap
[0] & FATTR4_WORD0_SIZE
))
432 p
= xdr_reserve_space(xdr
, 8);
434 return htonl(NFS4ERR_RESOURCE
);
435 p
= xdr_encode_hyper(p
, size
);
439 static __be32
encode_attr_time(struct xdr_stream
*xdr
, const struct timespec
*time
)
443 p
= xdr_reserve_space(xdr
, 12);
445 return htonl(NFS4ERR_RESOURCE
);
446 p
= xdr_encode_hyper(p
, time
->tv_sec
);
447 *p
= htonl(time
->tv_nsec
);
451 static __be32
encode_attr_ctime(struct xdr_stream
*xdr
, const uint32_t *bitmap
, const struct timespec
*time
)
453 if (!(bitmap
[1] & FATTR4_WORD1_TIME_METADATA
))
455 return encode_attr_time(xdr
,time
);
458 static __be32
encode_attr_mtime(struct xdr_stream
*xdr
, const uint32_t *bitmap
, const struct timespec
*time
)
460 if (!(bitmap
[1] & FATTR4_WORD1_TIME_MODIFY
))
462 return encode_attr_time(xdr
,time
);
465 static __be32
encode_compound_hdr_res(struct xdr_stream
*xdr
, struct cb_compound_hdr_res
*hdr
)
469 hdr
->status
= xdr_reserve_space(xdr
, 4);
470 if (unlikely(hdr
->status
== NULL
))
471 return htonl(NFS4ERR_RESOURCE
);
472 status
= encode_string(xdr
, hdr
->taglen
, hdr
->tag
);
473 if (unlikely(status
!= 0))
475 hdr
->nops
= xdr_reserve_space(xdr
, 4);
476 if (unlikely(hdr
->nops
== NULL
))
477 return htonl(NFS4ERR_RESOURCE
);
481 static __be32
encode_op_hdr(struct xdr_stream
*xdr
, uint32_t op
, __be32 res
)
485 p
= xdr_reserve_space(xdr
, 8);
486 if (unlikely(p
== NULL
))
487 return htonl(NFS4ERR_RESOURCE_HDR
);
493 static __be32
encode_getattr_res(struct svc_rqst
*rqstp
, struct xdr_stream
*xdr
, const struct cb_getattrres
*res
)
495 __be32
*savep
= NULL
;
496 __be32 status
= res
->status
;
498 if (unlikely(status
!= 0))
500 status
= encode_attr_bitmap(xdr
, res
->bitmap
, &savep
);
501 if (unlikely(status
!= 0))
503 status
= encode_attr_change(xdr
, res
->bitmap
, res
->change_attr
);
504 if (unlikely(status
!= 0))
506 status
= encode_attr_size(xdr
, res
->bitmap
, res
->size
);
507 if (unlikely(status
!= 0))
509 status
= encode_attr_ctime(xdr
, res
->bitmap
, &res
->ctime
);
510 if (unlikely(status
!= 0))
512 status
= encode_attr_mtime(xdr
, res
->bitmap
, &res
->mtime
);
513 *savep
= htonl((unsigned int)((char *)xdr
->p
- (char *)(savep
+1)));
515 dprintk("%s: exit with status = %d\n", __func__
, ntohl(status
));
519 #if defined(CONFIG_NFS_V4_1)
521 static __be32
encode_sessionid(struct xdr_stream
*xdr
,
522 const struct nfs4_sessionid
*sid
)
525 int len
= NFS4_MAX_SESSIONID_LEN
;
527 p
= xdr_reserve_space(xdr
, len
);
528 if (unlikely(p
== NULL
))
529 return htonl(NFS4ERR_RESOURCE
);
535 static __be32
encode_cb_sequence_res(struct svc_rqst
*rqstp
,
536 struct xdr_stream
*xdr
,
537 const struct cb_sequenceres
*res
)
540 unsigned status
= res
->csr_status
;
542 if (unlikely(status
!= 0))
545 encode_sessionid(xdr
, &res
->csr_sessionid
);
547 p
= xdr_reserve_space(xdr
, 4 * sizeof(uint32_t));
548 if (unlikely(p
== NULL
))
549 return htonl(NFS4ERR_RESOURCE
);
551 *p
++ = htonl(res
->csr_sequenceid
);
552 *p
++ = htonl(res
->csr_slotid
);
553 *p
++ = htonl(res
->csr_highestslotid
);
554 *p
++ = htonl(res
->csr_target_highestslotid
);
556 dprintk("%s: exit with status = %d\n", __func__
, ntohl(status
));
561 preprocess_nfs41_op(int nop
, unsigned int op_nr
, struct callback_op
**op
)
563 if (op_nr
== OP_CB_SEQUENCE
) {
565 return htonl(NFS4ERR_SEQUENCE_POS
);
568 return htonl(NFS4ERR_OP_NOT_IN_SESSION
);
575 case OP_CB_RECALL_ANY
:
576 case OP_CB_RECALL_SLOT
:
577 *op
= &callback_ops
[op_nr
];
580 case OP_CB_LAYOUTRECALL
:
581 case OP_CB_NOTIFY_DEVICEID
:
583 case OP_CB_PUSH_DELEG
:
584 case OP_CB_RECALLABLE_OBJ_AVAIL
:
585 case OP_CB_WANTS_CANCELLED
:
586 case OP_CB_NOTIFY_LOCK
:
587 return htonl(NFS4ERR_NOTSUPP
);
590 return htonl(NFS4ERR_OP_ILLEGAL
);
593 return htonl(NFS_OK
);
596 #else /* CONFIG_NFS_V4_1 */
599 preprocess_nfs41_op(int nop
, unsigned int op_nr
, struct callback_op
**op
)
601 return htonl(NFS4ERR_MINOR_VERS_MISMATCH
);
604 #endif /* CONFIG_NFS_V4_1 */
607 preprocess_nfs4_op(unsigned int op_nr
, struct callback_op
**op
)
612 *op
= &callback_ops
[op_nr
];
615 return htonl(NFS4ERR_OP_ILLEGAL
);
618 return htonl(NFS_OK
);
621 static __be32
process_op(uint32_t minorversion
, int nop
,
622 struct svc_rqst
*rqstp
,
623 struct xdr_stream
*xdr_in
, void *argp
,
624 struct xdr_stream
*xdr_out
, void *resp
, int* drc_status
)
626 struct callback_op
*op
= &callback_ops
[0];
632 dprintk("%s: start\n", __func__
);
633 status
= decode_op_hdr(xdr_in
, &op_nr
);
634 if (unlikely(status
))
637 dprintk("%s: minorversion=%d nop=%d op_nr=%u\n",
638 __func__
, minorversion
, nop
, op_nr
);
640 status
= minorversion
? preprocess_nfs41_op(nop
, op_nr
, &op
) :
641 preprocess_nfs4_op(op_nr
, &op
);
642 if (status
== htonl(NFS4ERR_OP_ILLEGAL
))
643 op_nr
= OP_CB_ILLEGAL
;
648 status
= *drc_status
;
652 maxlen
= xdr_out
->end
- xdr_out
->p
;
653 if (maxlen
> 0 && maxlen
< PAGE_SIZE
) {
654 status
= op
->decode_args(rqstp
, xdr_in
, argp
);
655 if (likely(status
== 0))
656 status
= op
->process_op(argp
, resp
);
658 status
= htonl(NFS4ERR_RESOURCE
);
660 /* Only set by OP_CB_SEQUENCE processing */
661 if (status
== htonl(NFS4ERR_RETRY_UNCACHED_REP
)) {
662 *drc_status
= status
;
667 res
= encode_op_hdr(xdr_out
, op_nr
, status
);
670 if (op
->encode_res
!= NULL
&& status
== 0)
671 status
= op
->encode_res(rqstp
, xdr_out
, resp
);
672 dprintk("%s: done, status = %d\n", __func__
, ntohl(status
));
677 * Decode, process and encode a COMPOUND
679 static __be32
nfs4_callback_compound(struct svc_rqst
*rqstp
, void *argp
, void *resp
)
681 struct cb_compound_hdr_arg hdr_arg
= { 0 };
682 struct cb_compound_hdr_res hdr_res
= { NULL
};
683 struct xdr_stream xdr_in
, xdr_out
;
685 __be32 status
, drc_status
= 0;
686 unsigned int nops
= 0;
688 dprintk("%s: start\n", __func__
);
690 xdr_init_decode(&xdr_in
, &rqstp
->rq_arg
, rqstp
->rq_arg
.head
[0].iov_base
);
692 p
= (__be32
*)((char *)rqstp
->rq_res
.head
[0].iov_base
+ rqstp
->rq_res
.head
[0].iov_len
);
693 xdr_init_encode(&xdr_out
, &rqstp
->rq_res
, p
);
695 status
= decode_compound_hdr_arg(&xdr_in
, &hdr_arg
);
696 if (status
== __constant_htonl(NFS4ERR_RESOURCE
))
697 return rpc_garbage_args
;
699 hdr_res
.taglen
= hdr_arg
.taglen
;
700 hdr_res
.tag
= hdr_arg
.tag
;
701 if (encode_compound_hdr_res(&xdr_out
, &hdr_res
) != 0)
702 return rpc_system_err
;
704 while (status
== 0 && nops
!= hdr_arg
.nops
) {
705 status
= process_op(hdr_arg
.minorversion
, nops
, rqstp
,
706 &xdr_in
, argp
, &xdr_out
, resp
, &drc_status
);
710 /* Buffer overflow in decode_ops_hdr or encode_ops_hdr. Return
711 * resource error in cb_compound status without returning op */
712 if (unlikely(status
== htonl(NFS4ERR_RESOURCE_HDR
))) {
713 status
= htonl(NFS4ERR_RESOURCE
);
717 *hdr_res
.status
= status
;
718 *hdr_res
.nops
= htonl(nops
);
719 dprintk("%s: done, status = %u\n", __func__
, ntohl(status
));
724 * Define NFS4 callback COMPOUND ops.
726 static struct callback_op callback_ops
[] = {
728 .res_maxsize
= CB_OP_HDR_RES_MAXSZ
,
731 .process_op
= (callback_process_op_t
)nfs4_callback_getattr
,
732 .decode_args
= (callback_decode_arg_t
)decode_getattr_args
,
733 .encode_res
= (callback_encode_res_t
)encode_getattr_res
,
734 .res_maxsize
= CB_OP_GETATTR_RES_MAXSZ
,
737 .process_op
= (callback_process_op_t
)nfs4_callback_recall
,
738 .decode_args
= (callback_decode_arg_t
)decode_recall_args
,
739 .res_maxsize
= CB_OP_RECALL_RES_MAXSZ
,
741 #if defined(CONFIG_NFS_V4_1)
743 .process_op
= (callback_process_op_t
)nfs4_callback_sequence
,
744 .decode_args
= (callback_decode_arg_t
)decode_cb_sequence_args
,
745 .encode_res
= (callback_encode_res_t
)encode_cb_sequence_res
,
746 .res_maxsize
= CB_OP_SEQUENCE_RES_MAXSZ
,
748 [OP_CB_RECALL_ANY
] = {
749 .process_op
= (callback_process_op_t
)nfs4_callback_recallany
,
750 .decode_args
= (callback_decode_arg_t
)decode_recallany_args
,
751 .res_maxsize
= CB_OP_RECALLANY_RES_MAXSZ
,
753 [OP_CB_RECALL_SLOT
] = {
754 .process_op
= (callback_process_op_t
)nfs4_callback_recallslot
,
755 .decode_args
= (callback_decode_arg_t
)decode_recallslot_args
,
756 .res_maxsize
= CB_OP_RECALLSLOT_RES_MAXSZ
,
758 #endif /* CONFIG_NFS_V4_1 */
762 * Define NFS4 callback procedures
764 static struct svc_procedure nfs4_callback_procedures1
[] = {
766 .pc_func
= nfs4_callback_null
,
767 .pc_decode
= (kxdrproc_t
)nfs4_decode_void
,
768 .pc_encode
= (kxdrproc_t
)nfs4_encode_void
,
772 .pc_func
= nfs4_callback_compound
,
773 .pc_encode
= (kxdrproc_t
)nfs4_encode_void
,
776 .pc_xdrressize
= NFS4_CALLBACK_BUFSIZE
,
780 struct svc_version nfs4_callback_version1
= {
782 .vs_nproc
= ARRAY_SIZE(nfs4_callback_procedures1
),
783 .vs_proc
= nfs4_callback_procedures1
,
784 .vs_xdrsize
= NFS4_CALLBACK_XDRSIZE
,
789 struct svc_version nfs4_callback_version4
= {
791 .vs_nproc
= ARRAY_SIZE(nfs4_callback_procedures1
),
792 .vs_proc
= nfs4_callback_procedures1
,
793 .vs_xdrsize
= NFS4_CALLBACK_XDRSIZE
,