Re: f_op->read seems to be always NULL since Linux 4.1

From: Al Viro
Date: Sun Jun 28 2015 - 04:30:45 EST


On Sun, Jun 28, 2015 at 08:36:18AM +0200, Andreas Hartmann wrote:
> On Sat, Jun 27, 2015 at 8:10 PM, Richard Weinberger wrote:
> >On Sat, Jun 27, 2015 at 7:32 PM, Andreas Hartmann
> ><andihartmann@xxxxxxxxxxxxxxx> wrote:
> [...]
> >See __vfs_read().
> >Your module most not rely on such internals.
>
> Thanks for your hint to the function which exists since 3.19.
>
> Is there a site out there which lists all relevant changes done for
> each kernel version and the recommendations how to correctly handle
> them?

localhost. It's in Documentation/filesystems/porting in the kernel
source. To quote the relevant entry (not far from the end - they
are in chronological order):

[mandatory]
never call ->read() and ->write() directly; use __vfs_{read,write} or
wrappers; instead of checking for ->write or ->read being NULL, look for
FMODE_CAN_{WRITE,READ} in file->f_mode.

Sometimes TFM to R _is_ in the natural place...
--
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/