fs/nfsd/nfs4xdr.c
Source file repositories/reference/linux-study-clean/fs/nfsd/nfs4xdr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfsd/nfs4xdr.c- Extension
.c- Size
- 177577 bytes
- Lines
- 6490
- 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/file.hlinux/slab.hlinux/namei.hlinux/statfs.hlinux/utsname.hlinux/pagemap.hlinux/sunrpc/svcauth_gss.hlinux/sunrpc/addr.hlinux/xattr.hlinux/vmalloc.hlinux/nfsacl.huapi/linux/xattr.hidmap.hacl.hxdr4.hvfs.hstate.hcache.hnetns.hpnfs.hfilecache.hnfs4xdr_gen.htrace.hlinux/security.h
Detected Declarations
struct nfsd4_fattr_argsfunction check_filenamefunction zero_clientidfunction svcxdr_tmpallocfunction svcxdr_dupstrfunction svcxdr_savememfunction nfsd4_decode_ignored_stringfunction nfsd4_decode_opaquefunction nfsd4_decode_component4function nfsd4_decode_nfstime4function nfsd4_decode_verifier4function nfsd4_decode_bitmap4function nfsd4_decode_nfsace4function nfsd4_decode_aclfunction nfsd4_decode_security_labelfunction nfsd4_posixacetag4_to_tagfunction nfsd4_decode_posixace4function nfsd4_decode_posixaclfunction nfsd4_decode_fattr4function nfsd4_decode_stateid4function nfsd4_decode_clientid4function nfsd4_decode_state_owner4function nfsd4_decode_layoutupdate4function nfsd4_decode_layoutreturn4function nfsd4_decode_sessionid4function nfsd4_decode_authsys_parmsfunction nfsd4_decode_gss_cb_handles4function nfsd4_decode_cb_secfunction nfsd4_decode_accessfunction nfsd4_decode_closefunction nfsd4_decode_commitfunction nfsd4_decode_createfunction nfsd4_decode_delegreturnfunction nfsd4_decode_getattrfunction nfsd4_decode_linkfunction nfsd4_decode_open_to_lock_owner4function nfsd4_decode_exist_lock_owner4function nfsd4_decode_locker4function nfsd4_decode_lockfunction nfsd4_decode_locktfunction nfsd4_decode_lockufunction nfsd4_decode_lookupfunction nfsd4_decode_createhow4function nfsd4_decode_openflag4function nfsd4_decode_share_accessfunction nfsd4_decode_share_denyfunction nfsd4_decode_open_claim4function nfsd4_decode_open
Annotated Snippet
struct nfsd4_fattr_args {
struct svc_rqst *rqstp;
struct svc_fh *fhp;
struct svc_export *exp;
struct dentry *dentry;
struct kstat stat;
struct kstatfs statfs;
struct nfs4_acl *acl;
u64 change_attr;
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
struct lsm_context context;
#endif
#ifdef CONFIG_NFSD_V4_POSIX_ACLS
struct posix_acl *dpacl;
struct posix_acl *pacl;
#endif
u32 rdattr_err;
bool contextsupport;
bool ignore_crossmnt;
bool case_insensitive;
bool case_preserving;
};
typedef __be32(*nfsd4_enc_attr)(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args);
static __be32 nfsd4_encode_fattr4__inval(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
return nfserr_inval;
}
static __be32 nfsd4_encode_fattr4__noop(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
return nfs_ok;
}
static __be32 nfsd4_encode_fattr4__true(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
return nfsd4_encode_bool(xdr, true);
}
static __be32 nfsd4_encode_fattr4__false(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
return nfsd4_encode_bool(xdr, false);
}
static __be32 nfsd4_encode_fattr4_supported_attrs(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
struct nfsd4_compoundres *resp = args->rqstp->rq_resp;
u32 minorversion = resp->cstate.minorversion;
u32 supp[3];
memcpy(supp, nfsd_suppattrs[minorversion], sizeof(supp));
if (!IS_POSIXACL(d_inode(args->dentry)))
supp[0] &= ~FATTR4_WORD0_ACL;
if (!args->contextsupport)
supp[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
return nfsd4_encode_bitmap4(xdr, supp[0], supp[1], supp[2]);
}
static __be32 nfsd4_encode_fattr4_type(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
__be32 *p;
p = xdr_reserve_space(xdr, XDR_UNIT);
if (!p)
return nfserr_resource;
switch (args->stat.mode & S_IFMT) {
case S_IFIFO:
*p = cpu_to_be32(NF4FIFO);
break;
case S_IFCHR:
*p = cpu_to_be32(NF4CHR);
break;
case S_IFDIR:
*p = cpu_to_be32(NF4DIR);
break;
case S_IFBLK:
*p = cpu_to_be32(NF4BLK);
break;
case S_IFLNK:
*p = cpu_to_be32(NF4LNK);
Annotation
- Immediate include surface: `linux/file.h`, `linux/slab.h`, `linux/namei.h`, `linux/statfs.h`, `linux/utsname.h`, `linux/pagemap.h`, `linux/sunrpc/svcauth_gss.h`, `linux/sunrpc/addr.h`.
- Detected declarations: `struct nfsd4_fattr_args`, `function check_filename`, `function zero_clientid`, `function svcxdr_tmpalloc`, `function svcxdr_dupstr`, `function svcxdr_savemem`, `function nfsd4_decode_ignored_string`, `function nfsd4_decode_opaque`, `function nfsd4_decode_component4`, `function nfsd4_decode_nfstime4`.
- 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.