From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbNBX-0003D1-8L for qemu-devel@nongnu.org; Mon, 27 Jun 2011 21:33:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbNBV-0004Ou-8f for qemu-devel@nongnu.org; Mon, 27 Jun 2011 21:33:51 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:37108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbNBU-0004Jh-W4 for qemu-devel@nongnu.org; Mon, 27 Jun 2011 21:33:49 -0400 Received: by mail-iy0-f173.google.com with SMTP id 3so5589872iyb.4 for ; Mon, 27 Jun 2011 18:33:48 -0700 (PDT) From: Fam Zheng Date: Tue, 28 Jun 2011 09:32:52 +0800 Message-Id: <1309224777-31024-8-git-send-email-famcool@gmail.com> In-Reply-To: <1309224777-31024-1-git-send-email-famcool@gmail.com> References: <1309224777-31024-1-git-send-email-famcool@gmail.com> Subject: [Qemu-devel] [PATCH v5 07/12] VMDK: move 'static' cid_update flag to bs field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, Fam Zheng , hch@lst.de, stefanha@gmail.com Cid_update is the flag for updating CID on first write after opening the image. This should be per image open rather than per program life cycle, so change it from static var of vmdk_write to a field in BDRVVmdkState. Signed-off-by: Fam Zheng --- block/vmdk.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index cf7370f..10a8a9a 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -82,6 +82,7 @@ typedef struct VmdkExtent { typedef struct BDRVVmdkState { int desc_offset; + bool cid_updated; int num_extents; uint32_t parent_cid; VmdkExtent *extents; @@ -857,7 +858,6 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, int n; int64_t index_in_cluster; uint64_t cluster_offset; - static int cid_update = 0; VmdkMetaData m_data; if (sector_num > bs->total_sectors) { @@ -904,9 +904,9 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, buf += n * 512; // update CID on the first write every time the virtual disk is opened - if (!cid_update) { + if (!s->cid_updated) { vmdk_write_cid(bs, time(NULL)); - cid_update++; + s->cid_updated = true; } } return 0;