Re: [PATCH 16/18] llseek: automatically add .llseek fop

From: Mike Frysinger
Date: Wed Jul 07 2010 - 17:55:51 EST


On Wed, Jul 7, 2010 at 17:40, Arnd Bergmann wrote:
> All file_operations should get a .llseek
> operation so we can make nonseekable_open
> the default for future file operations
> without a .llseek pointer.
>
> The three cases that we can automatically
> detect are no_llseek, seq_lseek and
> default_llseek. For cases where we can
> we can automatically prove that the
> file offset is always ignored, we use
> noop_llseek, which maintains the current
> behavior of not returning an error from
> a seek.
>
> New drivers should normally not use
> noop_llseek but instead use no_llseek and
> call nonseekable_open at open time.
> Existing drivers can be converted to do
> the same when the maintainer knows for
> certain that no user code relies on calling
> seek on the device file.

can we skip the transition for devices that we already know ?

> --- a/arch/blackfin/kernel/kgdb_test.c
> +++ b/arch/blackfin/kernel/kgdb_test.c
> static const struct file_operations kgdb_test_proc_fops = {
> + Â Â Â .llseek = noop_llseek,/* read and write both use no f_pos */
> --- a/arch/blackfin/mach-bf561/coreb.c
> +++ b/arch/blackfin/mach-bf561/coreb.c
> Âstatic const struct file_operations coreb_fops = {
> + Â Â Â .llseek = noop_llseek,/* no read or write fn */

neither of these drivers are seekable, so attempts to do so should be
an error ...

> drivers/char/bfin-otp.c
>+ .llseek = default_llseek,/* read accesses f_pos */

lseeking should work fine with bfin-otp, so this change is OK
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/