diff options
author | Simon Glass <sjg@chromium.org> | 2021-03-15 18:11:11 +1300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-03-27 15:04:31 +1300 |
commit | 1758551ec9526d56303a2b5cf1f58147e66945ed (patch) | |
tree | 8e8b35f4dadae793cd6668d10f958f0337191806 /drivers/block/sandbox.c | |
parent | 803e9c1c94d06cfab43606056c653268e12926d8 (diff) | |
download | u-boot-1758551ec9526d56303a2b5cf1f58147e66945ed.tar.gz u-boot-1758551ec9526d56303a2b5cf1f58147e66945ed.tar.bz2 u-boot-1758551ec9526d56303a2b5cf1f58147e66945ed.zip |
sandbox: Provide a way to bind fixed/removeable devices
At present when a file is bound to a host device it is always marked as
removeable. Arguably the device is removeable, since it can be unbound at
will. However while it is bound, it is not considered removable by the
user. Also it is useful to be able to model both fixed and removeable
devices for code that distinguishes them.
Add a -r flag to the 'host bind' command and plumb it through to provide
this feature.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/block/sandbox.c')
-rw-r--r-- | drivers/block/sandbox.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index e2f229b15d..1c2c3b4f88 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -89,7 +89,7 @@ static unsigned long host_block_write(struct blk_desc *block_dev, } #ifdef CONFIG_BLK -int host_dev_bind(int devnum, char *filename) +int host_dev_bind(int devnum, char *filename, bool removable) { struct host_block_dev *host_dev; struct udevice *dev; @@ -146,7 +146,7 @@ int host_dev_bind(int devnum, char *filename) } desc = blk_get_devnum_by_type(IF_TYPE_HOST, devnum); - desc->removable = 1; + desc->removable = removable; snprintf(desc->vendor, BLK_VEN_SIZE, "U-Boot"); snprintf(desc->product, BLK_PRD_SIZE, "hostfile"); snprintf(desc->revision, BLK_REV_SIZE, "1.0"); @@ -160,7 +160,7 @@ err: return ret; } #else -int host_dev_bind(int dev, char *filename) +int host_dev_bind(int dev, char *filename, bool removable) { struct host_block_dev *host_dev = find_host_device(dev); @@ -195,7 +195,7 @@ int host_dev_bind(int dev, char *filename) blk_dev->block_write = host_block_write; blk_dev->devnum = dev; blk_dev->part_type = PART_TYPE_UNKNOWN; - blk_dev->removable = 1; + blk_dev->removable = removable; snprintf(blk_dev->vendor, BLK_VEN_SIZE, "U-Boot"); snprintf(blk_dev->product, BLK_PRD_SIZE, "hostfile"); snprintf(blk_dev->revision, BLK_REV_SIZE, "1.0"); |