mbox

[PULL,v2,00/14] QMP and QObject patches

Message ID 1446020161-21758-1-git-send-email-armbru@redhat.com
State New
Headers show

Pull-request

git://repo.or.cz/qemu/armbru.git tags/pull-monitor-2015-10-28

Message

Markus Armbruster Oct. 28, 2015, 8:15 a.m. UTC
The following changes since commit 7e038b94e74e1c2d1b3598e2e4b0b5c8b79a7278:

  Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2015-10-27 10:10:46 +0000)

are available in the git repository at:

  git://repo.or.cz/qemu/armbru.git tags/pull-monitor-2015-10-28

for you to fetch changes up to 81387a94e3a95068b45d15a4db67f3942c46ad4e:

  docs: Document QMP event rate limiting (2015-10-28 09:07:48 +0100)

----------------------------------------------------------------
QMP and QObject patches

----------------------------------------------------------------
Markus Armbruster (14):
      qobject: Drop QObject_HEAD
      qbool: Make conversion from QObject * accept null
      qdict: Make conversion from QObject * accept null
      qfloat qint: Make conversion from QObject * accept null
      qlist: Make conversion from QObject * accept null
      qstring: Make conversion from QObject * accept null
      monitor: Reduce casting of QAPI event QDict
      monitor: Simplify event throttling
      monitor: Switch from timer_new() to timer_new_ns()
      monitor: Split MonitorQAPIEventConf off MonitorQAPIEventState
      glib: add compatibility interface for g_hash_table_add()
      monitor: Turn monitor_qapi_event_state[] into a hash table
      monitor: Throttle event VSERPORT_CHANGE separately by "id"
      docs: Document QMP event rate limiting

 docs/qmp-events.txt        |  12 +++
 docs/qmp-spec.txt          |   5 ++
 include/glib-compat.h      |   7 ++
 include/qapi/qmp/qbool.h   |   2 +-
 include/qapi/qmp/qdict.h   |   2 +-
 include/qapi/qmp/qfloat.h  |   2 +-
 include/qapi/qmp/qint.h    |   2 +-
 include/qapi/qmp/qlist.h   |   2 +-
 include/qapi/qmp/qobject.h |   4 -
 include/qapi/qmp/qstring.h |   2 +-
 monitor.c                  | 192 ++++++++++++++++++++++++++-------------------
 qapi/qmp-input-visitor.c   |  40 +++++-----
 qga/main.c                 |  11 +--
 qobject/qbool.c            |   4 +-
 qobject/qdict.c            |  39 +++------
 qobject/qfloat.c           |   4 +-
 qobject/qint.c             |   4 +-
 qobject/qlist.c            |   3 +-
 qobject/qstring.c          |   4 +-
 trace-events               |   4 +-
 20 files changed, 190 insertions(+), 155 deletions(-)

Comments

Peter Maydell Oct. 28, 2015, 3:07 p.m. UTC | #1
On 28 October 2015 at 08:15, Markus Armbruster <armbru@redhat.com> wrote:
> The following changes since commit 7e038b94e74e1c2d1b3598e2e4b0b5c8b79a7278:
>
>   Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2015-10-27 10:10:46 +0000)
>
> are available in the git repository at:
>
>   git://repo.or.cz/qemu/armbru.git tags/pull-monitor-2015-10-28
>
> for you to fetch changes up to 81387a94e3a95068b45d15a4db67f3942c46ad4e:
>
>   docs: Document QMP event rate limiting (2015-10-28 09:07:48 +0100)
>
> ----------------------------------------------------------------
> QMP and QObject patches
>
> ----------------------------------------------------------------
> Markus Armbruster (14):
>       qobject: Drop QObject_HEAD
>       qbool: Make conversion from QObject * accept null
>       qdict: Make conversion from QObject * accept null
>       qfloat qint: Make conversion from QObject * accept null
>       qlist: Make conversion from QObject * accept null
>       qstring: Make conversion from QObject * accept null
>       monitor: Reduce casting of QAPI event QDict
>       monitor: Simplify event throttling
>       monitor: Switch from timer_new() to timer_new_ns()
>       monitor: Split MonitorQAPIEventConf off MonitorQAPIEventState
>       glib: add compatibility interface for g_hash_table_add()
>       monitor: Turn monitor_qapi_event_state[] into a hash table
>       monitor: Throttle event VSERPORT_CHANGE separately by "id"
>       docs: Document QMP event rate limiting

