drivers/accessibility/speakup/kobjects.c
Source file repositories/reference/linux-study-clean/drivers/accessibility/speakup/kobjects.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accessibility/speakup/kobjects.c- Extension
.c- Size
- 26207 bytes
- Lines
- 1057
- Domain
- Driver Families
- Bucket
- drivers/accessibility
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/kobject.hlinux/string.hlinux/string_helpers.hlinux/sysfs.hlinux/ctype.hspeakup.hspk_priv.h
Detected Declarations
function Copyrightfunction report_char_chartab_statusfunction chars_chartab_storefunction keymap_showfunction keymap_storefunction silent_storefunction synth_showfunction synth_storefunction synth_direct_storefunction version_showfunction punc_showfunction punc_storefunction spk_var_showfunction spk_reset_default_valuefunction spk_var_storefunction message_show_helperfunction report_msg_statusfunction message_store_helperfunction checkfunction message_showfunction message_storefunction speakup_kobj_initfunction speakup_kobj_exitexport spk_var_showexport spk_var_store
Annotated Snippet
if (strcmp("characters", attr->attr.name) == 0) {
len = scnprintf(buf_pointer, bufsize, "%d\t%s\n",
i, spk_characters[i]);
} else { /* show chartab entry */
if (IS_TYPE(i, B_CTL))
cp = "B_CTL";
else if (IS_TYPE(i, WDLM))
cp = "WDLM";
else if (IS_TYPE(i, A_PUNC))
cp = "A_PUNC";
else if (IS_TYPE(i, PUNC))
cp = "PUNC";
else if (IS_TYPE(i, NUM))
cp = "NUM";
else if (IS_TYPE(i, A_CAP))
cp = "A_CAP";
else if (IS_TYPE(i, ALPHA))
cp = "ALPHA";
else if (IS_TYPE(i, B_CAPSYM))
cp = "B_CAPSYM";
else if (IS_TYPE(i, B_SYM))
cp = "B_SYM";
else
cp = "0";
len =
scnprintf(buf_pointer, bufsize, "%d\t%s\n", i, cp);
}
bufsize -= len;
buf_pointer += len;
}
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return buf_pointer - buf;
}
/*
* Print informational messages or warnings after updating
* character descriptions or chartab entries.
*/
static void report_char_chartab_status(int reset, int received, int used,
int rejected, int do_characters)
{
static char const *object_type[] = {
"character class entries",
"character descriptions",
};
int len;
char buf[80];
if (reset) {
pr_info("%s reset to defaults\n", object_type[do_characters]);
} else if (received) {
len = snprintf(buf, sizeof(buf),
" updated %d of %d %s\n",
used, received, object_type[do_characters]);
if (rejected)
snprintf(buf + (len - 1), sizeof(buf) - (len - 1),
" with %d reject%s\n",
rejected, rejected > 1 ? "s" : "");
pr_info("%s", buf);
}
}
/*
* This is called when a user changes the characters or chartab parameters.
*/
static ssize_t chars_chartab_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
char *cp = (char *)buf;
char *end = cp + count; /* the null at the end of the buffer */
char *linefeed = NULL;
char keyword[MAX_DESC_LEN + 1];
char *outptr = NULL; /* Will hold keyword or desc. */
char *temp = NULL;
char *desc = NULL;
ssize_t retval = count;
unsigned long flags;
unsigned long index = 0;
int charclass = 0;
int received = 0;
int used = 0;
int rejected = 0;
int reset = 0;
int do_characters = !strcmp(attr->attr.name, "characters");
size_t desc_length = 0;
int i;
spin_lock_irqsave(&speakup_info.spinlock, flags);
while (cp < end) {
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/kobject.h`, `linux/string.h`, `linux/string_helpers.h`, `linux/sysfs.h`, `linux/ctype.h`, `speakup.h`.
- Detected declarations: `function Copyright`, `function report_char_chartab_status`, `function chars_chartab_store`, `function keymap_show`, `function keymap_store`, `function silent_store`, `function synth_show`, `function synth_store`, `function synth_direct_store`, `function version_show`.
- Atlas domain: Driver Families / drivers/accessibility.
- Implementation status: integration 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.