Re: [PATCH v3] usb: gadget: f_mass_storage: forced_eject attribute
From: Alan Stern
Date: Thu Jul 07 2022 - 13:24:00 EST
On Thu, Jul 07, 2022 at 08:09:13PM +0300, Maxim Devaev wrote:
> It allows to reset prevent_medium_removal flag and "eject" the image.
>
> The patch is a completely alternative implementation of the previously
> proposed [1], the idea of which was born after the mentioned discussion.
>
> Signed-off-by: Maxim Devaev <mdevaev@xxxxxxxxx>
> Link: https://lore.kernel.org/lkml/20220406092445.215288-1-mdevaev@xxxxxxxxx [1]
> ---
Greg's patch bot is going to complain that you didn't describe the
differences between v2 and v3 at this point.
And since you'll have to submit the patch again...
> +ssize_t fsg_store_forced_eject(struct fsg_lun *curlun, struct rw_semaphore *filesem,
> + const char *buf, size_t count)
> +{
> + int ret;
> +
... How about putting a comment line here, explaining that this
override will cause the medium to be ejected no matter what the host
wants?
> + curlun->prevent_medium_removal = 0;
> + ret = fsg_store_file(curlun, filesem, "", 0);
> + return ret < 0 ? ret : count;
> +}
> +EXPORT_SYMBOL_GPL(fsg_store_forced_eject);
In any case, in the next submission you can add:
Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
Alan Stern