>From 1ccf1940e0b45a9001b916bc6160c03a098a5d1d Mon Sep 17 00:00:00 2001 From: Uri Lublin Date: Wed, 11 Mar 2009 20:16:23 +0200 Subject: [PATCH] block: pass BDRV_BACKING flag to backing-file open With this information, open can behave differently for the image filename and its backing files. Signed-off-by: Uri Lublin --- qemu/block.c | 3 ++- qemu/block.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/qemu/block.c b/qemu/block.c index 4c556ec..45fa5f4 100644 --- a/qemu/block.c +++ b/qemu/block.c @@ -397,7 +397,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, /* Note: for compatibility, we open disk image files as RDWR, and RDONLY as fallback */ if (!(flags & BDRV_O_FILE)) - open_flags = BDRV_O_RDWR | (flags & BDRV_O_CACHE_MASK); + open_flags = BDRV_O_RDWR | (flags & (BDRV_O_CACHE_MASK | BDRV_O_BACKING)); else open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); ret = drv->bdrv_open(bs, filename, open_flags); @@ -429,6 +429,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, } path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); + open_flags |= BDRV_O_BACKING; if (bdrv_open(bs->backing_hd, backing_filename, open_flags) < 0) goto fail; } diff --git a/qemu/block.h b/qemu/block.h index e1927dd..ff70d64 100644 --- a/qemu/block.h +++ b/qemu/block.h @@ -56,6 +56,8 @@ typedef struct QEMUSnapshotInfo { #define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_CACHE_DEF) +#define BDRV_O_BACKING 0x0100 + void bdrv_info(void); void bdrv_info_stats(void); -- 1.6.0.6