patch-2.1.60 linux/drivers/scsi/st.c

Next file: linux/fs/Config.in
Previous file: linux/drivers/scsi/sg.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.59/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
@@ -955,12 +955,12 @@
 
 
 /* Write command */
-	static long
-st_write(struct inode * inode, struct file * filp, const char * buf,
-	 unsigned long count)
+static ssize_t
+st_write(struct file * filp, const char * buf, size_t count, loff_t *ppos)
 {
-    long total;
-    int i, do_count, blks, retval, transfer;
+    struct inode *inode = filp->f_dentry->d_inode;
+    ssize_t total;
+    ssize_t i, do_count, blks, retval, transfer;
     int write_threshold;
     int doing_write = 0;
     static unsigned char cmd[10];
@@ -971,6 +971,11 @@
     ST_partstat * STps;
     int dev = TAPE_NR(inode->i_rdev);
 
+    if (ppos != &filp->f_pos) {
+      /* "A request was outside the capabilities of the device." */
+      return -ENXIO;
+    }
+
     STp = &(scsi_tapes[dev]);
     if (STp->ready != ST_READY)
       return (-EIO);
@@ -1254,7 +1259,7 @@
 /* Read data from the tape. Returns zero in the normal case, one if the
    eof status has changed, and the negative error code in case of a
    fatal error. Otherwise updates the buffer and the eof state. */
-	static long
+static long
 read_tape(struct inode *inode, long count, Scsi_Cmnd **aSCpnt)
 {
     int transfer, blks, bytes;
@@ -1441,17 +1446,23 @@
 
 
 /* Read command */
-	static long
-st_read(struct inode * inode, struct file * filp, char * buf, unsigned long count)
+static ssize_t
+st_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
 {
-    long total;
-    int i, transfer;
+    struct inode * inode = filp->f_dentry->d_inode;
+    ssize_t total;
+    ssize_t i, transfer;
     int special;
     Scsi_Cmnd * SCpnt = NULL;
     Scsi_Tape * STp;
     ST_mode * STm;
     ST_partstat * STps;
     int dev = TAPE_NR(inode->i_rdev);
+
+    if (ppos != &filp->f_pos) {
+      /* "A request was outside the capabilities of the device." */
+      return -ENXIO;
+    }
 
     STp = &(scsi_tapes[dev]);
     if (STp->ready != ST_READY)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov