drivers/scsi/qedi/qedi_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qedi/qedi_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qedi/qedi_debugfs.c- Extension
.c- Size
- 5600 bytes
- Lines
- 225
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
qedi.hqedi_dbg.hlinux/uaccess.hlinux/debugfs.hlinux/module.h
Detected Declarations
function qedi_dbg_host_initfunction qedi_dbg_host_exitfunction qedi_dbg_initfunction qedi_dbg_exitfunction qedi_dbg_do_not_recover_enablefunction qedi_dbg_do_not_recover_disablefunction qedi_dbg_do_not_recover_cmd_writefunction qedi_dbg_do_not_recover_cmd_readfunction qedi_gbl_ctx_showfunction qedi_dbg_gbl_ctx_openfunction qedi_io_trace_showfunction qedi_dbg_io_trace_open
Annotated Snippet
const struct file_operations *fops)
{
char host_dirname[32];
sprintf(host_dirname, "host%u", qedi->host_no);
qedi->bdf_dentry = debugfs_create_dir(host_dirname, qedi_dbg_root);
while (dops) {
if (!(dops->name))
break;
debugfs_create_file(dops->name, 0600, qedi->bdf_dentry, qedi,
fops);
dops++;
fops++;
}
}
void
qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi)
{
debugfs_remove_recursive(qedi->bdf_dentry);
qedi->bdf_dentry = NULL;
}
void
qedi_dbg_init(char *drv_name)
{
qedi_dbg_root = debugfs_create_dir(drv_name, NULL);
}
void
qedi_dbg_exit(void)
{
debugfs_remove_recursive(qedi_dbg_root);
qedi_dbg_root = NULL;
}
static ssize_t
qedi_dbg_do_not_recover_enable(struct qedi_dbg_ctx *qedi_dbg)
{
if (!qedi_do_not_recover)
qedi_do_not_recover = 1;
QEDI_INFO(qedi_dbg, QEDI_LOG_DEBUGFS, "do_not_recover=%d\n",
qedi_do_not_recover);
return 0;
}
static ssize_t
qedi_dbg_do_not_recover_disable(struct qedi_dbg_ctx *qedi_dbg)
{
if (qedi_do_not_recover)
qedi_do_not_recover = 0;
QEDI_INFO(qedi_dbg, QEDI_LOG_DEBUGFS, "do_not_recover=%d\n",
qedi_do_not_recover);
return 0;
}
static struct qedi_list_of_funcs qedi_dbg_do_not_recover_ops[] = {
{ "enable", qedi_dbg_do_not_recover_enable },
{ "disable", qedi_dbg_do_not_recover_disable },
{ NULL, NULL }
};
const struct qedi_debugfs_ops qedi_debugfs_ops[] = {
{ "gbl_ctx", NULL },
{ "do_not_recover", qedi_dbg_do_not_recover_ops},
{ "io_trace", NULL },
{ NULL, NULL }
};
static ssize_t
qedi_dbg_do_not_recover_cmd_write(struct file *filp, const char __user *buffer,
size_t count, loff_t *ppos)
{
size_t cnt = 0;
struct qedi_dbg_ctx *qedi_dbg =
(struct qedi_dbg_ctx *)filp->private_data;
struct qedi_list_of_funcs *lof = qedi_dbg_do_not_recover_ops;
if (*ppos)
return 0;
while (lof) {
if (!(lof->oper_str))
break;
if (!strncmp(lof->oper_str, buffer, strlen(lof->oper_str))) {
Annotation
- Immediate include surface: `qedi.h`, `qedi_dbg.h`, `linux/uaccess.h`, `linux/debugfs.h`, `linux/module.h`.
- Detected declarations: `function qedi_dbg_host_init`, `function qedi_dbg_host_exit`, `function qedi_dbg_init`, `function qedi_dbg_exit`, `function qedi_dbg_do_not_recover_enable`, `function qedi_dbg_do_not_recover_disable`, `function qedi_dbg_do_not_recover_cmd_write`, `function qedi_dbg_do_not_recover_cmd_read`, `function qedi_gbl_ctx_show`, `function qedi_dbg_gbl_ctx_open`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.