hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/include/linux/console_struct.h
....@@ -21,6 +21,43 @@
2121 struct uni_screen;
2222
2323 #define NPAR 16
24
+#define VC_TABSTOPS_COUNT 256U
25
+
26
+enum vc_intensity {
27
+ VCI_HALF_BRIGHT,
28
+ VCI_NORMAL,
29
+ VCI_BOLD,
30
+ VCI_MASK = 0x3,
31
+};
32
+
33
+/**
34
+ * struct vc_state -- state of a VC
35
+ * @x: cursor's x-position
36
+ * @y: cursor's y-position
37
+ * @color: foreground & background colors
38
+ * @Gx_charset: what's G0/G1 slot set to (like GRAF_MAP, LAT1_MAP)
39
+ * @charset: what character set to use (0=G0 or 1=G1)
40
+ * @intensity: see enum vc_intensity for values
41
+ * @reverse: reversed foreground/background colors
42
+ *
43
+ * These members are defined separately from struct vc_data as we save &
44
+ * restore them at times.
45
+ */
46
+struct vc_state {
47
+ unsigned int x, y;
48
+
49
+ unsigned char color;
50
+
51
+ unsigned char Gx_charset[2];
52
+ unsigned int charset : 1;
53
+
54
+ /* attribute flags */
55
+ enum vc_intensity intensity;
56
+ bool italic;
57
+ bool underline;
58
+ bool blink;
59
+ bool reverse;
60
+};
2461
2562 /*
2663 * Example: vc_data of a console that was scrolled 3 lines down.
....@@ -57,6 +94,8 @@
5794 struct vc_data {
5895 struct tty_port port; /* Upper level data */
5996
97
+ struct vc_state state, saved_state;
98
+
6099 unsigned short vc_num; /* Console number */
61100 unsigned int vc_cols; /* [#] Console size */
62101 unsigned int vc_rows;
....@@ -74,8 +113,6 @@
74113 /* attributes for all characters on screen */
75114 unsigned char vc_attr; /* Current attributes */
76115 unsigned char vc_def_color; /* Default colors */
77
- unsigned char vc_color; /* Foreground & background */
78
- unsigned char vc_s_color; /* Saved foreground & background */
79116 unsigned char vc_ulcolor; /* Color for underline mode */
80117 unsigned char vc_itcolor;
81118 unsigned char vc_halfcolor; /* Color for half intensity mode */
....@@ -83,8 +120,6 @@
83120 unsigned int vc_cursor_type;
84121 unsigned short vc_complement_mask; /* [#] Xor mask for mouse pointer */
85122 unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */
86
- unsigned int vc_x, vc_y; /* Cursor position */
87
- unsigned int vc_saved_x, vc_saved_y;
88123 unsigned long vc_pos; /* Cursor address */
89124 /* fonts */
90125 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
....@@ -99,8 +134,6 @@
99134 int vt_newvt;
100135 wait_queue_head_t paste_wait;
101136 /* mode flags */
102
- unsigned int vc_charset : 1; /* Character set G0 / G1 */
103
- unsigned int vc_s_charset : 1; /* Saved character set */
104137 unsigned int vc_disp_ctrl : 1; /* Display chars < 32? */
105138 unsigned int vc_toggle_meta : 1; /* Toggle high bit? */
106139 unsigned int vc_decscnm : 1; /* Screen Mode */
....@@ -108,32 +141,17 @@
108141 unsigned int vc_decawm : 1; /* Autowrap Mode */
109142 unsigned int vc_deccm : 1; /* Cursor Visible */
110143 unsigned int vc_decim : 1; /* Insert Mode */
111
- /* attribute flags */
112
- unsigned int vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */
113
- unsigned int vc_italic:1;
114
- unsigned int vc_underline : 1;
115
- unsigned int vc_blink : 1;
116
- unsigned int vc_reverse : 1;
117
- unsigned int vc_s_intensity : 2; /* saved rendition */
118
- unsigned int vc_s_italic:1;
119
- unsigned int vc_s_underline : 1;
120
- unsigned int vc_s_blink : 1;
121
- unsigned int vc_s_reverse : 1;
122144 /* misc */
123
- unsigned int vc_ques : 1;
145
+ unsigned int vc_priv : 3;
124146 unsigned int vc_need_wrap : 1;
125147 unsigned int vc_can_do_color : 1;
126148 unsigned int vc_report_mouse : 2;
127149 unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */
128150 unsigned char vc_utf_count;
129151 int vc_utf_char;
130
- unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */
152
+ DECLARE_BITMAP(vc_tab_stop, VC_TABSTOPS_COUNT); /* Tab stops. 256 columns. */
131153 unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */
132154 unsigned short * vc_translate;
133
- unsigned char vc_G0_charset;
134
- unsigned char vc_G1_charset;
135
- unsigned char vc_saved_G0;
136
- unsigned char vc_saved_G1;
137155 unsigned int vc_resize_user; /* resize request from user */
138156 unsigned int vc_bell_pitch; /* Console bell pitch */
139157 unsigned int vc_bell_duration; /* Console bell duration */
....@@ -142,7 +160,6 @@
142160 struct uni_pagedir *vc_uni_pagedir;
143161 struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
144162 struct uni_screen *vc_uni_screen; /* unicode screen content */
145
- bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
146163 /* additional information is in vt_kern.h */
147164 };
148165
....@@ -151,28 +168,30 @@
151168 struct work_struct SAK_work;
152169
153170 /* might add scrmem, kbd at some time,
154
- to have everything in one place - the disadvantage
155
- would be that vc_cons etc can no longer be static */
171
+ to have everything in one place */
156172 };
157173
158174 extern struct vc vc_cons [MAX_NR_CONSOLES];
159175 extern void vc_SAK(struct work_struct *work);
160176
161
-#define CUR_DEF 0
162
-#define CUR_NONE 1
163
-#define CUR_UNDERLINE 2
164
-#define CUR_LOWER_THIRD 3
165
-#define CUR_LOWER_HALF 4
166
-#define CUR_TWO_THIRDS 5
167
-#define CUR_BLOCK 6
168
-#define CUR_HWMASK 0x0f
169
-#define CUR_SWMASK 0xfff0
177
+#define CUR_MAKE(size, change, set) ((size) | ((change) << 8) | \
178
+ ((set) << 16))
179
+#define CUR_SIZE(c) ((c) & 0x00000f)
180
+# define CUR_DEF 0
181
+# define CUR_NONE 1
182
+# define CUR_UNDERLINE 2
183
+# define CUR_LOWER_THIRD 3
184
+# define CUR_LOWER_HALF 4
185
+# define CUR_TWO_THIRDS 5
186
+# define CUR_BLOCK 6
187
+#define CUR_SW 0x000010
188
+#define CUR_ALWAYS_BG 0x000020
189
+#define CUR_INVERT_FG_BG 0x000040
190
+#define CUR_FG 0x000700
191
+#define CUR_BG 0x007000
192
+#define CUR_CHANGE(c) ((c) & 0x00ff00)
193
+#define CUR_SET(c) (((c) & 0xff0000) >> 8)
170194
171
-#define CUR_DEFAULT CUR_UNDERLINE
172
-
173
-static inline bool con_is_visible(const struct vc_data *vc)
174
-{
175
- return *vc->vc_display_fg == vc;
176
-}
195
+bool con_is_visible(const struct vc_data *vc);
177196
178197 #endif /* _LINUX_CONSOLE_STRUCT_H */