net/rfkill/core.c
Source file repositories/reference/linux-study-clean/net/rfkill/core.c
File Facts
- System
- Linux kernel
- Corpus path
net/rfkill/core.c- Extension
.c- Size
- 33957 bytes
- Lines
- 1474
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/kernel.hlinux/module.hlinux/init.hlinux/workqueue.hlinux/capability.hlinux/list.hlinux/mutex.hlinux/rfkill.hlinux/sched.hlinux/spinlock.hlinux/device.hlinux/miscdevice.hlinux/wait.hlinux/poll.hlinux/fs.hlinux/slab.hrfkill.h
Detected Declarations
struct rfkillstruct rfkill_int_eventstruct rfkill_datafunction rfkill_led_trigger_eventfunction rfkill_led_trigger_activatefunction rfkill_set_led_trigger_namefunction rfkill_led_trigger_registerfunction rfkill_led_trigger_unregisterfunction rfkill_global_led_trigger_workerfunction rfkill_global_led_trigger_eventfunction rfkill_global_led_trigger_registerfunction rfkill_global_led_trigger_unregisterfunction rfkill_led_trigger_eventfunction rfkill_led_trigger_unregisterfunction rfkill_global_led_trigger_unregisterfunction scoped_guardfunction rfkill_send_eventsfunction list_for_each_entryfunction rfkill_eventfunction methodfunction rfkill_syncfunction rfkill_update_global_statefunction __rfkill_switch_allfunction __rfkill_switch_allfunction rfkill_restore_statesfunction Restorefunction rfkill_remove_epo_lockfunction rfkill_is_epo_lock_activefunction rfkill_get_global_sw_statefunction rfkill_set_hw_state_reasonfunction __rfkill_set_sw_statefunction rfkill_set_sw_statefunction rfkill_init_sw_statefunction rfkill_set_statesfunction rfkill_find_typefunction name_showfunction type_showfunction index_showfunction persistent_showfunction hard_showfunction soft_showfunction soft_storefunction hard_block_reasons_showfunction user_state_from_blockedfunction state_showfunction state_storefunction rfkill_releasefunction rfkill_dev_uevent
Annotated Snippet
static const struct file_operations rfkill_fops = {
.owner = THIS_MODULE,
.open = rfkill_fop_open,
.read = rfkill_fop_read,
.write = rfkill_fop_write,
.poll = rfkill_fop_poll,
.release = rfkill_fop_release,
.unlocked_ioctl = rfkill_fop_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
#define RFKILL_NAME "rfkill"
static struct miscdevice rfkill_miscdev = {
.fops = &rfkill_fops,
.name = RFKILL_NAME,
.minor = RFKILL_MINOR,
};
static int __init rfkill_init(void)
{
int error;
rfkill_update_global_state(RFKILL_TYPE_ALL, !rfkill_default_state);
error = class_register(&rfkill_class);
if (error)
goto error_class;
error = misc_register(&rfkill_miscdev);
if (error)
goto error_misc;
error = rfkill_global_led_trigger_register();
if (error)
goto error_led_trigger;
#ifdef CONFIG_RFKILL_INPUT
error = rfkill_handler_init();
if (error)
goto error_input;
#endif
return 0;
#ifdef CONFIG_RFKILL_INPUT
error_input:
rfkill_global_led_trigger_unregister();
#endif
error_led_trigger:
misc_deregister(&rfkill_miscdev);
error_misc:
class_unregister(&rfkill_class);
error_class:
return error;
}
subsys_initcall(rfkill_init);
static void __exit rfkill_exit(void)
{
#ifdef CONFIG_RFKILL_INPUT
rfkill_handler_exit();
#endif
rfkill_global_led_trigger_unregister();
misc_deregister(&rfkill_miscdev);
class_unregister(&rfkill_class);
}
module_exit(rfkill_exit);
MODULE_ALIAS_MISCDEV(RFKILL_MINOR);
MODULE_ALIAS("devname:" RFKILL_NAME);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/workqueue.h`, `linux/capability.h`, `linux/list.h`, `linux/mutex.h`, `linux/rfkill.h`.
- Detected declarations: `struct rfkill`, `struct rfkill_int_event`, `struct rfkill_data`, `function rfkill_led_trigger_event`, `function rfkill_led_trigger_activate`, `function rfkill_set_led_trigger_name`, `function rfkill_led_trigger_register`, `function rfkill_led_trigger_unregister`, `function rfkill_global_led_trigger_worker`, `function rfkill_global_led_trigger_event`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern 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.