X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fvc_screen.c;h=c5c6b5e26850e55072b6f304ce56cb57fbaff23c;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=c357ab7f9c4d63f454f2a51b4fc5026aad74b359;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index c357ab7f9..c5c6b5e26 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c @@ -70,11 +70,11 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) { int size; - lock_kernel(); + down(&con_buf_sem); size = vcs_size(file->f_dentry->d_inode); switch (orig) { default: - unlock_kernel(); + up(&con_buf_sem); return -EINVAL; case 2: offset += size; @@ -85,28 +85,21 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) break; } if (offset < 0 || offset > size) { - unlock_kernel(); + up(&con_buf_sem); return -EINVAL; } file->f_pos = offset; - unlock_kernel(); + up(&con_buf_sem); return file->f_pos; } -/* We share this temporary buffer with the console write code - * so that we can easily avoid touching user space while holding the - * console spinlock. - */ -extern char con_buf[PAGE_SIZE]; -#define CON_BUF_SIZE PAGE_SIZE -extern struct semaphore con_buf_sem; static ssize_t vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct inode *inode = file->f_dentry->d_inode; unsigned int currcons = iminor(inode); - long pos = *ppos; + long pos; long viewed, attr, read; int col, maxcol; unsigned short *org = NULL; @@ -114,6 +107,8 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) down(&con_buf_sem); + pos = *ppos; + /* Select the proper current console and verify * sanity of the situation under the console lock. */ @@ -275,7 +270,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct inode *inode = file->f_dentry->d_inode; unsigned int currcons = iminor(inode); - long pos = *ppos; + long pos; long viewed, attr, size, written; char *con_buf0; int col, maxcol; @@ -284,6 +279,8 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) down(&con_buf_sem); + pos = *ppos; + /* Select the proper current console and verify * sanity of the situation under the console lock. */