include/linux/kbd_kern.h
Source file repositories/reference/linux-study-clean/include/linux/kbd_kern.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/kbd_kern.h- Extension
.h- Size
- 3687 bytes
- Lines
- 137
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/tty.hlinux/interrupt.hlinux/keyboard.h
Detected Declarations
struct kbd_structstruct consolefunction vc_kbd_modefunction vc_kbd_ledfunction set_vc_kbd_modefunction set_vc_kbd_ledfunction clr_vc_kbd_modefunction clr_vc_kbd_ledfunction chg_vc_kbd_lockfunction chg_vc_kbd_slockfunction chg_vc_kbd_modefunction chg_vc_kbd_led
Annotated Snippet
struct kbd_struct {
unsigned char lockstate;
/* 8 modifiers - the names do not have any meaning at all;
they can be associated to arbitrarily chosen keys */
#define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */
#define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */
#define VC_CTRLLOCK KG_CTRL /* control lock mode */
#define VC_ALTLOCK KG_ALT /* alt lock mode */
#define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */
#define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */
#define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */
#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
unsigned char ledmode:1;
#define LED_SHOW_FLAGS 0 /* traditional state */
#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
unsigned char ledflagstate:4; /* flags, not lights */
unsigned char default_ledflagstate:4;
#define VC_SCROLLOCK 0 /* scroll-lock mode */
#define VC_NUMLOCK 1 /* numeric lock mode */
#define VC_CAPSLOCK 2 /* capslock mode */
#define VC_KANALOCK 3 /* kanalock mode */
unsigned char kbdmode:3; /* one 3-bit value */
#define VC_XLATE 0 /* translate keycodes using keymap */
#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
#define VC_RAW 2 /* raw (scancode) mode */
#define VC_UNICODE 3 /* Unicode mode */
#define VC_OFF 4 /* disabled mode */
unsigned char modeflags:5;
#define VC_APPLIC 0 /* application key mode */
#define VC_CKMODE 1 /* cursor key mode */
#define VC_REPEAT 2 /* keyboard repeat */
#define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends CRLF */
#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
};
extern int kbd_init(void);
extern void setledstate(struct kbd_struct *kbd, unsigned int led);
extern int do_poke_blanked_console;
extern void (*kbd_ledfunc)(unsigned int led);
extern int set_console(int nr);
extern void schedule_console_callback(void);
static inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
{
return ((kbd->modeflags >> flag) & 1);
}
static inline int vc_kbd_led(struct kbd_struct * kbd, int flag)
{
return ((kbd->ledflagstate >> flag) & 1);
}
static inline void set_vc_kbd_mode(struct kbd_struct * kbd, int flag)
{
kbd->modeflags |= 1 << flag;
}
static inline void set_vc_kbd_led(struct kbd_struct * kbd, int flag)
{
kbd->ledflagstate |= 1 << flag;
}
static inline void clr_vc_kbd_mode(struct kbd_struct * kbd, int flag)
{
kbd->modeflags &= ~(1 << flag);
}
static inline void clr_vc_kbd_led(struct kbd_struct * kbd, int flag)
{
kbd->ledflagstate &= ~(1 << flag);
}
static inline void chg_vc_kbd_lock(struct kbd_struct * kbd, int flag)
{
kbd->lockstate ^= 1 << flag;
}
static inline void chg_vc_kbd_slock(struct kbd_struct * kbd, int flag)
{
kbd->slockstate ^= 1 << flag;
Annotation
- Immediate include surface: `linux/tty.h`, `linux/interrupt.h`, `linux/keyboard.h`.
- Detected declarations: `struct kbd_struct`, `struct console`, `function vc_kbd_mode`, `function vc_kbd_led`, `function set_vc_kbd_mode`, `function set_vc_kbd_led`, `function clr_vc_kbd_mode`, `function clr_vc_kbd_led`, `function chg_vc_kbd_lock`, `function chg_vc_kbd_slock`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.