[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 07/19] vpc, vhdx: add get_info
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v3 07/19] vpc, vhdx: add get_info |
Date: |
Fri, 22 Nov 2013 13:39:49 +0100 |
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/vhdx.c | 10 ++++++++++
block/vpc.c | 14 ++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/block/vhdx.c b/block/vhdx.c
index 7d1af96..ed6fa53 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1043,6 +1043,15 @@ static void vhdx_block_translate(BDRVVHDXState *s,
int64_t sector_num,
}
+static int vhdx_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+ BDRVVHDXState *s = bs->opaque;
+
+ bdi->cluster_size = s->block_size;
+
+ return 0;
+}
+
static coroutine_fn int vhdx_co_readv(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov)
@@ -1885,6 +1894,7 @@ static BlockDriver bdrv_vhdx = {
.bdrv_co_readv = vhdx_co_readv,
.bdrv_co_writev = vhdx_co_writev,
.bdrv_create = vhdx_create,
+ .bdrv_get_info = vhdx_get_info,
.create_options = vhdx_create_options,
};
diff --git a/block/vpc.c b/block/vpc.c
index 577cc45..551876f 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -455,6 +455,18 @@ fail:
return -1;
}
+static int vpc_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+ BDRVVPCState *s = (BDRVVPCState *)bs->opaque;
+ VHDFooter *footer = (VHDFooter *) s->footer_buf;
+
+ if (cpu_to_be32(footer->type) != VHD_FIXED) {
+ bdi->cluster_size = s->block_size;
+ }
+
+ return 0;
+}
+
static int vpc_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors)
{
@@ -857,6 +869,8 @@ static BlockDriver bdrv_vpc = {
.bdrv_read = vpc_co_read,
.bdrv_write = vpc_co_write,
+ .bdrv_get_info = vpc_get_info,
+
.create_options = vpc_create_options,
.bdrv_has_zero_init = vpc_has_zero_init,
};
--
1.8.4.2
- Re: [Qemu-devel] [PATCH v3 01/19] block: generalize BlockLimits handling to cover bdrv_aio_discard too, (continued)
- [Qemu-devel] [PATCH v3 02/19] block: add flags to BlockRequest, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 03/19] block: add flags argument to bdrv_co_write_zeroes tracepoint, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 04/19] block: add bdrv_aio_write_zeroes, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 05/19] block: handle ENOTSUP from discard in generic code, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 07/19] vpc, vhdx: add get_info,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v3 09/19] block drivers: expose requirement for write same alignment from formats, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 08/19] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 10/19] block/iscsi: remove .bdrv_has_zero_init, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 06/19] block: make bdrv_co_do_write_zeroes stricter in producing aligned requests, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 11/19] block/iscsi: updated copyright, Paolo Bonzini, 2013/11/22
- [Qemu-devel] [PATCH v3 12/19] block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP, Paolo Bonzini, 2013/11/22