fs/nfs/callback_xdr.c
Source file repositories/reference/linux-study-clean/fs/nfs/callback_xdr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/callback_xdr.c- Extension
.c- Size
- 28570 bytes
- Lines
- 1118
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/kernel.hlinux/sunrpc/svc.hlinux/nfs4.hlinux/nfs_fs.hlinux/ratelimit.hlinux/printk.hlinux/slab.hlinux/sunrpc/bc_xprt.hnfs4_fs.hcallback.hinternal.hnfs4session.hnfs4trace.h
Detected Declarations
struct callback_opfunction nfs4_callback_nullfunction svc_process_commonfunction decode_stringfunction decode_fhfunction decode_bitmapfunction decode_stateidfunction decode_delegation_stateidfunction decode_compound_hdr_argfunction decode_op_hdrfunction decode_getattr_argsfunction decode_recall_argsfunction decode_layout_stateidfunction decode_layoutrecall_argsfunction decode_devicenotify_argsfunction decode_sessionidfunction decode_rc_listfunction decode_cb_sequence_argsfunction decode_recallany_argsfunction decode_recallslot_argsfunction decode_lockownerfunction decode_notify_lock_argsfunction decode_write_responsefunction decode_offload_argsfunction encode_stringfunction encode_attr_bitmapfunction encode_attr_changefunction encode_attr_sizefunction encode_attr_timefunction encode_attr_atimefunction encode_attr_ctimefunction encode_attr_mtimefunction encode_attr_delegatimefunction encode_attr_delegmtimefunction encode_compound_hdr_resfunction encode_op_hdrfunction encode_getattr_resfunction encode_sessionidfunction encode_cb_sequence_resfunction preprocess_nfs41_opfunction nfs4_callback_free_slotfunction nfs4_cb_free_slotfunction preprocess_nfs42_opfunction preprocess_nfs42_opfunction preprocess_nfs4_opfunction process_opfunction nfs4_callback_compoundfunction nfs_callback_dispatch
Annotated Snippet
struct callback_op {
__be32 (*process_op)(void *, void *, struct cb_process_state *);
__be32 (*decode_args)(struct svc_rqst *, struct xdr_stream *, void *);
__be32 (*encode_res)(struct svc_rqst *, struct xdr_stream *,
const void *);
long res_maxsize;
};
static struct callback_op callback_ops[];
static __be32 nfs4_callback_null(struct svc_rqst *rqstp)
{
return htonl(NFS4_OK);
}
/*
* svc_process_common() looks for an XDR encoder to know when
* not to drop a Reply.
*/
static bool nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
return true;
}
static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len,
const char **str, size_t maxlen)
{
ssize_t err;
err = xdr_stream_decode_opaque_inline(xdr, (void **)str, maxlen);
if (err < 0)
return cpu_to_be32(NFS4ERR_RESOURCE);
*len = err;
return 0;
}
static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
{
__be32 *p;
p = xdr_inline_decode(xdr, 4);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
fh->size = ntohl(*p);
if (fh->size > NFS4_FHSIZE)
return htonl(NFS4ERR_BADHANDLE);
p = xdr_inline_decode(xdr, fh->size);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
memcpy_and_pad(fh->data, sizeof(fh->data), p, fh->size, 0);
return 0;
}
static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
{
__be32 *p;
unsigned int attrlen;
p = xdr_inline_decode(xdr, 4);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
attrlen = ntohl(*p);
p = xdr_inline_decode(xdr, attrlen << 2);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
if (likely(attrlen > 0))
bitmap[0] = ntohl(*p++);
if (attrlen > 1)
bitmap[1] = ntohl(*p++);
if (attrlen > 2)
bitmap[2] = ntohl(*p);
return 0;
}
static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
{
__be32 *p;
p = xdr_inline_decode(xdr, NFS4_STATEID_SIZE);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
memcpy(stateid->data, p, NFS4_STATEID_SIZE);
return 0;
}
static __be32 decode_delegation_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
{
stateid->type = NFS4_DELEGATION_STATEID_TYPE;
return decode_stateid(xdr, stateid);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/sunrpc/svc.h`, `linux/nfs4.h`, `linux/nfs_fs.h`, `linux/ratelimit.h`, `linux/printk.h`, `linux/slab.h`, `linux/sunrpc/bc_xprt.h`.
- Detected declarations: `struct callback_op`, `function nfs4_callback_null`, `function svc_process_common`, `function decode_string`, `function decode_fh`, `function decode_bitmap`, `function decode_stateid`, `function decode_delegation_stateid`, `function decode_compound_hdr_arg`, `function decode_op_hdr`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.