[RFC] qemu: convert DomainLogContext class to use GObject

Daniel P. Berrangé berrange at redhat.com
Tue Mar 10 12:53:59 UTC 2020


On Tue, Mar 10, 2020 at 01:48:39PM +0100, Peter Krempa wrote:
> On Tue, Mar 10, 2020 at 12:42:47 +0000, Daniel Berrange wrote:
> > On Tue, Mar 10, 2020 at 01:33:42PM +0100, Peter Krempa wrote:
> > > On Tue, Mar 10, 2020 at 17:30:01 +0530, Gaurav Agrawal wrote:
> > > > ---
> > > >  src/qemu/qemu_domain.c  | 36 ++++++++++++++++++++----------------
> > > >  src/qemu/qemu_domain.h  |  6 ++++--
> > > >  src/qemu/qemu_process.c |  4 ++--
> > > >  3 files changed, 26 insertions(+), 20 deletions(-)
> > > > 
> > > > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > > > index 3d3f796d85..0d2edf4dbe 100644
> > > > --- a/src/qemu/qemu_domain.c
> > > > +++ b/src/qemu/qemu_domain.c
> > > > @@ -150,7 +150,7 @@ qemuDomainObjFromDomain(virDomainPtr domain)
> > > 
> > > [...]
> > > 
> > > >  static int
> > > >  qemuDomainOnceInit(void)
> > > >  {
> > > > -    if (!VIR_CLASS_NEW(qemuDomainLogContext, virClassForObject()))
> > > > -        return -1;
> > > > -
> > > >      if (!VIR_CLASS_NEW(qemuDomainSaveCookie, virClassForObject()))
> > > >          return -1;
> > > >  
> > > >      return 0;
> > > >  }
> > > >  
> > > > +static void qemu_domain_log_context_init(qemuDomainLogContext *logctxt G_GNUC_UNUSED)
> > > > +{
> > > > +}
> > > 
> > > There's no reason to break coding style rules in this kind of refactor
> > > nor to make it inconsistent in span of 20 lines.
> > 
> > If you're refering to the use of underscores, then this is expected
> > and indeed required because these method names are auto-generated
> > by the GObject macros. This should only be the case for three
> > specific methods (_init, _class_init and _get_type), with the rest
> > all following normal style. See the virIdentity conversion for
> > the prior example of this.
> 
> Yeah, I meant mainly that (also the newline after the type).
> 
> Can't we at least keep camel-case for the type itself?
> 
> 'qemuDomainLogContext_init'
> 
> That way at least looking for the symbol name will be less painful.

We had considered that in the original virIdentity conversion, but
decided mixing two different naming styles in one identifier was
even more ugly.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list