qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Issues around TYPE_INTERFACE


From: Daniel P . Berrangé
Subject: Re: [Qemu-devel] Issues around TYPE_INTERFACE
Date: Mon, 18 Mar 2019 13:17:14 +0000
User-agent: Mutt/1.11.3 (2019-02-01)

On Mon, Mar 18, 2019 at 01:53:38PM +0100, Markus Armbruster wrote:
> Daniel P. Berrangé <address@hidden> writes:
> 
> >>                                      For instance if I
> >> see a PROP_LINK that wants a TYPE_IDAU_INTERFACE I know
> >> I need to implement an interface on some suitable object,
> >> whereas if it were a TYPE_IDAU I'd be expecting to need
> >> to create (or write a subclass of) a concrete object.
> >> So I'd prefer us to settle on a convention that does
> >> explicitly mark the interface-ness in the type name.
> >
> > If we do want such a naming convention, then I think we'd want to have
> > checkpatch enforce it. eg in the .c file validate the TypeInfo struct:
> >
> >     static const TypeInfo acpi_dev_if_info = {
> >         .name          = TYPE_ACPI_DEVICE_IF,
> >         .parent        = TYPE_INTERFACE,
> >         .class_size = sizeof(AcpiDeviceIfClass),
> >     };
> >
> > If '.parent'  is a TYPE_INTERFACE, or another type ending in _IF, then
> > enforce the .name also ends in _IF  (or whatever name convention we
> > pick)
> 
> Very nice to have.
> 
> In case teaching it to checkpatch turns out to be too onerous: perhaps
> certain things would be easier to check in a program that looks at
> sources rather than patches.  Other projects have that as "make
> syntax-check".

FWIW, I think most of what qemu's checkpatch does would be better
as checks against the source tree. The big pain with checkpatch
is that it never enforces that we clean up existing code. So any
time we introduce a new rule, it usually means that we end up having
2 different styles in the code forever.

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 :|



reply via email to

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