fs/smb/client/smb1ops.c
Source file repositories/reference/linux-study-clean/fs/smb/client/smb1ops.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/smb1ops.c- Extension
.c- Size
- 46628 bytes
- Lines
- 1493
- 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/pagemap.hlinux/vfs.hlinux/fs_struct.huapi/linux/magic.hcifsglob.hcifsproto.hcifs_debug.hcifs_unicode.hfs_context.hnterr.hsmberr.hreparse.h
Detected Declarations
function SMB1function send_nt_cancelfunction send_lock_cancelfunction cifs_send_cancelfunction cifs_compare_fidsfunction cifs_read_data_offsetfunction cifs_read_data_lengthfunction cifs_find_midfunction cifs_add_creditsfunction cifs_set_creditsfunction cifs_get_credits_fieldfunction cifs_get_creditsfunction idfunction list_for_each_entryfunction cifs_downgrade_oplockfunction cifs_need_negfunction cifs_negotiatefunction smb1_negotiate_wsizefunction smb1_negotiate_rsizefunction cifs_qfs_tconfunction cifs_is_path_accessiblefunction cifs_query_path_infofunction CIFSFindFirstfunction cifs_get_srv_inumfunction cifs_query_file_infofunction cifs_clear_statsfunction cifs_print_statsfunction cifs_mkdir_setinfofunction cifs_open_filefunction cifs_set_fidfunction cifs_close_filefunction cifs_flush_filefunction cifs_sync_readfunction cifs_sync_writefunction smb_set_file_infofunction le32_to_cpufunction cifs_set_compressionfunction cifs_query_dir_firstfunction cifs_query_dir_nextfunction cifs_close_dirfunction cifs_oplock_responsefunction cifs_queryfsfunction cifs_mand_lockfunction cifs_unix_dfs_readlinkfunction cifs_query_symlinkfunction cifs_is_read_opfunction cifs_wp_retry_sizefunction cifs_dir_needs_close
Annotated Snippet
if (ctx == NULL) {
/*
* turn off POSIX ACL and PATHNAMES if not set
* originally at mount time
*/
if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0)
cap &= ~CIFS_UNIX_POSIX_ACL_CAP;
if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) {
if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP)
cifs_dbg(VFS, "POSIXPATH support change\n");
cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP;
} else if ((cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) {
cifs_dbg(VFS, "possible reconnect error\n");
cifs_dbg(VFS, "server disabled POSIX path support\n");
}
}
if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)
cifs_dbg(VFS, "per-share encryption not supported yet\n");
cap &= CIFS_UNIX_CAP_MASK;
if (ctx && ctx->no_psx_acl)
cap &= ~CIFS_UNIX_POSIX_ACL_CAP;
else if (CIFS_UNIX_POSIX_ACL_CAP & cap) {
cifs_dbg(FYI, "negotiated posix acl support\n");
if (cifs_sb) {
atomic_or(CIFS_MOUNT_POSIXACL,
&cifs_sb->mnt_cifs_flags);
}
}
if (ctx && ctx->posix_paths == 0)
cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP;
else if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
cifs_dbg(FYI, "negotiate posix pathnames\n");
if (cifs_sb) {
atomic_or(CIFS_MOUNT_POSIX_PATHS,
&cifs_sb->mnt_cifs_flags);
}
}
cifs_dbg(FYI, "Negotiate caps 0x%x\n", (int)cap);
#ifdef CONFIG_CIFS_DEBUG2
if (cap & CIFS_UNIX_FCNTL_CAP)
cifs_dbg(FYI, "FCNTL cap\n");
if (cap & CIFS_UNIX_EXTATTR_CAP)
cifs_dbg(FYI, "EXTATTR cap\n");
if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP)
cifs_dbg(FYI, "POSIX path cap\n");
if (cap & CIFS_UNIX_XATTR_CAP)
cifs_dbg(FYI, "XATTR cap\n");
if (cap & CIFS_UNIX_POSIX_ACL_CAP)
cifs_dbg(FYI, "POSIX ACL cap\n");
if (cap & CIFS_UNIX_LARGE_READ_CAP)
cifs_dbg(FYI, "very large read cap\n");
if (cap & CIFS_UNIX_LARGE_WRITE_CAP)
cifs_dbg(FYI, "very large write cap\n");
if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)
cifs_dbg(FYI, "transport encryption cap\n");
if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)
cifs_dbg(FYI, "mandatory transport encryption cap\n");
#endif /* CIFS_DEBUG2 */
if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
if (ctx == NULL)
cifs_dbg(FYI, "resetting capabilities failed\n");
else
cifs_dbg(VFS, "Negotiating Unix capabilities with the server failed. Consider mounting with the Unix Extensions disabled if problems are found by specifying the nounix mount option.\n");
}
}
}
/*
* An NT cancel request header looks just like the original request except:
*
* The Command is SMB_COM_NT_CANCEL
* The WordCount is zeroed out
* The ByteCount is zeroed out
*
* This function mangles an existing request buffer into a
* SMB_COM_NT_CANCEL request and then sends it.
*/
static int
send_nt_cancel(struct cifs_ses *ses, struct TCP_Server_Info *server,
struct smb_rqst *rqst, struct mid_q_entry *mid,
unsigned int xid)
{
struct smb_hdr *in_buf = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
struct kvec iov[1];
struct smb_rqst crqst = { .rq_iov = iov, .rq_nvec = 1 };
Annotation
- Immediate include surface: `linux/pagemap.h`, `linux/vfs.h`, `linux/fs_struct.h`, `uapi/linux/magic.h`, `cifsglob.h`, `cifsproto.h`, `cifs_debug.h`, `cifs_unicode.h`.
- Detected declarations: `function SMB1`, `function send_nt_cancel`, `function send_lock_cancel`, `function cifs_send_cancel`, `function cifs_compare_fids`, `function cifs_read_data_offset`, `function cifs_read_data_length`, `function cifs_find_mid`, `function cifs_add_credits`, `function cifs_set_credits`.
- 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.