History

vt: move vc_translate to vt.c and rename it

vc_translate is used only in vt.c, so move the definition from a header there. Also, it used to be a macro, so be modern and make a static inline from it. This makes the code actually readable. And as a preparation for next patches, rename it to vc_translate_ascii. vc_translate will be a wrapper for both unicode and this one.

Jiri Slaby committed 6 years ago

Commit a0181801 parent 9a6f72d2 files · +13 −4Browse files

Unified · Split

2 files
  1. drivers/tty/vt/vt.c +13 −1
  2. include/linux/vt_kern.h +0 −3
drivers/tty/vt/vt.c+13−1
@@ -2560,6 +2560,18 @@ static void con_flush(struct vc_data *vc, unsigned long draw_from, · 2559 unmodified lines
2560 *draw_x = -1;2560 *draw_x = -1;
2561}2561}
2562 2562
2563static inline int vc_translate_ascii(const struct vc_data *vc, int c)
2564{
2565 if (IS_ENABLED(CONFIG_CONSOLE_TRANSLATIONS)) {
2566 if (vc->vc_toggle_meta)
2567 c |= 0x80;
2568
2569 return vc->vc_translate[c];
2570 }
2571
2572 return c;
2573}
2574
2563/* acquires console_lock */2575/* acquires console_lock */
2564static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count)2576static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count)
2565{2577{
@@ -2687,7 +2699,7 @@ rescan_last_byte: · 121 unmodified lines
2687 c = 0xfffd;2699 c = 0xfffd;
2688 tc = c;2700 tc = c;
2689 } else { /* no utf or alternate charset mode */2701 } else { /* no utf or alternate charset mode */
2690 tc = vc_translate(vc, c);2702 tc = vc_translate_ascii(vc, c);
2691 }2703 }
2692 2704
2693 param.c = tc;2705 param.c = tc;
include/linux/vt_kern.h+0−3
@@ -74,8 +74,6 @@ int con_set_default_unimap(struct vc_data *vc); · 73 unmodified lines
74void con_free_unimap(struct vc_data *vc);74void con_free_unimap(struct vc_data *vc);
75int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);75int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
76 76
77#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
78 ((vc)->vc_toggle_meta ? 0x80 : 0)])
79#else77#else
80static inline int con_set_trans_old(unsigned char __user *table)78static inline int con_set_trans_old(unsigned char __user *table)
81{79{
@@ -124,7 +122,6 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc) · 42 unmodified lines
124 return 0;122 return 0;
125}123}
126 124
127#define vc_translate(vc, c) (c)
128#endif125#endif
129 126
130/* vt.c */127/* vt.c */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t