OSX build failure :-(

  CC    qga/commands-posix.o
In file included from /Users/pm215/src/qemu-for-merges/qga/main.c:25:
In file included from
/Users/pm215/src/qemu-for-merges/include/qapi/qmp/json-parser.h:17:
In file included from /Users/pm215/src/qemu-for-merges/include/qemu-common.h:25:
/Users/pm215/src/qemu-for-merges/include/glib-compat.h:171:12: error:
returning 'void' from a function with incompatible result type
'gboolean' (aka 'int')
    return g_hash_table_replace(hash_table, key, key)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looks like g_hash_table_replace was originally a 'void' return
and switched to 'gboolean' return at some later date:

https://github.com/GNOME/glib/commit/910191597a6c2e5d5d460e9ce9efb4f47d9cc63c

thanks
-- PMM
Eric Blake Oct. 28, 2015, 3:24 p.m. UTC | #2
On 10/28/2015 09:07 AM, Peter Maydell wrote:

>>       glib: add compatibility interface for g_hash_table_add()
>>       monitor: Turn monitor_qapi_event_state[] into a hash table

> 
>   CC    qga/commands-posix.o
> In file included from /Users/pm215/src/qemu-for-merges/qga/main.c:25:
> In file included from
> /Users/pm215/src/qemu-for-merges/include/qapi/qmp/json-parser.h:17:
> In file included from /Users/pm215/src/qemu-for-merges/include/qemu-common.h:25:
> /Users/pm215/src/qemu-for-merges/include/glib-compat.h:171:12: error:
> returning 'void' from a function with incompatible result type
> 'gboolean' (aka 'int')
>     return g_hash_table_replace(hash_table, key, key)
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Looks like g_hash_table_replace was originally a 'void' return
> and switched to 'gboolean' return at some later date:
> 
> https://github.com/GNOME/glib/commit/910191597a6c2e5d5d460e9ce9efb4f47d9cc63c

This patch series isn't using the return value of g_hash_table_add, so
our glib replacement could be changed to return void.

On the other hand, would it be better to proactively retrofit the return
type into ALL of the g_hash_table_* functions that were swapped to
return a value, so that future uses of the functions with qemu can make
use of the modern contract, even though this series doesn't use it?
Markus Armbruster Oct. 29, 2015, 1:05 p.m. UTC | #3
Eric Blake <eblake@redhat.com> writes:

> On 10/28/2015 09:07 AM, Peter Maydell wrote:
>
>>>       glib: add compatibility interface for g_hash_table_add()
>>>       monitor: Turn monitor_qapi_event_state[] into a hash table
>
>> 
>>   CC    qga/commands-posix.o
>> In file included from /Users/pm215/src/qemu-for-merges/qga/main.c:25:
>> In file included from
>> /Users/pm215/src/qemu-for-merges/include/qapi/qmp/json-parser.h:17:
>> In file included from /Users/pm215/src/qemu-for-merges/include/qemu-common.h:25:
>> /Users/pm215/src/qemu-for-merges/include/glib-compat.h:171:12: error:
>> returning 'void' from a function with incompatible result type
>> 'gboolean' (aka 'int')
>>     return g_hash_table_replace(hash_table, key, key)
>>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 
>> Looks like g_hash_table_replace was originally a 'void' return
>> and switched to 'gboolean' return at some later date:
>> 
>> https://github.com/GNOME/glib/commit/910191597a6c2e5d5d460e9ce9efb4f47d9cc63c

The 80s are calling: cavalier API break.  The GLib maintainers should
know better.

Anyway, this change is in 2.39.2.  The replacement function is for
<2.32.  Therefore, g_hash_table_replace() will always return void then.

> This patch series isn't using the return value of g_hash_table_add, so
> our glib replacement could be changed to return void.

Yes.  Matches GLib's function before 2.39.2.

> On the other hand, would it be better to proactively retrofit the return
> type into ALL of the g_hash_table_* functions that were swapped to
> return a value, so that future uses of the functions with qemu can make
> use of the modern contract, even though this series doesn't use it?

I think we should add glib-compat cruft only when we actually need it.