fs/lockd/nlm3xdr_gen.c

Source file repositories/reference/linux-study-clean/fs/lockd/nlm3xdr_gen.c

File Facts

System
Linux kernel
Corpus path
fs/lockd/nlm3xdr_gen.c
Extension
.c
Size
18327 bytes
Lines
715
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
// Generated by xdrgen. Manual edits will be lost.
// XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x
// XDR specification modification time: Thu Apr 23 10:56:34 2026

#include <linux/sunrpc/svc.h>

#include "nlm3xdr_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_nlm_stats(struct xdr_stream *xdr, nlm_stats *ptr)
{
	__be32 raw;
	u32 val;

	if (xdr_stream_decode_be32(xdr, &raw) < 0)
		return false;
	val = be32_to_cpu(raw);
	/* Compiler may optimize to a range check for dense enums */
	switch (val) {
	case LCK_GRANTED:
	case LCK_DENIED:
	case LCK_DENIED_NOLOCKS:
	case LCK_BLOCKED:
	case LCK_DENIED_GRACE_PERIOD:
		break;
	default:
		return false;
	}
	*ptr = raw;
	return true;
}

static bool __maybe_unused
xdrgen_decode_nlm_stat(struct xdr_stream *xdr, struct nlm_stat *ptr)
{
	if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
		return false;
	return true;
}

static bool __maybe_unused
xdrgen_decode_nlm_res(struct xdr_stream *xdr, struct nlm_res *ptr)
{
	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
		return false;
	if (!xdrgen_decode_nlm_stat(xdr, &ptr->stat))
		return false;
	return true;
}

static bool __maybe_unused
xdrgen_decode_nlm_holder(struct xdr_stream *xdr, struct nlm_holder *ptr)
{
	if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
		return false;
	if (!xdrgen_decode_int(xdr, &ptr->uppid))
		return false;
	if (!xdrgen_decode_netobj(xdr, &ptr->oh))
		return false;
	if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_offset))
		return false;
	if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_len))
		return false;
	return true;
}

static bool __maybe_unused
xdrgen_decode_nlm_testrply(struct xdr_stream *xdr, struct nlm_testrply *ptr)
{
	if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
		return false;
	switch (ptr->stat) {
	case __constant_cpu_to_be32(LCK_DENIED):
		if (!xdrgen_decode_nlm_holder(xdr, &ptr->u.holder))
			return false;
		break;
	default:
		break;
	}
	return true;
}

static bool __maybe_unused

Annotation

Implementation Notes