qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 64594e: qobject: Clean up QLIST_FOREACH_ENTRY


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 64594e: qobject: Clean up QLIST_FOREACH_ENTRY()
Date: Thu, 30 Apr 2020 06:00:33 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 64594e2bcc9a734bfabfaa8a75e08b4c9d920569
      
https://github.com/qemu/qemu/commit/64594e2bcc9a734bfabfaa8a75e08b4c9d920569
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/qmp/qlist.h

  Log Message:
  -----------
  qobject: Clean up QLIST_FOREACH_ENTRY()

QLIST_FOREACH_ENTRY() traverses a tail queue manually.  Use
QTAILQ_FIRST() and QTAILQ_NEXT() instead.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 1cd7741ef18e4333b17d64aaed3cd48e3e182a57
      
https://github.com/qemu/qemu/commit/1cd7741ef18e4333b17d64aaed3cd48e3e182a57
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M qobject/qjson.c

  Log Message:
  -----------
  qobject: Factor out helper json_pretty_newline()

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
[Coding style in moved code tidied up]


  Commit: 2f2ec111795119b2e020bc0cbf4b5f42878574b2
      
https://github.com/qemu/qemu/commit/2f2ec111795119b2e020bc0cbf4b5f42878574b2
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/qmp/qlist.h
    M qobject/qjson.c
    M qobject/qlist.c
    M tests/check-qlist.c

  Log Message:
  -----------
  qobject: Eliminate qlist_iter(), use QLIST_FOREACH_ENTRY() instead

qlist_iter() has just three uses outside tests/.  Replace by
QLIST_FOREACH_ENTRY() for more concise code and less type punning.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 7b1cd1c65abad70b26fbe9b11991bd88f0d956e1
      
https://github.com/qemu/qemu/commit/7b1cd1c65abad70b26fbe9b11991bd88f0d956e1
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/qmp/qdict.h
    M qapi/qobject-input-visitor.c
    M qobject/qdict.c
    M qobject/qjson.c
    M util/qemu-option.c

  Log Message:
  -----------
  qobject: Eliminate qdict_iter(), use qdict_first(), qdict_next()

qdict_iter() has just three uses and no test coverage.  Replace by
qdict_first(), qdict_next() for more concise code and less type
punning.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 2500f6f30b547b9c301dfe7571a16b028f7b848d
      
https://github.com/qemu/qemu/commit/2500f6f30b547b9c301dfe7571a16b028f7b848d
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M util/qemu-option.c

  Log Message:
  -----------
  qemu-option: Clean up after the previous commit

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 3777d36e674ca3b75b63413b4fb506b108309144
      
https://github.com/qemu/qemu/commit/3777d36e674ca3b75b63413b4fb506b108309144
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/visitor.h

  Log Message:
  -----------
  qapi: Belatedly update visitor.h's big comment for QAPI modules

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 294c90662ac9daae2c3bbf608296cf037925bd95
      
https://github.com/qemu/qemu/commit/294c90662ac9daae2c3bbf608296cf037925bd95
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/visitor.h

  Log Message:
  -----------
  qapi: Fix the virtual walk example in visitor.h's big comment

Call visit_check_list().  Missed in commit a4a1c70dc7 "qapi: Make
input visitors detect unvisited list tails".

Drop an irrelevant error_propagate() while there.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 782586c77103d297f38e78950dfbe2a31a3b2924
      
https://github.com/qemu/qemu/commit/782586c77103d297f38e78950dfbe2a31a3b2924
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/visitor.h

  Log Message:
  -----------
  qapi: Fix typo in visit_start_list()'s contract

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: c5460d5e19b4c531e86f8be0e00ab463fae7548b
      
https://github.com/qemu/qemu/commit/c5460d5e19b4c531e86f8be0e00ab463fae7548b
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/visitor.h

  Log Message:
  -----------
  qapi: Document @errp usage more thoroughly in visitor.h

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 554d6586ae96216771fe701c9d3a321e2adb057b
      
https://github.com/qemu/qemu/commit/554d6586ae96216771fe701c9d3a321e2adb057b
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/visitor.h

  Log Message:
  -----------
  qapi: Polish prose in visitor.h

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 8e08bf4ea24c3e6e07fab2c1b5bdcc7b104012c4
      
