include/linux/console_struct.h

Source file repositories/reference/linux-study-clean/include/linux/console_struct.h

File Facts

System
Linux kernel
Corpus path
include/linux/console_struct.h
Extension
.h
Size
8312 bytes
Lines
228
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct vc_state {
	unsigned int	x, y;

	unsigned char	color;

	unsigned char	Gx_charset[2];
	unsigned int	charset		: 1;

	/* attribute flags */
	enum vc_intensity intensity;
	bool		italic;
	bool		underline;
	bool		blink;
	bool		reverse;
};

/**
 * struct vc_font - Describes a font
 * @width: The width of a single glyph in bits
 * @height: The height of a single glyph in scanlines
 * @charcount: The number of glyphs in the font
 * @data: The raw font data
 *
 * Font data is organized as an array of glyphs. Each glyph is a bitmap with
 * set bits indicating the foreground color. Unset bits indicate background
 * color. The fields @width and @height store a single glyph's number of
 * horizontal bits and vertical scanlines. If width is not a multiple of 8,
 * there are trailing bits to fill up the byte. These bits should not be drawn.
 *
 * The field @data points to the first glyph's first byte. The value @charcount
 * gives the number of glyphs in the font. There are no empty scanlines between
 * two adjacent glyphs.
 */
struct vc_font {
	unsigned int width;
	unsigned int height;
	unsigned int charcount;
	const unsigned char *data;
};

unsigned int vc_font_pitch(const struct vc_font *font);
unsigned int vc_font_size(const struct vc_font *font);

/*
 * Example: vc_data of a console that was scrolled 3 lines down.
 *
 *                              Console buffer
 * vc_screenbuf ---------> +----------------------+-.
 *                         | initializing W       |  \
 *                         | initializing X       |   |
 *                         | initializing Y       |    > scroll-back area
 *                         | initializing Z       |   |
 *                         |                      |  /
 * vc_visible_origin ---> ^+----------------------+-:
 * (changes by scroll)    || Welcome to linux     |  \
 *                        ||                      |   |
 *           vc_rows --->< | login: root          |   |  visible on console
 *                        || password:            |    > (vc_screenbuf_size is
 * vc_origin -----------> ||                      |   |   vc_size_row * vc_rows)
 * (start when no scroll) || Last login: 12:28    |  /
 *                        v+----------------------+-:
 *                         | Have a lot of fun... |  \
 * vc_pos -----------------|--------v             |   > scroll-front area
 *                         | ~ # cat_             |  /
 * vc_scr_end -----------> +----------------------+-:
 * (vc_origin +            |                      |  \ EMPTY, to be filled by
 *  vc_screenbuf_size)     |                      |  / vc_video_erase_char
 *                         +----------------------+-'
 *                         <---- 2 * vc_cols ----->
 *                         <---- vc_size_row ----->
 *
 * Note that every character in the console buffer is accompanied with an
 * attribute in the buffer right after the character. This is not depicted
 * in the figure.
 */
struct vc_data {
	struct tty_port port;			/* Upper level data */

	struct vc_state state, saved_state;

	unsigned short	vc_num;			/* Console number */
	unsigned int	vc_cols;		/* [#] Console size */
	unsigned int	vc_rows;
	unsigned int	vc_size_row;		/* Bytes per row */
	unsigned int	vc_scan_lines;		/* # of scan lines */
	unsigned int	vc_cell_height;		/* CRTC character cell height */
	unsigned long	vc_origin;		/* [!] Start of real screen */
	unsigned long	vc_scr_end;		/* [!] End of real screen */
	unsigned long	vc_visible_origin;	/* [!] Top of visible window */
	unsigned int	vc_top, vc_bottom;	/* Scrolling region */

Annotation

Implementation Notes