include/linux/sunrpc/xdrgen/_builtins.h
Source file repositories/reference/linux-study-clean/include/linux/sunrpc/xdrgen/_builtins.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/sunrpc/xdrgen/_builtins.h- Extension
.h- Size
- 6112 bytes
- Lines
- 300
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sunrpc/xdr.h
Detected Declarations
function Copyrightfunction xdrgen_encode_voidfunction xdrgen_decode_boolfunction xdrgen_encode_boolfunction factofunction factofunction factofunction xdrgen_encode_unsigned_shortfunction xdrgen_decode_intfunction xdrgen_encode_intfunction xdrgen_decode_unsigned_intfunction xdrgen_encode_unsigned_intfunction xdrgen_decode_longfunction xdrgen_encode_longfunction xdrgen_decode_unsigned_longfunction xdrgen_encode_unsigned_longfunction xdrgen_decode_hyperfunction xdrgen_encode_hyperfunction xdrgen_decode_unsigned_hyperfunction xdrgen_encode_unsigned_hyperfunction xdrgen_decode_stringfunction xdrgen_encode_stringfunction xdrgen_decode_opaquefunction xdrgen_encode_opaque
Annotated Snippet
#ifndef _SUNRPC_XDRGEN__BUILTINS_H_
#define _SUNRPC_XDRGEN__BUILTINS_H_
#include <linux/sunrpc/xdr.h>
static inline bool
xdrgen_decode_void(struct xdr_stream *xdr)
{
return true;
}
static inline bool
xdrgen_encode_void(struct xdr_stream *xdr)
{
return true;
}
static inline bool
xdrgen_decode_bool(struct xdr_stream *xdr, bool *ptr)
{
__be32 *p = xdr_inline_decode(xdr, XDR_UNIT);
if (unlikely(!p))
return false;
*ptr = (*p != xdr_zero);
return true;
}
static inline bool
xdrgen_encode_bool(struct xdr_stream *xdr, bool val)
{
__be32 *p = xdr_reserve_space(xdr, XDR_UNIT);
if (unlikely(!p))
return false;
*p = val ? xdr_one : xdr_zero;
return true;
}
/*
* De facto (non-standard but commonly implemented) signed short type:
* - Wire sends sign-extended 32-bit value (e.g., 0xFFFFFFFF)
* - be32_to_cpup() returns u32 (0xFFFFFFFF)
* - Explicit (s16) cast truncates to 16 bits (0xFFFF = -1)
*/
static inline bool
xdrgen_decode_short(struct xdr_stream *xdr, s16 *ptr)
{
__be32 *p = xdr_inline_decode(xdr, XDR_UNIT);
if (unlikely(!p))
return false;
*ptr = (s16)be32_to_cpup(p);
return true;
}
/*
* De facto (non-standard but commonly implemented) signed short type:
* - C integer promotion sign-extends s16 val to int before passing to
* cpu_to_be32()
* - This is well-defined: -1 as s16 -1 as int 0xFFFFFFFF on wire
*/
static inline bool
xdrgen_encode_short(struct xdr_stream *xdr, s16 val)
{
__be32 *p = xdr_reserve_space(xdr, XDR_UNIT);
if (unlikely(!p))
return false;
*p = cpu_to_be32(val);
return true;
}
/*
* De facto (non-standard but commonly implemented) unsigned short type:
* 16-bit integer zero-extended to fill one XDR_UNIT.
*/
static inline bool
xdrgen_decode_unsigned_short(struct xdr_stream *xdr, u16 *ptr)
{
__be32 *p = xdr_inline_decode(xdr, XDR_UNIT);
if (unlikely(!p))
return false;
*ptr = (u16)be32_to_cpup(p);
return true;
}
static inline bool
xdrgen_encode_unsigned_short(struct xdr_stream *xdr, u16 val)
Annotation
- Immediate include surface: `linux/sunrpc/xdr.h`.
- Detected declarations: `function Copyright`, `function xdrgen_encode_void`, `function xdrgen_decode_bool`, `function xdrgen_encode_bool`, `function facto`, `function facto`, `function facto`, `function xdrgen_encode_unsigned_short`, `function xdrgen_decode_int`, `function xdrgen_encode_int`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.