fs/lockd/clntxdr.c
Source file repositories/reference/linux-study-clean/fs/lockd/clntxdr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/lockd/clntxdr.c- Extension
.c- Size
- 13585 bytes
- Lines
- 615
- 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.
- 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/types.hlinux/sunrpc/xdr.hlinux/sunrpc/clnt.hlinux/sunrpc/stats.hlockd.huapi/linux/nfs2.h
Detected Declarations
function Copyrightfunction nlm_compute_offsetsfunction encode_boolfunction encode_int32function encode_netobjfunction decode_netobjfunction encode_cookiefunction decode_cookiefunction encode_fhfunction encode_nlm_statfunction decode_nlm_statfunction encode_nlm_holderfunction decode_nlm_holderfunction encode_caller_namefunction encode_nlm_lockfunction nlm_xdr_enc_testargsfunction nlm_xdr_enc_lockargsfunction nlm_xdr_enc_cancargsfunction nlm_xdr_enc_unlockargsfunction nlm_xdr_enc_resfunction encode_nlm_testrplyfunction nlm_xdr_enc_testresfunction decode_nlm_testrplyfunction nlm_xdr_dec_testresfunction nlm_xdr_dec_res
Annotated Snippet
* union nlm_testrply switch (nlm_stats stat) {
* case LCK_DENIED:
* struct nlm_holder holder;
* default:
* void;
* };
*
* struct nlm_testres {
* netobj cookie;
* nlm_testrply test_stat;
* };
*/
static void encode_nlm_testrply(struct xdr_stream *xdr,
const struct lockd_res *result)
{
if (result->status == nlm_lck_denied)
encode_nlm_holder(xdr, result);
}
static void nlm_xdr_enc_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
const struct lockd_res *result = data;
encode_cookie(xdr, &result->cookie);
encode_nlm_stat(xdr, result->status);
encode_nlm_testrply(xdr, result);
}
/*
* NLMv3 XDR decode functions
*
* NLMv3 result types are defined in Chapter 10 of The Open Group's
* "Protocols for Interworking: XNFS, Version 3W".
*/
/*
* union nlm_testrply switch (nlm_stats stat) {
* case LCK_DENIED:
* struct nlm_holder holder;
* default:
* void;
* };
*
* struct nlm_testres {
* netobj cookie;
* nlm_testrply test_stat;
* };
*/
static int decode_nlm_testrply(struct xdr_stream *xdr,
struct lockd_res *result)
{
int error;
error = decode_nlm_stat(xdr, &result->status);
if (unlikely(error))
goto out;
if (result->status == nlm_lck_denied)
error = decode_nlm_holder(xdr, result);
out:
return error;
}
static int nlm_xdr_dec_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
void *data)
{
struct lockd_res *result = data;
int error;
error = decode_cookie(xdr, &result->cookie);
if (unlikely(error))
goto out;
error = decode_nlm_testrply(xdr, result);
out:
return error;
}
/*
* struct nlm_res {
* netobj cookie;
* nlm_stat stat;
* };
*/
static int nlm_xdr_dec_res(struct rpc_rqst *req,
struct xdr_stream *xdr,
void *data)
{
Annotation
- Immediate include surface: `linux/types.h`, `linux/sunrpc/xdr.h`, `linux/sunrpc/clnt.h`, `linux/sunrpc/stats.h`, `lockd.h`, `uapi/linux/nfs2.h`.
- Detected declarations: `function Copyright`, `function nlm_compute_offsets`, `function encode_bool`, `function encode_int32`, `function encode_netobj`, `function decode_netobj`, `function encode_cookie`, `function decode_cookie`, `function encode_fh`, `function encode_nlm_stat`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- 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.