https://github.com/qemu/qemu/commit/8e08bf4ea24c3e6e07fab2c1b5bdcc7b104012c4
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M docs/devel/qapi-code-gen.txt
    M include/qapi/visitor.h
    M qapi/qapi-visit-core.c
    M scripts/qapi/visit.py

  Log Message:
  -----------
  qapi: Assert incomplete object occurs only in dealloc visitor

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 8b7ce95b46815f274aed52857260cb180f6fade3
      
https://github.com/qemu/qemu/commit/8b7ce95b46815f274aed52857260cb180f6fade3
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M include/qapi/visitor-impl.h
    M qapi/qapi-dealloc-visitor.c

  Log Message:
  -----------
  qapi: Fix Visitor contract for start_alternate()

The contract demands v->start_alternate() for input and dealloc
visitors, but visit_start_alternate() actually requires it for input
and clone visitors.  Fix the contract, and delete superfluous
qapi_dealloc_start_alternate().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 777d20cfa5735de298f378e9b90f0cd1caafdc2d
      
https://github.com/qemu/qemu/commit/777d20cfa5735de298f378e9b90f0cd1caafdc2d
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M qapi/qapi-visit-core.c
    M tests/test-qobject-output-visitor.c
    M tests/test-string-output-visitor.c

  Log Message:
  -----------
  qapi: Assert output visitors see only valid enum values

output_type_enum() fails when *obj is not a valid value of the enum
type.  Should not happen.  Drop the check, along with its unit tests.
This unmasks qapi_enum_lookup()'s assertion.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
[Commit message tweaked]


  Commit: faad584adb48737aa3b39984786442a1a9c42aa4
      
https://github.com/qemu/qemu/commit/faad584adb48737aa3b39984786442a1a9c42aa4
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M qapi/qapi-visit-core.c

  Log Message:
  -----------
  qapi: Assert non-input visitors see only valid narrow integers

visit_type_intN() and visit_type_uintN() fail when the value is out of
bounds.

This is appropriate with an input visitor: the value comes from input,
and input may be bad.

It should never happen with the other visitors: the value comes from
the caller, and callers must keep it within bounds.  Assert that.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: c978bd5226f1ed73456ac468a7ed50af3d24dc84
      
https://github.com/qemu/qemu/commit/c978bd5226f1ed73456ac468a7ed50af3d24dc84
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M scripts/qapi/visit.py

  Log Message:
  -----------
  qapi: Clean up visitor's recovery from input with invalid type

An alternate type's visit_type_FOO() fails when it runs into an
invalid ->type.  If it's an input visit, we then need to free the the
object we got from visit_start_alternate().  We do that with
qapi_free_FOO(), which uses the dealloc visitor.

Trouble is that object is in a bad state: its ->type is invalid.  So
the dealloc visitor will run into the same error again, and the error
recovery skips deallocating the alternate's (invalid) alternative.
Works, because qapi_free_FOO() ignores the error.

Avoid it instead: free the messed up object with by g_free().

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 7111a86e1ba23ff8d59886df03d8a1cd6c5aab43
      
https://github.com/qemu/qemu/commit/7111a86e1ba23ff8d59886df03d8a1cd6c5aab43
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M scripts/qapi/visit.py

  Log Message:
  -----------
  qapi: Assert non-input visitors see only valid alternate tags

An alternate type's visit_type_FOO() fails when it runs into an
invalid ->type.

This is appropriate with an input visitor: visit_start_alternate()
sets ->type according to the input, and bad input can lead to bad
->type.

It should never happen with an output, clone or dealloc visitor: if it
did, the alternate being output, cloned or deallocated would be messed
up beyond repair.  Assert that.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 1f5842487ad5b3d59ea32742e30dc7441f413e6c
      
https://github.com/qemu/qemu/commit/1f5842487ad5b3d59ea32742e30dc7441f413e6c
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M block.c
    M block/sheepdog.c
    M blockdev.c
    M hw/core/machine-hmp-cmds.c
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M monitor/hmp-cmds.c

  Log Message:
  -----------
  qapi: Only input visitors can actually fail

The previous few commits have made this more obvious, and removed the
one exception.  Time to clarify the documentation, and drop dead error
checking.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: ea097dff0f011c07202ea7e52a421429e01ef351
      
