drivers/block/rnbd/rnbd-clt-sysfs.c
Source file repositories/reference/linux-study-clean/drivers/block/rnbd/rnbd-clt-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/rnbd/rnbd-clt-sysfs.c- Extension
.c- Size
- 16170 bytes
- Lines
- 694
- Domain
- Driver Families
- Bucket
- drivers/block
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/types.hlinux/ctype.hlinux/parser.hlinux/module.hlinux/in6.hlinux/fs.hlinux/uaccess.hlinux/device.hrdma/ib.hrdma/rdma_cm.hrnbd-clt.h
Detected Declarations
struct rnbd_map_optionsfunction rnbd_clt_parse_map_optionsfunction state_showfunction nr_poll_queues_showfunction mapping_path_showfunction access_mode_showfunction rnbd_clt_unmap_dev_showfunction rnbd_clt_unmap_dev_storefunction rnbd_destroy_sessionsfunction rnbd_clt_resize_dev_showfunction rnbd_clt_resize_dev_storefunction rnbd_clt_remap_dev_showfunction rnbd_clt_remap_dev_storefunction session_showfunction rnbd_clt_remove_dev_symlinkfunction rnbd_dev_releasefunction rnbd_clt_add_dev_kobjfunction rnbd_clt_map_device_showfunction rnbd_clt_get_path_namefunction rnbd_clt_add_dev_symlinkfunction rnbd_clt_map_device_storefunction rnbd_clt_create_sysfs_filesfunction rnbd_clt_destroy_sysfs_files
Annotated Snippet
struct rnbd_map_options {
char *sessname;
struct rtrs_addr *paths;
size_t *path_cnt;
char *pathname;
u16 *dest_port;
enum rnbd_access_mode *access_mode;
u32 *nr_poll_queues;
};
static int rnbd_clt_parse_map_options(const char *buf, size_t max_path_cnt,
struct rnbd_map_options *opt)
{
char *options, *sep_opt;
char *p;
substring_t args[MAX_OPT_ARGS];
int opt_mask = 0;
int token;
int ret = -EINVAL;
int nr_poll_queues = 0;
int dest_port = 0;
int p_cnt = 0;
int i;
options = kstrdup(buf, GFP_KERNEL);
if (!options)
return -ENOMEM;
sep_opt = strstrip(options);
while ((p = strsep(&sep_opt, " ")) != NULL) {
if (!*p)
continue;
token = match_token(p, rnbd_opt_tokens, args);
opt_mask |= token;
switch (token) {
case RNBD_OPT_SESSNAME:
p = match_strdup(args);
if (!p) {
ret = -ENOMEM;
goto out;
}
if (strlen(p) > NAME_MAX) {
pr_err("map_device: sessname too long\n");
ret = -EINVAL;
kfree(p);
goto out;
}
strscpy(opt->sessname, p, NAME_MAX);
kfree(p);
break;
case RNBD_OPT_PATH:
if (p_cnt >= max_path_cnt) {
pr_err("map_device: too many (> %zu) paths provided\n",
max_path_cnt);
ret = -ENOMEM;
goto out;
}
p = match_strdup(args);
if (!p) {
ret = -ENOMEM;
goto out;
}
ret = rtrs_addr_to_sockaddr(p, strlen(p),
*opt->dest_port,
&opt->paths[p_cnt]);
if (ret) {
pr_err("Can't parse path %s: %d\n", p, ret);
kfree(p);
goto out;
}
p_cnt++;
kfree(p);
break;
case RNBD_OPT_DEV_PATH:
p = match_strdup(args);
if (!p) {
ret = -ENOMEM;
goto out;
}
if (strlen(p) > NAME_MAX) {
pr_err("map_device: Device path too long\n");
ret = -EINVAL;
kfree(p);
Annotation
- Immediate include surface: `linux/types.h`, `linux/ctype.h`, `linux/parser.h`, `linux/module.h`, `linux/in6.h`, `linux/fs.h`, `linux/uaccess.h`, `linux/device.h`.
- Detected declarations: `struct rnbd_map_options`, `function rnbd_clt_parse_map_options`, `function state_show`, `function nr_poll_queues_show`, `function mapping_path_show`, `function access_mode_show`, `function rnbd_clt_unmap_dev_show`, `function rnbd_clt_unmap_dev_store`, `function rnbd_destroy_sessions`, `function rnbd_clt_resize_dev_show`.
- Atlas domain: Driver Families / drivers/block.
- 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.