Skip to contentSkip to conversation

firewire: nosy: char device is not seekable

PATCH In review Stefan Richter 2 participants 6 messages Oct 13, 2010 – Oct 23, 2010 Firewire

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firewire: nosy: char device is not seekable

Amend .open handler accordingly and add .llseek = no_llseek handler.

---
Arnd, is your mega-patch which adds legions of .llseek handlers done and to be merged soon as-is, or do you regenerate it regularly? (linux-next commit 9711569d "llseek: automatically add .llseek fop")

 drivers/firewire/nosy.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/firewire/nosy.c +2 -1
Index: b/drivers/firewire/nosy.c
===================================================================
@@ -302,7 +302,7 @@ nosy_open(struct inode *inode, struct fi
 
 	file->private_data = client;
 
-	return 0;
+	return nonseekable_open(inode, file);
 fail:
 	kfree(client);
 	lynx_put(lynx);
@@ -400,6 +400,7 @@ nosy_ioctl(struct file *file, unsigned i
 
 static const struct file_operations nosy_ops = {
 	.owner =		THIS_MODULE,
+	.llseek =		no_llseek,
 	.read =			nosy_read,
 	.unlocked_ioctl =	nosy_ioctl,
 	.poll =			nosy_poll,
Signature · 3 lines
Stefan Richter
-=====-==-=- =-=- -==-=
http://arcgraph.de/sr/
#1 lore raw

drivers/firewire/nosy.c nosy_ioctl(struct file *file, unsigned i · line 406

Quoted 6 lines · Stefan Richter

static const struct file_operations nosy_ops = {

drivers/firewire/nosy.c +1 -0
 	.owner =		THIS_MODULE,
+	.llseek =		no_llseek,
 	.read =			nosy_read,
 	.unlocked_ioctl =	nosy_ioctl,
 	.poll =			nosy_poll,

PS; this is safe since the only client that uses this interface is nosy-dump in linux/tools/firewire and it knows not to seek in this char dev.

Signature · 3 lines
Stefan Richter
-=====-==-=- =-=- -==-=
http://arcgraph.de/sr/
#2 lore raw
In reply to Stefan Richter
Quoted 7 lines · Stefan Richter

Amend .open handler accordingly and add .llseek = no_llseek handler.

---
Arnd, is your mega-patch which adds legions of .llseek handlers done and to be merged soon as-is, or do you regenerate it regularly? (linux-next commit 9711569d "llseek: automatically add .llseek fop")

I initially planned to regenerate it, but the flux is very small, so I have decided to keep the version I have today and only do manual updates to remove the conflicts and add the changes for new files that are missing the .llseek pointers.

Your patch looks good, and I'll remove my change for this file accordingly.

Thanks!

Arnd

#3 lore raw

PATCH 1/1 firewire: nosy: char device is not seekable

Remove unnecessary .llseek handler that came in via an automated mass conversion. .llseek = NULL means no_llseek since commit 776c163b1b93.

The only client that uses this interface is nosy-dump in linux/tools/firewire and it knows not to seek in this char dev.

---
I left out the addition of return nonseekable_open(...) in nosy_open in this update. This works for nosy, but is it also formally correct?

 drivers/firewire/nosy.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/firewire/nosy.c +0 -1
index bf184fb..8528b10 100644
@@ -405,7 +405,6 @@ static const struct file_operations nosy_ops = {
 	.poll =			nosy_poll,
 	.open =			nosy_open,
 	.release =		nosy_release,
-	.llseek =		noop_llseek,
 };
 
 #define PHY_PACKET_SIZE 12 /* 1 payload, 1 inverse, 1 ack = 3 quadlets */
Signature · 3 lines
Stefan Richter
-=====-==-=- =-=- =-===
http://arcgraph.de/sr/
#4 lore raw
Quoted 11 lines · Stefan Richter

Remove unnecessary .llseek handler that came in via an automated mass conversion. .llseek = NULL means no_llseek since commit 776c163b1b93.

The only client that uses this interface is nosy-dump in linux/tools/firewire and it knows not to seek in this char dev.

---
I left out the addition of return nonseekable_open(...) in nosy_open in this update. This works for nosy, but is it also formally correct?

Most likely you also want the nonseekeable_open, which would prevent both llseek and pread/pwrite, whereas leaving out llseek currently only prevents llseek.

Arnd

#5 lore raw
Quoted 3 lines · Arnd Bergmann

Most likely you also want the nonseekeable_open, which would prevent both llseek and pread/pwrite, whereas leaving out llseek currently only prevents llseek.

Right, thanks for the reminder.

Signature · 3 lines
Stefan Richter
-=====-==-=- =-=- =-===
http://arcgraph.de/sr/