linux/fs/nfs/callback_xdr.c

// SPDX-License-Identifier: GPL-2.0
/*
 * linux/fs/nfs/callback_xdr.c
 *
 * Copyright (C) 2004 Trond Myklebust
 *
 * NFSv4 callback encode/decode procedures
 */
#include <linux/kernel.h>
#include <linux/sunrpc/svc.h>
#include <linux/nfs4.h>
#include <linux/nfs_fs.h>
#include <linux/ratelimit.h>
#include <linux/printk.h>
#include <linux/slab.h>
#include <linux/sunrpc/bc_xprt.h>
#include "nfs4_fs.h"
#include "callback.h"
#include "internal.h"
#include "nfs4session.h"
#include "nfs4trace.h"

#define CB_OP_TAGLEN_MAXSZ
#define CB_OP_HDR_RES_MAXSZ
#define CB_OP_GETATTR_BITMAP_MAXSZ
#define CB_OP_GETATTR_RES_MAXSZ
#define CB_OP_RECALL_RES_MAXSZ

#if defined(CONFIG_NFS_V4_1)
#define CB_OP_LAYOUTRECALL_RES_MAXSZ
#define CB_OP_DEVICENOTIFY_RES_MAXSZ
#define CB_OP_SEQUENCE_RES_MAXSZ
#define CB_OP_RECALLANY_RES_MAXSZ
#define CB_OP_RECALLSLOT_RES_MAXSZ
#define CB_OP_NOTIFY_LOCK_RES_MAXSZ
#endif /* CONFIG_NFS_V4_1 */
#ifdef CONFIG_NFS_V4_2
#define CB_OP_OFFLOAD_RES_MAXSZ
#endif /* CONFIG_NFS_V4_2 */

#define NFSDBG_FACILITY

/* Internal error code */
#define NFS4ERR_RESOURCE_HDR

struct callback_op {};

static struct callback_op callback_ops[];

static __be32 nfs4_callback_null(struct svc_rqst *rqstp)
{}

/*
 * svc_process_common() looks for an XDR encoder to know when
 * not to drop a Reply.
 */
static bool nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{}

static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len,
		const char **str, size_t maxlen)
{}

static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
{}

static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
{}

static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
{}

static __be32 decode_delegation_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
{}

static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
{}

static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
{}

static __be32 decode_getattr_args(struct svc_rqst *rqstp,
		struct xdr_stream *xdr, void *argp)
{}

static __be32 decode_recall_args(struct svc_rqst *rqstp,
		struct xdr_stream *xdr, void *argp)
{}

#if defined(CONFIG_NFS_V4_1)
static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
{}

static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
				       struct xdr_stream *xdr, void *argp)
{}

static
__be32 decode_devicenotify_args(struct svc_rqst *rqstp,
				struct xdr_stream *xdr,
				void *argp)
{}

static __be32 decode_sessionid(struct xdr_stream *xdr,
				 struct nfs4_sessionid *sid)
{}

static __be32 decode_rc_list(struct xdr_stream *xdr,
			       struct referring_call_list *rc_list)
{}

static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
					struct xdr_stream *xdr,
					void *argp)
{}

static __be32 decode_recallany_args(struct svc_rqst *rqstp,
				      struct xdr_stream *xdr,
				      void *argp)
{}

static __be32 decode_recallslot_args(struct svc_rqst *rqstp,
					struct xdr_stream *xdr,
					void *argp)
{}

static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_args *args)
{}

static __be32 decode_notify_lock_args(struct svc_rqst *rqstp,
		struct xdr_stream *xdr, void *argp)
{}

#endif /* CONFIG_NFS_V4_1 */
#ifdef CONFIG_NFS_V4_2
static __be32 decode_write_response(struct xdr_stream *xdr,
					struct cb_offloadargs *args)
{}

static __be32 decode_offload_args(struct svc_rqst *rqstp,
					struct xdr_stream *xdr,
					void *data)
{}
#endif /* CONFIG_NFS_V4_2 */
static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
{}

static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, size_t sz)
{}

static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change)
{}

static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size)
{}

static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec64 *time)
{}

static __be32 encode_attr_atime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec64 *time)
{}

static __be32 encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec64 *time)
{}

static __be32 encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec64 *time)
{}

static __be32 encode_attr_delegatime(struct xdr_stream *xdr,
				     const uint32_t *bitmap,
				     const struct timespec64 *time)
{}

static __be32 encode_attr_delegmtime(struct xdr_stream *xdr,
				     const uint32_t *bitmap,
				     const struct timespec64 *time)
{}

static __be32 encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr)
{}

static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
{}

static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
		const void *resp)
{}

#if defined(CONFIG_NFS_V4_1)

static __be32 encode_sessionid(struct xdr_stream *xdr,
				 const struct nfs4_sessionid *sid)
{}

static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp,
				       struct xdr_stream *xdr,
				       const void *resp)
{}

static __be32
preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
{}

static void nfs4_callback_free_slot(struct nfs4_session *session,
		struct nfs4_slot *slot)
{}

static void nfs4_cb_free_slot(struct cb_process_state *cps)
{}

#else /* CONFIG_NFS_V4_1 */

static __be32
preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
{
	return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
}

static void nfs4_cb_free_slot(struct cb_process_state *cps)
{
}
#endif /* CONFIG_NFS_V4_1 */

#ifdef CONFIG_NFS_V4_2
static __be32
preprocess_nfs42_op(int nop, unsigned int op_nr, struct callback_op **op)
{}
#else /* CONFIG_NFS_V4_2 */
static __be32
preprocess_nfs42_op(int nop, unsigned int op_nr, struct callback_op **op)
{
	return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
}
#endif /* CONFIG_NFS_V4_2 */

static __be32
preprocess_nfs4_op(unsigned int op_nr, struct callback_op **op)
{}

static __be32 process_op(int nop, struct svc_rqst *rqstp,
			 struct cb_process_state *cps)
{}

/*
 * Decode, process and encode a COMPOUND
 */
static __be32 nfs4_callback_compound(struct svc_rqst *rqstp)
{}

static int
nfs_callback_dispatch(struct svc_rqst *rqstp)
{}

/*
 * Define NFS4 callback COMPOUND ops.
 */
static struct callback_op callback_ops[] =;

/*
 * Define NFS4 callback procedures
 */
static const struct svc_procedure nfs4_callback_procedures1[] =;

static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nfs4_callback_count1[ARRAY_SIZE(nfs4_callback_procedures1)]);
const struct svc_version nfs4_callback_version1 =;

static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nfs4_callback_count4[ARRAY_SIZE(nfs4_callback_procedures1)]);
const struct svc_version nfs4_callback_version4 =;