arch/um/drivers/chan_kern.c
Source file repositories/reference/linux-study-clean/arch/um/drivers/chan_kern.c
File Facts
- System
- Linux kernel
- Corpus path
arch/um/drivers/chan_kern.c- Extension
.c- Size
- 13207 bytes
- Lines
- 611
- Domain
- Architecture Layer
- Bucket
- arch/um
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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/slab.hlinux/tty.hlinux/tty_flip.hchan.hos.hirq_kern.h
Detected Declarations
struct chan_typefunction Copyrightfunction not_configged_openfunction not_configged_closefunction not_configged_readfunction not_configged_writefunction not_configged_console_writefunction not_configged_window_sizefunction not_configged_freefunction need_output_blockingfunction open_one_chanfunction open_chanfunction list_for_eachfunction chan_enable_winchfunction line_timer_cbfunction enable_chanfunction list_for_eachfunction free_irqsfunction list_for_eachfunction close_one_chanfunction close_chanfunction deactivate_chanfunction write_chanfunction console_write_chanfunction console_open_chanfunction chan_window_sizefunction free_one_chanfunction free_chanfunction list_for_each_safefunction one_chan_config_stringfunction chan_pair_config_stringfunction chan_config_stringfunction parse_chan_pairfunction chan_interrupt
Annotated Snippet
struct chan_type {
char *key;
const struct chan_ops *ops;
};
static const struct chan_type chan_table[] = {
{ "fd", &fd_ops },
#ifdef CONFIG_NULL_CHAN
{ "null", &null_ops },
#else
{ "null", ¬_configged_ops },
#endif
#ifdef CONFIG_PORT_CHAN
{ "port", &port_ops },
#else
{ "port", ¬_configged_ops },
#endif
#ifdef CONFIG_PTY_CHAN
{ "pty", &pty_ops },
{ "pts", &pts_ops },
#else
{ "pty", ¬_configged_ops },
{ "pts", ¬_configged_ops },
#endif
#ifdef CONFIG_TTY_CHAN
{ "tty", &tty_ops },
#else
{ "tty", ¬_configged_ops },
#endif
#ifdef CONFIG_XTERM_CHAN
{ "xterm", &xterm_ops },
#else
{ "xterm", ¬_configged_ops },
#endif
};
static struct chan *parse_chan(struct line *line, char *str, int device,
const struct chan_opts *opts, char **error_out)
{
const struct chan_type *entry;
const struct chan_ops *ops;
struct chan *chan;
void *data;
int i;
ops = NULL;
data = NULL;
for(i = 0; i < ARRAY_SIZE(chan_table); i++) {
entry = &chan_table[i];
if (!strncmp(str, entry->key, strlen(entry->key))) {
ops = entry->ops;
str += strlen(entry->key);
break;
}
}
if (ops == NULL) {
*error_out = "No match for configured backends";
return NULL;
}
data = (*ops->init)(str, device, opts);
if (data == NULL) {
*error_out = "Configuration failed";
return NULL;
}
chan = kmalloc_obj(*chan, GFP_ATOMIC);
if (chan == NULL) {
*error_out = "Memory allocation failed";
return NULL;
}
*chan = ((struct chan) { .list = LIST_HEAD_INIT(chan->list),
.free_list =
LIST_HEAD_INIT(chan->free_list),
.line = line,
.primary = 1,
.input = 0,
.output = 0,
.opened = 0,
.enabled = 0,
.fd_in = -1,
.fd_out = -1,
.ops = ops,
.data = data });
return chan;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/tty.h`, `linux/tty_flip.h`, `chan.h`, `os.h`, `irq_kern.h`.
- Detected declarations: `struct chan_type`, `function Copyright`, `function not_configged_open`, `function not_configged_close`, `function not_configged_read`, `function not_configged_write`, `function not_configged_console_write`, `function not_configged_window_size`, `function not_configged_free`, `function need_output_blocking`.
- Atlas domain: Architecture Layer / arch/um.
- Implementation status: source 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.