Commit 2eca58ca authored by Linus Torvalds's avatar Linus Torvalds

Character device tape drivers are non-lseekable.

You can seek the tape, but you do it with the magic tape
control ioctl's, not with lseek/pread/pwrite.
parent 6387d4ea
......@@ -3755,10 +3755,6 @@ static ssize_t idetape_chrdev_read (struct file *file, char __user *buf,
idetape_tape_t *tape = drive->driver_data;
ssize_t bytes_read,temp, actually_read = 0, rc;
if (ppos != &file->f_pos) {
/* "A request was outside the capabilities of the device." */
return -ENXIO;
}
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 3)
printk(KERN_INFO "ide-tape: Reached idetape_chrdev_read, count %Zd\n", count);
......@@ -3818,11 +3814,6 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf,
idetape_tape_t *tape = drive->driver_data;
ssize_t retval, actually_written = 0;
if (ppos != &file->f_pos) {
/* "A request was outside the capabilities of the device." */
return -ENXIO;
}
/* The drive is write protected. */
if (tape->write_prot)
return -EACCES;
......@@ -4187,6 +4178,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
idetape_pc_t pc;
int retval;
nonseekable_open(inode, filp);
#if IDETAPE_DEBUG_LOG
printk(KERN_INFO "ide-tape: Reached idetape_chrdev_open\n");
#endif /* IDETAPE_DEBUG_LOG */
......
......@@ -1001,6 +1001,7 @@ static int st_open(struct inode *inode, struct file *filp)
int dev = TAPE_NR(inode);
char *name;
nonseekable_open(inode, filp);
write_lock(&st_dev_arr_lock);
if (dev >= st_dev_max || scsi_tapes == NULL ||
((STp = scsi_tapes[dev]) == NULL)) {
......@@ -1203,7 +1204,7 @@ static int st_release(struct inode *inode, struct file *filp)
}
/* The checks common to both reading and writing */
static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count, loff_t *ppos)
static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count)
{
ssize_t retval = 0;
......@@ -1218,12 +1219,6 @@ static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count, loff_t
goto out;
}
if (ppos != &filp->f_pos) {
/* "A request was outside the capabilities of the device." */
retval = (-ENXIO);
goto out;
}
if (STp->ready != ST_READY) {
if (STp->ready == ST_NO_TAPE)
retval = (-ENOMEDIUM);
......@@ -1367,7 +1362,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
if (down_interruptible(&STp->lock))
return -ERESTARTSYS;
retval = rw_checks(STp, filp, count, ppos);
retval = rw_checks(STp, filp, count);
if (retval || count == 0)
goto out;
......@@ -1833,7 +1828,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
if (down_interruptible(&STp->lock))
return -ERESTARTSYS;
retval = rw_checks(STp, filp, count, ppos);
retval = rw_checks(STp, filp, count);
if (retval || count == 0)
goto out;
......
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