123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
#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;
switch (val) {
case fsm_DN:
case fsm_DR:
case fsm_DW:
case fsm_DRW:
break;
default:
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;
switch (val) {
case fsa_NONE:
case fsa_R:
case fsa_W:
case fsa_RW:
break;
default:
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)
{
__be32 raw;
u32 val;
if (xdr_stream_decode_be32(xdr, &raw) < 0)
return false;
val = be32_to_cpu(raw);
switch (val) {
case NLM4_GRANTED:
case NLM4_DENIED:
case NLM4_DENIED_NOLOCKS:
case NLM4_BLOCKED:
case NLM4_DENIED_GRACE_PERIOD:
case NLM4_DEADLCK:
case NLM4_ROFS:
case NLM4_STALE_FH:
case NLM4_FBIG:
case NLM4_FAILED:
break;
default:
return false;
}
*ptr = raw;
return true;
}
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;
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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;
}
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);
}
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);
}
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);
}