From patchwork Mon Apr 22 02:07:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 238281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 974EF2C0113 for ; Mon, 22 Apr 2013 12:11:15 +1000 (EST) Received: from localhost ([::1]:54825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UU6Dp-0005mb-Ou for incoming@patchwork.ozlabs.org; Sun, 21 Apr 2013 22:11:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UU6B9-0001YY-Pe for qemu-devel@nongnu.org; Sun, 21 Apr 2013 22:08:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UU6B7-0006PX-BS for qemu-devel@nongnu.org; Sun, 21 Apr 2013 22:08:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UU6B7-0006PM-4s for qemu-devel@nongnu.org; Sun, 21 Apr 2013 22:08:25 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3M28O8B031149 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 21 Apr 2013 22:08:24 -0400 Received: from localhost.localdomain.com ([10.66.7.14]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3M28COu022349; Sun, 21 Apr 2013 22:08:22 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2013 10:07:58 +0800 Message-Id: <1366596479-22212-5-git-send-email-famz@redhat.com> In-Reply-To: <1366596479-22212-1-git-send-email-famz@redhat.com> References: <1366596479-22212-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, Fam Zheng , stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2 4/5] vmdk: change magic number to macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Two hard coded flag bits are changed to macros. Signed-off-by: Fam Zheng --- block/vmdk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/vmdk.c b/block/vmdk.c index d8c6c70..632689b 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -32,6 +32,7 @@ #define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D') #define VMDK4_MAGIC (('K' << 24) | ('D' << 16) | ('M' << 8) | 'V') #define VMDK4_COMPRESSION_DEFLATE 1 +#define VMDK4_FLAG_NL_DETECT (1 << 0) #define VMDK4_FLAG_RGD (1 << 1) /* Zeroed-grain enable bit */ #define VMDK4_FLAG_ZERO_GRAIN (1 << 2) @@ -1287,7 +1288,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, magic = cpu_to_be32(VMDK4_MAGIC); memset(&header, 0, sizeof(header)); header.version = zeroed_grain ? 2 : 1; - header.flags = 3 + header.flags = VMDK4_FLAG_RGD | VMDK4_FLAG_NL_DETECT | (compress ? VMDK4_FLAG_COMPRESS | VMDK4_FLAG_MARKER : 0) | (zeroed_grain ? VMDK4_FLAG_ZG : 0); header.compressAlgorithm = compress ? VMDK4_COMPRESSION_DEFLATE : 0;