blk: sandbox: Support binding a device with a given logical block size

Allow optionally set the logical block size of the host device to
bind in the "host bind" command. If not given, defaults to 512.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
This commit is contained in:
Bin Meng
2023-09-26 16:43:33 +08:00
committed by Tom Rini
parent 77ca9d7457
commit 8897faba2d
5 changed files with 37 additions and 14 deletions

View File

@@ -74,10 +74,11 @@ int host_detach_file(struct udevice *dev);
* @label: Label of the attachment, e.g. "test1"
* @removable: true if the device should be marked as removable, false
* if it is fixed. See enum blk_flag_t
* @blksz: logical block size of the device
* @devp: Returns the device created, on success
* Returns: 0 if OK, -ve on error
*/
int host_create_device(const char *label, bool removable,
int host_create_device(const char *label, bool removable, unsigned long blksz,
struct udevice **devp);
/**
@@ -87,11 +88,13 @@ int host_create_device(const char *label, bool removable,
* @filename: Name of the file, e.g. "/path/to/disk.img"
* @removable: true if the device should be marked as removable, false
* if it is fixed. See enum blk_flag_t
* @blksz: logical block size of the device
* @devp: Returns the device created, on success
* Returns: 0 if OK, -ve on error
*/
int host_create_attach_file(const char *label, const char *filename,
bool removable, struct udevice **devp);
bool removable, unsigned long blksz,
struct udevice **devp);
/**
* host_find_by_label() - Find a host by label