History

vt: introduce enum vc_intensity for intensity

Introduce names (en enum) for 0, 1, and 2 constants. We now have VCI_HALF_BRIGHT, VCI_NORMAL, and VCI_BOLD instead. Apart from the cleanup, 1) the enum allows for better type checking, and 2) this saves some code. No more fiddling with bits is needed in assembly now. (OTOH, the structure is larger.)

Jiri Slaby committed 6 years ago

Commit b84ae3d1 parent 28bc24f7 files · +43 −28Browse files

Showing the changes to include/linux (2 of 7 files). Show all

Unified · Split

2 files
  1. include/linux/console.h +4 −1
  2. include/linux/console_struct.h +9 −2
include/linux/console.h+4−1
@@ -35,6 +35,8 @@ enum con_scroll { · 34 unmodified lines
3535 SM_DOWN,
3636 };
3737
38+enum vc_intensity;
39+
3840 /**
3941 * struct consw - callbacks for consoles
4042 *
@@ -74,7 +76,8 @@ struct consw { · 33 unmodified lines
7476 void (*con_scrolldelta)(struct vc_data *vc, int lines);
7577 int (*con_set_origin)(struct vc_data *vc);
7678 void (*con_save_screen)(struct vc_data *vc);
77− u8 (*con_build_attr)(struct vc_data *vc, u8 color, u8 intensity,
79+ u8 (*con_build_attr)(struct vc_data *vc, u8 color,
80+ enum vc_intensity intensity,
7881 u8 blink, u8 underline, u8 reverse, u8 italic);
7982 void (*con_invert_region)(struct vc_data *vc, u16 *p, int count);
8083 u16 *(*con_screen_pos)(struct vc_data *vc, int offset);
include/linux/console_struct.h+9−2
@@ -22,6 +22,13 @@ struct uni_screen; · 21 unmodified lines
2222
2323 #define NPAR 16
2424
25+enum vc_intensity {
26+ VCI_HALF_BRIGHT,
27+ VCI_NORMAL,
28+ VCI_BOLD,
29+ VCI_MASK = 0x3,
30+};
31+
2532 /**
2633 * struct vc_state -- state of a VC
2734 * @x: cursor's x-position
@@ -30,7 +37,7 @@ struct uni_screen; · 2 unmodified lines
3037 * @G0_charset: what's G0 slot set to (like GRAF_MAP, LAT1_MAP)
3138 * @G1_charset: what's G1 slot set to (like GRAF_MAP, LAT1_MAP)
3239 * @charset: what character set to use (0=G0 or 1=G1)
33− * @intensity: 0=half-bright, 1=normal, 2=bold
40+ * @intensity: see enum vc_intensity for values
3441 * @reverse: reversed foreground/background colors
3542 *
3643 * These members are defined separately from struct vc_data as we save &
@@ -46,7 +53,7 @@ struct vc_state { · 9 unmodified lines
4653 unsigned int charset : 1;
4754
4855 /* attribute flags */
49− unsigned int intensity : 2;
56+ enum vc_intensity intensity;
5057 unsigned int italic : 1;
5158 unsigned int underline : 1;
5259 unsigned int blink : 1;