X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fselection.c;h=74cff839c8572c9bf560640b0ea513938627fd54;hb=refs%2Fheads%2Fvserver;hp=791b1fc1f4a0c4b0fda1135bf944d79650b7ab73;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/char/selection.c b/drivers/char/selection.c index 791b1fc1f..74cff839c 100644 --- a/drivers/char/selection.c +++ b/drivers/char/selection.c @@ -33,7 +33,7 @@ extern void poke_blanked_console(void); /* Variables for selection control. */ /* Use a dynamic buffer, instead of static (Dec 1994) */ -struct vc_data *sel_cons; /* must not be disallocated */ +struct vc_data *sel_cons; /* must not be deallocated */ static volatile int sel_start = -1; /* cleared by clear_selection */ static int sel_end; static int sel_buffer_lth; @@ -43,15 +43,13 @@ static char *sel_buffer; from interrupt (via scrollback/front) */ /* set reverse video on characters s-e of console with selection. */ -inline static void -highlight(const int s, const int e) +static inline void highlight(const int s, const int e) { invert_screen(sel_cons, s, e-s+2, 1); } /* use complementary color to show the pointer */ -inline static void -highlight_pointer(const int where) +static inline void highlight_pointer(const int where) { complement_pos(sel_cons, where); } @@ -122,7 +120,7 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t { unsigned short xs, ys, xe, ye; - if (verify_area(VERIFY_READ, sel, sizeof(*sel))) + if (!access_ok(VERIFY_READ, sel, sizeof(*sel))) return -EFAULT; __get_user(xs, &sel->xs); __get_user(ys, &sel->ys); @@ -248,8 +246,7 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t clear_selection(); return -ENOMEM; } - if (sel_buffer) - kfree(sel_buffer); + kfree(sel_buffer); sel_buffer = bp; obp = bp; @@ -277,8 +274,9 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t */ int paste_selection(struct tty_struct *tty) { - struct vt_struct *vt = (struct vt_struct *) tty->driver_data; - int pasted = 0, count; + struct vc_data *vc = (struct vc_data *)tty->driver_data; + int pasted = 0; + unsigned int count; struct tty_ldisc *ld; DECLARE_WAITQUEUE(wait, current); @@ -288,7 +286,7 @@ int paste_selection(struct tty_struct *tty) ld = tty_ldisc_ref_wait(tty); - add_wait_queue(&vt->paste_wait, &wait); + add_wait_queue(&vc->paste_wait, &wait); while (sel_buffer && sel_buffer_lth > pasted) { set_current_state(TASK_INTERRUPTIBLE); if (test_bit(TTY_THROTTLED, &tty->flags)) { @@ -296,11 +294,11 @@ int paste_selection(struct tty_struct *tty) continue; } count = sel_buffer_lth - pasted; - count = min(count, tty->ldisc.receive_room(tty)); + count = min(count, tty->receive_room); tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count); pasted += count; } - remove_wait_queue(&vt->paste_wait, &wait); + remove_wait_queue(&vc->paste_wait, &wait); current->state = TASK_RUNNING; tty_ldisc_deref(ld);