mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Robert Baldyga <r.baldyga@samsung.com>, balbi@ti.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, andrzej.p@samsung.com,
	k.opasiak@samsung.com, Robert Baldyga <r.baldyga@samsung.com>
Subject: Re: [PATCH] usb: gadget: f_fs: add "zombie" mode
Date: Mon, 06 Oct 2014 14:36:15 +0200	[thread overview]
Message-ID: <xa1tvbnx2x4w.fsf@mina86.com> (raw)
In-Reply-To: <1412594714-535-1-git-send-email-r.baldyga@samsung.com>

On Mon, Oct 06 2014, Robert Baldyga <r.baldyga@samsung.com> wrote:
> Since we can compose gadgets from many functions, there is the problem
> related to gadget breakage while FunctionFS daemon being closed. In some
> cases it's strongly desired to keep gadget alive for a while, despite
> FunctionFS files are closed, to allow another functions to complete
> some presumably critical operations.
>
> For this purpose this patch introduces "zombie" mode. It can be enabled
> by setting mount option "zombie=1", and results with defering function
> closure to the moment of reopening ep0 file or filesystem umount.
>
> When ffs->state == FFS_ZOMBIE:
> - function is still binded and visible to host,
> - setup requests are automatically stalled,
> - all another transfers are refused,
> - opening ep0 causes function close, and then FunctionFS is ready for
>   descriptors and string write,
> - umount of functionfs cause function close.

However, all the ep# files will still exist on the filesystem.  This may
be a bit confusing and error-prone, no?

>
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> ---
>  drivers/usb/gadget/function/f_fs.c | 25 ++++++++++++++++++++++---
>  drivers/usb/gadget/function/u_fs.h |  4 ++++
>  2 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> @@ -1222,6 +1225,12 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
>  
>  		/* Interpret option */
>  		switch (eq - opts) {
> +		case 6:
> +			if (!memcmp(opts, "zombie", 6))
> +				data->zombie_mode  = !!value;

Unnecessary double space before =.

> +			else
> +				goto invalid;
> +			break;
>  		case 5:
>  			if (!memcmp(opts, "rmode", 5))
>  				data->root_mode  = (value & 0555) | S_IFDIR;
> diff --git a/drivers/usb/gadget/function/u_fs.h b/drivers/usb/gadget/function/u_fs.h
> @@ -92,6 +92,8 @@ enum ffs_state {
>  	 */
>  	FFS_ACTIVE,
>  
> +	FFS_ZOMBIE,
> +

Add comment describing the state.

>  	/*
>  	 * All endpoints have been closed.  This state is also set if
>  	 * we encounter an unrecoverable error.  The only

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--

  reply	other threads:[~2014-10-06 12:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 11:25 Robert Baldyga
2014-10-06 12:36 ` Michal Nazarewicz [this message]
2014-10-06 12:51   ` Robert Baldyga
2014-10-06 14:07     ` Michal Nazarewicz
2014-10-07  2:28 ` Felipe Balbi
2014-10-07  6:33   ` Robert Baldyga
2014-10-07 14:06     ` Felipe Balbi
2014-10-07 15:01       ` Krzysztof Opasiak
2014-10-07 15:28         ` Felipe Balbi
2014-10-07 16:37           ` Krzysztof Opasiak
2014-10-07 16:51             ` Felipe Balbi
2014-10-07 17:15               ` Alan Stern
2014-10-07 17:57                 ` Felipe Balbi
2014-10-07 18:42                   ` Alan Stern
2014-10-07 18:57                     ` Felipe Balbi
2014-10-07 19:16                       ` Alan Stern
2014-10-07 20:08                     ` Michal Nazarewicz
2014-10-08 10:09                       ` Krzysztof Opasiak
2014-10-08 11:28                         ` Michal Nazarewicz
2014-10-08 14:52                       ` Alan Stern
2014-10-09 10:56                         ` Michal Nazarewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xa1tvbnx2x4w.fsf@mina86.com \
    --to=mina86@mina86.com \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=k.opasiak@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=r.baldyga@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome