yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From ecaad218fdda71c1f64f557b3dff6a09a425b084 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <ecaad218fdda71c1f64f557b3dff6a09a425b084.1389014116.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
0a122b
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
0a122b
From: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Date: Mon, 9 Dec 2013 14:09:17 +0100
0a122b
Subject: [PATCH 29/50] vpc, vhdx: add get_info
0a122b
0a122b
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Message-id: <1386598178-11845-32-git-send-email-pbonzini@redhat.com>
0a122b
Patchwork-id: 56068
0a122b
O-Subject: [RHEL 7.0 qemu-kvm PATCH 31/52] vpc, vhdx: add get_info
0a122b
Bugzilla: 1007815
0a122b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Reviewed-by: Peter Lieven <pl@kamp.de>
0a122b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
(cherry picked from commit 97b00e285119e611f500686f32f9bccffbb9126a)
0a122b
0a122b
Conflicts:
0a122b
	block/vhdx.c [BlockDriver members]
0a122b
	block/vpc.c [VHDFooter vs. struct vhd_footer, BlockDriver members]
0a122b
---
0a122b
 block/vhdx.c | 10 ++++++++++
0a122b
 block/vpc.c  | 13 +++++++++++++
0a122b
 2 files changed, 23 insertions(+)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 block/vhdx.c | 10 ++++++++++
0a122b
 block/vpc.c  | 13 +++++++++++++
0a122b
 2 files changed, 23 insertions(+)
0a122b
0a122b
diff --git a/block/vhdx.c b/block/vhdx.c
0a122b
index 6cb0412..7285b95 100644
0a122b
--- a/block/vhdx.c
0a122b
+++ b/block/vhdx.c
0a122b
@@ -878,6 +878,15 @@ static void vhdx_block_translate(BDRVVHDXState *s, int64_t sector_num,
0a122b
 }
0a122b
 
0a122b
 
0a122b
+static int vhdx_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
0a122b
+{
0a122b
+    BDRVVHDXState *s = bs->opaque;
0a122b
+
0a122b
+    bdi->cluster_size = s->block_size;
0a122b
+
0a122b
+    return 0;
0a122b
+}
0a122b
+
0a122b
 
0a122b
 static coroutine_fn int vhdx_co_readv(BlockDriverState *bs, int64_t sector_num,
0a122b
                                       int nb_sectors, QEMUIOVector *qiov)
0a122b
@@ -973,6 +982,7 @@ static BlockDriver bdrv_vhdx = {
0a122b
     .bdrv_reopen_prepare    = vhdx_reopen_prepare,
0a122b
     .bdrv_co_readv          = vhdx_co_readv,
0a122b
     .bdrv_co_writev         = vhdx_co_writev,
0a122b
+    .bdrv_get_info          = vhdx_get_info,
0a122b
 };
0a122b
 
0a122b
 static void bdrv_vhdx_init(void)
0a122b
diff --git a/block/vpc.c b/block/vpc.c
0a122b
index 5d65756..49520c1 100644
0a122b
--- a/block/vpc.c
0a122b
+++ b/block/vpc.c
0a122b
@@ -439,6 +439,18 @@ fail:
0a122b
     return -1;
0a122b
 }
0a122b
 
0a122b
+static int vpc_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
0a122b
+{
0a122b
+    BDRVVPCState *s = (BDRVVPCState *)bs->opaque;
0a122b
+    struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf;
0a122b
+
0a122b
+    if (cpu_to_be32(footer->type) != VHD_FIXED) {
0a122b
+        bdi->cluster_size = s->block_size;
0a122b
+    }
0a122b
+
0a122b
+    return 0;
0a122b
+}
0a122b
+
0a122b
 static int vpc_read(BlockDriverState *bs, int64_t sector_num,
0a122b
                     uint8_t *buf, int nb_sectors)
0a122b
 {
0a122b
@@ -830,6 +842,7 @@ static BlockDriver bdrv_vpc = {
0a122b
     .bdrv_write             = vpc_co_write,
0a122b
 
0a122b
     .create_options = vpc_create_options,
0a122b
+    .bdrv_get_info  = vpc_get_info,
0a122b
 };
0a122b
 
0a122b
 static void bdrv_vpc_init(void)
0a122b
-- 
0a122b
1.7.11.7
0a122b