[SLOF] [PATCH] usb/storage: Implement block write support
thuth at redhat.com
Wed Dec 12 22:14:02 AEDT 2018
On 2018-12-06 14:49, Laurent Vivier wrote:
> The only missing parts were to manage the transfer direction in
> do-bulk-command and to copy the data to the buffer before the
> write operation.
> This is needed as GRUB2 wants to write the grubenv file at start
> and hangs because the data are not provided to the disk controller.
> I've checked the file is correctly modified by modifying an environment
> variable in GRUB2 with "set saved_entry=2" then "save_env saved_entry"
> and checking the result in linux with "grub2-editenv list".
> Fixes: Fixes: a0b96fe66fcd991b407c1d67ca842921e477a6fd
> (Provide "write" function in the disk-label package)
> Signed-off-by: Laurent Vivier <lvivier at redhat.com>
> slof/fs/usb/dev-storage.fs | 55 ++++++++++++++++++++++++--------------
> 1 file changed, 35 insertions(+), 20 deletions(-)
> diff --git a/slof/fs/usb/dev-storage.fs b/slof/fs/usb/dev-storage.fs
> index 94f8421..923a8f6 100644
> --- a/slof/fs/usb/dev-storage.fs
> +++ b/slof/fs/usb/dev-storage.fs
> @@ -103,27 +103,33 @@ scsi-open
> \ if sense-len is 0 then no sense data is actually present
> -: do-bulk-command ( resp-buffer resp-size -- TRUE | FALSE )
> +: do-bulk-command ( dir resp-buffer resp-size -- TRUE | FALSE )
> TO resp-size
> TO resp-buffer
> udev USB_PIPE_OUT td-buf td-buf-phys dma-buf-phys usb>cmd 1F
> - usb-transfer-bulk IF \ transfer CBW
> + usb-transfer-bulk 1 = not IF \ transfer CBW
The patch is quite hard to read if you do two things at once (implement
the block write support and invert the logic of the IF-statements here).
May I suggest to split this up in two patches:
1) Invert the logic of the IF-statements, fix indentation (no TABs in
Forth code, please)
2) Implement the block write support.
More information about the SLOF