[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/22] block: add bdrv_find_backing_image
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 14/22] block: add bdrv_find_backing_image |
Date: |
Thu, 26 Jan 2012 17:38:08 +0100 |
From: Marcelo Tosatti <address@hidden>
Add bdrv_find_backing_image: given a BlockDriverState pointer, and an id,
traverse the backing image chain to locate the id.
Signed-off-by: Marcelo Tosatti <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 18 ++++++++++++++++++
block.h | 2 ++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 2baac95..3621d11 100644
--- a/block.c
+++ b/block.c
@@ -2595,6 +2595,24 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs,
return -ENOTSUP;
}
+BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs,
+ const char *backing_file)
+{
+ if (!bs->drv) {
+ return NULL;
+ }
+
+ if (bs->backing_hd) {
+ if (strcmp(bs->backing_file, backing_file) == 0) {
+ return bs->backing_hd;
+ } else {
+ return bdrv_find_backing_image(bs->backing_hd, backing_file);
+ }
+ }
+
+ return NULL;
+}
+
#define NB_SUFFIXES 4
char *get_human_readable_size(char *buf, int buf_size, int64_t size)
diff --git a/block.h b/block.h
index a3b0b80..cae289b 100644
--- a/block.h
+++ b/block.h
@@ -148,6 +148,8 @@ int coroutine_fn bdrv_co_writev(BlockDriverState *bs,
int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov);
int coroutine_fn bdrv_co_is_allocated(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, int *pnum);
+BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs,
+ const char *backing_file);
int bdrv_truncate(BlockDriverState *bs, int64_t offset);
int64_t bdrv_getlength(BlockDriverState *bs);
int64_t bdrv_get_allocated_file_size(BlockDriverState *bs);
--
1.7.6.5
- [Qemu-devel] [PATCH 08/22] block: rate-limit streaming operations, (continued)
- [Qemu-devel] [PATCH 08/22] block: rate-limit streaming operations, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 06/22] block: add BlockJob interface for long-running operations, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 12/22] qmp: add query-block-jobs, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 07/22] block: add image streaming block job, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 15/22] add QERR_BASE_NOT_FOUND, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 11/22] qmp: add block_job_cancel command, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 19/22] block/vdi: Zero unused parts when allocating a new block (fix #919242), Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 13/22] blockdev: make image streaming safe across hotplug, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 18/22] virtio-blk: add virtio_blk_handle_read trace event, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 17/22] docs: describe live block operations, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 14/22] block: add bdrv_find_backing_image,
Kevin Wolf <=
- [Qemu-devel] [PATCH 21/22] qcow: Use bdrv functions to replace file operation, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 20/22] qcow: Return real error code in qcow_open, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 16/22] block: add support for partial streaming, Kevin Wolf, 2012/01/26
- [Qemu-devel] [PATCH 22/22] scsi: Guard against buflen exceeding req->cmd.xfer in scsi_disk_emulate_command, Kevin Wolf, 2012/01/26
- Re: [Qemu-devel] [PULL 00/22] Block patches, Anthony Liguori, 2012/01/27