diff options
Diffstat (limited to 'block/block-backend.c')
-rw-r--r-- | block/block-backend.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index 7405024e08..f5bf13eec9 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -420,7 +420,7 @@ void monitor_remove_blk(BlockBackend *blk) * Return @blk's name, a non-null string. * Returns an empty string iff @blk is not referenced by the monitor. */ -const char *blk_name(BlockBackend *blk) +const char *blk_name(const BlockBackend *blk) { return blk->name ?: ""; } @@ -1746,13 +1746,14 @@ int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf, BDRV_REQ_WRITE_COMPRESSED); } -int blk_truncate(BlockBackend *blk, int64_t offset) +int blk_truncate(BlockBackend *blk, int64_t offset, Error **errp) { if (!blk_is_available(blk)) { + error_setg(errp, "No medium inserted"); return -ENOMEDIUM; } - return bdrv_truncate(blk->root, offset); + return bdrv_truncate(blk->root, offset, errp); } static void blk_pdiscard_entry(void *opaque) |