mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
In order to generate source code to encode and decode NLMv4 protocol elements, include a copy of the RPC language description of NLMv4 for xdrgen to process. The language description is an amalgam of RFC 1813 and the Open Group's XNFS specification: https://pubs.opengroup.org/onlinepubs/9629799/chap10.htm The C code committed here was generated from the new nlm4.x file using tools/net/sunrpc/xdrgen/xdrgen. The goals of replacing hand-written XDR functions with ones that are tool-generated are to improve memory safety and make XDR encoding and decoding less brittle to maintain. The xdrgen utility derives both the type definitions and the encode/decode functions directly from protocol specifications, using names and symbols familiar to anyone who knows those specs. Unlike hand-written code that can inadvertently diverge from the specification, xdrgen guarantees that the generated code matches the specification exactly. We would eventually like xdrgen to generate Rust code as well, making the conversion of the kernel's NFS stacks to use Rust just a little easier for us. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
725 lines
18 KiB
C
725 lines
18 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Generated by xdrgen. Manual edits will be lost.
|
|
// XDR specification file: ../../Documentation/sunrpc/xdr/nlm4.x
|
|
// XDR specification modification time: Thu Dec 25 13:10:19 2025
|
|
|
|
#include <linux/sunrpc/svc.h>
|
|
|
|
#include "nlm4xdr_gen.h"
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_netobj(struct xdr_stream *xdr, netobj *ptr)
|
|
{
|
|
return xdrgen_decode_opaque(xdr, ptr, MAXNETOBJ_SZ);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_fsh4_mode(struct xdr_stream *xdr, fsh4_mode *ptr)
|
|
{
|
|
u32 val;
|
|
|
|
if (xdr_stream_decode_u32(xdr, &val) < 0)
|
|
return false;
|
|
*ptr = val;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_fsh4_access(struct xdr_stream *xdr, fsh4_access *ptr)
|
|
{
|
|
u32 val;
|
|
|
|
if (xdr_stream_decode_u32(xdr, &val) < 0)
|
|
return false;
|
|
*ptr = val;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_uint64(struct xdr_stream *xdr, uint64 *ptr)
|
|
{
|
|
return xdrgen_decode_unsigned_hyper(xdr, ptr);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_int64(struct xdr_stream *xdr, int64 *ptr)
|
|
{
|
|
return xdrgen_decode_hyper(xdr, ptr);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_uint32(struct xdr_stream *xdr, uint32 *ptr)
|
|
{
|
|
return xdrgen_decode_unsigned_long(xdr, ptr);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_int32(struct xdr_stream *xdr, int32 *ptr)
|
|
{
|
|
return xdrgen_decode_long(xdr, ptr);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_stats(struct xdr_stream *xdr, nlm4_stats *ptr)
|
|
{
|
|
return xdr_stream_decode_be32(xdr, ptr) == 0;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_holder(struct xdr_stream *xdr, struct nlm4_holder *ptr)
|
|
{
|
|
if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
|
|
return false;
|
|
if (!xdrgen_decode_int32(xdr, &ptr->svid))
|
|
return false;
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->oh))
|
|
return false;
|
|
if (!xdrgen_decode_uint64(xdr, &ptr->l_offset))
|
|
return false;
|
|
if (!xdrgen_decode_uint64(xdr, &ptr->l_len))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_testrply(struct xdr_stream *xdr, struct nlm4_testrply *ptr)
|
|
{
|
|
if (!xdrgen_decode_nlm4_stats(xdr, &ptr->stat))
|
|
return false;
|
|
switch (ptr->stat) {
|
|
case __constant_cpu_to_be32(NLM4_DENIED):
|
|
if (!xdrgen_decode_nlm4_holder(xdr, &ptr->u.holder))
|
|
return false;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_stat(struct xdr_stream *xdr, struct nlm4_stat *ptr)
|
|
{
|
|
if (!xdrgen_decode_nlm4_stats(xdr, &ptr->stat))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_res(struct xdr_stream *xdr, struct nlm4_res *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_stat(xdr, &ptr->stat))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_testres(struct xdr_stream *xdr, struct nlm4_testres *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_testrply(xdr, &ptr->stat))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_lock(struct xdr_stream *xdr, struct nlm4_lock *ptr)
|
|
{
|
|
if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
|
|
return false;
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->fh))
|
|
return false;
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->oh))
|
|
return false;
|
|
if (!xdrgen_decode_int32(xdr, &ptr->svid))
|
|
return false;
|
|
if (!xdrgen_decode_uint64(xdr, &ptr->l_offset))
|
|
return false;
|
|
if (!xdrgen_decode_uint64(xdr, &ptr->l_len))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_lockargs(struct xdr_stream *xdr, struct nlm4_lockargs *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_bool(xdr, &ptr->block))
|
|
return false;
|
|
if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
|
|
return false;
|
|
if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
|
|
return false;
|
|
if (!xdrgen_decode_int32(xdr, &ptr->state))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_cancargs(struct xdr_stream *xdr, struct nlm4_cancargs *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_bool(xdr, &ptr->block))
|
|
return false;
|
|
if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_testargs(struct xdr_stream *xdr, struct nlm4_testargs *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_unlockargs(struct xdr_stream *xdr, struct nlm4_unlockargs *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_share(struct xdr_stream *xdr, struct nlm4_share *ptr)
|
|
{
|
|
if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
|
|
return false;
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->fh))
|
|
return false;
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->oh))
|
|
return false;
|
|
if (!xdrgen_decode_fsh4_mode(xdr, &ptr->mode))
|
|
return false;
|
|
if (!xdrgen_decode_fsh4_access(xdr, &ptr->access))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_shareargs(struct xdr_stream *xdr, struct nlm4_shareargs *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_share(xdr, &ptr->share))
|
|
return false;
|
|
if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_shareres(struct xdr_stream *xdr, struct nlm4_shareres *ptr)
|
|
{
|
|
if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
|
|
return false;
|
|
if (!xdrgen_decode_nlm4_stats(xdr, &ptr->stat))
|
|
return false;
|
|
if (!xdrgen_decode_int32(xdr, &ptr->sequence))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_notify(struct xdr_stream *xdr, struct nlm4_notify *ptr)
|
|
{
|
|
if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXNAMELEN))
|
|
return false;
|
|
if (!xdrgen_decode_int32(xdr, &ptr->state))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_decode_nlm4_notifyargs(struct xdr_stream *xdr, struct nlm4_notifyargs *ptr)
|
|
{
|
|
if (!xdrgen_decode_nlm4_notify(xdr, &ptr->notify))
|
|
return false;
|
|
if (xdr_stream_decode_opaque_fixed(xdr, ptr->private, SM_PRIV_SIZE) < 0)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_void - Decode a void argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
return xdrgen_decode_void(xdr);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_testargs - Decode a nlm4_testargs argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_testargs *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_testargs(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_lockargs - Decode a nlm4_lockargs argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_lockargs *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_lockargs(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_cancargs - Decode a nlm4_cancargs argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_cancargs *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_cancargs(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_unlockargs - Decode a nlm4_unlockargs argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_unlockargs *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_unlockargs(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_testres - Decode a nlm4_testres argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_testres *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_testres(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_res - Decode a nlm4_res argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_res *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_res(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_notifyargs - Decode a nlm4_notifyargs argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_notifyargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_notifyargs *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_notifyargs(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_shareargs - Decode a nlm4_shareargs argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_shareargs *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_shareargs(xdr, argp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_decode_nlm4_notify - Decode a nlm4_notify argument
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: source XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure arguments decoded successfully
|
|
* %false: decode failed
|
|
*/
|
|
bool nlm4_svc_decode_nlm4_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_notify *argp = rqstp->rq_argp;
|
|
|
|
return xdrgen_decode_nlm4_notify(xdr, argp);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_netobj(struct xdr_stream *xdr, const netobj value)
|
|
{
|
|
return xdr_stream_encode_opaque(xdr, value.data, value.len) >= 0;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_fsh4_mode(struct xdr_stream *xdr, fsh4_mode value)
|
|
{
|
|
return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_fsh4_access(struct xdr_stream *xdr, fsh4_access value)
|
|
{
|
|
return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_uint64(struct xdr_stream *xdr, const uint64 value)
|
|
{
|
|
return xdrgen_encode_unsigned_hyper(xdr, value);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_int64(struct xdr_stream *xdr, const int64 value)
|
|
{
|
|
return xdrgen_encode_hyper(xdr, value);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_uint32(struct xdr_stream *xdr, const uint32 value)
|
|
{
|
|
return xdrgen_encode_unsigned_long(xdr, value);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_int32(struct xdr_stream *xdr, const int32 value)
|
|
{
|
|
return xdrgen_encode_long(xdr, value);
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_stats(struct xdr_stream *xdr, nlm4_stats value)
|
|
{
|
|
return xdr_stream_encode_be32(xdr, value) == XDR_UNIT;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_holder(struct xdr_stream *xdr, const struct nlm4_holder *value)
|
|
{
|
|
if (!xdrgen_encode_bool(xdr, value->exclusive))
|
|
return false;
|
|
if (!xdrgen_encode_int32(xdr, value->svid))
|
|
return false;
|
|
if (!xdrgen_encode_netobj(xdr, value->oh))
|
|
return false;
|
|
if (!xdrgen_encode_uint64(xdr, value->l_offset))
|
|
return false;
|
|
if (!xdrgen_encode_uint64(xdr, value->l_len))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_testrply(struct xdr_stream *xdr, const struct nlm4_testrply *ptr)
|
|
{
|
|
if (!xdrgen_encode_nlm4_stats(xdr, ptr->stat))
|
|
return false;
|
|
switch (ptr->stat) {
|
|
case __constant_cpu_to_be32(NLM4_DENIED):
|
|
if (!xdrgen_encode_nlm4_holder(xdr, &ptr->u.holder))
|
|
return false;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_stat(struct xdr_stream *xdr, const struct nlm4_stat *value)
|
|
{
|
|
if (!xdrgen_encode_nlm4_stats(xdr, value->stat))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_res(struct xdr_stream *xdr, const struct nlm4_res *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_stat(xdr, &value->stat))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_testres(struct xdr_stream *xdr, const struct nlm4_testres *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_testrply(xdr, &value->stat))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_lock(struct xdr_stream *xdr, const struct nlm4_lock *value)
|
|
{
|
|
if (value->caller_name.len > LM_MAXSTRLEN)
|
|
return false;
|
|
if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
|
|
return false;
|
|
if (!xdrgen_encode_netobj(xdr, value->fh))
|
|
return false;
|
|
if (!xdrgen_encode_netobj(xdr, value->oh))
|
|
return false;
|
|
if (!xdrgen_encode_int32(xdr, value->svid))
|
|
return false;
|
|
if (!xdrgen_encode_uint64(xdr, value->l_offset))
|
|
return false;
|
|
if (!xdrgen_encode_uint64(xdr, value->l_len))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_lockargs(struct xdr_stream *xdr, const struct nlm4_lockargs *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_bool(xdr, value->block))
|
|
return false;
|
|
if (!xdrgen_encode_bool(xdr, value->exclusive))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
|
|
return false;
|
|
if (!xdrgen_encode_bool(xdr, value->reclaim))
|
|
return false;
|
|
if (!xdrgen_encode_int32(xdr, value->state))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_cancargs(struct xdr_stream *xdr, const struct nlm4_cancargs *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_bool(xdr, value->block))
|
|
return false;
|
|
if (!xdrgen_encode_bool(xdr, value->exclusive))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_testargs(struct xdr_stream *xdr, const struct nlm4_testargs *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_bool(xdr, value->exclusive))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_unlockargs(struct xdr_stream *xdr, const struct nlm4_unlockargs *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_share(struct xdr_stream *xdr, const struct nlm4_share *value)
|
|
{
|
|
if (value->caller_name.len > LM_MAXSTRLEN)
|
|
return false;
|
|
if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
|
|
return false;
|
|
if (!xdrgen_encode_netobj(xdr, value->fh))
|
|
return false;
|
|
if (!xdrgen_encode_netobj(xdr, value->oh))
|
|
return false;
|
|
if (!xdrgen_encode_fsh4_mode(xdr, value->mode))
|
|
return false;
|
|
if (!xdrgen_encode_fsh4_access(xdr, value->access))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_shareargs(struct xdr_stream *xdr, const struct nlm4_shareargs *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_share(xdr, &value->share))
|
|
return false;
|
|
if (!xdrgen_encode_bool(xdr, value->reclaim))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_shareres(struct xdr_stream *xdr, const struct nlm4_shareres *value)
|
|
{
|
|
if (!xdrgen_encode_netobj(xdr, value->cookie))
|
|
return false;
|
|
if (!xdrgen_encode_nlm4_stats(xdr, value->stat))
|
|
return false;
|
|
if (!xdrgen_encode_int32(xdr, value->sequence))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_notify(struct xdr_stream *xdr, const struct nlm4_notify *value)
|
|
{
|
|
if (value->name.len > LM_MAXNAMELEN)
|
|
return false;
|
|
if (xdr_stream_encode_opaque(xdr, value->name.data, value->name.len) < 0)
|
|
return false;
|
|
if (!xdrgen_encode_int32(xdr, value->state))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool __maybe_unused
|
|
xdrgen_encode_nlm4_notifyargs(struct xdr_stream *xdr, const struct nlm4_notifyargs *value)
|
|
{
|
|
if (!xdrgen_encode_nlm4_notify(xdr, &value->notify))
|
|
return false;
|
|
if (xdr_stream_encode_opaque_fixed(xdr, value->private, SM_PRIV_SIZE) < 0)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_encode_void - Encode a void result
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: target XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure results encoded successfully
|
|
* %false: encode failed
|
|
*/
|
|
bool nlm4_svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
return xdrgen_encode_void(xdr);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_encode_nlm4_testres - Encode a nlm4_testres result
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: target XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure results encoded successfully
|
|
* %false: encode failed
|
|
*/
|
|
bool nlm4_svc_encode_nlm4_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_testres *resp = rqstp->rq_resp;
|
|
|
|
return xdrgen_encode_nlm4_testres(xdr, resp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_encode_nlm4_res - Encode a nlm4_res result
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: target XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure results encoded successfully
|
|
* %false: encode failed
|
|
*/
|
|
bool nlm4_svc_encode_nlm4_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_res *resp = rqstp->rq_resp;
|
|
|
|
return xdrgen_encode_nlm4_res(xdr, resp);
|
|
}
|
|
|
|
/**
|
|
* nlm4_svc_encode_nlm4_shareres - Encode a nlm4_shareres result
|
|
* @rqstp: RPC transaction context
|
|
* @xdr: target XDR data stream
|
|
*
|
|
* Return values:
|
|
* %true: procedure results encoded successfully
|
|
* %false: encode failed
|
|
*/
|
|
bool nlm4_svc_encode_nlm4_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|
{
|
|
struct nlm4_shareres *resp = rqstp->rq_resp;
|
|
|
|
return xdrgen_encode_nlm4_shareres(xdr, resp);
|
|
}
|