qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 02/18] qapi-types.py: Implement 'base' for union


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 02/18] qapi-types.py: Implement 'base' for unions
Date: Thu, 29 Aug 2013 18:50:03 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 29.08.2013 um 18:33 hat Luiz Capitulino geschrieben:
> On Thu, 29 Aug 2013 18:06:50 +0200
> Kevin Wolf <address@hidden> wrote:
> 
> > Am 29.08.2013 um 15:52 hat Luiz Capitulino geschrieben:
> > > On Tue, 27 Aug 2013 17:58:59 +0200
> > > Kevin Wolf <address@hidden> wrote:
> > > 
> > > > Am 21.08.2013 um 05:38 hat Amos Kong geschrieben:
> > > > > On Tue, Jul 23, 2013 at 03:03:10PM +0200, Kevin Wolf wrote:
> > > > > > The new 'base' key in a union definition refers to a struct type, 
> > > > > > which
> > > > > > is inlined into the union definition and can represent fields 
> > > > > > common to
> > > > > > all kinds.
> > > > > > 
> > > > > > For example the following schema definition...
> > > > > > 
> > > > > >     { 'type': 'BlockOptionsBase', 'data': { 'read-only': 'bool' } }
> > > > > > 
> > > > > >     { 'union': 'BlockOptions',
> > > > > >       'base': 'BlockOptionsBase',
> > > > > >       'data': {
> > > > > >           'raw': 'BlockOptionsRaw'
> > > > > >           'qcow2': 'BlockOptionsQcow2'
> > > > > >       } }
> > > > > > 
> > > > > > ...would result in this generated C struct:
> > > > > > 
> > > > > >     struct BlockOptions
> > > > > >     {
> > > > > >         BlockOptionsKind kind;
> > > > > >         union {
> > > > > >             void *data;
> > > > > >             BlockOptionsRaw * raw;
> > > > > >             BlockOptionsQcow2 * qcow2;
> > > > > >         };
> > > > > >         bool read_only;
> > > > > >     };
> > > > > > 
> > > > > > Signed-off-by: Kevin Wolf <address@hidden>

> > > > > > @@ -176,6 +181,13 @@ struct %(name)s
> > > > > >  
> > > > > >      ret += mcgen('''
> > > > > >      };
> > > > > > +''')
> > > > > > +
> > > > > > +    if base:
> > > > > > +        struct = find_struct(base)
> > > > > > +        ret += generate_struct_fields(struct['data'])
> > > > > 
> > > > > 
> > > > > generate_struct_fields() doesn't exist in upstream.
> > > > > 
> > > > > [qemu-upstream]$ grep generate_struct_fields -r *
> > > > > scripts/qapi-types.py:        ret += 
> > > > > generate_struct_fields(struct['data'])
> > > > > [qemu-upstream]$
> > > > 
> > > > Yup, something went wrong while applying the series, that patch was
> > > > simply dropped (and interestingly it didn't result in any conflicts or
> > > > compile errors). I'll include it in my next pull request.
> > > 
> > > Strange, it appears on your pull request... But anyway, your series
> > > made it into 1.6.0, so I think we'll need the missing patch in 1.6.1 too?
> > 
> > There's no user in 1.6 (or would we have a build failure) because I
> > didn't merge blockdev-add, so I guess it doesn't matter.
> 
> I won't say it's a huge deal, but any downstreamers basing on 1.6 will
> have a hard time if they backport blockdev-add or any future command
> that my depend on this.

About as hard as with any other dependency. But I won't oppose any
request to include it in a stable release, adding a missing function
that is called is clearly a bug fix.

Kevin



reply via email to

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