staging: make new character devices nonseekable
authorArnd Bergmann <arnd@arndb.de>
Thu, 30 Sep 2010 08:24:07 +0000 (10:24 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 5 Oct 2010 15:50:14 +0000 (08:50 -0700)
As a preparation for changing the default behaviour of llseek to no_llseek,
every file_operations structure should have a .llseek operation.

There are three new instances in staging now, which can all be changed
into no_llseek explicitly since the devices do not need to seek.

Add nonseekable_open where appropriate, to prevent pread/pwrite as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/bcm/Bcmchar.c
drivers/staging/bcm/InterfaceInit.c
drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c

index b2398629189460a0f17cefad617034b8a5ac756a..afde77ae0768d72a96e44fd532a5210699296675 100644 (file)
@@ -1,3 +1,5 @@
+#include <linux/fs.h>
+
 #include "headers.h"
 /***************************************************************
 * Function       - bcm_char_open()
@@ -35,6 +37,8 @@ static int bcm_char_open(struct inode *inode, struct file * filp)
 
        /*Start Queuing the control response Packets*/
        atomic_inc(&Adapter->ApplicationRunning);
+
+       nonseekable_open(inode, filp);
        return 0;
 }
 static int bcm_char_release(struct inode *inode, struct file *filp)
@@ -2360,6 +2364,7 @@ static struct file_operations bcm_fops = {
     .release  = bcm_char_release,
     .read     = bcm_char_read,
     .unlocked_ioctl    = bcm_char_ioctl,
+       .llseek = no_llseek,
 };
 
 
index d22a0e52a046c560634720d229f2c5c38d4912d6..67d8572f891c4ea1bd461fd3da34e5e7c42a965c 100644 (file)
@@ -163,6 +163,7 @@ static struct file_operations usbbcm_fops = {
     .read    =  usbbcm_read,
     .write   =  usbbcm_write,
     .owner   =  THIS_MODULE,
+       .llseek = no_llseek,
 };
 
 static struct usb_class_driver usbbcm_class = {
index 65087cea30280dba6340d90b69d279271c906c5b..89d9a5848791ccfac6df0356cb4e2646467c0538 100644 (file)
@@ -81,10 +81,11 @@ int numofmsgbuf = 0;
 //
 static struct file_operations ft1000fops =
 {
-    unlocked_ioctl:    ft1000_ChIoctl,
-    poll:     ft1000_ChPoll,
-    open:     ft1000_ChOpen,
-    release:  ft1000_ChRelease
+       .unlocked_ioctl = ft1000_ChIoctl,
+       .poll           = ft1000_ChPoll,
+       .open           = ft1000_ChOpen,
+       .release        = ft1000_ChRelease,
+       .llseek         = no_llseek,
 };
 
 
@@ -470,6 +471,7 @@ static int ft1000_ChOpen (struct inode *Inode, struct file *File)
 
     File->private_data = pdevobj[num]->net;
 
+       nonseekable_open(Inode, File);
     return 0;
 }