From patchwork Wed Apr 20 22:27:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Karhunen X-Patchwork-Id: 8895541 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE0329F441 for ; Thu, 21 Apr 2016 00:11:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31090202EC for ; Thu, 21 Apr 2016 00:11:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 633742026F for ; Thu, 21 Apr 2016 00:11:33 +0000 (UTC) Received: from localhost ([::1]:58948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at2DU-00018Z-PC for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Apr 2016 20:11:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at0bn-0006zI-7D for qemu-devel@nongnu.org; Wed, 20 Apr 2016 18:28:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1at0bj-0005d7-73 for qemu-devel@nongnu.org; Wed, 20 Apr 2016 18:28:31 -0400 Received: from sesbmg23.ericsson.net ([193.180.251.37]:54409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at0bi-0005d2-T2 for qemu-devel@nongnu.org; Wed, 20 Apr 2016 18:28:27 -0400 X-AuditID: c1b4fb25-f79f26d00000327e-2d-571802898faa Received: from ESESSHC005.ericsson.se (Unknown_Domain [153.88.183.33]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id C1.02.12926.98208175; Thu, 21 Apr 2016 00:28:25 +0200 (CEST) Received: from E7440.dyn.sj.us.am.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.35) with Microsoft SMTP Server id 14.3.248.2; Thu, 21 Apr 2016 00:28:24 +0200 From: Janne Karhunen To: Date: Wed, 20 Apr 2016 15:27:52 -0700 Message-ID: <1461191272-17802-1-git-send-email-Janne.Karhunen@gmail.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprALMWRmVeSWpSXmKPExsUyM2K7om4nk0S4wauPohbzpu5ltzjeu4PF gclj56y77B5Prm1mCmCK4rJJSc3JLEst0rdL4Mp43XOJueCBYkXH5NfsDYz/xbsYOTkkBEwk Jmycywxhi0lcuLeeDcQWEjjCKHFkjn4XIxeQvYtRYuWjBrAEm4C+ROPFRSwgtoiAtET/nHZ2 EJtZIEpi6aweVhBbWMBLYkrLWSYQm0VAVWLVpfVgNq+Ah8SX7p9sEMvkJE4em8wKEReUODnz CQvEHAmJgy9eMEMcoSpxdsEzxgmMfLOQlM1CUraAkWkVo2hxanFSbrqRsV5qUWZycXF+nl5e askmRmA4HdzyW3UH4+U3jocYBTgYlXh4E7rFw4VYE8uKK3MPMUpwMCuJ8Lr/BArxpiRWVqUW 5ccXleakFh9ilOZgURLnzY78FyYkkJ5YkpqdmlqQWgSTZeLglGpgFDYxqp7CeeIQl1eUWSjn s9Rv170iVVl70qNW3u1Wyjnv8bDa7VpO0vuJvVurAn8Fb43puXf9x4Ija2OWpuuLFAYWy1a/ 65eR0NZV4qz1nsRYV3nMWTI9Kvjr7ukzPrMWMe3M0djv5tb7WfCz2DzjjX6+i85eO+kWKZo3 aUf5SS6mtKfqkluUWIozEg21mIuKEwH4+ou3IwIAAA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 193.180.251.37 X-Mailman-Approved-At: Wed, 20 Apr 2016 20:10:35 -0400 Subject: [Qemu-devel] [PATCH] Allow users to specify the vmdk virtual hardware version. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Janne Karhunen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Janne Karhunen Replace hardcoded vmdk description file hardware version flag with a user definable version. Signed-off-by: Janne Karhunen --- block/vmdk.c | 20 ++++++++++---------- include/block/block_int.h | 3 +-- qemu-doc.texi | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 45f9d3c..1436785 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1829,8 +1829,8 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) int64_t total_size = 0, filesize; char *adapter_type = NULL; char *backing_file = NULL; + char *hw_version = NULL; char *fmt = NULL; - int flags = 0; int ret = 0; bool flat, split, compress; GString *ext_desc_lines; @@ -1861,7 +1861,7 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) "# The Disk Data Base\n" "#DDB\n" "\n" - "ddb.virtualHWVersion = \"%d\"\n" + "ddb.virtualHWVersion = \"%s\"\n" "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"%" PRIu32 "\"\n" "ddb.geometry.sectors = \"63\"\n" @@ -1878,9 +1878,8 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) BDRV_SECTOR_SIZE); adapter_type = qemu_opt_get_del(opts, BLOCK_OPT_ADAPTER_TYPE); backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); - if (qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false)) { - flags |= BLOCK_FLAG_COMPAT6; - } + hw_version = qemu_opt_get_del(opts, BLOCK_OPT_HWVERSION); + fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT); if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false)) { zeroed_grain = true; @@ -2001,7 +2000,7 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) fmt, parent_desc_line, ext_desc_lines->str, - (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), + hw_version, total_size / (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE), number_heads, @@ -2047,6 +2046,7 @@ exit: } g_free(adapter_type); g_free(backing_file); + g_free(hw_version); g_free(fmt); g_free(desc); g_free(path); @@ -2292,10 +2292,10 @@ static QemuOptsList vmdk_create_opts = { .help = "File name of a base image" }, { - .name = BLOCK_OPT_COMPAT6, - .type = QEMU_OPT_BOOL, - .help = "VMDK version 6 image", - .def_value_str = "off" + .name = BLOCK_OPT_HWVERSION, + .type = QEMU_OPT_STRING, + .help = "VMDK hardware version", + .def_value_str = "4" }, { .name = BLOCK_OPT_SUBFMT, diff --git a/include/block/block_int.h b/include/block/block_int.h index 10d8759..0852316 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -38,12 +38,11 @@ #include "qemu/throttle.h" #define BLOCK_FLAG_ENCRYPT 1 -#define BLOCK_FLAG_COMPAT6 4 #define BLOCK_FLAG_LAZY_REFCOUNTS 8 #define BLOCK_OPT_SIZE "size" #define BLOCK_OPT_ENCRYPT "encryption" -#define BLOCK_OPT_COMPAT6 "compat6" +#define BLOCK_OPT_HWVERSION "hwversion" #define BLOCK_OPT_BACKING_FILE "backing_file" #define BLOCK_OPT_BACKING_FMT "backing_fmt" #define BLOCK_OPT_CLUSTER_SIZE "cluster_size" diff --git a/qemu-doc.texi b/qemu-doc.texi index 79141d3..79f4168 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -691,8 +691,8 @@ Supported options: @table @code @item backing_file File name of a base image (see @option{create} subcommand). -@item compat6 -Create a VMDK version 6 image (instead of version 4) +@item hwversion +Specify vmdk hardware version (default 4) @item subformat Specifies which VMDK subformat to use. Valid options are @code{monolithicSparse} (default),