drivers/s390/block/dasd_proc.c
Source file repositories/reference/linux-study-clean/drivers/s390/block/dasd_proc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/block/dasd_proc.c- Extension
.c- Size
- 9717 bytes
- Lines
- 369
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/ctype.hlinux/slab.hlinux/string.hlinux/seq_file.hlinux/vmalloc.hlinux/proc_fs.hasm/debug.hlinux/uaccess.hdasd_int.h
Detected Declarations
function dasd_devices_showfunction dasd_devices_stopfunction dasd_stats_all_block_onfunction dasd_stats_all_block_offfunction dasd_stats_all_block_resetfunction dasd_statistics_arrayfunction dasd_stats_proc_showfunction dasd_stats_proc_openfunction dasd_stats_proc_writefunction dasd_proc_initfunction dasd_proc_exit
Annotated Snippet
if (strcmp(str, "on") == 0) {
/* switch on statistics profiling */
rc = dasd_stats_all_block_on();
if (rc) {
dasd_stats_all_block_off();
goto out_error;
}
rc = dasd_profile_on(&dasd_global_profile);
if (rc) {
dasd_stats_all_block_off();
goto out_error;
}
dasd_profile_reset(&dasd_global_profile);
dasd_global_profile_level = DASD_PROFILE_ON;
pr_info("The statistics feature has been switched "
"on\n");
} else if (strcmp(str, "off") == 0) {
/* switch off statistics profiling */
dasd_global_profile_level = DASD_PROFILE_OFF;
dasd_profile_off(&dasd_global_profile);
dasd_stats_all_block_off();
pr_info("The statistics feature has been switched "
"off\n");
} else
goto out_parse_error;
} else if (strncmp(str, "reset", 5) == 0) {
/* reset the statistics */
dasd_profile_reset(&dasd_global_profile);
dasd_stats_all_block_reset();
pr_info("The statistics have been reset\n");
} else
goto out_parse_error;
vfree(buffer);
return user_len;
out_parse_error:
rc = -EINVAL;
pr_warn("%s is not a supported value for /proc/dasd/statistics\n", str);
out_error:
vfree(buffer);
return rc;
#else
pr_warn("/proc/dasd/statistics: is not activated in this kernel\n");
return user_len;
#endif /* CONFIG_DASD_PROFILE */
}
static const struct proc_ops dasd_stats_proc_ops = {
.proc_open = dasd_stats_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = dasd_stats_proc_write,
};
/*
* Create dasd proc-fs entries.
* In case creation failed, cleanup and return -ENOENT.
*/
int
dasd_proc_init(void)
{
dasd_proc_root_entry = proc_mkdir("dasd", NULL);
if (!dasd_proc_root_entry)
goto out_nodasd;
dasd_devices_entry = proc_create_seq("devices", 0444,
dasd_proc_root_entry,
&dasd_devices_seq_ops);
if (!dasd_devices_entry)
goto out_nodevices;
dasd_statistics_entry = proc_create("statistics",
S_IFREG | S_IRUGO | S_IWUSR,
dasd_proc_root_entry,
&dasd_stats_proc_ops);
if (!dasd_statistics_entry)
goto out_nostatistics;
return 0;
out_nostatistics:
remove_proc_entry("devices", dasd_proc_root_entry);
out_nodevices:
remove_proc_entry("dasd", NULL);
dasd_proc_root_entry = NULL;
out_nodasd:
return -ENOENT;
}
void
dasd_proc_exit(void)
{
if (!dasd_proc_root_entry)
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/slab.h`, `linux/string.h`, `linux/seq_file.h`, `linux/vmalloc.h`, `linux/proc_fs.h`, `asm/debug.h`, `linux/uaccess.h`.
- Detected declarations: `function dasd_devices_show`, `function dasd_devices_stop`, `function dasd_stats_all_block_on`, `function dasd_stats_all_block_off`, `function dasd_stats_all_block_reset`, `function dasd_statistics_array`, `function dasd_stats_proc_show`, `function dasd_stats_proc_open`, `function dasd_stats_proc_write`, `function dasd_proc_init`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.