From patchwork Fri Apr 19 03:48:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 237833 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 ABFC72C0214 for ; Fri, 19 Apr 2013 13:50:42 +1000 (EST) Received: from localhost ([::1]:33202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT2LQ-0008NX-WA for incoming@patchwork.ozlabs.org; Thu, 18 Apr 2013 23:50:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT2Jx-0006Wg-PV for qemu-devel@nongnu.org; Thu, 18 Apr 2013 23:49:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UT2Jv-0000Zf-CE for qemu-devel@nongnu.org; Thu, 18 Apr 2013 23:49:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT2Jv-0000ZR-5E for qemu-devel@nongnu.org; Thu, 18 Apr 2013 23:49:07 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3J3n5V0020401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 18 Apr 2013 23:49:05 -0400 Received: from localhost.localdomain.com ([10.66.7.14]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3J3mq9n026143; Thu, 18 Apr 2013 23:49:03 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 19 Apr 2013 11:48:44 +0800 Message-Id: <1366343325-5252-5-git-send-email-famz@redhat.com> In-Reply-To: <1366343325-5252-1-git-send-email-famz@redhat.com> References: <1366343325-5252-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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, Feiran Zheng Subject: [Qemu-devel] [PATCH 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 From: Feiran Zheng 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 827b35b..5daa9f2 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_ZG (1 << 2) @@ -1285,7 +1286,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;