hw/block/block.c: improve confusing blk_check_size_and_read_all() error

In cases where a device tries to read more bytes than the block device
contains, the error is vague: "device requires X bytes, block backend
provides Y bytes".

This patch changes the errors of this function to include the block
backend name, the device id and device type name where appropriate.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-id: 7260eadff22c08457740117c1bb7bd2b4353acb9.1706598705.git.manos.pitsidianakis@linaro.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Manos Pitsidianakis 2024-01-30 09:30:32 +02:00 committed by Stefan Hajnoczi
parent 956ef49990
commit 954b33daee
5 changed files with 22 additions and 16 deletions

View file

@ -88,8 +88,8 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
/* Backend access helpers */
bool blk_check_size_and_read_all(BlockBackend *blk, void *buf, hwaddr size,
Error **errp);
bool blk_check_size_and_read_all(BlockBackend *blk, DeviceState *dev,
void *buf, hwaddr size, Error **errp);
/* Configuration helpers */