block: Move guest_block_size into BlockBackend

guest_block_size is a guest device property so it should be moved into
the interface between block layer and guest devices, which is the
BlockBackend.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Max Reitz 2015-10-19 17:53:19 +02:00 committed by Kevin Wolf
parent 4981bdec0d
commit 68e9ec017b
4 changed files with 5 additions and 13 deletions

View file

@ -31,6 +31,9 @@ struct BlockBackend {
/* TODO change to DeviceState when all users are qdevified */
const BlockDevOps *dev_ops;
void *dev_opaque;
/* the block size for which the guest device expects atomicity */
int guest_block_size;
};
typedef struct BlockBackendAIOCB {
@ -351,7 +354,7 @@ void blk_detach_dev(BlockBackend *blk, void *dev)
blk->dev = NULL;
blk->dev_ops = NULL;
blk->dev_opaque = NULL;
bdrv_set_guest_block_size(blk->bs, 512);
blk->guest_block_size = 512;
blk_unref(blk);
}
@ -806,7 +809,7 @@ int blk_get_max_transfer_length(BlockBackend *blk)
void blk_set_guest_block_size(BlockBackend *blk, int align)
{
bdrv_set_guest_block_size(blk->bs, align);
blk->guest_block_size = align;
}
void *blk_blockalign(BlockBackend *blk, size_t size)