aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/vt/selection.c39
-rw-r--r--drivers/tty/vt/vt.c2
2 files changed, 33 insertions, 8 deletions
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 2a5091670927..8e9b4be97a2d 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -62,10 +62,14 @@ sel_pos(int n)
62 use_unicode); 62 use_unicode);
63} 63}
64 64
65/* remove the current selection highlight, if any, 65/**
66 from the console holding the selection. */ 66 * clear_selection - remove current selection
67void 67 *
68clear_selection(void) { 68 * Remove the current selection highlight, if any from the console
69 * holding the selection. The caller must hold the console lock.
70 */
71void clear_selection(void)
72{
69 highlight_pointer(-1); /* hide the pointer */ 73 highlight_pointer(-1); /* hide the pointer */
70 if (sel_start != -1) { 74 if (sel_start != -1) {
71 highlight(sel_start, sel_end); 75 highlight(sel_start, sel_end);
@@ -75,7 +79,7 @@ clear_selection(void) {
75 79
76/* 80/*
77 * User settable table: what characters are to be considered alphabetic? 81 * User settable table: what characters are to be considered alphabetic?
78 * 256 bits. FIXME: Needs a locking model. 82 * 256 bits. Locked by the console lock.
79 */ 83 */
80static u32 inwordLut[8]={ 84static u32 inwordLut[8]={
81 0x00000000, /* control chars */ 85 0x00000000, /* control chars */
@@ -92,10 +96,20 @@ static inline int inword(const u16 c) {
92 return c > 0xff || (( inwordLut[c>>5] >> (c & 0x1F) ) & 1); 96 return c > 0xff || (( inwordLut[c>>5] >> (c & 0x1F) ) & 1);
93} 97}
94 98
95/* set inwordLut contents. Invoked by ioctl(). */ 99/**
100 * set loadlut - load the LUT table
101 * @p: user table
102 *
103 * Load the LUT table from user space. The caller must hold the console
104 * lock. Make a temporary copy so a partial update doesn't make a mess.
105 */
96int sel_loadlut(char __user *p) 106int sel_loadlut(char __user *p)
97{ 107{
98 return copy_from_user(inwordLut, (u32 __user *)(p+4), 32) ? -EFAULT : 0; 108 u32 tmplut[8];
109 if (copy_from_user(tmplut, (u32 __user *)(p+4), 32))
110 return -EFAULT;
111 memcpy(inwordLut, tmplut, 32);
112 return 0;
99} 113}
100 114
101/* does screen address p correspond to character at LH/RH edge of screen? */ 115/* does screen address p correspond to character at LH/RH edge of screen? */
@@ -131,7 +145,16 @@ static int store_utf8(u16 c, char *p)
131 } 145 }
132} 146}
133 147
134/* set the current selection. Invoked by ioctl() or by kernel code. */ 148/**
149 * set_selection - set the current selection.
150 * @sel: user selection info
151 * @tty: the console tty
152 *
153 * Invoked by the ioctl handle for the vt layer.
154 *
155 * The entire selection process is managed under the console_lock. It's
156 * a lot under the lock but its hardly a performance path
157 */
135int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty) 158int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
136{ 159{
137 struct vc_data *vc = vc_cons[fg_console].d; 160 struct vc_data *vc = vc_cons[fg_console].d;
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index ab7385e526af..e5abceacc2d0 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2623,7 +2623,9 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
2623 console_unlock(); 2623 console_unlock();
2624 break; 2624 break;
2625 case TIOCL_SELLOADLUT: 2625 case TIOCL_SELLOADLUT:
2626 console_lock();
2626 ret = sel_loadlut(p); 2627 ret = sel_loadlut(p);
2628 console_unlock();
2627 break; 2629 break;
2628 case TIOCL_GETSHIFTSTATE: 2630 case TIOCL_GETSHIFTSTATE:
2629 2631