fs/smb/client/fs_context.c
Source file repositories/reference/linux-study-clean/fs/smb/client/fs_context.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/fs_context.c- Extension
.c- Size
- 61144 bytes
- Lines
- 2259
- 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/module.hlinux/nsproxy.hlinux/slab.hlinux/magic.hlinux/security.hnet/net_namespace.hdfs_cache.hlinux/ctype.hlinux/fs_context.hlinux/fs_parser.hlinux/fs.hlinux/mount.hlinux/parser.hlinux/utsname.hcifsfs.hcifsglob.hcifsproto.hcifs_unicode.hcifs_debug.hcifs_fs_sb.hntlmssp.hnterr.hrfc1002pdu.hfs_context.h
Detected Declarations
function cifs_parse_security_flavorsfunction cifs_parse_upcall_targetfunction cifs_parse_cache_flavorfunction parse_reparse_flavorfunction parse_symlink_flavorfunction smb3_fs_context_dupfunction cifs_parse_smb_versionfunction smb3_parse_devnamefunction smb3_parse_devnamefunction smb3_handle_conflicting_optionsfunction sys_mountfunction smb3_fs_context_validatefunction smb3_get_tree_commonfunction smb3_get_treefunction smb3_fs_context_freefunction smb3_verify_reconfigure_ctxfunction smb3_sync_session_ctx_passwordsfunction strcmpfunction changesfunction smb3_reconfigurefunction smb3_fs_context_parse_paramfunction sizesfunction smb3_init_fs_contextfunction smb3_cleanup_fs_context_contentsfunction smb3_cleanup_fs_contextfunction smb3_update_mnt_flags
Annotated Snippet
if (new_ctx->field == NULL) { \
smb3_cleanup_fs_context_contents(new_ctx); \
return -ENOMEM; \
} \
} \
} while (0)
int
smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx)
{
memcpy(new_ctx, ctx, sizeof(*ctx));
new_ctx->prepath = NULL;
new_ctx->nodename = NULL;
new_ctx->username = NULL;
new_ctx->password = NULL;
new_ctx->password2 = NULL;
new_ctx->server_hostname = NULL;
new_ctx->domainname = NULL;
new_ctx->UNC = NULL;
new_ctx->source = NULL;
new_ctx->iocharset = NULL;
new_ctx->leaf_fullpath = NULL;
new_ctx->dns_dom = NULL;
new_ctx->symlinkroot = NULL;
/*
* Make sure to stay in sync with smb3_cleanup_fs_context_contents()
*/
DUP_CTX_STR(prepath);
DUP_CTX_STR(username);
DUP_CTX_STR(password);
DUP_CTX_STR(password2);
DUP_CTX_STR(server_hostname);
DUP_CTX_STR(UNC);
DUP_CTX_STR(source);
DUP_CTX_STR(domainname);
DUP_CTX_STR(nodename);
DUP_CTX_STR(iocharset);
DUP_CTX_STR(leaf_fullpath);
DUP_CTX_STR(dns_dom);
DUP_CTX_STR(symlinkroot);
return 0;
}
static int
cifs_parse_smb_version(struct fs_context *fc, char *value, struct smb3_fs_context *ctx, bool is_smb3)
{
substring_t args[MAX_OPT_ARGS];
switch (match_token(value, cifs_smb_version_tokens, args)) {
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
case Smb_1:
if (disable_legacy_dialects) {
cifs_errorf(fc, "mount with legacy dialect disabled\n");
return 1;
}
if (is_smb3) {
cifs_errorf(fc, "vers=1.0 (cifs) not permitted when mounting with smb3\n");
return 1;
}
cifs_errorf(fc, "Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers\n");
ctx->ops = &smb1_operations;
ctx->vals = &smb1_values;
break;
case Smb_20:
if (disable_legacy_dialects) {
cifs_errorf(fc, "mount with legacy dialect disabled\n");
return 1;
}
if (is_smb3) {
cifs_errorf(fc, "vers=2.0 not permitted when mounting with smb3\n");
return 1;
}
ctx->ops = &smb20_operations;
ctx->vals = &smb20_values;
break;
#else
case Smb_1:
cifs_errorf(fc, "vers=1.0 (cifs) mount not permitted when legacy dialects disabled\n");
return 1;
case Smb_20:
cifs_errorf(fc, "vers=2.0 mount not permitted when legacy dialects disabled\n");
return 1;
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
case Smb_21:
ctx->ops = &smb21_operations;
ctx->vals = &smb21_values;
break;
case Smb_30:
ctx->ops = &smb30_operations;
Annotation
- Immediate include surface: `linux/module.h`, `linux/nsproxy.h`, `linux/slab.h`, `linux/magic.h`, `linux/security.h`, `net/net_namespace.h`, `dfs_cache.h`, `linux/ctype.h`.
- Detected declarations: `function cifs_parse_security_flavors`, `function cifs_parse_upcall_target`, `function cifs_parse_cache_flavor`, `function parse_reparse_flavor`, `function parse_symlink_flavor`, `function smb3_fs_context_dup`, `function cifs_parse_smb_version`, `function smb3_parse_devname`, `function smb3_parse_devname`, `function smb3_handle_conflicting_options`.
- 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.