[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/30] block: helper function, to find the base imag
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 11/30] block: helper function, to find the base image of a chain |
Date: |
Fri, 28 Sep 2012 19:56:54 +0200 |
From: Jeff Cody <address@hidden>
This is a simple helper function, that will return the base image
of a given image chain.
Signed-off-by: Jeff Cody <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 16 ++++++++++++++++
block.h | 1 +
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 54209a5..d7a6d14 100644
--- a/block.c
+++ b/block.c
@@ -3117,6 +3117,22 @@ int bdrv_get_backing_file_depth(BlockDriverState *bs)
return 1 + bdrv_get_backing_file_depth(bs->backing_hd);
}
+BlockDriverState *bdrv_find_base(BlockDriverState *bs)
+{
+ BlockDriverState *curr_bs = NULL;
+
+ if (!bs) {
+ return NULL;
+ }
+
+ curr_bs = bs;
+
+ while (curr_bs->backing_hd) {
+ curr_bs = curr_bs->backing_hd;
+ }
+ return curr_bs;
+}
+
#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 8c9b424..e9249c4 100644
--- a/block.h
+++ b/block.h
@@ -207,6 +207,7 @@ int bdrv_drop_intermediate(BlockDriverState *active,
BlockDriverState *top,
BlockDriverState *base);
BlockDriverState *bdrv_find_overlay(BlockDriverState *active,
BlockDriverState *bs);
+BlockDriverState *bdrv_find_base(BlockDriverState *bs);
typedef struct BdrvCheckResult {
--
1.7.6.5
- [Qemu-devel] [PULL 00/30] Block patches, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 02/30] block: after creating a live snapshot, make old image read-only, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 01/30] block-migration: Flush requests in blk_mig_cleanup, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 03/30] aio: Fix qemu_aio_wait() to maintain correct walking_handlers count, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 06/30] configure: Add a config option for GlusterFS as block backend, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 07/30] block: Support GlusterFS as a QEMU block backend., Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 05/30] aio: Another fix to the walking_handlers logic, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 10/30] blockdev: rename block_stream_cb to a generic block_job_cb, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 09/30] block: add live block commit functionality, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 11/30] block: helper function, to find the base image of a chain,
Kevin Wolf <=
- [Qemu-devel] [PATCH 08/30] block: add support functions for live commit, to find and delete images., Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 04/30] qemu: URI parsing library, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 12/30] QAPI: add command for live block commit, 'block-commit', Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 13/30] qemu-iotests: add initial tests for live block commit, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 14/30] qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 15/30] block: fix documentation of block_job_cancel_sync, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 17/30] block: add block_job_query, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 18/30] qmp: add 'busy' member to BlockJobInfo, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 16/30] block: move job APIs to separate files, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 19/30] block: add support for job pause/resume, Kevin Wolf, 2012/09/28