Support getting the guest block size for the block backend. It's needed for the following commit.
Signed-off-by: Xie Yongji <xieyon...@bytedance.com> --- block/block-backend.c | 6 ++++++ include/sysemu/block-backend-io.h | 1 + 2 files changed, 7 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index 35457a6a1d..1582ff81c9 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2106,6 +2106,12 @@ void blk_set_guest_block_size(BlockBackend *blk, int align) blk->guest_block_size = align; } +int blk_get_guest_block_size(BlockBackend *blk) +{ + IO_CODE(); + return blk->guest_block_size; +} + void *blk_try_blockalign(BlockBackend *blk, size_t size) { IO_CODE(); diff --git a/include/sysemu/block-backend-io.h b/include/sysemu/block-backend-io.h index 6517c39295..7600822196 100644 --- a/include/sysemu/block-backend-io.h +++ b/include/sysemu/block-backend-io.h @@ -73,6 +73,7 @@ void blk_iostatus_set_err(BlockBackend *blk, int error); int blk_get_max_iov(BlockBackend *blk); int blk_get_max_hw_iov(BlockBackend *blk); void blk_set_guest_block_size(BlockBackend *blk, int align); +int blk_get_guest_block_size(BlockBackend *blk); void blk_io_plug(BlockBackend *blk); void blk_io_unplug(BlockBackend *blk); -- 2.20.1