public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: make new character devices nonseekable
@ 2010-09-26 15:31 Arnd Bergmann
  2010-09-27  1:22 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2010-09-26 15:31 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel

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>
---
 bcm/Bcmchar.c                    |    3 +++
 bcm/InterfaceInit.c              |    1 +
 ft1000/ft1000-usb/ft1000_chdev.c |    2 ++
 3 files changed, 6 insertions(+)

These are the only instances I can't patch automatically because the code
is not yet upstream. Please apply.

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index b239862..559d909 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -35,6 +35,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, file);
 	return 0;
 }
 static int bcm_char_release(struct inode *inode, struct file *filp)
@@ -2360,6 +2362,7 @@ static struct file_operations bcm_fops = {
     .release  = bcm_char_release,
     .read     = bcm_char_read,
     .unlocked_ioctl    = bcm_char_ioctl,
+	.llseek = no_llseek,
 };
 
 
diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c
index d22a0e5..67d8572 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -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 = {
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
index 65087ce..92c0c04 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
@@ -85,6 +85,7 @@ static struct file_operations ft1000fops =
     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;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: make new character devices nonseekable
  2010-09-26 15:31 [PATCH] staging: make new character devices nonseekable Arnd Bergmann
@ 2010-09-27  1:22 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2010-09-27  1:22 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel

On Sun, Sep 26, 2010 at 05:31:52PM +0200, Arnd Bergmann wrote:
> 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>
> ---
>  bcm/Bcmchar.c                    |    3 +++
>  bcm/InterfaceInit.c              |    1 +
>  ft1000/ft1000-usb/ft1000_chdev.c |    2 ++
>  3 files changed, 6 insertions(+)

Odd, this patch breaks the build, what's up?

Hm, do I need to apply it to a recent Linus version?  My staging-next
tree is 2.6.36-rc2 based, do I need to update it?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-27  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-26 15:31 [PATCH] staging: make new character devices nonseekable Arnd Bergmann
2010-09-27  1:22 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox