[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 22/24] qemu-io: make map command use new block mapping
From: |
Devin Nakamura |
Subject: |
[Qemu-devel] [RFC 22/24] qemu-io: make map command use new block mapping function |
Date: |
Fri, 29 Jul 2011 00:49:52 -0400 |
bdrv_get_mapping will be used when it is defined,
otherwise default to old behaviour.
Signed-off-by: Devin Nakamura <address@hidden>
---
qemu-io.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index a553d0c..caf51fe 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1543,7 +1543,7 @@ static const cmdinfo_t alloc_cmd = {
.oneline = "checks if a sector is present in the file",
};
-static int map_f(int argc, char **argv)
+static int map_f_old(int argc, char **argv)
{
int64_t offset;
int64_t nb_sectors;
@@ -1570,6 +1570,27 @@ static int map_f(int argc, char **argv)
return 0;
}
+static int map_f(int argc, char **argv)
+{
+ uint64_t host_offset, guest_offset, count;
+ int ret;
+
+ if (!bs->drv->bdrv_get_mapping) {
+ return map_f_old(argc, argv);
+ }
+
+ guest_offset = count = 0;
+ printf(" Guest Offset - Host Offset - Count\n");
+ do {
+ ret = bdrv_get_mapping(bs, &guest_offset, &host_offset, &count);
+ if (count) {
+ printf("%016lx - %016lx - %016lx\n", guest_offset, host_offset,
+ count);
+ }
+ } while (!ret && count > 0);
+ return ret;
+}
+
static const cmdinfo_t map_cmd = {
.name = "map",
.argmin = 0,
--
1.7.6.rc1
- [Qemu-devel] [RFC 12/24] qed: add bdrv_qed_copy_header(), (continued)
- [Qemu-devel] [RFC 12/24] qed: add bdrv_qed_copy_header(), Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 15/24] qcow2: split up the creation of new refcount table from the act of checking it, Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 14/24] qcow2: fix typo in documentation for qcow2_get_cluster_offset(), Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 16/24] qcow2: add qcow2_drop_leaked_clusters(), Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 17/24] qcow2: add qcow2_get_mapping, Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 18/24] qcow2: add qcow2_map, Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 19/24] qcow2: add qcow2_copy_header(), Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 21/24] qcow2: add qcow2_open_conversion_target(), Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 23/24] qemu-io: add setmap command, Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 24/24] qemu-img: add inplace conversion to qemu-img, Devin Nakamura, 2011/07/29
- [Qemu-devel] [RFC 22/24] qemu-io: make map command use new block mapping function,
Devin Nakamura <=
- [Qemu-devel] [RFC 20/24] qcow2: add get_conversion_options(), Devin Nakamura, 2011/07/29