[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xa1toatny765.fsf@mina86.com>
Date: Tue, 07 Oct 2014 22:08:18 +0200
From: Michal Nazarewicz <mina86@...a86.com>
To: Alan Stern <stern@...land.harvard.edu>, Felipe Balbi <balbi@...com>
Cc: Krzysztof Opasiak <k.opasiak@...sung.com>,
'Robert Baldyga' <r.baldyga@...sung.com>,
gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, andrzej.p@...sung.com
Subject: Re: [PATCH] usb: gadget: f_fs: add "zombie" mode
> On Tue, 7 Oct 2014, Felipe Balbi wrote:
>> Right, but if we allow this, I can already see folks abusing to
>> connect to the host early and only when necessary do some trickery to
>> e.g. start adbd (not saying Android will do this, just using it as an
>> easy example).
I don't really see that happening. For the gadget to start all
descriptors need to be known. Functionfs will know the descriptors
only once the user space daemon provides them. Therefore, with the
current features (or even with addition of Robert's feature) there is no
way to let the gadget start without having the daemon running.
On Tue, Oct 07 2014, Alan Stern <stern@...land.harvard.edu> wrote:
> We can still keep the pullup turned off until all the functions are
> ready. That's a part of normal behavior -- unlike what happens when a
> userspace component crashes or is killed.
>> Then how do we differentiate a normal close() from a "oh-crap-I-died"
>> close() ?
> We can't, so why worry about it?
We actually might be able to distinguish those cases with another ioctl
which daemon must issue on the ep0 prior to closing it. I'm not saying
that we should implement that though.
> If a file handle was closed for normal reasons then userspace probably
> in the middle of shutting down the gadget anyway. If not then the
> user will get what they deserve.
>
> If the file handle was closed for abnormal reasons, we can behave like
> crashed firmware. Which means, in the end, doing the same thing as in
> the normal-reason case -- i.e., do nothing. In particular, don't
> disconnect.
>
> If you want to allow for the possibility of orderly shutdown (and maybe
> even possible restart) of a userspace handler, the function library
> should first tell the kernel explicitly to disconnect. Then function
> components can be changed around completely, and when everything is
> ready, userspace can tell the kernel to connect again.
I'm wondering if it would be possible to support user-space daemon
restarts with O_APPEND flag. This is probably looking too far to the
future though.
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +--<mpn@...gle.com>--<xmpp:mina86@...ber.org>--ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists