fs/smb/common/smb2pdu.h
Source file repositories/reference/linux-study-clean/fs/smb/common/smb2pdu.h
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/common/smb2pdu.h- Extension
.h- Size
- 56510 bytes
- Lines
- 1782
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/build_bug.h
Detected Declarations
struct smb2_hdrstruct smb3_hdr_reqstruct smb2_pdustruct smb2_err_rspstruct smb2_transform_hdrstruct smb2_compression_hdrstruct smb2_compression_payload_hdrstruct smb2_compression_pattern_v1struct tree_connect_contextsstruct smb3_blob_datastruct sid_array_datastruct sid_attr_datastruct privilege_array_datastruct remoted_identity_tcon_contextstruct smb2_tree_connect_req_extensionstruct smb2_tree_connect_reqstruct smb2_tree_connect_rspstruct smb2_tree_disconnect_reqstruct smb2_tree_disconnect_rspstruct smb2_neg_contextstruct smb2_preauth_neg_contextstruct smb2_encryption_neg_contextstruct smb2_compression_capabilities_contextstruct smb2_netname_neg_contextstruct smb2_transport_capabilities_contextstruct smb2_rdma_transform_capabilities_contextstruct smb2_signing_capabilitiesstruct smb2_posix_neg_contextstruct smb2_negotiate_reqstruct smb2_negotiate_rspstruct smb2_sess_setup_reqstruct smb2_sess_setup_rspstruct smb2_logoff_reqstruct smb2_logoff_rspstruct smb2_close_reqstruct smb2_close_rspstruct smb2_read_reqstruct smb2_read_rspstruct smb2_write_reqstruct smb2_write_rspstruct smb2_flush_reqstruct smb2_flush_rspstruct smb2_lock_elementstruct smb2_lock_reqstruct smb2_lock_rspstruct smb2_echo_reqstruct smb2_echo_rspstruct smb2_query_directory_req
Annotated Snippet
struct smb2_hdr {
__le32 ProtocolId; /* 0xFE 'S' 'M' 'B' */
__le16 StructureSize; /* 64 */
__le16 CreditCharge; /* MBZ */
__le32 Status; /* Error from server */
__le16 Command;
__le16 CreditRequest; /* CreditResponse */
__le32 Flags;
__le32 NextCommand;
__le64 MessageId;
union {
struct {
__le32 ProcessId;
__le32 TreeId;
} __packed SyncId;
__le64 AsyncId;
} __packed Id;
__le64 SessionId;
__u8 Signature[16];
} __packed;
struct smb3_hdr_req {
__le32 ProtocolId; /* 0xFE 'S' 'M' 'B' */
__le16 StructureSize; /* 64 */
__le16 CreditCharge; /* MBZ */
__le16 ChannelSequence; /* See MS-SMB2 3.2.4.1 and 3.2.7.1 */
__le16 Reserved;
__le16 Command;
__le16 CreditRequest; /* CreditResponse */
__le32 Flags;
__le32 NextCommand;
__le64 MessageId;
union {
struct {
__le32 ProcessId;
__le32 TreeId;
} __packed SyncId;
__le64 AsyncId;
} __packed Id;
__le64 SessionId;
__u8 Signature[16];
} __packed;
struct smb2_pdu {
struct smb2_hdr hdr;
__le16 StructureSize2; /* size of wct area (varies, request specific) */
} __packed;
#define SMB2_ERROR_STRUCTURE_SIZE2 9
#define SMB2_ERROR_STRUCTURE_SIZE2_LE cpu_to_le16(SMB2_ERROR_STRUCTURE_SIZE2)
struct smb2_err_rsp {
struct smb2_hdr hdr;
__le16 StructureSize;
__u8 ErrorContextCount;
__u8 Reserved;
__le32 ByteCount; /* even if zero, at least one byte follows */
__u8 ErrorData[]; /* variable length */
} __packed;
#define SMB3_AES_CCM_NONCE 11
#define SMB3_AES_GCM_NONCE 12
/* Transform flags (for 3.0 dialect this flag indicates CCM */
#define TRANSFORM_FLAG_ENCRYPTED 0x0001
struct smb2_transform_hdr {
__le32 ProtocolId; /* 0xFD 'S' 'M' 'B' */
__u8 Signature[16];
__u8 Nonce[16];
__le32 OriginalMessageSize;
__u16 Reserved1;
__le16 Flags; /* EncryptionAlgorithm for 3.0, enc enabled for 3.1.1 */
__le64 SessionId;
} __packed;
/*
* These are simplified versions from the spec, as we don't need a fully fledged
* form of both unchained and chained structs.
*
* For chained payloads, only the first 8 bytes belong to the transform header.
* CompressionAlgorithm, Flags and Offset below overlay the first chained
* payload header, where Offset represents Length.
*
* See MS-SMB2 2.2.42 for more details.
*/
#define SMB2_COMPRESSION_FLAG_NONE 0x0000
#define SMB2_COMPRESSION_FLAG_CHAINED 0x0001
struct smb2_compression_hdr {
__le32 ProtocolId; /* 0xFC 'S' 'M' 'B' */
Annotation
- Immediate include surface: `linux/types.h`, `linux/build_bug.h`.
- Detected declarations: `struct smb2_hdr`, `struct smb3_hdr_req`, `struct smb2_pdu`, `struct smb2_err_rsp`, `struct smb2_transform_hdr`, `struct smb2_compression_hdr`, `struct smb2_compression_payload_hdr`, `struct smb2_compression_pattern_v1`, `struct tree_connect_contexts`, `struct smb3_blob_data`.
- 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.