callback_xdr.c (4911096f1a5df73c12c287a42ece4e7b5d9c19ec) callback_xdr.c (b9efa1b27e25b1286504973c0a6bf0f24106faa8)
1/*
2 * linux/fs/nfs/callback_xdr.c
3 *
4 * Copyright (C) 2004 Trond Myklebust
5 *
6 * NFSv4 callback encode/decode procedures
7 */
8#include <linux/kernel.h>

--- 10 unchanged lines hidden (view full) ---

19 CB_OP_GETATTR_BITMAP_MAXSZ + \
20 2 + 2 + 3 + 3)
21#define CB_OP_RECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
22
23#if defined(CONFIG_NFS_V4_1)
24#define CB_OP_SEQUENCE_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \
25 4 + 1 + 3)
26#define CB_OP_RECALLANY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
1/*
2 * linux/fs/nfs/callback_xdr.c
3 *
4 * Copyright (C) 2004 Trond Myklebust
5 *
6 * NFSv4 callback encode/decode procedures
7 */
8#include <linux/kernel.h>

--- 10 unchanged lines hidden (view full) ---

19 CB_OP_GETATTR_BITMAP_MAXSZ + \
20 2 + 2 + 3 + 3)
21#define CB_OP_RECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
22
23#if defined(CONFIG_NFS_V4_1)
24#define CB_OP_SEQUENCE_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \
25 4 + 1 + 3)
26#define CB_OP_RECALLANY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
27#define CB_OP_RECALLSLOT_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
27#endif /* CONFIG_NFS_V4_1 */
28
29#define NFSDBG_FACILITY NFSDBG_CALLBACK
30
31/* Internal error code */
32#define NFS4ERR_RESOURCE_HDR 11050
33
34typedef __be32 (*callback_process_op_t)(void *, void *);

--- 309 unchanged lines hidden (view full) ---

344 p = read_buf(xdr, 4);
345 if (unlikely(p == NULL))
346 return htonl(NFS4ERR_BADXDR);
347 args->craa_type_mask = ntohl(*p);
348
349 return 0;
350}
351
28#endif /* CONFIG_NFS_V4_1 */
29
30#define NFSDBG_FACILITY NFSDBG_CALLBACK
31
32/* Internal error code */
33#define NFS4ERR_RESOURCE_HDR 11050
34
35typedef __be32 (*callback_process_op_t)(void *, void *);

--- 309 unchanged lines hidden (view full) ---

345 p = read_buf(xdr, 4);
346 if (unlikely(p == NULL))
347 return htonl(NFS4ERR_BADXDR);
348 args->craa_type_mask = ntohl(*p);
349
350 return 0;
351}
352
353static unsigned decode_recallslot_args(struct svc_rqst *rqstp,
354 struct xdr_stream *xdr,
355 struct cb_recallslotargs *args)
356{
357 __be32 *p;
358
359 args->crsa_addr = svc_addr(rqstp);
360 p = read_buf(xdr, 4);
361 if (unlikely(p == NULL))
362 return htonl(NFS4ERR_BADXDR);
363 args->crsa_target_max_slots = ntohl(*p++);
364 return 0;
365}
366
352#endif /* CONFIG_NFS_V4_1 */
353
354static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
355{
356 __be32 *p;
357
358 p = xdr_reserve_space(xdr, 4 + len);
359 if (unlikely(p == NULL))

--- 192 unchanged lines hidden (view full) ---

552 return htonl(NFS4ERR_OP_NOT_IN_SESSION);
553 }
554
555 switch (op_nr) {
556 case OP_CB_GETATTR:
557 case OP_CB_RECALL:
558 case OP_CB_SEQUENCE:
559 case OP_CB_RECALL_ANY:
367#endif /* CONFIG_NFS_V4_1 */
368
369static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
370{
371 __be32 *p;
372
373 p = xdr_reserve_space(xdr, 4 + len);
374 if (unlikely(p == NULL))

--- 192 unchanged lines hidden (view full) ---

567 return htonl(NFS4ERR_OP_NOT_IN_SESSION);
568 }
569
570 switch (op_nr) {
571 case OP_CB_GETATTR:
572 case OP_CB_RECALL:
573 case OP_CB_SEQUENCE:
574 case OP_CB_RECALL_ANY:
575 case OP_CB_RECALL_SLOT:
560 *op = &callback_ops[op_nr];
561 break;
562
563 case OP_CB_LAYOUTRECALL:
564 case OP_CB_NOTIFY_DEVICEID:
565 case OP_CB_NOTIFY:
566 case OP_CB_PUSH_DELEG:
567 case OP_CB_RECALLABLE_OBJ_AVAIL:
576 *op = &callback_ops[op_nr];
577 break;
578
579 case OP_CB_LAYOUTRECALL:
580 case OP_CB_NOTIFY_DEVICEID:
581 case OP_CB_NOTIFY:
582 case OP_CB_PUSH_DELEG:
583 case OP_CB_RECALLABLE_OBJ_AVAIL:
568 case OP_CB_RECALL_SLOT:
569 case OP_CB_WANTS_CANCELLED:
570 case OP_CB_NOTIFY_LOCK:
571 return htonl(NFS4ERR_NOTSUPP);
572
573 default:
574 return htonl(NFS4ERR_OP_ILLEGAL);
575 }
576

--- 152 unchanged lines hidden (view full) ---

729 .encode_res = (callback_encode_res_t)encode_cb_sequence_res,
730 .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ,
731 },
732 [OP_CB_RECALL_ANY] = {
733 .process_op = (callback_process_op_t)nfs4_callback_recallany,
734 .decode_args = (callback_decode_arg_t)decode_recallany_args,
735 .res_maxsize = CB_OP_RECALLANY_RES_MAXSZ,
736 },
584 case OP_CB_WANTS_CANCELLED:
585 case OP_CB_NOTIFY_LOCK:
586 return htonl(NFS4ERR_NOTSUPP);
587
588 default:
589 return htonl(NFS4ERR_OP_ILLEGAL);
590 }
591

--- 152 unchanged lines hidden (view full) ---

744 .encode_res = (callback_encode_res_t)encode_cb_sequence_res,
745 .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ,
746 },
747 [OP_CB_RECALL_ANY] = {
748 .process_op = (callback_process_op_t)nfs4_callback_recallany,
749 .decode_args = (callback_decode_arg_t)decode_recallany_args,
750 .res_maxsize = CB_OP_RECALLANY_RES_MAXSZ,
751 },
752 [OP_CB_RECALL_SLOT] = {
753 .process_op = (callback_process_op_t)nfs4_callback_recallslot,
754 .decode_args = (callback_decode_arg_t)decode_recallslot_args,
755 .res_maxsize = CB_OP_RECALLSLOT_RES_MAXSZ,
756 },
737#endif /* CONFIG_NFS_V4_1 */
738};
739
740/*
741 * Define NFS4 callback procedures
742 */
743static struct svc_procedure nfs4_callback_procedures1[] = {
744 [CB_NULL] = {

--- 29 unchanged lines hidden ---
757#endif /* CONFIG_NFS_V4_1 */
758};
759
760/*
761 * Define NFS4 callback procedures
762 */
763static struct svc_procedure nfs4_callback_procedures1[] = {
764 [CB_NULL] = {

--- 29 unchanged lines hidden ---