qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Chris Wright <chrisw@redhat.com>, Adam Litke <agl@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [RFC] QCFG: a new mechanism to replace QemuOpts and	option handling
Date: Tue, 15 Mar 2011 08:56:58 -0500	[thread overview]
Message-ID: <4D7F702A.2070007@codemonkey.ws> (raw)
In-Reply-To: <4D7F6D91.60605@redhat.com>

On 03/15/2011 08:45 AM, Kevin Wolf wrote:
> Am 15.03.2011 14:27, schrieb Anthony Liguori:
>> On 03/15/2011 05:09 AM, Kevin Wolf wrote:
>>>> 5) Very complex data types can be implemented.  We had some discussion
>>>> of supporting nested structures with -blockdev.  This wouldn't work with
>>>> QemuOpts but I've already implemented it with QCFG (blockdev syntax is
>>>> my test case right now).  The syntax I'm currently using is -blockdev
>>>> cache=none,id=foo,format.qcow.protocol.nbd.hostname=localhost where '.'
>>>> is used to reference sub structures.
>>> Do you have an example from your implementation for this?
>> It's not exhaustive as I'm only using this for testing but here's what
>> I've been working with:
>>
>> { 'type': 'ProbeProtocol', 'data': { 'unsafe': 'bool', 'filename': 'str' } }
>>
>> { 'type': 'FileProtocol', 'data': { 'filename': 'str' } }
>>
>> { 'type': 'HostDeviceProtocol', 'data': { 'device': 'str' } }
>>
>> { 'type': 'NbdProtocol', 'data': { 'hostname': 'str', 'port': 'int' } }
>>
>> { 'union': 'BlockdevProtocol',
>>     'data': { 'probe': 'ProbeProtocol', 'file': 'FileProtocol',
>>               'host-dev': 'HostDeviceProtocol', 'nbd': 'NbdProtocol' } }
> What would this look like in the generated C code? A union of
> differently typed pointers?

Yes:

typedef enum BlockdevFormatKind {
     BFK_PROBE = 0,
     BFK_RAW = 1,
     BFK_QCOW2 = 2,
     BFK_QED = 3,
} BlockdevFormatKind;

typedef struct BlockdevFormat {
     BlockdevFormatKind kind;
     union {
         struct ProbeFormat * probe;
         struct RawFormat * raw;
         struct Qcow2Format * qcow2;
         struct QedFormat * qed;
     };
     struct BlockdevFormat * next;
} BlockdevFormat;

> Are format drivers still contained in a single C file in block/ that is
> enabled just by compiling it in or does the block layer now have to know
> about all available drivers and the options they provide?

Yes, everything is contained within a single file.  In terms of build 
dependencies, it's really just a call about what matters to you.  You 
can have the block open take a BlockdevFormat which means the block 
layer doesn't need to know about specific formats.

Regards,

Anthony Liguori

>>> This is probably the most complex thing you can get, so I think it would
>>> make a better example than a VNC configuration.
>> Yup, that's been what I've been using to prototype all of this.  I
>> didn't it in the mail because it's rather complex :-)
> This is exactly what makes it interesting. :-)
>
> Kevin
>

  reply	other threads:[~2011-03-15 13:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14 17:48 [Qemu-devel] [RFC] QCFG: a new mechanism to replace QemuOpts and option handling Anthony Liguori
2011-03-14 19:52 ` Lluís
2011-03-14 20:04   ` Anthony Liguori
2011-03-15 10:09 ` Kevin Wolf
2011-03-15 13:27   ` Anthony Liguori
2011-03-15 13:45     ` Kevin Wolf
2011-03-15 13:56       ` Anthony Liguori [this message]
2011-03-18 18:12     ` Stefan Hajnoczi
2011-03-15 11:21 ` [Qemu-devel] " Kevin Wolf
2011-03-15 13:37   ` Anthony Liguori
2011-03-15 13:51     ` Kevin Wolf
2011-03-17 15:26       ` Markus Armbruster
2011-03-18  4:12         ` Anthony Liguori
2011-03-18 13:07           ` Markus Armbruster
2011-03-17 15:22 ` [Qemu-devel] " Markus Armbruster
2011-03-17 18:28   ` Anthony Liguori
2011-03-18  9:44     ` Kevin Wolf
2011-03-18 14:04     ` Markus Armbruster
2011-03-18 22:39       ` Anthony Liguori
2011-03-22 13:01         ` Markus Armbruster
2011-03-22 15:49           ` Anthony Liguori
2011-03-24  8:32             ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D7F702A.2070007@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=agl@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=chrisw@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).