Skip to contentSkip to conversation

BLUETOOTH: Remove the redundant non-seekable llseek

PATCH Marcel Holtmann 2 participants 3 messages May 30, 2007 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hi Robert,

Quoted 10 lines

Remove the llseek method given that the open method already calls nonseekable_open().

---

given that the fops open() method already calls nonseekable_open() at the end, it would seem that this old-style method for preventing lseeking is redundant. am i reading that correctly?

I wasn't aware of that fact, but after reading through the VFS code I agree that your patch is perfectly fine. Other drivers are using no_llseek in some cases, but even that is not needed at all. So full ACK from my side.

Regards

Marcel

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 9 lines · Marcel Holtmann

Hi Robert,

Quoted 7 lines

Remove the llseek method given that the open method already calls nonseekable_open().

---

Quoted 8 lines
Quoted 3 lines

given that the fops open() method already calls nonseekable_open() at the end, it would seem that this old-style method for preventing lseeking is redundant. am i reading that correctly?

I wasn't aware of that fact, but after reading through the VFS code I agree that your patch is perfectly fine. Other drivers are using no_llseek in some cases, but even that is not needed at all. So full ACK from my side.

i've already submitted a few other patches to remove the no_llseek() from other drivers if they don't need it, so don't think i'm just picking on *you*, marcel. :-)

rday

p.s. i really *hate* the fact that that routine is called "nonseekable_open" since it gives the impression that it's somehow a full replacement for a "regular" open, when its entire implementation consists of:

int nonseekable_open(struct inode *inode, struct file *filp)

{
        filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
        return 0;
}

really, it should have been called something like "set_nonseekable" or "make_me_nonseekable" or something similar. oh, well ...

rday

Signature · 11 lines
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#2 lore raw
In reply to Marcel Holtmann
Quoted 9 lines · Marcel Holtmann

Hi Robert,

Quoted 7 lines

Remove the llseek method given that the open method already calls nonseekable_open().

---

Quoted 8 lines
Quoted 3 lines

given that the fops open() method already calls nonseekable_open() at the end, it would seem that this old-style method for preventing lseeking is redundant. am i reading that correctly?

I wasn't aware of that fact, but after reading through the VFS code I agree that your patch is perfectly fine. Other drivers are using no_llseek in some cases, but even that is not needed at all. So full ACK from my side.

for people who want the full explanation of what's going on here, you can read the brilliantly-named "safe seeks" article here:

http://lwn.net/Articles/97154/

which explains how the nonseekable_open() call added to the end of your regular device open() call prevents not just regular lseeks but also the pread() and pwrite() calls, so some of those older tests to avoid lseek'ing are no longer necessary, as you can see from the trivial implementation of nonseekable_open():

int nonseekable_open(struct inode *inode, struct file *filp)

{
        filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
        return 0;
}

i've already done a quick scan of the tree and submitted patches to remove code that is now superfluous given the use of nonseekable_open().

rday

Signature · 11 lines
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors