qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-1.4] qapi: Improve chardev-add documentation


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH for-1.4] qapi: Improve chardev-add documentation
Date: Tue, 12 Feb 2013 17:56:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Gerd Hoffmann <address@hidden> writes:

>   Hi,
>
>> But why nested discriminators?
>> 
>>     regular files: type=file
>>     serial       : type=port, data.type=serial
>>     parallel     : type=port, data.type=parallel
>> 
>> Simpler, and closer to existing -chardev:
>> 
>>     regular files: type=file
>>     serial       : type=serial
>>     parallel     : type=parallel
>
> Matter of taste IMHO.
> I can live with that too.
> Feel free to send patches.
>
>> I also dislike the pointless '"data" : {}' required by type pty and
>> null, but I can't figure out how to express 'void' in the schema.
>
> Someone mentioned it is possible to leave out empty data altogether.
> Didn't try whenever our marshaller actually accepts that though.

Looks like it doesn't :(

Empty objects work fine here:

    { 'type': 'ChardevDummy', 'data': { } }

Generates the obvious

    struct ChardevDummy
    {
    };

They don't work here:

    { 'union': 'ChardevBackend', 'data': { 'file'   : 'ChardevFile',
                                           'hostdev': 'ChardevHostdev',
                                           'socket' : 'ChardevSocket',
                                           'pty'    : 'ChardevDummy',
                                           'null'   : {} } }

Generates

    struct ChardevBackend
    {
        ChardevBackendKind kind;
        union {
            void *data;
            ChardevFile * file;
            ChardevHostdev * hostdev;
            ChardevSocket * socket;
            ChardevDummy * pty;
            void null;
        };
    };

which is kind of cute, but the compiler doesn't like it.

Anthony, Mike, is this a bug?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]