This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / scsi / st.c
index 5fa0153..24a3c49 100644 (file)
@@ -1001,7 +1001,6 @@ 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)) {
@@ -1204,7 +1203,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)
+static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count, loff_t *ppos)
 {
        ssize_t retval = 0;
 
@@ -1219,6 +1218,12 @@ static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count)
                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);
@@ -1362,7 +1367,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);
+       retval = rw_checks(STp, filp, count, ppos);
        if (retval || count == 0)
                goto out;
 
@@ -1828,7 +1833,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);
+       retval = rw_checks(STp, filp, count, ppos);
        if (retval || count == 0)
                goto out;
 
@@ -3408,7 +3413,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
                case SCSI_IOCTL_GET_BUS_NUMBER:
                        break;
                default:
-                       i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
+                       i = scsi_cmd_ioctl(STp->disk, cmd_in, p);
                        if (i != -ENOTTY)
                                return i;
                        break;
@@ -3969,7 +3974,7 @@ static int st_remove(struct device *dev)
        for (i = 0; i < st_dev_max; i++) {
                tpnt = scsi_tapes[i];
                if (tpnt != NULL && tpnt->device == SDp) {
-                       scsi_tapes[i] = NULL;
+                       scsi_tapes[i] = 0;
                        st_nr_dev--;
                        write_unlock(&st_dev_arr_lock);
                        devfs_unregister_tape(tpnt->disk->number);