RE: [PATCH] usb: gadget: ffs: don't allow to open with O_NONBLOCK flag
From: David Laight
Date: Tue Apr 07 2015 - 12:54:31 EST
From: Robert Baldyga
> Hi Michal,
>
> On 04/01/2015 05:17 PM, Michal Nazarewicz wrote:
> > On Wed, Apr 01 2015, Robert Baldyga <r.baldyga@xxxxxxxxxxx> wrote:
> >> FunctionFS can't support O_NONBLOCK because read/write operatons are
> >> directly translated into USB requests which are asynchoronous, so we
> >> can't know how long we will have to wait for request completion. For
> >> this reason in case of open with O_NONBLOCK flag we return
> >> -EWOULDBLOCK.
> >
> > cant is a bit strong of a word here though. It can, but in a few
> > cases it doesnt.
> >
> > It kinda saddens me that this undoes all the lines of code that were put
> > into the file to support O_NONBLOCK (e.g. FFS_NO_SETUP path of
> > ffs_ep0_read).
> >
> > Im also worried this may break existing applications which, for better
> > or worse, open the file with O_NONBLOCK.
> >
> > Most importantly though, this does not stop users from using fcntl to
> > set O_NONBLOCK, so if you really want to stop O_NONBLOCK from being set,
> > that path should be checked as well (if possible).
>
> I want rather to inform users that non-blocking i/o wouldn't work for
> epfiles. Indeed we can handle O_NONBLOCK for ep0 (for the same reason we
> can have poll), but for other epfiles there is no way to check if
> read/write operation can end up in short time. Everything is up to host.
Is that really necessary?
I'm sure there are a lot of device drivers that ignore O_NONBLOCK.
David
N§²æ¸yú²X¬¶ÇvØ)Þ{.nÇ·¥{±êX§¶¡Ü}©²ÆzÚj:+v¨¾«êZ+Êzf£¢·h§~Ûÿû®w¥¢¸?¨è&¢)ßfùy§m
á«a¶Úÿ0¶ìå