VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / s390 / char / tape_char.c
index ccbe214..86262a1 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <asm/uaccess.h>
 
+#define TAPE_DBF_AREA  tape_core_dbf
+
 #include "tape.h"
 #include "tape_std.h"
 #include "tape_class.h"
@@ -29,8 +31,8 @@
 /*
  * file operation structure for tape character frontend
  */
-static ssize_t tapechar_read(struct file *, char *, size_t, loff_t *);
-static ssize_t tapechar_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t tapechar_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t tapechar_write(struct file *, const char __user *, size_t, loff_t *);
 static int tapechar_open(struct inode *,struct file *);
 static int tapechar_release(struct inode *,struct file *);
 static int tapechar_ioctl(struct inode *, struct file *, unsigned int,
@@ -134,7 +136,7 @@ tapechar_check_idalbuffer(struct tape_device *device, size_t block_size)
  * Tape device read function
  */
 ssize_t
-tapechar_read (struct file *filp, char *data, size_t count, loff_t *ppos)
+tapechar_read(struct file *filp, char __user *data, size_t count, loff_t *ppos)
 {
        struct tape_device *device;
        struct tape_request *request;
@@ -143,16 +145,6 @@ tapechar_read (struct file *filp, char *data, size_t count, loff_t *ppos)
 
        DBF_EVENT(6, "TCHAR:read\n");
        device = (struct tape_device *) filp->private_data;
-       /* Check position. */
-       if (ppos != &filp->f_pos) {
-               /*
-                * "A request was outside the capabilities of the device."
-                * This check uses internal knowledge about how pread and
-                * read work...
-                */
-               DBF_EVENT(6, "TCHAR:ppos wrong\n");
-               return -EOVERFLOW;
-       }
 
        /*
         * If the tape isn't terminated yet, do it now. And since we then
@@ -208,7 +200,7 @@ tapechar_read (struct file *filp, char *data, size_t count, loff_t *ppos)
  * Tape device write function
  */
 ssize_t
-tapechar_write(struct file *filp, const char *data, size_t count, loff_t *ppos)
+tapechar_write(struct file *filp, const char __user *data, size_t count, loff_t *ppos)
 {
        struct tape_device *device;
        struct tape_request *request;
@@ -219,12 +211,6 @@ tapechar_write(struct file *filp, const char *data, size_t count, loff_t *ppos)
 
        DBF_EVENT(6, "TCHAR:write\n");
        device = (struct tape_device *) filp->private_data;
-       /* Check position */
-       if (ppos != &filp->f_pos) {
-               /* "A request was outside the capabilities of the device." */
-               DBF_EVENT(6, "TCHAR:ppos wrong\n");
-               return -EOVERFLOW;
-       }
        /* Find out block size and number of blocks */
        if (device->char_data.block_size != 0) {
                if (count < device->char_data.block_size) {
@@ -327,7 +313,7 @@ tapechar_open (struct inode *inode, struct file *filp)
        rc = tape_open(device);
        if (rc == 0) {
                filp->private_data = device;
-               return 0;
+               return nonseekable_open(inode, filp);
        }
        tape_put_device(device);
 
@@ -389,7 +375,7 @@ tapechar_ioctl(struct inode *inp, struct file *filp,
        if (no == MTIOCTOP) {
                struct mtop op;
 
-               if (copy_from_user(&op, (char *) data, sizeof(op)) != 0)
+               if (copy_from_user(&op, (char __user *) data, sizeof(op)) != 0)
                        return -EFAULT;
                if (op.mt_count < 0)
                        return -EINVAL;
@@ -436,7 +422,7 @@ tapechar_ioctl(struct inode *inp, struct file *filp,
                if (rc < 0)
                        return rc;
                pos.mt_blkno = rc;
-               if (copy_to_user((char *) data, &pos, sizeof(pos)) != 0)
+               if (copy_to_user((char __user *) data, &pos, sizeof(pos)) != 0)
                        return -EFAULT;
                return 0;
        }
@@ -466,7 +452,7 @@ tapechar_ioctl(struct inode *inp, struct file *filp,
                        get.mt_blkno = rc;
                }
 
-               if (copy_to_user((char *) data, &get, sizeof(get)) != 0)
+               if (copy_to_user((char __user *) data, &get, sizeof(get)) != 0)
                        return -EFAULT;
 
                return 0;