mbox series

[0/3] qom: Replace INTERFACE_CHECK with OBJECT_CHECK

Message ID 20200916193101.511600-1-ehabkost@redhat.com
Headers show
Series qom: Replace INTERFACE_CHECK with OBJECT_CHECK | expand

Message

Eduardo Habkost Sept. 16, 2020, 7:30 p.m. UTC
This series replaces INTERFACE_CHECK with OBJECT_CHECK because
both macros are exactly the same.

The last patch is a new run of the OBJECT_CHECK ->
DECLARE*_CHECKER* converter script that will convert the former
INTERFACE_CHECK-based macros.

Eduardo Habkost (3):
  qom: Correct object_class_dynamic_cast_assert() documentation
  qom: Replace INTERFACE_CHECK with OBJECT_CHECK
  [automated] Use DECLARE_*CHECKER* macros

 include/hw/acpi/acpi_dev_interface.h |  7 +++----
 include/hw/arm/linux-boot-if.h       |  6 +++---
 include/hw/fw-path-provider.h        |  6 +++---
 include/hw/hotplug.h                 |  6 +++---
 include/hw/intc/intc.h               |  7 +++----
 include/hw/ipmi/ipmi.h               |  6 +++---
 include/hw/isa/isa.h                 |  2 +-
 include/hw/mem/memory-device.h       |  6 +++---
 include/hw/nmi.h                     |  6 +++---
 include/hw/ppc/pnv_xscom.h           |  4 ++--
 include/hw/ppc/spapr_irq.h           |  4 ++--
 include/hw/ppc/xics.h                |  4 ++--
 include/hw/ppc/xive.h                | 12 ++++++------
 include/hw/rdma/rdma.h               |  7 +++----
 include/hw/rtc/m48t59.h              |  6 +++---
 include/hw/stream.h                  |  6 +++---
 include/hw/vmstate-if.h              |  6 +++---
 include/qom/object.h                 | 14 +-------------
 include/qom/object_interfaces.h      |  7 +++----
 include/sysemu/tpm.h                 |  6 +++---
 target/arm/idau.h                    |  6 +++---
 tests/check-qom-interface.c          |  6 +++---
 22 files changed, 62 insertions(+), 78 deletions(-)

-- 
2.26.2

Comments

Marc-André Lureau Sept. 16, 2020, 9:31 p.m. UTC | #1
Hi

On Wed, Sep 16, 2020 at 11:35 PM Eduardo Habkost <ehabkost@redhat.com>
wrote:

> This series replaces INTERFACE_CHECK with OBJECT_CHECK because

> both macros are exactly the same.

>

> The last patch is a new run of the OBJECT_CHECK ->

> DECLARE*_CHECKER* converter script that will convert the former

> INTERFACE_CHECK-based macros.

>

>

Well, at least having a different macro allows to tweak qom implementation
or replace it with something different more easily.

