summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/consolemap.c1
-rw-r--r--drivers/char/keyboard.c1
-rw-r--r--drivers/char/selection.c1
-rw-r--r--drivers/char/tty_io.c7
-rw-r--r--drivers/char/vc_screen.c1
-rw-r--r--drivers/char/vt.c179
-rw-r--r--drivers/char/vt_ioctl.c60
7 files changed, 125 insertions, 125 deletions
diff --git a/drivers/char/consolemap.c b/drivers/char/consolemap.c
index bf55df922e45..3719e5889149 100644
--- a/drivers/char/consolemap.c
+++ b/drivers/char/consolemap.c
@@ -19,7 +19,6 @@
#include <linux/tty.h>
#include <asm/uaccess.h>
#include <linux/consolemap.h>
-#include <linux/console_struct.h>
#include <linux/vt_kern.h>
static unsigned short translations[][256] = {
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 7ad9b8d0253b..20ca5f5b0f73 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -35,7 +35,6 @@
#include <linux/init.h>
#include <linux/slab.h>
-#include <linux/console_struct.h>
#include <linux/kbd_kern.h>
#include <linux/kbd_diacr.h>
#include <linux/vt_kern.h>
diff --git a/drivers/char/selection.c b/drivers/char/selection.c
index 3295c7d6e6d2..6aa4932e7c4a 100644
--- a/drivers/char/selection.c
+++ b/drivers/char/selection.c
@@ -22,7 +22,6 @@
#include <linux/vt_kern.h>
#include <linux/consolemap.h>
-#include <linux/console_struct.h>
#include <linux/selection.h>
#ifndef MIN
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index bb7e38bdf02e..9a7e9fb83301 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1504,6 +1504,13 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
return -EFAULT;
if (!memcmp(&tmp_ws, &tty->winsize, sizeof(*arg)))
return 0;
+#ifdef CONFIG_VT
+ if (tty->driver.type == TTY_DRIVER_TYPE_CONSOLE) {
+ unsigned int currcons = minor(tty->device) - tty->driver.minor_start;
+ if (vc_resize(currcons, tmp_ws.ws_col, tmp_ws.ws_row))
+ return -ENXIO;
+ }
+#endif
if (tty->pgrp > 0)
kill_pg(tty->pgrp, SIGWINCH, 1);
if ((real_tty->pgrp != tty->pgrp) && (real_tty->pgrp > 0))
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index b74049de43c3..5667c82b8dd8 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -32,7 +32,6 @@
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/vt_kern.h>
-#include <linux/console_struct.h>
#include <linux/selection.h>
#include <linux/kbd_kern.h>
#include <linux/console.h>
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index b88de4fe13b6..8cdf6cb7d213 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -90,7 +90,6 @@
#include <linux/devfs_fs_kernel.h>
#include <linux/vt_kern.h>
#include <linux/selection.h>
-#include <linux/console_struct.h>
#include <linux/kbd_kern.h>
#include <linux/consolemap.h>
#include <linux/timer.h>
@@ -691,106 +690,106 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
return 0;
}
+inline int resize_screen(int currcons, int width, int height)
+{
+ /* Resizes the resolution of the display adapater */
+ int err = 0;
+
+ if (vcmode != KD_GRAPHICS && sw->con_resize)
+ err = sw->con_resize(vc_cons[currcons].d, width, height);
+ return err;
+}
+
/*
* Change # of rows and columns (0 means unchanged/the size of fg_console)
* [this is to be used together with some user program
* like resize that changes the hardware videomode]
*/
-int vc_resize(unsigned int lines, unsigned int cols,
- unsigned int first, unsigned int last)
-{
- unsigned int cc, ll, ss, sr, todo = 0;
- unsigned int currcons = fg_console, i;
- unsigned short *newscreens[MAX_NR_CONSOLES];
-
- cc = (cols ? cols : video_num_columns);
- ll = (lines ? lines : video_num_lines);
- sr = cc << 1;
- ss = sr * ll;
-
- for (currcons = first; currcons <= last; currcons++) {
- if (!vc_cons_allocated(currcons) ||
- (cc == video_num_columns && ll == video_num_lines))
- newscreens[currcons] = NULL;
- else {
- unsigned short *p = (unsigned short *) kmalloc(ss, GFP_USER);
- if (!p) {
- for (i = first; i < currcons; i++)
- if (newscreens[i])
- kfree(newscreens[i]);
- return -ENOMEM;
- }
- newscreens[currcons] = p;
- todo++;
- }
- }
- if (!todo)
+int vc_resize(int currcons, unsigned int cols, unsigned int lines)
+{
+ unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err = 0;
+ unsigned int old_cols, old_rows, old_row_size, old_screen_size;
+ unsigned int new_cols, new_rows, new_row_size, new_screen_size;
+ unsigned short *newscreen;
+
+ if (!vc_cons_allocated(currcons))
+ return -ENXIO;
+
+ new_cols = (cols ? cols : video_num_columns);
+ new_rows = (lines ? lines : video_num_lines);
+ new_row_size = new_cols << 1;
+ new_screen_size = new_row_size * new_rows;
+
+ if (new_cols == video_num_columns && new_rows == video_num_lines)
return 0;
- for (currcons = first; currcons <= last; currcons++) {
- unsigned int occ, oll, oss, osr;
- unsigned long ol, nl, nlend, rlth, rrem;
- if (!newscreens[currcons] || !vc_cons_allocated(currcons))
- continue;
+ newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
+ if (!newscreen)
+ return -ENOMEM;
- oll = video_num_lines;
- occ = video_num_columns;
- osr = video_size_row;
- oss = screenbuf_size;
-
- video_num_lines = ll;
- video_num_columns = cc;
- video_size_row = sr;
- screenbuf_size = ss;
-
- rlth = min(osr, sr);
- rrem = sr - rlth;
- ol = origin;
- nl = (long) newscreens[currcons];
- nlend = nl + ss;
- if (ll < oll)
- ol += (oll - ll) * osr;
-
- update_attr(currcons);
-
- while (ol < scr_end) {
- scr_memcpyw((unsigned short *) nl, (unsigned short *) ol, rlth);
- if (rrem)
- scr_memsetw((void *)(nl + rlth), video_erase_char, rrem);
- ol += osr;
- nl += sr;
- }
- if (nlend > nl)
- scr_memsetw((void *) nl, video_erase_char, nlend - nl);
- if (kmalloced)
- kfree(screenbuf);
- screenbuf = newscreens[currcons];
- kmalloced = 1;
- screenbuf_size = ss;
- set_origin(currcons);
+ old_rows = video_num_lines;
+ old_cols = video_num_columns;
+ old_row_size = video_size_row;
+ old_screen_size = screenbuf_size;
- /* do part of a reset_terminal() */
- top = 0;
- bottom = video_num_lines;
- gotoxy(currcons, x, y);
- save_cur(currcons);
-
- if (console_table[currcons]) {
- struct winsize ws, *cws = &console_table[currcons]->winsize;
- memset(&ws, 0, sizeof(ws));
- ws.ws_row = video_num_lines;
- ws.ws_col = video_num_columns;
- if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) &&
- console_table[currcons]->pgrp > 0)
- kill_pg(console_table[currcons]->pgrp, SIGWINCH, 1);
- *cws = ws;
- }
+ video_num_lines = new_rows;
+ video_num_columns = new_cols;
+ video_size_row = new_row_size;
+ screenbuf_size = new_screen_size;
- if (IS_VISIBLE)
- update_screen(currcons);
+ err = resize_screen(currcons, new_cols, new_rows);
+ if (err)
+ return err;
+
+ rlth = min(old_row_size, new_row_size);
+ rrem = new_row_size - rlth;
+ old_origin = origin;
+ new_origin = (long) newscreen;
+ new_scr_end = new_origin + new_screen_size;
+ if (new_rows < old_rows)
+ old_origin += (old_rows - new_rows) * old_row_size;
+
+ update_attr(currcons);
+
+ while (old_origin < scr_end) {
+ scr_memcpyw((unsigned short *) new_origin, (unsigned short *) old_origin, rlth);
+ if (rrem)
+ scr_memsetw((void *)(new_origin + rlth), video_erase_char, rrem);
+ old_origin += old_row_size;
+ new_origin += new_row_size;
}
+ if (new_scr_end > new_origin)
+ scr_memsetw((void *) new_origin, video_erase_char, new_scr_end - new_origin);
+ if (kmalloced)
+ kfree(screenbuf);
+ screenbuf = newscreen;
+ kmalloced = 1;
+ screenbuf_size = new_screen_size;
+ if (IS_VISIBLE)
+ err = resize_screen(currcons, new_cols, new_rows);
+ set_origin(currcons);
- return 0;
+ /* do part of a reset_terminal() */
+ top = 0;
+ bottom = video_num_lines;
+ gotoxy(currcons, x, y);
+ save_cur(currcons);
+
+ if (vc_cons[currcons].d->vc_tty) {
+ struct winsize ws, *cws = &vc_cons[currcons].d->vc_tty->winsize;
+
+ memset(&ws, 0, sizeof(ws));
+ ws.ws_row = video_num_lines;
+ ws.ws_col = video_num_columns;
+ if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) &&
+ vc_cons[currcons].d->vc_tty->pgrp > 0)
+ kill_pg(vc_cons[currcons].d->vc_tty->pgrp, SIGWINCH, 1);
+ *cws = ws;
+ }
+
+ if (IS_VISIBLE)
+ update_screen(currcons);
+ return err;
}
@@ -1200,7 +1199,7 @@ static void set_mode(int currcons, int on_off)
case 3: /* 80/132 mode switch unimplemented */
deccolm = on_off;
#if 0
- (void) vc_resize(video_num_lines, deccolm ? 132 : 80);
+ (void) vc_resize(deccolm ? 132 : 80, video_num_lines);
/* this alone does not suffice; some user mode
utility has to change the hardware regs */
#endif
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index fcdb5208acea..cda2f20d8308 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -810,7 +810,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
if (get_user(ll, &vtsizes->v_rows) ||
get_user(cc, &vtsizes->v_cols))
return -EFAULT;
- return vc_resize_all(ll, cc);
+ for (i = 0; i < MAX_NR_CONSOLES; i++)
+ vc_resize(i, cc, ll);
+ return 0;
}
case VT_RESIZEX:
@@ -829,37 +831,33 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
__get_user(vcol, &vtconsize->v_vcol);
__get_user(ccol, &vtconsize->v_ccol);
vlin = vlin ? vlin : video_scan_lines;
- if ( clin )
- {
- if ( ll )
- {
- if ( ll != vlin/clin )
- return -EINVAL; /* Parameters don't add up */
- }
- else
- ll = vlin/clin;
- }
- if ( vcol && ccol )
- {
- if ( cc )
- {
- if ( cc != vcol/ccol )
- return -EINVAL;
- }
- else
- cc = vcol/ccol;
- }
-
- if ( clin > 32 )
- return -EINVAL;
+ if (clin) {
+ if (ll) {
+ if (ll != vlin/clin)
+ return -EINVAL; /* Parameters don't add up */
+ } else
+ ll = vlin/clin;
+ }
+ if (vcol && ccol) {
+ if (cc) {
+ if (cc != vcol/ccol)
+ return -EINVAL;
+ } else
+ cc = vcol/ccol;
+ }
+
+ if (clin > 32)
+ return -EINVAL;
- if ( vlin )
- video_scan_lines = vlin;
- if ( clin )
- video_font_height = clin;
-
- return vc_resize_all(ll, cc);
- }
+ if (vlin)
+ video_scan_lines = vlin;
+ if (clin)
+ video_font_height = clin;
+
+ for (i = 0; i < MAX_NR_CONSOLES; i++)
+ vc_resize(i, cc, ll);
+ return 0;
+ }
case PIO_FONT: {
struct console_font_op op;