qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* RE: [Qemu-devel] [PATCH] Added an option to set the VMDK adapter type
@ 2010-08-04 21:07 Aaron Mason
  0 siblings, 0 replies; 7+ messages in thread
From: Aaron Mason @ 2010-08-04 21:07 UTC (permalink / raw)
  To: Kevin Wolf, andrzej zaborowski; +Cc: qemu-devel

there

sent from my Telstra NEXTG™ handset

-----Original Message-----
From: Kevin Wolf <kwolf@redhat.com>
Sent: Wednesday, 4 August 2010 10:29 PM
To: andrzej zaborowski <balrogg@gmail.com>
Cc: Aaron Mason <aaron.mason@thats-too-much.info>; qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Added an option to set the VMDK adapter type

Am 04.08.2010 14:27, schrieb andrzej zaborowski:
> Hi,
> 
> On 4 August 2010 12:30, Kevin Wolf <kwolf@redhat.com> wrote:
>> Am 04.08.2010 01:46, schrieb Aaron Mason:
>>> +    const char *real_filename, *temp_str, *adapterType = "ide";
> 
> Sorry to complain about style, but note that uppercase characters are
> not used in variable names in Qemu (that I see).

Whoops, missed that one when complaining about the other style problems.
Yes, this should be adapter_type.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <3621879199971178442@unknownmsgid>]
* [Qemu-devel] [PATCH] Added an option to set the VMDK adapter type
@ 2010-08-03 23:46 Aaron Mason
  2010-08-04  7:16 ` Natalia Portillo
  2010-08-04 10:30 ` Kevin Wolf
  0 siblings, 2 replies; 7+ messages in thread
From: Aaron Mason @ 2010-08-03 23:46 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

Hi,

Now that I have half a clue, please find attached a properly formatted
patch for the above with a signed-off line.  Hopefully attaching it
won't cause issues as I have winblows on this machine and can't get
git send-email to work at this time.

Regards

[-- Attachment #2: 0001-Added-an-option-to-set-the-VMDK-adapter-type.patch --]
[-- Type: application/octet-stream, Size: 2956 bytes --]

From 37bed87750573b7ac737c3f2a919b68a06a00513 Mon Sep 17 00:00:00 2001
From: unknown <aaron.mason@.rlpb.org.au>
Date: Wed, 4 Aug 2010 08:41:38 +1000
Subject: [PATCH] Added an option to set the VMDK adapter type

Signed-off-by: Aaron Mason <aaron.mason@thats-too-much.info>
---
 block/vmdk.c |   20 +++++++++++++++++---
 block_int.h  |    1 +
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 2d4ba42..ef7733d 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -686,9 +686,9 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
         "ddb.geometry.cylinders = \"%" PRId64 "\"\n"
         "ddb.geometry.heads = \"16\"\n"
         "ddb.geometry.sectors = \"63\"\n"
-        "ddb.adapterType = \"ide\"\n";
+        "ddb.adapterType = \"%s\"\n";
     char desc[1024];
-    const char *real_filename, *temp_str;
+    const char *real_filename, *temp_str, *adapterType = "ide";
     int64_t total_size = 0;
     const char *backing_file = NULL;
     int flags = 0;
@@ -702,6 +702,15 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
             backing_file = options->value.s;
         } else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) {
             flags |= options->value.n ? BLOCK_FLAG_COMPAT6: 0;
+        } else if (!strcmp(options->name, BLOCK_OPT_ADAPTER)) {
+            if (options->value.s != NULL) {
+                if (!strcmp(options->value.s, "ide") || 
+                    !strcmp(options->value.s, "buslogic") ||
+                    !strcmp(options->value.s, "lsilogic")) {
+                    adapterType = options->value.s;
+                } else
+                    return -1;
+            }
         }
         options++;
     }
@@ -799,7 +808,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
     snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL),
              total_size, real_filename,
              (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4),
-             total_size / (int64_t)(63 * 16));
+             total_size / (int64_t)(63 * 16), adapterType);
 
     /* write the descriptor */
     lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET);
@@ -845,6 +854,11 @@ static QEMUOptionParameter vmdk_create_options[] = {
         .type = OPT_FLAG,
         .help = "VMDK version 6 image"
     },
+    {
+        .name = BLOCK_OPT_ADAPTER,
+        .type = OPT_STRING,
+        .help = "Adapter type - ide (default), lsilogic or buslogic"
+    },
     { NULL }
 };
 
diff --git a/block_int.h b/block_int.h
index 96ff4cf..ec90de0 100644
--- a/block_int.h
+++ b/block_int.h
@@ -39,6 +39,7 @@
 #define BLOCK_OPT_BACKING_FMT   "backing_fmt"
 #define BLOCK_OPT_CLUSTER_SIZE  "cluster_size"
 #define BLOCK_OPT_PREALLOC      "preallocation"
+#define BLOCK_OPT_ADAPTER       "adapter_type"
 
 typedef struct AIOPool {
     void (*cancel)(BlockDriverAIOCB *acb);
-- 
1.7.0.2.msysgit.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-08-06 11:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-04 21:07 [Qemu-devel] [PATCH] Added an option to set the VMDK adapter type Aaron Mason
     [not found] <3621879199971178442@unknownmsgid>
2010-08-06 11:40 ` Aaron Mason
  -- strict thread matches above, loose matches on Subject: below --
2010-08-03 23:46 Aaron Mason
2010-08-04  7:16 ` Natalia Portillo
2010-08-04 10:30 ` Kevin Wolf
2010-08-04 12:27   ` andrzej zaborowski
2010-08-04 12:29     ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).