Commit 6387d4ea authored by Linus Torvalds's avatar Linus Torvalds

Mark tty's as being non-seekable, and remove the now

unnecessary tests at read/write time.
parent 22782ffc
...@@ -345,18 +345,12 @@ EXPORT_SYMBOL(tty_check_change); ...@@ -345,18 +345,12 @@ EXPORT_SYMBOL(tty_check_change);
static ssize_t hung_up_tty_read(struct file * file, char __user * buf, static ssize_t hung_up_tty_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
/* Can't seek (pread) on ttys. */
if (ppos != &file->f_pos)
return -ESPIPE;
return 0; return 0;
} }
static ssize_t hung_up_tty_write(struct file * file, const char __user * buf, static ssize_t hung_up_tty_write(struct file * file, const char __user * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on ttys. */
if (ppos != &file->f_pos)
return -ESPIPE;
return -EIO; return -EIO;
} }
...@@ -648,10 +642,6 @@ static ssize_t tty_read(struct file * file, char __user * buf, size_t count, ...@@ -648,10 +642,6 @@ static ssize_t tty_read(struct file * file, char __user * buf, size_t count,
struct tty_struct * tty; struct tty_struct * tty;
struct inode *inode; struct inode *inode;
/* Can't seek (pread) on ttys. */
if (ppos != &file->f_pos)
return -ESPIPE;
tty = (struct tty_struct *)file->private_data; tty = (struct tty_struct *)file->private_data;
inode = file->f_dentry->d_inode; inode = file->f_dentry->d_inode;
if (tty_paranoia_check(tty, inode, "tty_read")) if (tty_paranoia_check(tty, inode, "tty_read"))
...@@ -726,10 +716,6 @@ static ssize_t tty_write(struct file * file, const char __user * buf, size_t cou ...@@ -726,10 +716,6 @@ static ssize_t tty_write(struct file * file, const char __user * buf, size_t cou
struct tty_struct * tty; struct tty_struct * tty;
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
/* Can't seek (pwrite) on ttys. */
if (ppos != &file->f_pos)
return -ESPIPE;
tty = (struct tty_struct *)file->private_data; tty = (struct tty_struct *)file->private_data;
if (tty_paranoia_check(tty, inode, "tty_write")) if (tty_paranoia_check(tty, inode, "tty_write"))
return -EIO; return -EIO;
...@@ -755,9 +741,6 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t ...@@ -755,9 +741,6 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t
if (p) { if (p) {
ssize_t res; ssize_t res;
/* Can't seek (pwrite) on ttys. */
if (ppos != &file->f_pos)
return -ESPIPE;
res = vfs_write(p, buf, count, &p->f_pos); res = vfs_write(p, buf, count, &p->f_pos);
fput(p); fput(p);
return res; return res;
...@@ -1339,6 +1322,7 @@ static int tty_open(struct inode * inode, struct file * filp) ...@@ -1339,6 +1322,7 @@ static int tty_open(struct inode * inode, struct file * filp)
dev_t device = inode->i_rdev; dev_t device = inode->i_rdev;
unsigned short saved_flags = filp->f_flags; unsigned short saved_flags = filp->f_flags;
nonseekable_open(inode, filp);
retry_open: retry_open:
noctty = filp->f_flags & O_NOCTTY; noctty = filp->f_flags & O_NOCTTY;
index = -1; index = -1;
......
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