I have some wip branch somewhere where I actually made Interface a
different beast than Object (it was saving some fields, and avoiding some
potentially wrong casts iirc - I didn't bother to upstream that yet). Also
I have a different branch where I played with GObject to replace qom. In
both cases, your proposal would have, or would make, the work more
complicated.


Eduardo Habkost (3):
>   qom: Correct object_class_dynamic_cast_assert() documentation

>   qom: Replace INTERFACE_CHECK with OBJECT_CHECK

>   [automated] Use DECLARE_*CHECKER* macros

>

>  include/hw/acpi/acpi_dev_interface.h |  7 +++----

>  include/hw/arm/linux-boot-if.h       |  6 +++---

>  include/hw/fw-path-provider.h        |  6 +++---

>  include/hw/hotplug.h                 |  6 +++---

>  include/hw/intc/intc.h               |  7 +++----

>  include/hw/ipmi/ipmi.h               |  6 +++---

>  include/hw/isa/isa.h                 |  2 +-

>  include/hw/mem/memory-device.h       |  6 +++---

>  include/hw/nmi.h                     |  6 +++---

>  include/hw/ppc/pnv_xscom.h           |  4 ++--

>  include/hw/ppc/spapr_irq.h           |  4 ++--

>  include/hw/ppc/xics.h                |  4 ++--

>  include/hw/ppc/xive.h                | 12 ++++++------

>  include/hw/rdma/rdma.h               |  7 +++----

>  include/hw/rtc/m48t59.h              |  6 +++---

>  include/hw/stream.h                  |  6 +++---

>  include/hw/vmstate-if.h              |  6 +++---

>  include/qom/object.h                 | 14 +-------------

>  include/qom/object_interfaces.h      |  7 +++----

>  include/sysemu/tpm.h                 |  6 +++---

>  target/arm/idau.h                    |  6 +++---

>  tests/check-qom-interface.c          |  6 +++---

>  22 files changed, 62 insertions(+), 78 deletions(-)

>

> --

> 2.26.2

>

>

>

>


-- 
Marc-André Lureau
<div dir="ltr"><div dir="ltr">Hi<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 16, 2020 at 11:35 PM Eduardo Habkost &lt;<a href="mailto:ehabkost@redhat.com">ehabkost@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This series replaces INTERFACE_CHECK with OBJECT_CHECK because<br>
both macros are exactly the same.<br>
<br>
The last patch is a new run of the OBJECT_CHECK -&gt;<br>
DECLARE*_CHECKER* converter script that will convert the former<br>
INTERFACE_CHECK-based macros.<br>
<br></blockquote><div><br></div><div>Well, at least having a different macro allows to tweak qom implementation or replace it with something different more easily.</div><div><br></div><div>I have some wip branch somewhere where I actually made Interface a different beast than Object (it was saving some fields, and avoiding some potentially wrong casts iirc - I didn&#39;t bother to upstream that yet). Also I have a different branch where I played with GObject to replace qom. In both cases, your proposal would have, or would make, the work more complicated. <br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Eduardo Habkost (3):<br>
  qom: Correct object_class_dynamic_cast_assert() documentation<br>
  qom: Replace INTERFACE_CHECK with OBJECT_CHECK<br>
  [automated] Use DECLARE_*CHECKER* macros<br>
<br>
 include/hw/acpi/acpi_dev_interface.h |  7 +++----<br>
 include/hw/arm/linux-boot-if.h       |  6 +++---<br>
 include/hw/fw-path-provider.h        |  6 +++---<br>
 include/hw/hotplug.h                 |  6 +++---<br>
 include/hw/intc/intc.h               |  7 +++----<br>
 include/hw/ipmi/ipmi.h               |  6 +++---<br>
 include/hw/isa/isa.h                 |  2 +-<br>
 include/hw/mem/memory-device.h       |  6 +++---<br>
 include/hw/nmi.h                     |  6 +++---<br>
 include/hw/ppc/pnv_xscom.h           |  4 ++--<br>
 include/hw/ppc/spapr_irq.h           |  4 ++--<br>
 include/hw/ppc/xics.h                |  4 ++--<br>
 include/hw/ppc/xive.h                | 12 ++++++------<br>
 include/hw/rdma/rdma.h               |  7 +++----<br>
 include/hw/rtc/m48t59.h              |  6 +++---<br>
 include/hw/stream.h                  |  6 +++---<br>
 include/hw/vmstate-if.h              |  6 +++---<br>
 include/qom/object.h                 | 14 +-------------<br>
 include/qom/object_interfaces.h      |  7 +++----<br>
 include/sysemu/tpm.h                 |  6 +++---<br>
 target/arm/idau.h                    |  6 +++---<br>
 tests/check-qom-interface.c          |  6 +++---<br>
 22 files changed, 62 insertions(+), 78 deletions(-)<br>
<br>
-- <br>
2.26.2<br>
<br>
<br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Marc-André Lureau<br></div></div>
Eduardo Habkost Sept. 16, 2020, 10:13 p.m. UTC | #2
On Thu, Sep 17, 2020 at 01:31:50AM +0400, Marc-André Lureau wrote:
> Hi

> 

> On Wed, Sep 16, 2020 at 11:35 PM Eduardo Habkost <ehabkost@redhat.com>

> wrote:

> 

> > This series replaces INTERFACE_CHECK with OBJECT_CHECK because

> > both macros are exactly the same.

> >

> > The last patch is a new run of the OBJECT_CHECK ->

> > DECLARE*_CHECKER* converter script that will convert the former

> > INTERFACE_CHECK-based macros.

> >

> >

> Well, at least having a different macro allows to tweak qom implementation

> or replace it with something different more easily.

> 

> I have some wip branch somewhere where I actually made Interface a

> different beast than Object (it was saving some fields, and avoiding some

> potentially wrong casts iirc - I didn't bother to upstream that yet). Also

> I have a different branch where I played with GObject to replace qom. In

> both cases, your proposal would have, or would make, the work more

> complicated.


If there are expectations that the distinction will become
useful, we can keep it by now.

I will submit a different proposal to have a
DECLARE_INTERFACE_CHECKER macro similar to
DECLARE_INSTANCE_CHECKER, followed by a
OBJECT_DECLARE_INTERFACE_TYPE macro similar to
OBJECT_DECLARE_TYPE.

-- 
Eduardo
Markus Armbruster Sept. 17, 2020, 7:05 a.m. UTC | #3
Eduardo Habkost <ehabkost@redhat.com> writes:

> This series replaces INTERFACE_CHECK with OBJECT_CHECK because

> both macros are exactly the same.


See also issue#2 in

    Subject: Issues around TYPE_INTERFACE
    Date: Tue, 12 Mar 2019 11:50:54 +0100
    Message-ID: <87h8c82woh.fsf@dusky.pond.sub.org>
    https://lists.nongnu.org/archive/html/qemu-devel/2019-03/msg03840.html

> The last patch is a new run of the OBJECT_CHECK ->

> DECLARE*_CHECKER* converter script that will convert the former

> INTERFACE_CHECK-based macros.
Philippe Mathieu-Daudé Sept. 17, 2020, 7:19 a.m. UTC | #4
On 9/16/20 11:31 PM, Marc-André Lureau wrote:
> Hi

> 

> On Wed, Sep 16, 2020 at 11:35 PM Eduardo Habkost <ehabkost@redhat.com

> <mailto:ehabkost@redhat.com>> wrote:

> 

>     This series replaces INTERFACE_CHECK with OBJECT_CHECK because

>     both macros are exactly the same.

> 

>     The last patch is a new run of the OBJECT_CHECK ->

>     DECLARE*_CHECKER* converter script that will convert the former

>     INTERFACE_CHECK-based macros.

> 

> 

> Well, at least having a different macro allows to tweak qom

> implementation or replace it with something different more easily.

> 

> I have some wip branch somewhere where I actually made Interface a

> different beast than Object (it was saving some fields, and avoiding

> some potentially wrong casts iirc - I didn't bother to upstream that

> yet). Also I have a different branch where I played with GObject to

> replace qom. In both cases, your proposal would have, or would make, the

> work more complicated.


Considering "wip branch not bothered to upstream" as "fork",
your comment from [*] applies here...

  You can't blame upstream from doing cleanups and modernization, or
  stagnating. Forks are forks, with all the pain they carry. If they
  want to avoid the maintenance cost, they have to do the extra effort
  to get it upstream. This is also a "sneaky way" to remind them that
  effort is better spent in this direction.

[*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg720284.html
Marc-André Lureau Sept. 17, 2020, 7:25 a.m. UTC | #5
Hi

On Thu, Sep 17, 2020 at 11:19 AM Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:

> On 9/16/20 11:31 PM, Marc-André Lureau wrote:

> > Hi

> >

> > On Wed, Sep 16, 2020 at 11:35 PM Eduardo Habkost <ehabkost@redhat.com

> > <mailto:ehabkost@redhat.com>> wrote:

> >

> >     This series replaces INTERFACE_CHECK with OBJECT_CHECK because

> >     both macros are exactly the same.

> >

> >     The last patch is a new run of the OBJECT_CHECK ->

> >     DECLARE*_CHECKER* converter script that will convert the former

> >     INTERFACE_CHECK-based macros.

> >

> >

> > Well, at least having a different macro allows to tweak qom

> > implementation or replace it with something different more easily.

> >

> > I have some wip branch somewhere where I actually made Interface a

> > different beast than Object (it was saving some fields, and avoiding

> > some potentially wrong casts iirc - I didn't bother to upstream that

> > yet). Also I have a different branch where I played with GObject to

> > replace qom. In both cases, your proposal would have, or would make, the

> > work more complicated.

>

> Considering "wip branch not bothered to upstream" as "fork",

> your comment from [*] applies here...

>

>   You can't blame upstream from doing cleanups and modernization, or

>   stagnating. Forks are forks, with all the pain they carry. If they

>   want to avoid the maintenance cost, they have to do the extra effort

>   to get it upstream. This is also a "sneaky way" to remind them that

>   effort is better spent in this direction.

>

> [*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg720284.html

>

>

Fair enough. Note I didn't nack it, but in general the proposal seems to
blurry some worthy semantic difference between object & interface. Maybe
#define alias INTERFACE_CHECK with OBJECT_CHECK instead ?

-- 
Marc-André Lureau
<div dir="ltr"><div dir="ltr">Hi<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 17, 2020 at 11:19 AM Philippe Mathieu-Daudé &lt;<a href="mailto:philmd@redhat.com">philmd@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 9/16/20 11:31 PM, Marc-André Lureau wrote:<br>
&gt; Hi<br>
&gt; <br>
&gt; On Wed, Sep 16, 2020 at 11:35 PM Eduardo Habkost &lt;<a href="mailto:ehabkost@redhat.com" target="_blank">ehabkost@redhat.com</a><br>
&gt; &lt;mailto:<a href="mailto:ehabkost@redhat.com" target="_blank">ehabkost@redhat.com</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;     This series replaces INTERFACE_CHECK with OBJECT_CHECK because<br>
&gt;     both macros are exactly the same.<br>
&gt; <br>
&gt;     The last patch is a new run of the OBJECT_CHECK -&gt;<br>
&gt;     DECLARE*_CHECKER* converter script that will convert the former<br>
&gt;     INTERFACE_CHECK-based macros.<br>
&gt; <br>
&gt; <br>
&gt; Well, at least having a different macro allows to tweak qom<br>
&gt; implementation or replace it with something different more easily.<br>
&gt; <br>
&gt; I have some wip branch somewhere where I actually made Interface a<br>
&gt; different beast than Object (it was saving some fields, and avoiding<br>
&gt; some potentially wrong casts iirc - I didn&#39;t bother to upstream that<br>
&gt; yet). Also I have a different branch where I played with GObject to<br>
&gt; replace qom. In both cases, your proposal would have, or would make, the<br>
&gt; work more complicated.<br>
<br>
Considering &quot;wip branch not bothered to upstream&quot; as &quot;fork&quot;,<br>
your comment from [*] applies here...<br>
<br>
  You can&#39;t blame upstream from doing cleanups and modernization, or<br>
  stagnating. Forks are forks, with all the pain they carry. If they<br>
  want to avoid the maintenance cost, they have to do the extra effort<br>
  to get it upstream. This is also a &quot;sneaky way&quot; to remind them that<br>
  effort is better spent in this direction.<br>
<br>
[*] <a href="https://www.mail-archive.com/qemu-devel@nongnu.org/msg720284.html" rel="noreferrer" target="_blank">https://www.mail-archive.com/qemu-devel@nongnu.org/msg720284.html</a><br>
<br>
</blockquote></div><div><br></div><div>Fair enough. Note I didn&#39;t nack it, but in general the proposal seems to blurry some worthy semantic difference between object &amp; interface. Maybe #define alias INTERFACE_CHECK with OBJECT_CHECK instead ?<br></div><br>-- <br><div dir="ltr" class="gmail_signature">Marc-André Lureau<br></div></div>
Eduardo Habkost Sept. 18, 2020, 6:23 p.m. UTC | #6
On Thu, Sep 17, 2020 at 11:25:30AM +0400, Marc-André Lureau wrote:
> Hi

> 

> On Thu, Sep 17, 2020 at 11:19 AM Philippe Mathieu-Daudé <philmd@redhat.com>

> wrote:

> 

> > On 9/16/20 11:31 PM, Marc-André Lureau wrote:

> > > Hi

> > >

> > > On Wed, Sep 16, 2020 at 11:35 PM Eduardo Habkost <ehabkost@redhat.com

> > > <mailto:ehabkost@redhat.com>> wrote:

> > >

> > >     This series replaces INTERFACE_CHECK with OBJECT_CHECK because

> > >     both macros are exactly the same.

> > >

> > >     The last patch is a new run of the OBJECT_CHECK ->

> > >     DECLARE*_CHECKER* converter script that will convert the former

> > >     INTERFACE_CHECK-based macros.

> > >

> > >

> > > Well, at least having a different macro allows to tweak qom

> > > implementation or replace it with something different more easily.

> > >

> > > I have some wip branch somewhere where I actually made Interface a

> > > different beast than Object (it was saving some fields, and avoiding

> > > some potentially wrong casts iirc - I didn't bother to upstream that

> > > yet). Also I have a different branch where I played with GObject to

> > > replace qom. In both cases, your proposal would have, or would make, the

> > > work more complicated.

> >

> > Considering "wip branch not bothered to upstream" as "fork",

> > your comment from [*] applies here...

> >

> >   You can't blame upstream from doing cleanups and modernization, or

> >   stagnating. Forks are forks, with all the pain they carry. If they

> >   want to avoid the maintenance cost, they have to do the extra effort

> >   to get it upstream. This is also a "sneaky way" to remind them that

> >   effort is better spent in this direction.

> >

> > [*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg720284.html

> >

> >

> Fair enough. Note I didn't nack it, but in general the proposal seems to

> blurry some worthy semantic difference between object & interface. Maybe

> #define alias INTERFACE_CHECK with OBJECT_CHECK instead ?


I'm actually considering deleting INTERFACE_CHECK and
OBJECT_CHECK completely after we finish the boilerplate
conversion, and tell everybody to use
OBJECT_DECLARE_INTERFACE/OBJECT_DECLARE_TYPE instead.

-- 
Eduardo