include/linux/sunrpc/xdr.h
Source file repositories/reference/linux-study-clean/include/linux/sunrpc/xdr.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/sunrpc/xdr.h- Extension
.h- Size
- 23286 bytes
- Lines
- 829
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/uio.hasm/byteorder.hlinux/unaligned.hlinux/scatterlist.h
Detected Declarations
struct bio_vecstruct rpc_rqststruct xdr_netobjstruct xdr_bufstruct xdr_array2_descstruct xdr_array2_descstruct xdr_streamfunction xdr_buf_initfunction quantitiesfunction xdr_decode_hyperfunction xdr_decode_opaque_fixedfunction xdr_netobj_dupfunction xdr_adjust_iovecfunction xdr_inline_decodefunction xdr_set_scratch_bufferfunction xdr_set_scratch_bufferfunction xdr_commit_encodefunction xdr_stream_remainingfunction Sizefunction Sizefunction xdr_stream_encode_item_presentfunction xdr_stream_encode_item_absentfunction xdr_stream_encode_boolfunction xdr_stream_encode_u32function xdr_stream_encode_be32function xdr_stream_encode_u64function xdr_stream_encode_opaque_inlinefunction xdr_stream_encode_opaque_fixedfunction xdr_stream_encode_opaquefunction xdr_stream_encode_uint32_arrayfunction xdr_item_is_absentfunction xdr_item_is_presentfunction xdr_stream_decode_boolfunction xdr_stream_decode_u32function xdr_stream_decode_be32function xdr_stream_decode_u64function xdr_stream_decode_opaque_fixedfunction xdr_stream_decode_opaque_inlinefunction xdr_stream_decode_uint32_array
Annotated Snippet
struct xdr_netobj {
unsigned int len;
u8 * data;
};
/*
* Basic structure for transmission/reception of a client XDR message.
* Features a header (for a linear buffer containing RPC headers
* and the data payload for short messages), and then an array of
* pages.
* The tail iovec allows you to append data after the page array. Its
* main interest is for appending padding to the pages in order to
* satisfy the int_32-alignment requirements in RFC1832.
*
* For the future, we might want to string several of these together
* in a list if anybody wants to make use of NFSv4 COMPOUND
* operations and/or has a need for scatter/gather involving pages.
*/
struct xdr_buf {
struct kvec head[1], /* RPC header + non-page data */
tail[1]; /* Appended after page data */
struct bio_vec *bvec;
struct page ** pages; /* Array of pages */
unsigned int page_base, /* Start of page data */
page_len, /* Length of page data */
flags; /* Flags for data disposition */
#define XDRBUF_READ 0x01 /* target of file read */
#define XDRBUF_WRITE 0x02 /* source of file write */
#define XDRBUF_SPARSE_PAGES 0x04 /* Page array is sparse */
unsigned int buflen, /* Total length of storage buffer */
len; /* Length of XDR encoded message */
};
static inline void
xdr_buf_init(struct xdr_buf *buf, void *start, size_t len)
{
buf->head[0].iov_base = start;
buf->head[0].iov_len = len;
buf->tail[0].iov_len = 0;
buf->pages = NULL;
buf->page_len = 0;
buf->flags = 0;
buf->len = 0;
buf->buflen = len;
}
/*
* pre-xdr'ed macros.
*/
#define xdr_zero cpu_to_be32(0)
#define xdr_one cpu_to_be32(1)
#define xdr_two cpu_to_be32(2)
#define rpc_auth_null cpu_to_be32(RPC_AUTH_NULL)
#define rpc_auth_unix cpu_to_be32(RPC_AUTH_UNIX)
#define rpc_auth_short cpu_to_be32(RPC_AUTH_SHORT)
#define rpc_auth_gss cpu_to_be32(RPC_AUTH_GSS)
#define rpc_auth_tls cpu_to_be32(RPC_AUTH_TLS)
#define rpc_call cpu_to_be32(RPC_CALL)
#define rpc_reply cpu_to_be32(RPC_REPLY)
#define rpc_msg_accepted cpu_to_be32(RPC_MSG_ACCEPTED)
#define rpc_success cpu_to_be32(RPC_SUCCESS)
#define rpc_prog_unavail cpu_to_be32(RPC_PROG_UNAVAIL)
#define rpc_prog_mismatch cpu_to_be32(RPC_PROG_MISMATCH)
#define rpc_proc_unavail cpu_to_be32(RPC_PROC_UNAVAIL)
#define rpc_garbage_args cpu_to_be32(RPC_GARBAGE_ARGS)
#define rpc_system_err cpu_to_be32(RPC_SYSTEM_ERR)
#define rpc_drop_reply cpu_to_be32(RPC_DROP_REPLY)
#define rpc_mismatch cpu_to_be32(RPC_MISMATCH)
#define rpc_auth_error cpu_to_be32(RPC_AUTH_ERROR)
#define rpc_auth_ok cpu_to_be32(RPC_AUTH_OK)
#define rpc_autherr_badcred cpu_to_be32(RPC_AUTH_BADCRED)
#define rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED)
#define rpc_autherr_badverf cpu_to_be32(RPC_AUTH_BADVERF)
#define rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF)
#define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK)
#define rpc_autherr_invalidresp cpu_to_be32(RPC_AUTH_INVALIDRESP)
#define rpc_autherr_failed cpu_to_be32(RPC_AUTH_FAILED)
#define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM)
#define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM)
/*
Annotation
- Immediate include surface: `linux/uio.h`, `asm/byteorder.h`, `linux/unaligned.h`, `linux/scatterlist.h`.
- Detected declarations: `struct bio_vec`, `struct rpc_rqst`, `struct xdr_netobj`, `struct xdr_buf`, `struct xdr_array2_desc`, `struct xdr_array2_desc`, `struct xdr_stream`, `function xdr_buf_init`, `function quantities`, `function xdr_decode_hyper`.
- 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.