From patchwork Thu May 2 02:25:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 240878 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 B6C142C00D4 for ; Thu, 2 May 2013 12:27:00 +1000 (EST) Received: from localhost ([::1]:39672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXjEY-00085D-RZ for incoming@patchwork.ozlabs.org; Wed, 01 May 2013 22:26:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXjDn-0007VK-Vz for qemu-devel@nongnu.org; Wed, 01 May 2013 22:26:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXjDl-0002Xc-NG for qemu-devel@nongnu.org; Wed, 01 May 2013 22:26:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXjDl-0002XY-Fa for qemu-devel@nongnu.org; Wed, 01 May 2013 22:26:09 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r422Q83Z019837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 May 2013 22:26:09 -0400 Received: from localhost.localdomain.com ([10.66.7.14]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r422PaC3029593; Wed, 1 May 2013 22:26:07 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Thu, 2 May 2013 10:25:25 +0800 Message-Id: <1367461527-9789-5-git-send-email-famz@redhat.com> In-Reply-To: <1367461527-9789-1-git-send-email-famz@redhat.com> References: <1367461527-9789-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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 v5 4/6] 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 cc19e20..0463d3b 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_ZERO_GRAIN : 0); header.compressAlgorithm = compress ? VMDK4_COMPRESSION_DEFLATE : 0;