fs/nfs/fs_context.c
Source file repositories/reference/linux-study-clean/fs/nfs/fs_context.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/fs_context.c- Extension
.c- Size
- 45827 bytes
- Lines
- 1794
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/compat.hlinux/module.hlinux/fs.hlinux/fs_context.hlinux/fs_parser.hlinux/nfs_fs.hlinux/nfs_mount.hlinux/nfs4_mount.hnet/handshake.hnfs.hinternal.hnfstrace.h
Detected Declarations
struct compat_nfs_stringstruct compat_nfs4_mount_data_v1enum nfs_paramfunction nfs_verify_server_addressfunction nfs_server_transport_udp_invalidfunction nfs_server_transport_udp_invalidfunction nfs_validate_transport_protocolfunction nfs_set_mount_transport_protocolfunction nfs_auth_info_addfunction nfs_parse_security_flavorsfunction nfs_parse_xprtsec_policyfunction nfs_parse_version_stringfunction nfs_tls_key_verifyfunction test_bitfunction nfs_tls_key_verifyfunction nfs_fs_context_parse_paramfunction nfs_parse_sourcefunction is_remount_fcfunction immediatelyfunction compat_nfs_stringfunction nfs4_compat_mount_data_convfunction nfs4_parse_monolithicfunction sys_mountfunction nfs_fs_context_validatefunction nfs_get_treefunction nfs_fs_context_dupfunction nfs_fs_context_freefunction nfs_init_fs_contextexport nfs_fs_typeexport nfs4_fs_type
Annotated Snippet
struct compat_nfs_string {
compat_uint_t len;
compat_uptr_t data;
};
static inline void compat_nfs_string(struct nfs_string *dst,
struct compat_nfs_string *src)
{
dst->data = compat_ptr(src->data);
dst->len = src->len;
}
struct compat_nfs4_mount_data_v1 {
compat_int_t version;
compat_int_t flags;
compat_int_t rsize;
compat_int_t wsize;
compat_int_t timeo;
compat_int_t retrans;
compat_int_t acregmin;
compat_int_t acregmax;
compat_int_t acdirmin;
compat_int_t acdirmax;
struct compat_nfs_string client_addr;
struct compat_nfs_string mnt_path;
struct compat_nfs_string hostname;
compat_uint_t host_addrlen;
compat_uptr_t host_addr;
compat_int_t proto;
compat_int_t auth_flavourlen;
compat_uptr_t auth_flavours;
};
static void nfs4_compat_mount_data_conv(struct nfs4_mount_data *data)
{
struct compat_nfs4_mount_data_v1 *compat =
(struct compat_nfs4_mount_data_v1 *)data;
/* copy the fields backwards */
data->auth_flavours = compat_ptr(compat->auth_flavours);
data->auth_flavourlen = compat->auth_flavourlen;
data->proto = compat->proto;
data->host_addr = compat_ptr(compat->host_addr);
data->host_addrlen = compat->host_addrlen;
compat_nfs_string(&data->hostname, &compat->hostname);
compat_nfs_string(&data->mnt_path, &compat->mnt_path);
compat_nfs_string(&data->client_addr, &compat->client_addr);
data->acdirmax = compat->acdirmax;
data->acdirmin = compat->acdirmin;
data->acregmax = compat->acregmax;
data->acregmin = compat->acregmin;
data->retrans = compat->retrans;
data->timeo = compat->timeo;
data->wsize = compat->wsize;
data->rsize = compat->rsize;
data->flags = compat->flags;
data->version = compat->version;
}
/*
* Validate NFSv4 mount options
*/
static int nfs4_parse_monolithic(struct fs_context *fc,
struct nfs4_mount_data *data)
{
struct nfs_fs_context *ctx = nfs_fc2context(fc);
struct sockaddr_storage *sap = &ctx->nfs_server._address;
int ret;
char *c;
if (!data) {
if (is_remount_fc(fc))
goto done;
return nfs_invalf(fc,
"NFS4: mount program didn't pass any mount data");
}
ctx->version = 4;
if (data->version != 1)
return generic_parse_monolithic(fc, data);
if (in_compat_syscall())
nfs4_compat_mount_data_conv(data);
if (data->host_addrlen > sizeof(ctx->nfs_server.address))
goto out_no_address;
if (data->host_addrlen == 0)
goto out_no_address;
ctx->nfs_server.addrlen = data->host_addrlen;
Annotation
- Immediate include surface: `linux/compat.h`, `linux/module.h`, `linux/fs.h`, `linux/fs_context.h`, `linux/fs_parser.h`, `linux/nfs_fs.h`, `linux/nfs_mount.h`, `linux/nfs4_mount.h`.
- Detected declarations: `struct compat_nfs_string`, `struct compat_nfs4_mount_data_v1`, `enum nfs_param`, `function nfs_verify_server_address`, `function nfs_server_transport_udp_invalid`, `function nfs_server_transport_udp_invalid`, `function nfs_validate_transport_protocol`, `function nfs_set_mount_transport_protocol`, `function nfs_auth_info_add`, `function nfs_parse_security_flavors`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.