fs/smb/server/smb_common.c
Source file repositories/reference/linux-study-clean/fs/smb/server/smb_common.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/server/smb_common.c- Extension
.c- Size
- 19529 bytes
- Lines
- 842
- 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.
- 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/user_namespace.hsmb_common.hserver.hmisc.h../common/smb2status.hconnection.hksmbd_work.hmgmt/user_session.hmgmt/user_config.hmgmt/tree_connect.hmgmt/share_config.h
Detected Declarations
struct smb_protocolenum SHARED_MODE_ERRORSfunction ksmbd_server_side_copy_max_chunk_countfunction ksmbd_server_side_copy_max_chunk_sizefunction ksmbd_server_side_copy_max_total_sizefunction ksmbd_min_protocolfunction ksmbd_max_protocolfunction ksmbd_lookup_protocol_idxfunction ksmbd_verify_smb_messagefunction ksmbd_smb_requestfunction supported_protocolfunction ksmbd_lookup_dialect_by_namefunction ksmbd_lookup_dialect_by_idfunction ksmbd_negotiate_smb_dialectfunction get_smb1_cmd_valfunction init_smb1_rsp_hdrfunction smb1_check_user_sessionfunction smb1_allocate_rsp_buffunction set_smb1_rsp_statusfunction smb1_negotiatefunction init_smb1_serverfunction ksmbd_init_smb_serverfunction ksmbd_populate_dot_dotdot_entriesfunction ksmbd_extract_shortnamefunction __smb2_negotiatefunction smb_handle_negotiatefunction ksmbd_smb_negotiate_commonfunction smb_shared_mode_errorfunction ksmbd_smb_check_shared_modefunction is_asteriskfunction __ksmbd_override_fsidsfunction ksmbd_override_fsidsfunction ksmbd_revert_fsidsfunction smb_map_generic_desired_access
Annotated Snippet
struct smb_protocol {
int index;
char *name;
char *prot;
__u16 prot_id;
};
static struct smb_protocol smb1_protos[] = {
{
SMB21_PROT,
"\2SMB 2.1",
"SMB2_10",
SMB21_PROT_ID
},
{
SMB2X_PROT,
"\2SMB 2.???",
"SMB2_22",
SMB2X_PROT_ID
},
};
static struct smb_protocol smb2_protos[] = {
{
SMB21_PROT,
"\2SMB 2.1",
"SMB2_10",
SMB21_PROT_ID
},
{
SMB30_PROT,
"\2SMB 3.0",
"SMB3_00",
SMB30_PROT_ID
},
{
SMB302_PROT,
"\2SMB 3.02",
"SMB3_02",
SMB302_PROT_ID
},
{
SMB311_PROT,
"\2SMB 3.1.1",
"SMB3_11",
SMB311_PROT_ID
},
};
unsigned int ksmbd_server_side_copy_max_chunk_count(void)
{
return 256;
}
unsigned int ksmbd_server_side_copy_max_chunk_size(void)
{
return (2U << 30) - 1;
}
unsigned int ksmbd_server_side_copy_max_total_size(void)
{
return (2U << 30) - 1;
}
inline int ksmbd_min_protocol(void)
{
return SMB21_PROT;
}
inline int ksmbd_max_protocol(void)
{
return SMB311_PROT;
}
static const struct {
int version;
const char *string;
} version_strings[] = {
{SMB2_PROT, SMB20_VERSION_STRING},
{SMB21_PROT, SMB21_VERSION_STRING},
{SMB30_PROT, SMB30_VERSION_STRING},
{SMB302_PROT, SMB302_VERSION_STRING},
{SMB311_PROT, SMB311_VERSION_STRING},
};
const char *ksmbd_get_protocol_string(int version)
{
int i;
for (i = 0; i < ARRAY_SIZE(version_strings); i++) {
Annotation
- Immediate include surface: `linux/user_namespace.h`, `smb_common.h`, `server.h`, `misc.h`, `../common/smb2status.h`, `connection.h`, `ksmbd_work.h`, `mgmt/user_session.h`.
- Detected declarations: `struct smb_protocol`, `enum SHARED_MODE_ERRORS`, `function ksmbd_server_side_copy_max_chunk_count`, `function ksmbd_server_side_copy_max_chunk_size`, `function ksmbd_server_side_copy_max_total_size`, `function ksmbd_min_protocol`, `function ksmbd_max_protocol`, `function ksmbd_lookup_protocol_idx`, `function ksmbd_verify_smb_message`, `function ksmbd_smb_request`.
- 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.