fs/smb/server/mgmt/share_config.c
Source file repositories/reference/linux-study-clean/fs/smb/server/mgmt/share_config.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/server/mgmt/share_config.c- Extension
.c- Size
- 5697 bytes
- Lines
- 257
- 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/list.hlinux/jhash.hlinux/slab.hlinux/rwsem.hlinux/parser.hlinux/namei.hlinux/sched.hlinux/mm.hshare_config.huser_config.huser_session.h../connection.h../transport_ipc.h../misc.h
Detected Declarations
struct ksmbd_veto_patternfunction share_name_hashfunction kill_sharefunction ksmbd_share_config_delfunction __ksmbd_share_config_putfunction __get_share_configfunction hash_for_each_possiblefunction parse_veto_listfunction ksmbd_share_veto_filenamefunction list_for_each_entry
Annotated Snippet
struct ksmbd_veto_pattern {
char *pattern;
struct list_head list;
};
static unsigned int share_name_hash(const char *name)
{
return jhash(name, strlen(name), 0);
}
static void kill_share(struct ksmbd_share_config *share)
{
while (!list_empty(&share->veto_list)) {
struct ksmbd_veto_pattern *p;
p = list_entry(share->veto_list.next,
struct ksmbd_veto_pattern,
list);
list_del(&p->list);
kfree(p->pattern);
kfree(p);
}
if (share->path)
path_put(&share->vfs_path);
kfree(share->name);
kfree(share->path);
kfree(share);
}
void ksmbd_share_config_del(struct ksmbd_share_config *share)
{
down_write(&shares_table_lock);
hash_del(&share->hlist);
up_write(&shares_table_lock);
}
void __ksmbd_share_config_put(struct ksmbd_share_config *share)
{
ksmbd_share_config_del(share);
kill_share(share);
}
static struct ksmbd_share_config *
__get_share_config(struct ksmbd_share_config *share)
{
if (!atomic_inc_not_zero(&share->refcount))
return NULL;
return share;
}
static struct ksmbd_share_config *__share_lookup(const char *name)
{
struct ksmbd_share_config *share;
unsigned int key = share_name_hash(name);
hash_for_each_possible(shares_table, share, hlist, key) {
if (!strcmp(name, share->name))
return share;
}
return NULL;
}
static int parse_veto_list(struct ksmbd_share_config *share,
char *veto_list,
int veto_list_sz)
{
int sz = 0;
if (!veto_list_sz)
return 0;
while (veto_list_sz > 0) {
struct ksmbd_veto_pattern *p;
sz = strlen(veto_list);
if (!sz)
break;
p = kzalloc_obj(struct ksmbd_veto_pattern, KSMBD_DEFAULT_GFP);
if (!p)
return -ENOMEM;
p->pattern = kstrdup(veto_list, KSMBD_DEFAULT_GFP);
if (!p->pattern) {
kfree(p);
return -ENOMEM;
}
list_add(&p->list, &share->veto_list);
Annotation
- Immediate include surface: `linux/list.h`, `linux/jhash.h`, `linux/slab.h`, `linux/rwsem.h`, `linux/parser.h`, `linux/namei.h`, `linux/sched.h`, `linux/mm.h`.
- Detected declarations: `struct ksmbd_veto_pattern`, `function share_name_hash`, `function kill_share`, `function ksmbd_share_config_del`, `function __ksmbd_share_config_put`, `function __get_share_config`, `function hash_for_each_possible`, `function parse_veto_list`, `function ksmbd_share_veto_filename`, `function list_for_each_entry`.
- 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.