vt_kern.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _VT_KERN_H
  3. #define _VT_KERN_H
  4. /*
  5. * this really is an extension of the vc_cons structure in console.c, but
  6. * with information needed by the vt package
  7. */
  8. #include <linux/vt.h>
  9. #include <linux/kd.h>
  10. #include <linux/tty.h>
  11. #include <linux/mutex.h>
  12. #include <linux/console_struct.h>
  13. #include <linux/mm.h>
  14. #include <linux/consolemap.h>
  15. #include <linux/notifier.h>
  16. void kd_mksound(unsigned int hz, unsigned int ticks);
  17. int kbd_rate(struct kbd_repeat *rep);
  18. extern int fg_console, last_console, want_console;
  19. /* console.c */
  20. int vc_allocate(unsigned int console);
  21. int vc_cons_allocated(unsigned int console);
  22. int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
  23. struct vc_data *vc_deallocate(unsigned int console);
  24. void reset_palette(struct vc_data *vc);
  25. void do_blank_screen(int entering_gfx);
  26. void do_unblank_screen(int leaving_gfx);
  27. void poke_blanked_console(void);
  28. int con_font_op(struct vc_data *vc, struct console_font_op *op);
  29. int con_set_cmap(unsigned char __user *cmap);
  30. int con_get_cmap(unsigned char __user *cmap);
  31. void scrollback(struct vc_data *vc);
  32. void scrollfront(struct vc_data *vc, int lines);
  33. void clear_buffer_attributes(struct vc_data *vc);
  34. void update_region(struct vc_data *vc, unsigned long start, int count);
  35. void redraw_screen(struct vc_data *vc, int is_switch);
  36. #define update_screen(x) redraw_screen(x, 0)
  37. #define switch_screen(x) redraw_screen(x, 1)
  38. struct tty_struct;
  39. int tioclinux(struct tty_struct *tty, unsigned long arg);
  40. #ifdef CONFIG_CONSOLE_TRANSLATIONS
  41. /* consolemap.c */
  42. struct unipair;
  43. int con_set_trans_old(unsigned char __user * table);
  44. int con_get_trans_old(unsigned char __user * table);
  45. int con_set_trans_new(unsigned short __user * table);
  46. int con_get_trans_new(unsigned short __user * table);
  47. int con_clear_unimap(struct vc_data *vc);
  48. int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);
  49. int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);
  50. int con_set_default_unimap(struct vc_data *vc);
  51. void con_free_unimap(struct vc_data *vc);
  52. int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
  53. #else
  54. static inline int con_set_trans_old(unsigned char __user *table)
  55. {
  56. return 0;
  57. }
  58. static inline int con_get_trans_old(unsigned char __user *table)
  59. {
  60. return -EINVAL;
  61. }
  62. static inline int con_set_trans_new(unsigned short __user *table)
  63. {
  64. return 0;
  65. }
  66. static inline int con_get_trans_new(unsigned short __user *table)
  67. {
  68. return -EINVAL;
  69. }
  70. static inline int con_clear_unimap(struct vc_data *vc)
  71. {
  72. return 0;
  73. }
  74. static inline
  75. int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
  76. {
  77. return 0;
  78. }
  79. static inline
  80. int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
  81. struct unipair __user *list)
  82. {
  83. return -EINVAL;
  84. }
  85. static inline int con_set_default_unimap(struct vc_data *vc)
  86. {
  87. return 0;
  88. }
  89. static inline void con_free_unimap(struct vc_data *vc)
  90. {
  91. }
  92. static inline void con_protect_unimap(struct vc_data *vc, int rdonly)
  93. {
  94. }
  95. static inline
  96. int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
  97. {
  98. return 0;
  99. }
  100. #endif
  101. /* vt.c */
  102. void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
  103. int vt_waitactive(int n);
  104. void change_console(struct vc_data *new_vc);
  105. void reset_vc(struct vc_data *vc);
  106. int do_unbind_con_driver(const struct consw *csw, int first, int last,
  107. int deflt);
  108. int vty_init(const struct file_operations *console_fops);
  109. extern bool vt_dont_switch;
  110. extern int default_utf8;
  111. extern int global_cursor_default;
  112. struct vt_spawn_console {
  113. spinlock_t lock;
  114. struct pid *pid;
  115. int sig;
  116. };
  117. extern struct vt_spawn_console vt_spawn_con;
  118. int vt_move_to_console(unsigned int vt, int alloc);
  119. /* Interfaces for VC notification of character events (for accessibility etc) */
  120. struct vt_notifier_param {
  121. struct vc_data *vc; /* VC on which the update happened */
  122. unsigned int c; /* Printed char */
  123. };
  124. int register_vt_notifier(struct notifier_block *nb);
  125. int unregister_vt_notifier(struct notifier_block *nb);
  126. void hide_boot_cursor(bool hide);
  127. /* keyboard provided interfaces */
  128. int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
  129. int vt_do_kdskbmode(unsigned int console, unsigned int arg);
  130. int vt_do_kdskbmeta(unsigned int console, unsigned int arg);
  131. int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
  132. int perm);
  133. int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm,
  134. unsigned int console);
  135. int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm);
  136. int vt_do_kdskled(unsigned int console, int cmd, unsigned long arg, int perm);
  137. int vt_do_kdgkbmode(unsigned int console);
  138. int vt_do_kdgkbmeta(unsigned int console);
  139. void vt_reset_unicode(unsigned int console);
  140. int vt_get_shift_state(void);
  141. void vt_reset_keyboard(unsigned int console);
  142. int vt_get_leds(unsigned int console, int flag);
  143. int vt_get_kbd_mode_bit(unsigned int console, int bit);
  144. void vt_set_kbd_mode_bit(unsigned int console, int bit);
  145. void vt_clr_kbd_mode_bit(unsigned int console, int bit);
  146. void vt_set_led_state(unsigned int console, int leds);
  147. void vt_kbd_con_start(unsigned int console);
  148. void vt_kbd_con_stop(unsigned int console);
  149. void vc_scrolldelta_helper(struct vc_data *c, int lines,
  150. unsigned int rolled_over, void *_base, unsigned int size);
  151. #endif /* _VT_KERN_H */