fs/smb/client/cifs_swn.c
Source file repositories/reference/linux-study-clean/fs/smb/client/cifs_swn.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/cifs_swn.c- Extension
.c- Size
- 22808 bytes
- Lines
- 877
- 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/kref.hnet/genetlink.huapi/linux/cifs/cifs_netlink.hcifs_swn.hcifsglob.hcifsproto.hfscache.hcifs_debug.hnetlink.h
Detected Declarations
struct cifs_swn_regstruct cifs_swn_reg_infofunction cifs_swn_snapshot_regfunction cifs_swn_dup_regfunction cifs_swn_free_reg_infofunction cifs_swn_auth_info_krbfunction cifs_swn_auth_info_ntlmfunction cifs_swn_send_register_messagefunction cifs_swn_send_unregister_messagefunction cifs_swn_tcon_matchesfunction list_for_each_entryfunction idr_for_each_entryfunction cifs_swn_reg_releasefunction cifs_put_swn_reg_lockedfunction cifs_swn_resource_state_changedfunction cifs_sockaddr_equalfunction cifs_swn_store_swn_addrfunction cifs_swn_reconnectfunction cifs_swn_client_movefunction cifs_swn_notifyfunction cifs_swn_registerfunction cifs_swn_unregisterfunction cifs_swn_get_next_reg_infofunction cifs_swn_dumpfunction cifs_swn_check
Annotated Snippet
struct cifs_swn_reg {
int id;
struct kref ref_count;
const char *net_name;
const char *share_name;
bool net_name_notify;
bool share_name_notify;
bool ip_notify;
};
struct cifs_swn_reg_info {
int id;
unsigned int ref_count;
const char *net_name;
const char *share_name;
bool net_name_notify;
bool share_name_notify;
bool ip_notify;
};
static void cifs_swn_snapshot_reg(struct cifs_swn_reg *swnreg,
struct cifs_swn_reg_info *info)
{
info->id = swnreg->id;
info->ref_count = kref_read(&swnreg->ref_count);
info->net_name = swnreg->net_name;
info->share_name = swnreg->share_name;
info->net_name_notify = swnreg->net_name_notify;
info->share_name_notify = swnreg->share_name_notify;
info->ip_notify = swnreg->ip_notify;
}
static int cifs_swn_dup_reg(struct cifs_swn_reg *swnreg,
struct cifs_swn_reg_info *info)
{
cifs_swn_snapshot_reg(swnreg, info);
info->net_name = kstrdup(swnreg->net_name, GFP_KERNEL);
if (!info->net_name)
return -ENOMEM;
info->share_name = kstrdup(swnreg->share_name, GFP_KERNEL);
if (!info->share_name) {
kfree(info->net_name);
return -ENOMEM;
}
return 0;
}
static void cifs_swn_free_reg_info(struct cifs_swn_reg_info *info)
{
kfree(info->net_name);
kfree(info->share_name);
}
static int cifs_swn_auth_info_krb(struct cifs_tcon *tcon, struct sk_buff *skb)
{
int ret;
ret = nla_put_flag(skb, CIFS_GENL_ATTR_SWN_KRB_AUTH);
if (ret < 0)
return ret;
return 0;
}
static int cifs_swn_auth_info_ntlm(struct cifs_tcon *tcon, struct sk_buff *skb)
{
int ret;
if (tcon->ses->user_name != NULL) {
ret = nla_put_string(skb, CIFS_GENL_ATTR_SWN_USER_NAME, tcon->ses->user_name);
if (ret < 0)
return ret;
}
if (tcon->ses->password != NULL) {
ret = nla_put_string(skb, CIFS_GENL_ATTR_SWN_PASSWORD, tcon->ses->password);
if (ret < 0)
return ret;
}
if (tcon->ses->domainName != NULL) {
ret = nla_put_string(skb, CIFS_GENL_ATTR_SWN_DOMAIN_NAME, tcon->ses->domainName);
if (ret < 0)
return ret;
}
Annotation
- Immediate include surface: `linux/kref.h`, `net/genetlink.h`, `uapi/linux/cifs/cifs_netlink.h`, `cifs_swn.h`, `cifsglob.h`, `cifsproto.h`, `fscache.h`, `cifs_debug.h`.
- Detected declarations: `struct cifs_swn_reg`, `struct cifs_swn_reg_info`, `function cifs_swn_snapshot_reg`, `function cifs_swn_dup_reg`, `function cifs_swn_free_reg_info`, `function cifs_swn_auth_info_krb`, `function cifs_swn_auth_info_ntlm`, `function cifs_swn_send_register_message`, `function cifs_swn_send_unregister_message`, `function cifs_swn_tcon_matches`.
- 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.