kernel/trace/rv/rv.c
Source file repositories/reference/linux-study-clean/kernel/trace/rv/rv.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/trace/rv/rv.c- Extension
.c- Size
- 20744 bytes
- Lines
- 855
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/init.hlinux/slab.hrv_trace.hrv.h
Detected Declarations
function rv_get_task_monitor_slotfunction rv_put_task_monitor_slotfunction rv_is_nested_monitorfunction enablefunction monitor_enable_read_datafunction __rv_disable_monitorfunction rv_disable_singlefunction rv_enable_singlefunction rv_disable_containerfunction list_for_each_entry_continuefunction rv_enable_containerfunction list_for_each_entry_continuefunction rv_disable_monitorfunction rv_enable_monitorfunction monitor_enable_write_datafunction monitor_desc_read_datafunction create_monitor_dirfunction monitors_showfunction monitors_stopfunction list_for_each_entry_continuefunction available_monitors_openfunction disable_all_monitorsfunction enabled_monitors_openfunction enabled_monitors_writefunction list_for_each_entryfunction rv_monitoring_onfunction monitoring_on_read_datafunction turn_monitoring_offfunction reset_all_monitorsfunction list_for_each_entryfunction turn_monitoring_onfunction turn_monitoring_on_with_resetfunction monitoring_on_write_datafunction destroy_monitor_dirfunction rv_register_monitorfunction list_for_each_entryfunction rv_unregister_monitorfunction rv_init_interface
Annotated Snippet
static const struct file_operations interface_enable_fops = {
.open = simple_open,
.write = monitor_enable_write_data,
.read = monitor_enable_read_data,
};
/*
* Interface to read monitors description.
*/
static ssize_t monitor_desc_read_data(struct file *filp, char __user *user_buf, size_t count,
loff_t *ppos)
{
struct rv_monitor *mon = filp->private_data;
char buff[256];
memset(buff, 0, sizeof(buff));
snprintf(buff, sizeof(buff), "%s\n", mon->description);
return simple_read_from_buffer(user_buf, count, ppos, buff, strlen(buff) + 1);
}
static const struct file_operations interface_desc_fops = {
.open = simple_open,
.read = monitor_desc_read_data,
};
/*
* During the registration of a monitor, this function creates
* the monitor dir, where the specific options of the monitor
* are exposed.
*/
static int create_monitor_dir(struct rv_monitor *mon, struct rv_monitor *parent)
{
struct dentry *root = parent ? parent->root_d : get_monitors_root();
struct dentry *dir __free(rv_remove) = rv_create_dir(mon->name, root);
struct dentry *tmp;
int retval;
if (!dir)
return -ENOMEM;
tmp = rv_create_file("enable", RV_MODE_WRITE, dir, mon, &interface_enable_fops);
if (!tmp)
return -ENOMEM;
tmp = rv_create_file("desc", RV_MODE_READ, dir, mon, &interface_desc_fops);
if (!tmp)
return -ENOMEM;
retval = reactor_populate_monitor(mon, dir);
if (retval)
return retval;
mon->root_d = no_free_ptr(dir);
return 0;
}
/*
* Available/Enable monitor shared seq functions.
*/
static int monitors_show(struct seq_file *m, void *p)
{
struct rv_monitor *mon = container_of(p, struct rv_monitor, list);
if (mon->parent)
seq_printf(m, "%s:%s\n", mon->parent->name, mon->name);
else
seq_printf(m, "%s\n", mon->name);
return 0;
}
/*
* Used by the seq file operations at the end of a read
* operation.
*/
static void monitors_stop(struct seq_file *m, void *p)
{
mutex_unlock(&rv_interface_lock);
}
/*
* Available monitor seq functions.
*/
static void *available_monitors_start(struct seq_file *m, loff_t *pos)
{
mutex_lock(&rv_interface_lock);
return seq_list_start(&rv_monitors_list, *pos);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/slab.h`, `rv_trace.h`, `rv.h`.
- Detected declarations: `function rv_get_task_monitor_slot`, `function rv_put_task_monitor_slot`, `function rv_is_nested_monitor`, `function enable`, `function monitor_enable_read_data`, `function __rv_disable_monitor`, `function rv_disable_single`, `function rv_enable_single`, `function rv_disable_container`, `function list_for_each_entry_continue`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern 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.