https://github.com/qemu/qemu/commit/ea097dff0f011c07202ea7e52a421429e01ef351
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M qom/object.c

  Log Message:
  -----------
  qom: Simplify object_property_get_enum()

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 2061487bdba7fb9077efc09210224b42fad7d18f
      
https://github.com/qemu/qemu/commit/2061487bdba7fb9077efc09210224b42fad7d18f
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M docs/devel/qapi-code-gen.txt
    M monitor/qmp.c
    M scripts/qapi/commands.py

  Log Message:
  -----------
  qapi: Disallow qmp_marshal_FOO(NULL, ...)

For QMP commands without arguments, gen_marshal() laboriously
generates a qmp_marshal_FOO() that copes with null @args.  Turns
there's just one caller that passes null instead of an empty QDict.
Adjust that caller, and simplify gen_marshal().

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 89bf68f933393a1bc0de4d07b59ffa8920da130f
      
https://github.com/qemu/qemu/commit/89bf68f933393a1bc0de4d07b59ffa8920da130f
  Author: Markus Armbruster <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M scripts/qapi/commands.py

  Log Message:
  -----------
  qapi: Generate simpler marshalling code when no arguments

When command FOO has no arguments, its generated qmp_marshal_FOO() is
a bit confusing.  Make it simpler:

     visit_start_struct(v, NULL, NULL, 0, &err);
     if (err) {
         goto out;
     }
-
-    if (!err) {
-        visit_check_struct(v, &err);
-    }
+    visit_check_struct(v, &err);
     visit_end_struct(v, NULL);
     if (err) {
         goto out;
     }

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 68bfd7db1e8b718187fd0ba4dde32396efcde668
      
https://github.com/qemu/qemu/commit/68bfd7db1e8b718187fd0ba4dde32396efcde668
  Author: Peter Maydell <address@hidden>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M block.c
    M block/sheepdog.c
    M blockdev.c
    M docs/devel/qapi-code-gen.txt
    M hw/core/machine-hmp-cmds.c
    M include/qapi/qmp/qdict.h
    M include/qapi/qmp/qlist.h
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M monitor/hmp-cmds.c
    M monitor/qmp.c
    M qapi/qapi-dealloc-visitor.c
    M qapi/qapi-visit-core.c
    M qapi/qobject-input-visitor.c
    M qobject/qdict.c
    M qobject/qjson.c
    M qobject/qlist.c
    M qom/object.c
    M scripts/qapi/commands.py
    M scripts/qapi/visit.py
    M tests/check-qlist.c
    M tests/test-qobject-output-visitor.c
    M tests/test-string-output-visitor.c
    M util/qemu-option.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-04-30' into 
staging

QAPI patches for 2020-04-30

# gpg: Signature made Thu 30 Apr 2020 06:29:18 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "address@hidden"
# gpg: Good signature from "Markus Armbruster <address@hidden>" [full]
# gpg:                 aka "Markus Armbruster <address@hidden>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2020-04-30:
  qapi: Generate simpler marshalling code when no arguments
  qapi: Disallow qmp_marshal_FOO(NULL, ...)
  qom: Simplify object_property_get_enum()
  qapi: Only input visitors can actually fail
  qapi: Assert non-input visitors see only valid alternate tags
  qapi: Clean up visitor's recovery from input with invalid type
  qapi: Assert non-input visitors see only valid narrow integers
  qapi: Assert output visitors see only valid enum values
  qapi: Fix Visitor contract for start_alternate()
  qapi: Assert incomplete object occurs only in dealloc visitor
  qapi: Polish prose in visitor.h
  qapi: Document @errp usage more thoroughly in visitor.h
  qapi: Fix typo in visit_start_list()'s contract
  qapi: Fix the virtual walk example in visitor.h's big comment
  qapi: Belatedly update visitor.h's big comment for QAPI modules
  qemu-option: Clean up after the previous commit
  qobject: Eliminate qdict_iter(), use qdict_first(), qdict_next()
  qobject: Eliminate qlist_iter(), use QLIST_FOREACH_ENTRY() instead
  qobject: Factor out helper json_pretty_newline()
  qobject: Clean up QLIST_FOREACH_ENTRY()

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/157360331ab3...68bfd7db1e8b



reply via email to

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