linux-loongson/include/linux/sunrpc/xdrgen/_defs.h
Chuck Lever 631c2925ba xdrgen: Keep track of on-the-wire data type widths
The generic parts of the RPC layer need to know the widths (in
XDR_UNIT increments) of the XDR data types defined for each
protocol.

As a first step, add dictionaries to keep track of the symbolic and
actual maximum XDR width of XDR types.

This makes it straightforward to look up the width of a type by its
name. The built-in dictionaries are pre-loaded with the widths of
the built-in XDR types as defined in RFC 4506.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-11-11 13:42:01 -05:00

36 lines
702 B
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2024 Oracle and/or its affiliates.
*
* This header defines XDR data type primitives specified in
* Section 4 of RFC 4506, used by RPC programs implemented
* in the Linux kernel.
*/
#ifndef _SUNRPC_XDRGEN__DEFS_H_
#define _SUNRPC_XDRGEN__DEFS_H_
#define TRUE (true)
#define FALSE (false)
typedef struct {
u32 len;
unsigned char *data;
} string;
typedef struct {
u32 len;
u8 *data;
} opaque;
#define XDR_void (0)
#define XDR_bool (1)
#define XDR_int (1)
#define XDR_unsigned_int (1)
#define XDR_long (1)
#define XDR_unsigned_long (1)
#define XDR_hyper (2)
#define XDR_unsigned_hyper (2)
#endif /* _SUNRPC_XDRGEN__DEFS_H_ */