summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/storage_common.h
diff options
context:
space:
mode:
authorMaxim Devaev <mdevaev@gmail.com>2022-07-11 12:29:57 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-14 16:06:42 +0200
commit421c8d9a20da92deed2dac227e7ebdee7eb3e88f (patch)
tree9dd7b02019b4500836d798ac73042c36735cfe6f /drivers/usb/gadget/function/storage_common.h
parentusb: gadget: udc: amd5536 depends on HAS_DMA (diff)
downloadlinux-421c8d9a20da92deed2dac227e7ebdee7eb3e88f.tar.xz
linux-421c8d9a20da92deed2dac227e7ebdee7eb3e88f.zip
usb: gadget: f_mass_storage: forced_eject attribute
It allows to reset prevent_medium_removal flag and "eject" the image. This can be useful to free the drive from a hunging host or if the host continues to use the drive even after unmounting (Linux does this). It's also a bit like using an unfolded paperclip on an optical drive. Previously, the undocumented method of sending SIGUSR1 to a special "file-storage" kernel thread could be used for these purposes, but when using multiple storages there was no way to distinguish one from the other, so we had to send a signal to everyone. Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Maxim Devaev <mdevaev@gmail.com> Link: https://lore.kernel.org/r/20220711102956.19642-1-mdevaev@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/function/storage_common.h')
-rw-r--r--drivers/usb/gadget/function/storage_common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/storage_common.h b/drivers/usb/gadget/function/storage_common.h
index bdeb1e233fc9..0a544a82cbf8 100644
--- a/drivers/usb/gadget/function/storage_common.h
+++ b/drivers/usb/gadget/function/storage_common.h
@@ -219,5 +219,7 @@ ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf,
size_t count);
ssize_t fsg_store_inquiry_string(struct fsg_lun *curlun, const char *buf,
size_t count);
+ssize_t fsg_store_forced_eject(struct fsg_lun *curlun, struct rw_semaphore *filesem,
+ const char *buf, size_t count);
#endif /* USB_STORAGE_COMMON_H */