]> git.hungrycats.org Git - linux/commitdiff
Character device tape drivers are non-lseekable.
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 7 Aug 2004 12:07:42 +0000 (05:07 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 7 Aug 2004 12:07:42 +0000 (05:07 -0700)
You can seek the tape, but you do it with the magic tape
control ioctl's, not with lseek/pread/pwrite.

drivers/ide/ide-tape.c
drivers/scsi/st.c

index 480426f438870f62307518738c98d31cf896b37e..f86ffc4b356b2f9f20f0b3c75f5ee33f186608e2 100644 (file)
@@ -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 */
index fe114ba4ed943d27887f9216e553de195992adf2..6e87d622662649a9ce5e04091df50b8af9af4024 100644 (file)
@@ -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)
 }
 \f
 /* 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;