From patchwork Wed Apr 24 12:44:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 239192 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 109652C00BA for ; Wed, 24 Apr 2013 22:46:51 +1000 (EST) Received: from localhost ([::1]:45407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUz61-0005DI-9V for incoming@patchwork.ozlabs.org; Wed, 24 Apr 2013 08:46:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUz4C-0002np-QM for qemu-devel@nongnu.org; Wed, 24 Apr 2013 08:44:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUz49-0006vt-QW for qemu-devel@nongnu.org; Wed, 24 Apr 2013 08:44:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUz49-0006vn-JV for qemu-devel@nongnu.org; Wed, 24 Apr 2013 08:44:53 -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 r3OCiqd9021458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Apr 2013 08:44:53 -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 r3OCieWH012945; Wed, 24 Apr 2013 08:44:51 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Wed, 24 Apr 2013 20:44:33 +0800 Message-Id: <1366807475-26350-5-git-send-email-famz@redhat.com> In-Reply-To: <1366807475-26350-1-git-send-email-famz@redhat.com> References: <1366807475-26350-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 Subject: [Qemu-devel] [PATCH v3 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;