Commit 716a6639 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] cleanup vc array access

This removes as far as possible unneccessary vc_cons lookups by using a
pointer to the vc_data structure instead of the index.  The hidden currcons
argument in console_macros.h is temporarily replaced with a hidden vc pointer.
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c035fc12
#define cons_num (vc_cons[currcons].d->vc_num) #define cons_num (vc->vc_num)
#define video_scan_lines (vc_cons[currcons].d->vc_scan_lines) #define video_scan_lines (vc->vc_scan_lines)
#define sw (vc_cons[currcons].d->vc_sw) #define sw (vc->vc_sw)
#define screenbuf (vc_cons[currcons].d->vc_screenbuf) #define screenbuf (vc->vc_screenbuf)
#define screenbuf_size (vc_cons[currcons].d->vc_screenbuf_size) #define screenbuf_size (vc->vc_screenbuf_size)
#define origin (vc_cons[currcons].d->vc_origin) #define origin (vc->vc_origin)
#define scr_top (vc_cons[currcons].d->vc_scr_top) #define scr_top (vc->vc_scr_top)
#define visible_origin (vc_cons[currcons].d->vc_visible_origin) #define visible_origin (vc->vc_visible_origin)
#define scr_end (vc_cons[currcons].d->vc_scr_end) #define scr_end (vc->vc_scr_end)
#define pos (vc_cons[currcons].d->vc_pos) #define pos (vc->vc_pos)
#define top (vc_cons[currcons].d->vc_top) #define top (vc->vc_top)
#define bottom (vc_cons[currcons].d->vc_bottom) #define bottom (vc->vc_bottom)
#define x (vc_cons[currcons].d->vc_x) #define x (vc->vc_x)
#define y (vc_cons[currcons].d->vc_y) #define y (vc->vc_y)
#define vc_state (vc_cons[currcons].d->vc_state) #define vc_state (vc->vc_state)
#define npar (vc_cons[currcons].d->vc_npar) #define npar (vc->vc_npar)
#define par (vc_cons[currcons].d->vc_par) #define par (vc->vc_par)
#define ques (vc_cons[currcons].d->vc_ques) #define ques (vc->vc_ques)
#define attr (vc_cons[currcons].d->vc_attr) #define attr (vc->vc_attr)
#define saved_x (vc_cons[currcons].d->vc_saved_x) #define saved_x (vc->vc_saved_x)
#define saved_y (vc_cons[currcons].d->vc_saved_y) #define saved_y (vc->vc_saved_y)
#define translate (vc_cons[currcons].d->vc_translate) #define translate (vc->vc_translate)
#define G0_charset (vc_cons[currcons].d->vc_G0_charset) #define G0_charset (vc->vc_G0_charset)
#define G1_charset (vc_cons[currcons].d->vc_G1_charset) #define G1_charset (vc->vc_G1_charset)
#define saved_G0 (vc_cons[currcons].d->vc_saved_G0) #define saved_G0 (vc->vc_saved_G0)
#define saved_G1 (vc_cons[currcons].d->vc_saved_G1) #define saved_G1 (vc->vc_saved_G1)
#define utf (vc_cons[currcons].d->vc_utf) #define utf (vc->vc_utf)
#define utf_count (vc_cons[currcons].d->vc_utf_count) #define utf_count (vc->vc_utf_count)
#define utf_char (vc_cons[currcons].d->vc_utf_char) #define utf_char (vc->vc_utf_char)
#define video_erase_char (vc_cons[currcons].d->vc_video_erase_char) #define video_erase_char (vc->vc_video_erase_char)
#define disp_ctrl (vc_cons[currcons].d->vc_disp_ctrl) #define disp_ctrl (vc->vc_disp_ctrl)
#define toggle_meta (vc_cons[currcons].d->vc_toggle_meta) #define toggle_meta (vc->vc_toggle_meta)
#define decscnm (vc_cons[currcons].d->vc_decscnm) #define decscnm (vc->vc_decscnm)
#define decom (vc_cons[currcons].d->vc_decom) #define decom (vc->vc_decom)
#define decawm (vc_cons[currcons].d->vc_decawm) #define decawm (vc->vc_decawm)
#define deccm (vc_cons[currcons].d->vc_deccm) #define deccm (vc->vc_deccm)
#define decim (vc_cons[currcons].d->vc_decim) #define decim (vc->vc_decim)
#define deccolm (vc_cons[currcons].d->vc_deccolm) #define deccolm (vc->vc_deccolm)
#define need_wrap (vc_cons[currcons].d->vc_need_wrap) #define need_wrap (vc->vc_need_wrap)
#define kmalloced (vc_cons[currcons].d->vc_kmalloced) #define kmalloced (vc->vc_kmalloced)
#define report_mouse (vc_cons[currcons].d->vc_report_mouse) #define report_mouse (vc->vc_report_mouse)
#define color (vc_cons[currcons].d->vc_color) #define color (vc->vc_color)
#define s_color (vc_cons[currcons].d->vc_s_color) #define s_color (vc->vc_s_color)
#define def_color (vc_cons[currcons].d->vc_def_color) #define def_color (vc->vc_def_color)
#define foreground (color & 0x0f) #define foreground (color & 0x0f)
#define background (color & 0xf0) #define background (color & 0xf0)
#define charset (vc_cons[currcons].d->vc_charset) #define charset (vc->vc_charset)
#define s_charset (vc_cons[currcons].d->vc_s_charset) #define s_charset (vc->vc_s_charset)
#define intensity (vc_cons[currcons].d->vc_intensity) #define intensity (vc->vc_intensity)
#define underline (vc_cons[currcons].d->vc_underline) #define underline (vc->vc_underline)
#define blink (vc_cons[currcons].d->vc_blink) #define blink (vc->vc_blink)
#define reverse (vc_cons[currcons].d->vc_reverse) #define reverse (vc->vc_reverse)
#define s_intensity (vc_cons[currcons].d->vc_s_intensity) #define s_intensity (vc->vc_s_intensity)
#define s_underline (vc_cons[currcons].d->vc_s_underline) #define s_underline (vc->vc_s_underline)
#define s_blink (vc_cons[currcons].d->vc_s_blink) #define s_blink (vc->vc_s_blink)
#define s_reverse (vc_cons[currcons].d->vc_s_reverse) #define s_reverse (vc->vc_s_reverse)
#define ulcolor (vc_cons[currcons].d->vc_ulcolor) #define ulcolor (vc->vc_ulcolor)
#define halfcolor (vc_cons[currcons].d->vc_halfcolor) #define halfcolor (vc->vc_halfcolor)
#define tab_stop (vc_cons[currcons].d->vc_tab_stop) #define tab_stop (vc->vc_tab_stop)
#define palette (vc_cons[currcons].d->vc_palette) #define palette (vc->vc_palette)
#define bell_pitch (vc_cons[currcons].d->vc_bell_pitch) #define bell_pitch (vc->vc_bell_pitch)
#define bell_duration (vc_cons[currcons].d->vc_bell_duration) #define bell_duration (vc->vc_bell_duration)
#define cursor_type (vc_cons[currcons].d->vc_cursor_type) #define cursor_type (vc->vc_cursor_type)
#define display_fg (vc_cons[currcons].d->vc_display_fg) #define display_fg (vc->vc_display_fg)
#define complement_mask (vc_cons[currcons].d->vc_complement_mask) #define complement_mask (vc->vc_complement_mask)
#define s_complement_mask (vc_cons[currcons].d->vc_s_complement_mask) #define s_complement_mask (vc->vc_s_complement_mask)
#define hi_font_mask (vc_cons[currcons].d->vc_hi_font_mask) #define hi_font_mask (vc->vc_hi_font_mask)
#define vcmode (vt_cons[currcons]->vc_mode) #define vcmode (vt_cons[vc->vc_num]->vc_mode)
#define structsize (sizeof(struct vc_data) + sizeof(struct vt_struct)) #define structsize (sizeof(struct vc_data) + sizeof(struct vt_struct))
...@@ -208,9 +208,9 @@ static void set_inverse_transl(struct vc_data *conp, struct uni_pagedir *p, int ...@@ -208,9 +208,9 @@ static void set_inverse_transl(struct vc_data *conp, struct uni_pagedir *p, int
} }
} }
unsigned short *set_translate(int m,int currcons) unsigned short *set_translate(int m, struct vc_data *vc)
{ {
inv_translate[currcons] = m; inv_translate[vc->vc_num] = m;
return translations[m]; return translations[m];
} }
...@@ -362,15 +362,16 @@ static void con_release_unimap(struct uni_pagedir *p) ...@@ -362,15 +362,16 @@ static void con_release_unimap(struct uni_pagedir *p)
} }
} }
void con_free_unimap(int con) void con_free_unimap(struct vc_data *vc)
{ {
struct uni_pagedir *p; struct uni_pagedir *p;
struct vc_data *conp = vc_cons[con].d;
p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; if (!p)
if (!p) return; return;
*conp->vc_uni_pagedir_loc = 0; *vc->vc_uni_pagedir_loc = 0;
if (--p->refcount) return; if (--p->refcount)
return;
con_release_unimap(p); con_release_unimap(p);
kfree(p); kfree(p);
} }
...@@ -442,12 +443,11 @@ con_insert_unipair(struct uni_pagedir *p, u_short unicode, u_short fontpos) ...@@ -442,12 +443,11 @@ con_insert_unipair(struct uni_pagedir *p, u_short unicode, u_short fontpos)
} }
/* ui is a leftover from using a hashtable, but might be used again */ /* ui is a leftover from using a hashtable, but might be used again */
int con_clear_unimap(int con, struct unimapinit *ui) int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
{ {
struct uni_pagedir *p, *q; struct uni_pagedir *p, *q;
struct vc_data *conp = vc_cons[con].d;
p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
if (p && p->readonly) return -EIO; if (p && p->readonly) return -EIO;
if (!p || --p->refcount) { if (!p || --p->refcount) {
q = (struct uni_pagedir *)kmalloc(sizeof(*p), GFP_KERNEL); q = (struct uni_pagedir *)kmalloc(sizeof(*p), GFP_KERNEL);
...@@ -457,7 +457,7 @@ int con_clear_unimap(int con, struct unimapinit *ui) ...@@ -457,7 +457,7 @@ int con_clear_unimap(int con, struct unimapinit *ui)
} }
memset(q, 0, sizeof(*q)); memset(q, 0, sizeof(*q));
q->refcount=1; q->refcount=1;
*conp->vc_uni_pagedir_loc = (unsigned long)q; *vc->vc_uni_pagedir_loc = (unsigned long)q;
} else { } else {
if (p == dflt) dflt = NULL; if (p == dflt) dflt = NULL;
p->refcount++; p->refcount++;
...@@ -467,14 +467,12 @@ int con_clear_unimap(int con, struct unimapinit *ui) ...@@ -467,14 +467,12 @@ int con_clear_unimap(int con, struct unimapinit *ui)
return 0; return 0;
} }
int int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
con_set_unimap(int con, ushort ct, struct unipair __user *list)
{ {
int err = 0, err1, i; int err = 0, err1, i;
struct uni_pagedir *p, *q; struct uni_pagedir *p, *q;
struct vc_data *conp = vc_cons[con].d;
p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
if (p->readonly) return -EIO; if (p->readonly) return -EIO;
if (!ct) return 0; if (!ct) return 0;
...@@ -483,10 +481,10 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list) ...@@ -483,10 +481,10 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list)
int j, k; int j, k;
u16 **p1, *p2, l; u16 **p1, *p2, l;
err1 = con_clear_unimap(con, NULL); err1 = con_clear_unimap(vc, NULL);
if (err1) return err1; if (err1) return err1;
q = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; q = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
for (i = 0, l = 0; i < 32; i++) for (i = 0, l = 0; i < 32; i++)
if ((p1 = p->uni_pgdir[i])) if ((p1 = p->uni_pgdir[i]))
for (j = 0; j < 32; j++) for (j = 0; j < 32; j++)
...@@ -496,7 +494,7 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list) ...@@ -496,7 +494,7 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list)
err1 = con_insert_unipair(q, l, p2[k]); err1 = con_insert_unipair(q, l, p2[k]);
if (err1) { if (err1) {
p->refcount++; p->refcount++;
*conp->vc_uni_pagedir_loc = (unsigned long)p; *vc->vc_uni_pagedir_loc = (unsigned long)p;
con_release_unimap(q); con_release_unimap(q);
kfree(q); kfree(q);
return err1; return err1;
...@@ -515,11 +513,11 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list) ...@@ -515,11 +513,11 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list)
list++; list++;
} }
if (con_unify_unimap(conp, p)) if (con_unify_unimap(vc, p))
return err; return err;
for (i = 0; i <= 3; i++) for (i = 0; i <= 3; i++)
set_inverse_transl(conp, p, i); /* Update all inverse translations */ set_inverse_transl(vc, p, i); /* Update all inverse translations */
return err; return err;
} }
...@@ -529,20 +527,18 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list) ...@@ -529,20 +527,18 @@ con_set_unimap(int con, ushort ct, struct unipair __user *list)
with. This routine is executed at sys_setup time, and when the with. This routine is executed at sys_setup time, and when the
PIO_FONTRESET ioctl is called. */ PIO_FONTRESET ioctl is called. */
int int con_set_default_unimap(struct vc_data *vc)
con_set_default_unimap(int con)
{ {
int i, j, err = 0, err1; int i, j, err = 0, err1;
u16 *q; u16 *q;
struct uni_pagedir *p; struct uni_pagedir *p;
struct vc_data *conp = vc_cons[con].d;
if (dflt) { if (dflt) {
p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
if (p == dflt) if (p == dflt)
return 0; return 0;
dflt->refcount++; dflt->refcount++;
*conp->vc_uni_pagedir_loc = (unsigned long)dflt; *vc->vc_uni_pagedir_loc = (unsigned long)dflt;
if (p && --p->refcount) { if (p && --p->refcount) {
con_release_unimap(p); con_release_unimap(p);
kfree(p); kfree(p);
...@@ -552,10 +548,10 @@ con_set_default_unimap(int con) ...@@ -552,10 +548,10 @@ con_set_default_unimap(int con)
/* The default font is always 256 characters */ /* The default font is always 256 characters */
err = con_clear_unimap(con,NULL); err = con_clear_unimap(vc, NULL);
if (err) return err; if (err) return err;
p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
q = dfont_unitable; q = dfont_unitable;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
...@@ -565,47 +561,42 @@ con_set_default_unimap(int con) ...@@ -565,47 +561,42 @@ con_set_default_unimap(int con)
err = err1; err = err1;
} }
if (con_unify_unimap(conp, p)) { if (con_unify_unimap(vc, p)) {
dflt = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; dflt = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
return err; return err;
} }
for (i = 0; i <= 3; i++) for (i = 0; i <= 3; i++)
set_inverse_transl(conp, p, i); /* Update all inverse translations */ set_inverse_transl(vc, p, i); /* Update all inverse translations */
dflt = p; dflt = p;
return err; return err;
} }
EXPORT_SYMBOL(con_set_default_unimap); EXPORT_SYMBOL(con_set_default_unimap);
int int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
con_copy_unimap(int dstcon, int srccon)
{ {
struct vc_data *sconp = vc_cons[srccon].d;
struct vc_data *dconp = vc_cons[dstcon].d;
struct uni_pagedir *q; struct uni_pagedir *q;
if (!vc_cons_allocated(srccon) || !*sconp->vc_uni_pagedir_loc) if (!*src_vc->vc_uni_pagedir_loc)
return -EINVAL; return -EINVAL;
if (*dconp->vc_uni_pagedir_loc == *sconp->vc_uni_pagedir_loc) if (*dst_vc->vc_uni_pagedir_loc == *src_vc->vc_uni_pagedir_loc)
return 0; return 0;
con_free_unimap(dstcon); con_free_unimap(dst_vc);
q = (struct uni_pagedir *)*sconp->vc_uni_pagedir_loc; q = (struct uni_pagedir *)*src_vc->vc_uni_pagedir_loc;
q->refcount++; q->refcount++;
*dconp->vc_uni_pagedir_loc = (long)q; *dst_vc->vc_uni_pagedir_loc = (long)q;
return 0; return 0;
} }
int int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list)
con_get_unimap(int con, ushort ct, ushort __user *uct, struct unipair __user *list)
{ {
int i, j, k, ect; int i, j, k, ect;
u16 **p1, *p2; u16 **p1, *p2;
struct uni_pagedir *p; struct uni_pagedir *p;
struct vc_data *conp = vc_cons[con].d;
ect = 0; ect = 0;
if (*conp->vc_uni_pagedir_loc) { if (*vc->vc_uni_pagedir_loc) {
p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
if ((p1 = p->uni_pgdir[i])) if ((p1 = p->uni_pgdir[i]))
for (j = 0; j < 32; j++) for (j = 0; j < 32; j++)
...@@ -625,12 +616,12 @@ con_get_unimap(int con, ushort ct, ushort __user *uct, struct unipair __user *li ...@@ -625,12 +616,12 @@ con_get_unimap(int con, ushort ct, ushort __user *uct, struct unipair __user *li
return ((ect <= ct) ? 0 : -ENOMEM); return ((ect <= ct) ? 0 : -ENOMEM);
} }
void con_protect_unimap(int con, int rdonly) void con_protect_unimap(struct vc_data *vc, int rdonly)
{ {
struct uni_pagedir *p = (struct uni_pagedir *) struct uni_pagedir *p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
*vc_cons[con].d->vc_uni_pagedir_loc;
if (p) p->readonly = rdonly; if (p)
p->readonly = rdonly;
} }
int int
...@@ -679,7 +670,7 @@ console_map_init(void) ...@@ -679,7 +670,7 @@ console_map_init(void)
for (i = 0; i < MAX_NR_CONSOLES; i++) for (i = 0; i < MAX_NR_CONSOLES; i++)
if (vc_cons_allocated(i) && !*vc_cons[i].d->vc_uni_pagedir_loc) if (vc_cons_allocated(i) && !*vc_cons[i].d->vc_uni_pagedir_loc)
con_set_default_unimap(i); con_set_default_unimap(vc_cons[i].d);
} }
EXPORT_SYMBOL(con_copy_unimap); EXPORT_SYMBOL(con_copy_unimap);
...@@ -536,12 +536,12 @@ static void fn_send_intr(struct vc_data *vc, struct pt_regs *regs) ...@@ -536,12 +536,12 @@ static void fn_send_intr(struct vc_data *vc, struct pt_regs *regs)
static void fn_scroll_forw(struct vc_data *vc, struct pt_regs *regs) static void fn_scroll_forw(struct vc_data *vc, struct pt_regs *regs)
{ {
scrollfront(0); scrollfront(vc, 0);
} }
static void fn_scroll_back(struct vc_data *vc, struct pt_regs *regs) static void fn_scroll_back(struct vc_data *vc, struct pt_regs *regs)
{ {
scrollback(0); scrollback(vc, 0);
} }
static void fn_show_mem(struct vc_data *vc, struct pt_regs *regs) static void fn_show_mem(struct vc_data *vc, struct pt_regs *regs)
...@@ -581,7 +581,7 @@ static void fn_SAK(struct vc_data *vc, struct pt_regs *regs) ...@@ -581,7 +581,7 @@ static void fn_SAK(struct vc_data *vc, struct pt_regs *regs)
*/ */
if (tty) if (tty)
do_SAK(tty); do_SAK(tty);
reset_vc(fg_console); reset_vc(vc);
} }
static void fn_null(struct vc_data *vc, struct pt_regs *regs) static void fn_null(struct vc_data *vc, struct pt_regs *regs)
......
...@@ -43,15 +43,13 @@ static char *sel_buffer; ...@@ -43,15 +43,13 @@ static char *sel_buffer;
from interrupt (via scrollback/front) */ from interrupt (via scrollback/front) */
/* set reverse video on characters s-e of console with selection. */ /* set reverse video on characters s-e of console with selection. */
inline static void static inline void highlight(const int s, const int e)
highlight(const int s, const int e)
{ {
invert_screen(sel_cons, s, e-s+2, 1); invert_screen(sel_cons, s, e-s+2, 1);
} }
/* use complementary color to show the pointer */ /* use complementary color to show the pointer */
inline static void static inline void highlight_pointer(const int where)
highlight_pointer(const int where)
{ {
complement_pos(sel_cons, where); complement_pos(sel_cons, where);
} }
......
...@@ -33,11 +33,10 @@ ...@@ -33,11 +33,10 @@
#include <linux/buffer_head.h> /* for fsync_bdev() */ #include <linux/buffer_head.h> /* for fsync_bdev() */
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/vt_kern.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
extern void reset_vc(unsigned int);
/* Whether we react on sysrq keys or just ignore them */ /* Whether we react on sysrq keys or just ignore them */
int sysrq_enabled = 1; int sysrq_enabled = 1;
...@@ -68,7 +67,7 @@ static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs, ...@@ -68,7 +67,7 @@ static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs,
{ {
if (tty) if (tty)
do_SAK(tty); do_SAK(tty);
reset_vc(fg_console); reset_vc(vc_cons[fg_console].d);
} }
static struct sysrq_key_op sysrq_SAK_op = { static struct sysrq_key_op sysrq_SAK_op = {
.handler = sysrq_handle_SAK, .handler = sysrq_handle_SAK,
......
...@@ -1789,7 +1789,6 @@ static int tty_open(struct inode * inode, struct file * filp) ...@@ -1789,7 +1789,6 @@ static int tty_open(struct inode * inode, struct file * filp)
} }
#ifdef CONFIG_VT #ifdef CONFIG_VT
if (device == MKDEV(TTY_MAJOR,0)) { if (device == MKDEV(TTY_MAJOR,0)) {
extern int fg_console;
extern struct tty_driver *console_driver; extern struct tty_driver *console_driver;
driver = console_driver; driver = console_driver;
index = fg_console; index = fg_console;
...@@ -2016,11 +2015,10 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, ...@@ -2016,11 +2015,10 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
return 0; return 0;
#ifdef CONFIG_VT #ifdef CONFIG_VT
if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) { if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) {
unsigned int currcons = tty->index;
int rc; int rc;
acquire_console_sem(); acquire_console_sem();
rc = vc_resize(currcons, tmp_ws.ws_col, tmp_ws.ws_row); rc = vc_resize(tty->driver_data, tmp_ws.ws_col, tmp_ws.ws_row);
release_console_sem(); release_console_sem();
if (rc) if (rc)
return -ENXIO; return -ENXIO;
......
...@@ -52,14 +52,17 @@ vcs_size(struct inode *inode) ...@@ -52,14 +52,17 @@ vcs_size(struct inode *inode)
int size; int size;
int minor = iminor(inode); int minor = iminor(inode);
int currcons = minor & 127; int currcons = minor & 127;
struct vc_data *vc;
if (currcons == 0) if (currcons == 0)
currcons = fg_console; currcons = fg_console;
else else
currcons--; currcons--;
if (!vc_cons_allocated(currcons)) if (!vc_cons_allocated(currcons))
return -ENXIO; return -ENXIO;
vc = vc_cons[currcons].d;
size = vc_cons[currcons].d->vc_rows * vc_cons[currcons].d->vc_cols; size = vc->vc_rows * vc->vc_cols;
if (minor & 128) if (minor & 128)
size = 2*size + HEADER_SIZE; size = 2*size + HEADER_SIZE;
...@@ -442,7 +445,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) ...@@ -442,7 +445,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
buf += orig_count; buf += orig_count;
pos += orig_count; pos += orig_count;
if (org0) if (org0)
update_region(currcons, (unsigned long)(org0), org-org0); update_region(vc, (unsigned long)(org0), org - org0);
} }
*ppos += written; *ppos += written;
ret = written; ret = written;
......
This diff is collapsed.
...@@ -311,7 +311,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struc ...@@ -311,7 +311,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struc
op->height = cfdarg.charheight; op->height = cfdarg.charheight;
op->charcount = cfdarg.charcount; op->charcount = cfdarg.charcount;
op->data = cfdarg.chardata; op->data = cfdarg.chardata;
return con_font_op(fg_console, op); return con_font_op(vc_cons[fg_console].d, op);
case GIO_FONTX: { case GIO_FONTX: {
op->op = KD_FONT_OP_GET; op->op = KD_FONT_OP_GET;
op->flags = KD_FONT_FLAG_OLD; op->flags = KD_FONT_FLAG_OLD;
...@@ -319,7 +319,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struc ...@@ -319,7 +319,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struc
op->height = cfdarg.charheight; op->height = cfdarg.charheight;
op->charcount = cfdarg.charcount; op->charcount = cfdarg.charcount;
op->data = cfdarg.chardata; op->data = cfdarg.chardata;
i = con_font_op(fg_console, op); i = con_font_op(vc_cons[fg_console].d, op);
if (i) if (i)
return i; return i;
cfdarg.charheight = op->height; cfdarg.charheight = op->height;
...@@ -333,7 +333,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struc ...@@ -333,7 +333,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struc
} }
static inline int static inline int
do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, unsigned int console) do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, struct vc_data *vc)
{ {
struct unimapdesc tmp; struct unimapdesc tmp;
int i = 0; int i = 0;
...@@ -349,11 +349,11 @@ do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, unsigned i ...@@ -349,11 +349,11 @@ do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, unsigned i
case PIO_UNIMAP: case PIO_UNIMAP:
if (!perm) if (!perm)
return -EPERM; return -EPERM;
return con_set_unimap(console, tmp.entry_ct, tmp.entries); return con_set_unimap(vc, tmp.entry_ct, tmp.entries);
case GIO_UNIMAP: case GIO_UNIMAP:
if (!perm && fg_console != console) if (!perm && fg_console != vc->vc_num)
return -EPERM; return -EPERM;
return con_get_unimap(console, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries); return con_get_unimap(vc, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
} }
return 0; return 0;
} }
...@@ -796,7 +796,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -796,7 +796,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
* make sure we are atomic with respect to * make sure we are atomic with respect to
* other console switches.. * other console switches..
*/ */
complete_change_console(newvt); complete_change_console(vc_cons[newvt].d);
release_console_sem(); release_console_sem();
} }
} }
...@@ -852,7 +852,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -852,7 +852,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
return -EFAULT; return -EFAULT;
for (i = 0; i < MAX_NR_CONSOLES; i++) { for (i = 0; i < MAX_NR_CONSOLES; i++) {
acquire_console_sem(); acquire_console_sem();
vc_resize(i, cc, ll); vc_resize(vc_cons[i].d, cc, ll);
release_console_sem(); release_console_sem();
} }
return 0; return 0;
...@@ -900,7 +900,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -900,7 +900,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
vc_cons[i].d->vc_scan_lines = vlin; vc_cons[i].d->vc_scan_lines = vlin;
if (clin) if (clin)
vc_cons[i].d->vc_font.height = clin; vc_cons[i].d->vc_font.height = clin;
vc_resize(i, cc, ll); vc_resize(vc_cons[i].d, cc, ll);
release_console_sem(); release_console_sem();
} }
return 0; return 0;
...@@ -915,7 +915,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -915,7 +915,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
op.height = 0; op.height = 0;
op.charcount = 256; op.charcount = 256;
op.data = up; op.data = up;
return con_font_op(fg_console, &op); return con_font_op(vc_cons[fg_console].d, &op);
} }
case GIO_FONT: { case GIO_FONT: {
...@@ -925,7 +925,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -925,7 +925,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
op.height = 32; op.height = 32;
op.charcount = 256; op.charcount = 256;
op.data = up; op.data = up;
return con_font_op(fg_console, &op); return con_font_op(vc_cons[fg_console].d, &op);
} }
case PIO_CMAP: case PIO_CMAP:
...@@ -953,9 +953,10 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -953,9 +953,10 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
{ {
op.op = KD_FONT_OP_SET_DEFAULT; op.op = KD_FONT_OP_SET_DEFAULT;
op.data = NULL; op.data = NULL;
i = con_font_op(fg_console, &op); i = con_font_op(vc_cons[fg_console].d, &op);
if (i) return i; if (i)
con_set_default_unimap(fg_console); return i;
con_set_default_unimap(vc_cons[fg_console].d);
return 0; return 0;
} }
#endif #endif
...@@ -966,7 +967,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -966,7 +967,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
return -EFAULT; return -EFAULT;
if (!perm && op.op != KD_FONT_OP_GET) if (!perm && op.op != KD_FONT_OP_GET)
return -EPERM; return -EPERM;
i = con_font_op(console, &op); i = con_font_op(vc, &op);
if (i) return i; if (i) return i;
if (copy_to_user(up, &op, sizeof(op))) if (copy_to_user(up, &op, sizeof(op)))
return -EFAULT; return -EFAULT;
...@@ -995,13 +996,13 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -995,13 +996,13 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
return -EPERM; return -EPERM;
i = copy_from_user(&ui, up, sizeof(struct unimapinit)); i = copy_from_user(&ui, up, sizeof(struct unimapinit));
if (i) return -EFAULT; if (i) return -EFAULT;
con_clear_unimap(console, &ui); con_clear_unimap(vc, &ui);
return 0; return 0;
} }
case PIO_UNIMAP: case PIO_UNIMAP:
case GIO_UNIMAP: case GIO_UNIMAP:
return do_unimap_ioctl(cmd, up, perm, console); return do_unimap_ioctl(cmd, up, perm, vc);
case VT_LOCKSWITCH: case VT_LOCKSWITCH:
if (!capable(CAP_SYS_TTY_CONFIG)) if (!capable(CAP_SYS_TTY_CONFIG))
...@@ -1054,26 +1055,29 @@ int vt_waitactive(int vt) ...@@ -1054,26 +1055,29 @@ int vt_waitactive(int vt)
#define vt_wake_waitactive() wake_up(&vt_activate_queue) #define vt_wake_waitactive() wake_up(&vt_activate_queue)
void reset_vc(unsigned int new_console) void reset_vc(struct vc_data *vc)
{ {
vt_cons[new_console]->vc_mode = KD_TEXT; struct vt_struct *vt = vt_cons[vc->vc_num];
kbd_table[new_console].kbdmode = VC_XLATE;
vt_cons[new_console]->vt_mode.mode = VT_AUTO; vt->vc_mode = KD_TEXT;
vt_cons[new_console]->vt_mode.waitv = 0; kbd_table[vc->vc_num].kbdmode = VC_XLATE;
vt_cons[new_console]->vt_mode.relsig = 0; vt->vt_mode.mode = VT_AUTO;
vt_cons[new_console]->vt_mode.acqsig = 0; vt->vt_mode.waitv = 0;
vt_cons[new_console]->vt_mode.frsig = 0; vt->vt_mode.relsig = 0;
vt_cons[new_console]->vt_pid = -1; vt->vt_mode.acqsig = 0;
vt_cons[new_console]->vt_newvt = -1; vt->vt_mode.frsig = 0;
vt->vt_pid = -1;
vt->vt_newvt = -1;
if (!in_interrupt()) /* Via keyboard.c:SAK() - akpm */ if (!in_interrupt()) /* Via keyboard.c:SAK() - akpm */
reset_palette(new_console) ; reset_palette(vc);
} }
/* /*
* Performs the back end of a vt switch * Performs the back end of a vt switch
*/ */
void complete_change_console(unsigned int new_console) void complete_change_console(struct vc_data *vc)
{ {
unsigned int new_console = vc->vc_num;
unsigned char old_vc_mode; unsigned char old_vc_mode;
last_console = fg_console; last_console = fg_console;
...@@ -1084,7 +1088,7 @@ void complete_change_console(unsigned int new_console) ...@@ -1084,7 +1088,7 @@ void complete_change_console(unsigned int new_console)
* unblank the screen later. * unblank the screen later.
*/ */
old_vc_mode = vt_cons[fg_console]->vc_mode; old_vc_mode = vt_cons[fg_console]->vc_mode;
switch_screen(new_console); switch_screen(vc);
/* /*
* This can't appear below a successful kill_proc(). If it did, * This can't appear below a successful kill_proc(). If it did,
...@@ -1129,7 +1133,7 @@ void complete_change_console(unsigned int new_console) ...@@ -1129,7 +1133,7 @@ void complete_change_console(unsigned int new_console)
* this outside of VT_PROCESS but there is no single process * this outside of VT_PROCESS but there is no single process
* to account for and tracking tty count may be undesirable. * to account for and tracking tty count may be undesirable.
*/ */
reset_vc(new_console); reset_vc(vc);
if (old_vc_mode != vt_cons[new_console]->vc_mode) if (old_vc_mode != vt_cons[new_console]->vc_mode)
{ {
...@@ -1151,11 +1155,9 @@ void complete_change_console(unsigned int new_console) ...@@ -1151,11 +1155,9 @@ void complete_change_console(unsigned int new_console)
/* /*
* Performs the front-end of a vt switch * Performs the front-end of a vt switch
*/ */
void change_console(unsigned int new_console) void change_console(struct vc_data *new_vc)
{ {
if ((new_console == fg_console) || (vt_dont_switch)) if (!new_vc || new_vc->vc_num == fg_console || vt_dont_switch)
return;
if (!vc_cons_allocated(new_console))
return; return;
/* /*
...@@ -1189,7 +1191,7 @@ void change_console(unsigned int new_console) ...@@ -1189,7 +1191,7 @@ void change_console(unsigned int new_console)
* return. The process needs to send us a * return. The process needs to send us a
* VT_RELDISP ioctl to complete the switch. * VT_RELDISP ioctl to complete the switch.
*/ */
vt_cons[fg_console]->vt_newvt = new_console; vt_cons[fg_console]->vt_newvt = new_vc->vc_num;
return; return;
} }
...@@ -1202,7 +1204,7 @@ void change_console(unsigned int new_console) ...@@ -1202,7 +1204,7 @@ void change_console(unsigned int new_console)
* this outside of VT_PROCESS but there is no single process * this outside of VT_PROCESS but there is no single process
* to account for and tracking tty count may be undesirable. * to account for and tracking tty count may be undesirable.
*/ */
reset_vc(fg_console); reset_vc(vc_cons[fg_console].d);
/* /*
* Fall through to normal (VT_AUTO) handling of the switch... * Fall through to normal (VT_AUTO) handling of the switch...
...@@ -1215,5 +1217,5 @@ void change_console(unsigned int new_console) ...@@ -1215,5 +1217,5 @@ void change_console(unsigned int new_console)
if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
return; return;
complete_change_console(new_console); complete_change_console(new_vc);
} }
...@@ -42,7 +42,7 @@ static void dummycon_init(struct vc_data *vc, int init) ...@@ -42,7 +42,7 @@ static void dummycon_init(struct vc_data *vc, int init)
vc->vc_cols = DUMMY_COLUMNS; vc->vc_cols = DUMMY_COLUMNS;
vc->vc_rows = DUMMY_ROWS; vc->vc_rows = DUMMY_ROWS;
} else } else
vc_resize(vc->vc_num, DUMMY_COLUMNS, DUMMY_ROWS); vc_resize(vc, DUMMY_COLUMNS, DUMMY_ROWS);
} }
static int dummycon_dummy(void) static int dummycon_dummy(void)
......
...@@ -458,7 +458,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, ...@@ -458,7 +458,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
if (CON_IS_VISIBLE(vc) && vt_cons[vc->vc_num]->vc_mode == KD_TEXT) { if (CON_IS_VISIBLE(vc) && vt_cons[vc->vc_num]->vc_mode == KD_TEXT) {
fbcon_clear_margins(vc, 0); fbcon_clear_margins(vc, 0);
update_screen(vc->vc_num); update_screen(vc);
} }
if (save) { if (save) {
...@@ -609,7 +609,7 @@ static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, ...@@ -609,7 +609,7 @@ static void con2fb_init_display(struct vc_data *vc, struct fb_info *info,
fg_vc->vc_rows); fg_vc->vc_rows);
} }
switch_screen(fg_console); update_screen(vc_cons[fg_console].d);
} }
/** /**
...@@ -802,7 +802,7 @@ static const char *fbcon_startup(void) ...@@ -802,7 +802,7 @@ static const char *fbcon_startup(void)
cols = info->var.xres / vc->vc_font.width; cols = info->var.xres / vc->vc_font.width;
rows = info->var.yres / vc->vc_font.height; rows = info->var.yres / vc->vc_font.height;
vc_resize(vc->vc_num, cols, rows); vc_resize(vc, cols, rows);
DPRINTK("mode: %s\n", info->fix.id); DPRINTK("mode: %s\n", info->fix.id);
DPRINTK("visual: %d\n", info->fix.visual); DPRINTK("visual: %d\n", info->fix.visual);
...@@ -890,13 +890,12 @@ static void fbcon_init(struct vc_data *vc, int init) ...@@ -890,13 +890,12 @@ static void fbcon_init(struct vc_data *vc, int init)
struct vc_data **default_mode = vc->vc_display_fg; struct vc_data **default_mode = vc->vc_display_fg;
struct vc_data *svc = *default_mode; struct vc_data *svc = *default_mode;
struct display *t, *p = &fb_display[vc->vc_num]; struct display *t, *p = &fb_display[vc->vc_num];
int display_fg = (*default_mode)->vc_num;
int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256; int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256;
int cap = info->flags; int cap = info->flags;
if (info_idx == -1 || info == NULL) if (info_idx == -1 || info == NULL)
return; return;
if (vc->vc_num != display_fg || logo_shown == FBCON_LOGO_DONTSHOW || if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
(info->fix.type == FB_TYPE_TEXT)) (info->fix.type == FB_TYPE_TEXT))
logo = 0; logo = 0;
...@@ -907,7 +906,7 @@ static void fbcon_init(struct vc_data *vc, int init) ...@@ -907,7 +906,7 @@ static void fbcon_init(struct vc_data *vc, int init)
/* If we are not the first console on this /* If we are not the first console on this
fb, copy the font from that console */ fb, copy the font from that console */
t = &fb_display[display_fg]; t = &fb_display[svc->vc_num];
if (!vc->vc_font.data) { if (!vc->vc_font.data) {
vc->vc_font.data = p->fontdata = t->fontdata; vc->vc_font.data = p->fontdata = t->fontdata;
vc->vc_font.width = (*default_mode)->vc_font.width; vc->vc_font.width = (*default_mode)->vc_font.width;
...@@ -929,15 +928,15 @@ static void fbcon_init(struct vc_data *vc, int init) ...@@ -929,15 +928,15 @@ static void fbcon_init(struct vc_data *vc, int init)
} }
if (!*svc->vc_uni_pagedir_loc) if (!*svc->vc_uni_pagedir_loc)
con_set_default_unimap(display_fg); con_set_default_unimap(svc);
if (!*vc->vc_uni_pagedir_loc) if (!*vc->vc_uni_pagedir_loc)
con_copy_unimap(vc->vc_num, display_fg); con_copy_unimap(vc, svc);
cols = vc->vc_cols; cols = vc->vc_cols;
rows = vc->vc_rows; rows = vc->vc_rows;
new_cols = info->var.xres / vc->vc_font.width; new_cols = info->var.xres / vc->vc_font.width;
new_rows = info->var.yres / vc->vc_font.height; new_rows = info->var.yres / vc->vc_font.height;
vc_resize(vc->vc_num, new_cols, new_rows); vc_resize(vc, new_cols, new_rows);
/* /*
* We must always set the mode. The mode of the previous console * We must always set the mode. The mode of the previous console
* driver could be in the same resolution but we are using different * driver could be in the same resolution but we are using different
...@@ -968,7 +967,7 @@ static void fbcon_init(struct vc_data *vc, int init) ...@@ -968,7 +967,7 @@ static void fbcon_init(struct vc_data *vc, int init)
if (logo) if (logo)
fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);
if (vc->vc_num == display_fg && softback_buf) { if (vc == svc && softback_buf) {
int l = fbcon_softback_size / vc->vc_size_row; int l = fbcon_softback_size / vc->vc_size_row;
if (l > 5) if (l > 5)
softback_end = softback_buf + l * vc->vc_size_row; softback_end = softback_buf + l * vc->vc_size_row;
...@@ -1144,13 +1143,12 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc) ...@@ -1144,13 +1143,12 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc)
struct display *p = &fb_display[vc->vc_num], *t; struct display *p = &fb_display[vc->vc_num], *t;
struct vc_data **default_mode = vc->vc_display_fg; struct vc_data **default_mode = vc->vc_display_fg;
struct vc_data *svc = *default_mode; struct vc_data *svc = *default_mode;
int display_fg = (*default_mode)->vc_num;
int rows, cols, charcnt = 256; int rows, cols, charcnt = 256;
info->var.xoffset = info->var.yoffset = p->yscroll = 0; info->var.xoffset = info->var.yoffset = p->yscroll = 0;
if (var_to_display(p, &info->var, info)) if (var_to_display(p, &info->var, info))
return; return;
t = &fb_display[display_fg]; t = &fb_display[svc->vc_num];
if (!vc->vc_font.data) { if (!vc->vc_font.data) {
vc->vc_font.data = p->fontdata = t->fontdata; vc->vc_font.data = p->fontdata = t->fontdata;
vc->vc_font.width = (*default_mode)->vc_font.width; vc->vc_font.width = (*default_mode)->vc_font.width;
...@@ -1173,15 +1171,15 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc) ...@@ -1173,15 +1171,15 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc)
} }
if (!*svc->vc_uni_pagedir_loc) if (!*svc->vc_uni_pagedir_loc)
con_set_default_unimap(display_fg); con_set_default_unimap(svc);
if (!*vc->vc_uni_pagedir_loc) if (!*vc->vc_uni_pagedir_loc)
con_copy_unimap(vc->vc_num, display_fg); con_copy_unimap(vc, svc);
cols = info->var.xres / vc->vc_font.width; cols = info->var.xres / vc->vc_font.width;
rows = info->var.yres / vc->vc_font.height; rows = info->var.yres / vc->vc_font.height;
vc_resize(vc->vc_num, cols, rows); vc_resize(vc, cols, rows);
if (CON_IS_VISIBLE(vc)) { if (CON_IS_VISIBLE(vc)) {
update_screen(vc->vc_num); update_screen(vc);
if (softback_buf) { if (softback_buf) {
int l = fbcon_softback_size / vc->vc_size_row; int l = fbcon_softback_size / vc->vc_size_row;
...@@ -1987,7 +1985,7 @@ static int fbcon_switch(struct vc_data *vc) ...@@ -1987,7 +1985,7 @@ static int fbcon_switch(struct vc_data *vc)
logo_shown = fg_console; logo_shown = fg_console;
/* This is protected above by initmem_freed */ /* This is protected above by initmem_freed */
fb_show_logo(info); fb_show_logo(info);
update_region(fg_console, update_region(vc,
vc->vc_origin + vc->vc_size_row * vc->vc_top, vc->vc_origin + vc->vc_size_row * vc->vc_top,
vc->vc_size_row * (vc->vc_bottom - vc->vc_size_row * (vc->vc_bottom -
vc->vc_top) / 2); vc->vc_top) / 2);
...@@ -2048,7 +2046,7 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) ...@@ -2048,7 +2046,7 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
} }
if (!blank) if (!blank)
update_screen(vc->vc_num); update_screen(vc);
} }
return 0; return 0;
...@@ -2198,7 +2196,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, ...@@ -2198,7 +2196,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
if (resize) { if (resize) {
/* reset wrap/pan */ /* reset wrap/pan */
info->var.xoffset = info->var.yoffset = p->yscroll = 0; info->var.xoffset = info->var.yoffset = p->yscroll = 0;
vc_resize(vc->vc_num, info->var.xres / w, info->var.yres / h); vc_resize(vc, info->var.xres / w, info->var.yres / h);
if (CON_IS_VISIBLE(vc) && softback_buf) { if (CON_IS_VISIBLE(vc) && softback_buf) {
int l = fbcon_softback_size / vc->vc_size_row; int l = fbcon_softback_size / vc->vc_size_row;
if (l > 5) if (l > 5)
...@@ -2213,7 +2211,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, ...@@ -2213,7 +2211,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
} else if (CON_IS_VISIBLE(vc) } else if (CON_IS_VISIBLE(vc)
&& vt_cons[vc->vc_num]->vc_mode == KD_TEXT) { && vt_cons[vc->vc_num]->vc_mode == KD_TEXT) {
fbcon_clear_margins(vc, 0); fbcon_clear_margins(vc, 0);
update_screen(vc->vc_num); update_screen(vc);
} }
if (old_data && (--REFCOUNT(old_data) == 0)) if (old_data && (--REFCOUNT(old_data) == 0))
...@@ -2464,7 +2462,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines) ...@@ -2464,7 +2462,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines)
vc->vc_size_row); vc->vc_size_row);
} }
softback_in = p; softback_in = p;
update_region(vc->vc_num, vc->vc_origin, update_region(vc, vc->vc_origin,
logo_lines * vc->vc_cols); logo_lines * vc->vc_cols);
} }
logo_shown = FBCON_LOGO_CANSHOW; logo_shown = FBCON_LOGO_CANSHOW;
...@@ -2545,7 +2543,7 @@ static void fbcon_resumed(struct fb_info *info) ...@@ -2545,7 +2543,7 @@ static void fbcon_resumed(struct fb_info *info)
return; return;
vc = vc_cons[ops->currcon].d; vc = vc_cons[ops->currcon].d;
update_screen(vc->vc_num); update_screen(vc);
} }
static void fbcon_modechanged(struct fb_info *info) static void fbcon_modechanged(struct fb_info *info)
...@@ -2569,13 +2567,13 @@ static void fbcon_modechanged(struct fb_info *info) ...@@ -2569,13 +2567,13 @@ static void fbcon_modechanged(struct fb_info *info)
var_to_display(p, &info->var, info); var_to_display(p, &info->var, info);
cols = info->var.xres / vc->vc_font.width; cols = info->var.xres / vc->vc_font.width;
rows = info->var.yres / vc->vc_font.height; rows = info->var.yres / vc->vc_font.height;
vc_resize(vc->vc_num, cols, rows); vc_resize(vc, cols, rows);
updatescrollmode(p, info, vc); updatescrollmode(p, info, vc);
scrollback_max = 0; scrollback_max = 0;
scrollback_current = 0; scrollback_current = 0;
update_var(vc->vc_num, info); update_var(vc->vc_num, info);
fbcon_set_palette(vc, color_table); fbcon_set_palette(vc, color_table);
update_screen(vc->vc_num); update_screen(vc);
if (softback_buf) { if (softback_buf) {
int l = fbcon_softback_size / vc->vc_size_row; int l = fbcon_softback_size / vc->vc_size_row;
if (l > 5) if (l > 5)
......
...@@ -351,10 +351,9 @@ static void mdacon_init(struct vc_data *c, int init) ...@@ -351,10 +351,9 @@ static void mdacon_init(struct vc_data *c, int init)
if (init) { if (init) {
c->vc_cols = mda_num_columns; c->vc_cols = mda_num_columns;
c->vc_rows = mda_num_lines; c->vc_rows = mda_num_lines;
} else { } else
vc_resize(c->vc_num, mda_num_columns, mda_num_lines); vc_resize(c, mda_num_columns, mda_num_lines);
}
/* make the first MDA console visible */ /* make the first MDA console visible */
if (mda_display_fg == NULL) if (mda_display_fg == NULL)
......
...@@ -155,9 +155,9 @@ promcon_init_unimap(struct vc_data *conp) ...@@ -155,9 +155,9 @@ promcon_init_unimap(struct vc_data *conp)
k++; k++;
} }
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
con_clear_unimap(conp->vc_num, NULL); con_clear_unimap(conp, NULL);
con_set_unimap(conp->vc_num, k, p); con_set_unimap(conp, k, p);
con_protect_unimap(conp->vc_num, 1); con_protect_unimap(conp, 1);
set_fs(old_fs); set_fs(old_fs);
kfree(p); kfree(p);
} }
...@@ -175,7 +175,7 @@ promcon_init(struct vc_data *conp, int init) ...@@ -175,7 +175,7 @@ promcon_init(struct vc_data *conp, int init)
p = *conp->vc_uni_pagedir_loc; p = *conp->vc_uni_pagedir_loc;
if (conp->vc_uni_pagedir_loc == &conp->vc_uni_pagedir || if (conp->vc_uni_pagedir_loc == &conp->vc_uni_pagedir ||
!--conp->vc_uni_pagedir_loc[1]) !--conp->vc_uni_pagedir_loc[1])
con_free_unimap(conp->vc_num); con_free_unimap(conp);
conp->vc_uni_pagedir_loc = promcon_uni_pagedir; conp->vc_uni_pagedir_loc = promcon_uni_pagedir;
promcon_uni_pagedir[1]++; promcon_uni_pagedir[1]++;
if (!promcon_uni_pagedir[0] && p) { if (!promcon_uni_pagedir[0] && p) {
...@@ -183,7 +183,7 @@ promcon_init(struct vc_data *conp, int init) ...@@ -183,7 +183,7 @@ promcon_init(struct vc_data *conp, int init)
} }
if (!init) { if (!init) {
if (conp->vc_cols != pw + 1 || conp->vc_rows != ph + 1) if (conp->vc_cols != pw + 1 || conp->vc_rows != ph + 1)
vc_resize(conp->vc_num, pw + 1, ph + 1); vc_resize(conp, pw + 1, ph + 1);
} }
} }
...@@ -192,9 +192,9 @@ promcon_deinit(struct vc_data *conp) ...@@ -192,9 +192,9 @@ promcon_deinit(struct vc_data *conp)
{ {
/* When closing the last console, reset video origin */ /* When closing the last console, reset video origin */
if (!--promcon_uni_pagedir[1]) if (!--promcon_uni_pagedir[1])
con_free_unimap(conp->vc_num); con_free_unimap(conp);
conp->vc_uni_pagedir_loc = &conp->vc_uni_pagedir; conp->vc_uni_pagedir_loc = &conp->vc_uni_pagedir;
con_set_default_unimap(conp->vc_num); con_set_default_unimap(conp);
} }
static int static int
......
...@@ -217,7 +217,7 @@ static void sticon_init(struct vc_data *c, int init) ...@@ -217,7 +217,7 @@ static void sticon_init(struct vc_data *c, int init)
} else { } else {
/* vc_rows = (c->vc_rows > vc_rows) ? vc_rows : c->vc_rows; */ /* vc_rows = (c->vc_rows > vc_rows) ? vc_rows : c->vc_rows; */
/* vc_cols = (c->vc_cols > vc_cols) ? vc_cols : c->vc_cols; */ /* vc_cols = (c->vc_cols > vc_cols) ? vc_cols : c->vc_cols; */
vc_resize(c->vc_num, vc_cols, vc_rows); vc_resize(c, vc_cols, vc_rows);
/* vc_resize_con(vc_rows, vc_cols, c->vc_num); */ /* vc_resize_con(vc_rows, vc_cols, c->vc_num); */
} }
} }
......
...@@ -340,11 +340,11 @@ static void vgacon_init(struct vc_data *c, int init) ...@@ -340,11 +340,11 @@ static void vgacon_init(struct vc_data *c, int init)
p = *c->vc_uni_pagedir_loc; p = *c->vc_uni_pagedir_loc;
if (c->vc_uni_pagedir_loc == &c->vc_uni_pagedir || if (c->vc_uni_pagedir_loc == &c->vc_uni_pagedir ||
!--c->vc_uni_pagedir_loc[1]) !--c->vc_uni_pagedir_loc[1])
con_free_unimap(c->vc_num); con_free_unimap(c);
c->vc_uni_pagedir_loc = vgacon_uni_pagedir; c->vc_uni_pagedir_loc = vgacon_uni_pagedir;
vgacon_uni_pagedir[1]++; vgacon_uni_pagedir[1]++;
if (!vgacon_uni_pagedir[0] && p) if (!vgacon_uni_pagedir[0] && p)
con_set_default_unimap(c->vc_num); con_set_default_unimap(c);
} }
static inline void vga_set_mem_top(struct vc_data *c) static inline void vga_set_mem_top(struct vc_data *c)
...@@ -358,10 +358,10 @@ static void vgacon_deinit(struct vc_data *c) ...@@ -358,10 +358,10 @@ static void vgacon_deinit(struct vc_data *c)
if (!--vgacon_uni_pagedir[1]) { if (!--vgacon_uni_pagedir[1]) {
c->vc_visible_origin = vga_vram_base; c->vc_visible_origin = vga_vram_base;
vga_set_mem_top(c); vga_set_mem_top(c);
con_free_unimap(c->vc_num); con_free_unimap(c);
} }
c->vc_uni_pagedir_loc = &c->vc_uni_pagedir; c->vc_uni_pagedir_loc = &c->vc_uni_pagedir;
con_set_default_unimap(c->vc_num); con_set_default_unimap(c);
} }
static u8 vgacon_build_attr(struct vc_data *c, u8 color, u8 intensity, static u8 vgacon_build_attr(struct vc_data *c, u8 color, u8 intensity,
...@@ -908,7 +908,7 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight) ...@@ -908,7 +908,7 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight)
c->vc_sw->con_cursor(c, CM_DRAW); c->vc_sw->con_cursor(c, CM_DRAW);
} }
c->vc_font.height = fontheight; c->vc_font.height = fontheight;
vc_resize(c->vc_num, 0, rows); /* Adjust console size */ vc_resize(c, 0, rows); /* Adjust console size */
} }
} }
return 0; return 0;
......
...@@ -1559,7 +1559,7 @@ static int do_fontx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, ...@@ -1559,7 +1559,7 @@ static int do_fontx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
get_user(data, &user_cfd->chardata)) get_user(data, &user_cfd->chardata))
return -EFAULT; return -EFAULT;
op.data = compat_ptr(data); op.data = compat_ptr(data);
return con_font_op(fg_console, &op); return con_font_op(vc_cons[fg_console].d, &op);
case GIO_FONTX: case GIO_FONTX:
op.op = KD_FONT_OP_GET; op.op = KD_FONT_OP_GET;
op.flags = 0; op.flags = 0;
...@@ -1571,7 +1571,7 @@ static int do_fontx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, ...@@ -1571,7 +1571,7 @@ static int do_fontx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
if (!data) if (!data)
return 0; return 0;
op.data = compat_ptr(data); op.data = compat_ptr(data);
i = con_font_op(fg_console, &op); i = con_font_op(vc_cons[fg_console].d, &op);
if (i) if (i)
return i; return i;
if (put_user(op.height, &user_cfd->charheight) || if (put_user(op.height, &user_cfd->charheight) ||
...@@ -1608,7 +1608,7 @@ static int do_kdfontop_ioctl(unsigned int fd, unsigned int cmd, unsigned long ar ...@@ -1608,7 +1608,7 @@ static int do_kdfontop_ioctl(unsigned int fd, unsigned int cmd, unsigned long ar
op.data = compat_ptr(((struct console_font_op32 *)&op)->data); op.data = compat_ptr(((struct console_font_op32 *)&op)->data);
op.flags |= KD_FONT_FLAG_OLD; op.flags |= KD_FONT_FLAG_OLD;
vt = (struct vt_struct *)((struct tty_struct *)file->private_data)->driver_data; vt = (struct vt_struct *)((struct tty_struct *)file->private_data)->driver_data;
i = con_font_op(vt->vc_num, &op); i = con_font_op(vc_cons[vt->vc_num].d, &op);
if (i) return i; if (i) return i;
((struct console_font_op32 *)&op)->data = (unsigned long)op.data; ((struct console_font_op32 *)&op)->data = (unsigned long)op.data;
if (copy_to_user(fontop, &op, sizeof(struct console_font_op32))) if (copy_to_user(fontop, &op, sizeof(struct console_font_op32)))
...@@ -1633,9 +1633,9 @@ static int do_unimap_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, ...@@ -1633,9 +1633,9 @@ static int do_unimap_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
switch (cmd) { switch (cmd) {
case PIO_UNIMAP: case PIO_UNIMAP:
if (!perm) return -EPERM; if (!perm) return -EPERM;
return con_set_unimap(fg_console, tmp.entry_ct, compat_ptr(tmp.entries)); return con_set_unimap(vc_cons[fg_console].d, tmp.entry_ct, compat_ptr(tmp.entries));
case GIO_UNIMAP: case GIO_UNIMAP:
return con_get_unimap(fg_console, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries)); return con_get_unimap(vc_cons[fg_console].d, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries));
} }
return 0; return 0;
} }
......
...@@ -11,5 +11,5 @@ ...@@ -11,5 +11,5 @@
struct vc_data; struct vc_data;
extern unsigned char inverse_translate(struct vc_data *conp, int glyph); extern unsigned char inverse_translate(struct vc_data *conp, int glyph);
extern unsigned short *set_translate(int m,int currcons); extern unsigned short *set_translate(int m, struct vc_data *vc);
extern int conv_uni_to_pc(struct vc_data *conp, long ucs); extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
...@@ -41,25 +41,25 @@ extern int kbd_rate(struct kbd_repeat *rep); ...@@ -41,25 +41,25 @@ extern int kbd_rate(struct kbd_repeat *rep);
int vc_allocate(unsigned int console); int vc_allocate(unsigned int console);
int vc_cons_allocated(unsigned int console); int vc_cons_allocated(unsigned int console);
int vc_resize(int currcons, unsigned int cols, unsigned int lines); int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
void vc_disallocate(unsigned int console); void vc_disallocate(unsigned int console);
void reset_palette(int currcons); void reset_palette(struct vc_data *vc);
void set_palette(int currcons); void set_palette(struct vc_data *vc);
void do_blank_screen(int entering_gfx); void do_blank_screen(int entering_gfx);
void do_unblank_screen(int leaving_gfx); void do_unblank_screen(int leaving_gfx);
void unblank_screen(void); void unblank_screen(void);
void poke_blanked_console(void); void poke_blanked_console(void);
int con_font_op(int currcons, struct console_font_op *op); int con_font_op(struct vc_data *vc, struct console_font_op *op);
int con_font_set(int currcons, struct console_font_op *op); int con_font_set(struct vc_data *vc, struct console_font_op *op);
int con_font_get(int currcons, struct console_font_op *op); int con_font_get(struct vc_data *vc, struct console_font_op *op);
int con_font_default(int currcons, struct console_font_op *op); int con_font_default(struct vc_data *vc, struct console_font_op *op);
int con_font_copy(int currcons, struct console_font_op *op); int con_font_copy(struct vc_data *vc, struct console_font_op *op);
int con_set_cmap(unsigned char __user *cmap); int con_set_cmap(unsigned char __user *cmap);
int con_get_cmap(unsigned char __user *cmap); int con_get_cmap(unsigned char __user *cmap);
void scrollback(int); void scrollback(struct vc_data *vc, int lines);
void scrollfront(int); void scrollfront(struct vc_data *vc, int lines);
void update_region(int currcons, unsigned long start, int count); void update_region(struct vc_data *vc, unsigned long start, int count);
void redraw_screen(int new_console, int is_switch); void redraw_screen(struct vc_data *vc, int is_switch);
#define update_screen(x) redraw_screen(x, 0) #define update_screen(x) redraw_screen(x, 0)
#define switch_screen(x) redraw_screen(x, 1) #define switch_screen(x) redraw_screen(x, 1)
...@@ -75,19 +75,19 @@ int con_set_trans_old(unsigned char __user * table); ...@@ -75,19 +75,19 @@ int con_set_trans_old(unsigned char __user * table);
int con_get_trans_old(unsigned char __user * table); int con_get_trans_old(unsigned char __user * table);
int con_set_trans_new(unsigned short __user * table); int con_set_trans_new(unsigned short __user * table);
int con_get_trans_new(unsigned short __user * table); int con_get_trans_new(unsigned short __user * table);
int con_clear_unimap(int currcons, struct unimapinit *ui); int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui);
int con_set_unimap(int currcons, ushort ct, struct unipair __user *list); int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);
int con_get_unimap(int currcons, ushort ct, ushort __user *uct, struct unipair __user *list); int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);
int con_set_default_unimap(int currcons); int con_set_default_unimap(struct vc_data *vc);
void con_free_unimap(int currcons); void con_free_unimap(struct vc_data *vc);
void con_protect_unimap(int currcons, int rdonly); void con_protect_unimap(struct vc_data *vc, int rdonly);
int con_copy_unimap(int dstcons, int srccons); int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
/* vt.c */ /* vt.c */
void complete_change_console(unsigned int new_console); void complete_change_console(struct vc_data *vc);
int vt_waitactive(int vt); int vt_waitactive(int vt);
void change_console(unsigned int); void change_console(struct vc_data *new_vc);
void reset_vc(unsigned int new_console); void reset_vc(struct vc_data *vc);
/* /*
* vc_screen.c shares this temporary buffer with the console write code so that * vc_screen.c shares this temporary buffer with the console write code so that
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment