Skip to content
Snippets Groups Projects
  1. Jan 02, 2021
  2. Dec 19, 2020
    • Markus Armbruster's avatar
      Revert "qobject: let object_property_get_str() use new API" · 26c52828
      Markus Armbruster authored
      
      Commit aafb21a0 "qobject: let object_property_get_str() use new API"
      isn't much of a simplification.  Not worth having
      object_property_get_str() differ from the other
      object_property_get_FOO().  Revert.
      
      This reverts commit aafb21a0.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Daniel P. Berrangé <berrange@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20201211171152.146877-12-armbru@redhat.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      26c52828
    • Markus Armbruster's avatar
      qobject: Change qobject_to_json()'s value to GString · eab3a467
      Markus Armbruster authored
      
      qobject_to_json() and qobject_to_json_pretty() build a GString, then
      covert it to QString.  Just one of the callers actually needs a
      QString: qemu_rbd_parse_filename().  A few others need a string they
      can modify: qmp_send_response(), qga's send_response(), to_json_str(),
      and qmp_fd_vsend_fds().  The remainder just need a string.
      
      Change qobject_to_json() and qobject_to_json_pretty() to return the
      GString.
      
      qemu_rbd_parse_filename() now has to convert to QString.  All others
      save a QString temporary.  to_json_str() actually becomes a bit
      simpler, because GString provides more convenient modification
      functions.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20201211171152.146877-6-armbru@redhat.com>
      eab3a467
    • Markus Armbruster's avatar
      qobject: Make qobject_to_json_pretty() take a pretty argument · 6589f459
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20201211171152.146877-4-armbru@redhat.com>
      6589f459
    • Eric Blake's avatar
      qapi: Use QAPI_LIST_PREPEND() where possible · 54aa3de7
      Eric Blake authored
      
      Anywhere we create a list of just one item or by prepending items
      (typically because order doesn't matter), we can use
      QAPI_LIST_PREPEND().  But places where we must keep the list in order
      by appending remain open-coded until later patches.
      
      Note that as a side effect, this also performs a cleanup of two minor
      issues in qga/commands-posix.c: the old code was performing
       new = g_malloc0(sizeof(*ret));
      which 1) is confusing because you have to verify whether 'new' and
      'ret' are variables with the same type, and 2) would conflict with C++
      compilation (not an actual problem for this file, but makes
      copy-and-paste harder).
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20201113011340.463563-5-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      [Straightforward conflicts due to commit a8aa94b5 "qga: update
      schema for guest-get-disks 'dependents' field" and commit a10b453a
      "target/mips: Move mips_cpu_add_definition() from helper.c to cpu.c"
      resolved.  Commit message tweaked.]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      54aa3de7
  3. Dec 10, 2020
  4. Oct 15, 2020
  5. Oct 12, 2020
  6. Oct 06, 2020
  7. Sep 23, 2020
    • Stefan Hajnoczi's avatar
      qemu/atomic.h: rename atomic_ to qatomic_ · d73415a3
      Stefan Hajnoczi authored
      
      clang's C11 atomic_fetch_*() functions only take a C11 atomic type
      pointer argument. QEMU uses direct types (int, etc) and this causes a
      compiler error when a QEMU code calls these functions in a source file
      that also included <stdatomic.h> via a system header file:
      
        $ CC=clang CXX=clang++ ./configure ... && make
        ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      
      Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
      used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h
      and <stdatomic.h> can co-exist. I checked /usr/include on my machine and
      searched GitHub for existing "qatomic_" users but there seem to be none.
      
      This patch was generated using:
      
        $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \
          sort -u >/tmp/changed_identifiers
        $ for identifier in $(</tmp/changed_identifiers); do
              sed -i "s%\<$identifier\>%q$identifier%g" \
                  $(git grep -I -l "\<$identifier\>")
          done
      
      I manually fixed line-wrap issues and misaligned rST tables.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
      d73415a3
  8. Sep 22, 2020
    • Daniel P. Berrangé's avatar
      qom: simplify object_find_property / object_class_find_property · efba1595
      Daniel P. Berrangé authored
      
      When debugging QEMU it is often useful to put a breakpoint on the
      error_setg_internal method impl.
      
      Unfortunately the object_property_add / object_class_property_add
      methods call object_property_find / object_class_property_find methods
      to check if a property exists already before adding the new property.
      
      As a result there are a huge number of calls to error_setg_internal
      on startup of most QEMU commands, making it very painful to set a
      breakpoint on this method.
      
      Most callers of object_find_property and object_class_find_property,
      however, pass in a NULL for the Error parameter. This simplifies the
      methods to remove the Error parameter entirely, and then adds some
      new wrapper methods that are able to raise an Error when needed.
      
      Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200914135617.1493072-1-berrange@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      efba1595
  9. Sep 18, 2020
  10. Sep 15, 2020
  11. Sep 08, 2020
  12. Aug 21, 2020
  13. Jul 21, 2020
    • Markus Armbruster's avatar
      qom: Make info qom-tree sort children more efficiently · 0dde9fd1
      Markus Armbruster authored
      
      Commit e8c9e658 "qom: Make "info qom-tree" show children sorted"
      sorts children the simple, stupid, quadratic way.  I thought the
      number of children would be small enough for this not to matter.  I
      was wrong: there are outliers with several hundred children, e.g ARM
      machines nuri and smdkc210 each have a node with 513 children.
      
      While n^2 sorting isn't noticeable in normal, human usage even for
      n=513, it can be quite noticeable in certain automated tests.  In
      particular, the sort made device-introspect-test even slower.  Commit
      3e7b80f8 "tests: improve performance of device-introspect-test" just
      fixed that by cutting back its excessive use of "info qom-tree".
      Sorting more efficiently makes sense regardless, so do it.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200714160202.3121879-6-armbru@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      0dde9fd1
    • Markus Armbruster's avatar
      qom: Change object_get_canonical_path_component() not to malloc · 7a309cc9
      Markus Armbruster authored
      
      object_get_canonical_path_component() returns a malloced copy of a
      property name on success, null on failure.
      
      19 of its 25 callers immediately free the returned copy.
      
      Change object_get_canonical_path_component() to return the property
      name directly.  Since modifying the name would be wrong, adjust the
      return type to const char *.
      
      Drop the free from the 19 callers become simpler, add the g_strdup()
      to the other six.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200714160202.3121879-4-armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarLi Qiang <liq3ea@gmail.com>
      7a309cc9
  14. Jul 17, 2020
    • Markus Armbruster's avatar
      qom: Plug memory leak in "info qom-tree" · ab2d185d
      Markus Armbruster authored
      
      Commit e8c9e658 "qom: Make "info qom-tree" show children sorted"
      created a memory leak, because I didn't realize
      object_get_canonical_path_component()'s value needs to be freed.
      
      Reproducer:
      
          $ qemu-system-x86_64 -nodefaults -display none -S -monitor stdio
          QEMU 5.0.50 monitor - type 'help' for more information
          (qemu) info qom-tree
      
      This leaks some 4500 path components, 12-13 characters on average,
      i.e. roughly 100kBytes depending on the allocator.  A couple of
      hundred "info qom-tree" here, a couple of hundred there, and soon
      enough we're talking about real memory.
      
      Plug the leak.
      
      Fixes: e8c9e658
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reported-by: Reviewed-by: Li Qiang <liq3ea@gmail.com> [sent same patch]
      Message-Id: <20200714160202.3121879-3-armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      ab2d185d
  15. Jul 10, 2020
    • Eric Auger's avatar
      qom: Introduce object_property_try_add_child() · db57fef1
      Eric Auger authored
      
      object_property_add() does not allow object_property_try_add()
      to gracefully fail as &error_abort is passed as an error handle.
      
      However such failure can easily be triggered from the QMP shell when,
      for instance, one attempts to create an object with an id that already
      exists. This is achieved from the following call path:
      
      qmp_object_add -> user_creatable_add_dict -> user_creatable_add_type ->
      object_property_add_child -> object_property_add
      
      For instance, from the qmp-shell, call twice:
      object-add qom-type=memory-backend-ram id=mem1 props.size=1073741824
      and QEMU aborts.
      
      This behavior is undesired as a user/management application mistake
      in reusing a property ID shouldn't result in loss of the VM and live
      data within.
      
      This patch introduces a new function, object_property_try_add_child()
      which takes an error handle and turn object_property_try_add() into
      a non-static one.
      
      Now the call path becomes:
      
      user_creatable_add_type -> object_property_try_add_child ->
      object_property_try_add
      
      and the error is returned gracefully to the QMP client.
      
      (QEMU) object-add qom-type=memory-backend-ram id=mem2  props.size=4294967296
      {"return": {}}
      (QEMU) object-add qom-type=memory-backend-ram id=mem2  props.size=4294967296
      {"error": {"class": "GenericError", "desc": "attempt to add duplicate property
      'mem2' to object (type 'container')"}}
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Fixes: d2623129 ("qom: Drop parameter @errp of object_property_add() & friends")
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Tested-by: default avatarGreg Kurz <groug@kaod.org>
      Message-Id: <20200629193424.30280-2-eric.auger@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      db57fef1
    • Markus Armbruster's avatar
      error: Eliminate error_propagate() manually · 992861fb
      Markus Armbruster authored
      
      When all we do with an Error we receive into a local variable is
      propagating to somewhere else, we can just as well receive it there
      right away.  The previous two commits did that for sufficiently simple
      cases with Coccinelle.  Do it for several more manually.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200707160613.848843-37-armbru@redhat.com>
      992861fb
    • Markus Armbruster's avatar
      error: Eliminate error_propagate() with Coccinelle, part 2 · af175e85
      Markus Armbruster authored
      
      When all we do with an Error we receive into a local variable is
      propagating to somewhere else, we can just as well receive it there
      right away.  The previous commit did that with a Coccinelle script I
      consider fairly trustworthy.  This commit uses the same script with
      the matching of return taken out, i.e. we convert
      
          if (!foo(..., &err)) {
              ...
              error_propagate(errp, err);
              ...
          }
      
      to
      
          if (!foo(..., errp)) {
              ...
              ...
          }
      
      This is unsound: @err could still be read between afterwards.  I don't
      know how to express "no read of @err without an intervening write" in
      Coccinelle.  Instead, I manually double-checked for uses of @err.
      
      Suboptimal line breaks tweaked manually.  qdev_realize() simplified
      further to placate scripts/checkpatch.pl.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200707160613.848843-36-armbru@redhat.com>
      af175e85
    • Markus Armbruster's avatar
      error: Eliminate error_propagate() with Coccinelle, part 1 · 668f62ec
      Markus Armbruster authored
      
      When all we do with an Error we receive into a local variable is
      propagating to somewhere else, we can just as well receive it there
      right away.  Convert
      
          if (!foo(..., &err)) {
              ...
              error_propagate(errp, err);
              ...
              return ...
          }
      
      to
      
          if (!foo(..., errp)) {
              ...
              ...
              return ...
          }
      
      where nothing else needs @err.  Coccinelle script:
      
          @rule1 forall@
          identifier fun, err, errp, lbl;
          expression list args, args2;
          binary operator op;
          constant c1, c2;
          symbol false;
          @@
               if (
          (
          -        fun(args, &err, args2)
          +        fun(args, errp, args2)
          |
          -        !fun(args, &err, args2)
          +        !fun(args, errp, args2)
          |
          -        fun(args, &err, args2) op c1
          +        fun(args, errp, args2) op c1
          )
                  )
               {
                   ... when != err
                       when != lbl:
                       when strict
          -        error_propagate(errp, err);
                   ... when != err
          (
                   return;
          |
                   return c2;
          |
                   return false;
          )
               }
      
          @rule2 forall@
          identifier fun, err, errp, lbl;
          expression list args, args2;
          expression var;
          binary operator op;
          constant c1, c2;
          symbol false;
          @@
          -    var = fun(args, &err, args2);
          +    var = fun(args, errp, args2);
               ... when != err
               if (
          (
                   var
          |
                   !var
          |
                   var op c1
          )
                  )
               {
                   ... when != err
                       when != lbl:
                       when strict
          -        error_propagate(errp, err);
                   ... when != err
          (
                   return;
          |
                   return c2;
          |
                   return false;
          |
                   return var;
          )
               }
      
          @depends on rule1 || rule2@
          identifier err;
          @@
          -    Error *err = NULL;
               ... when != err
      
      Not exactly elegant, I'm afraid.
      
      The "when != lbl:" is necessary to avoid transforming
      
               if (fun(args, &err)) {
                   goto out
               }
               ...
           out:
               error_propagate(errp, err);
      
      even though other paths to label out still need the error_propagate().
      For an actual example, see sclp_realize().
      
      Without the "when strict", Coccinelle transforms vfio_msix_setup(),
      incorrectly.  I don't know what exactly "when strict" does, only that
      it helps here.
      
      The match of return is narrower than what I want, but I can't figure
      out how to express "return where the operand doesn't use @err".  For
      an example where it's too narrow, see vfio_intx_enable().
      
      Silently fails to convert hw/arm/armsse.c, because Coccinelle gets
      confused by ARMSSE being used both as typedef and function-like macro
      there.  Converted manually.
      
      Line breaks tidied up manually.  One nested declaration of @local_err
      deleted manually.  Preexisting unwanted blank line dropped in
      hw/riscv/sifive_e.c.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200707160613.848843-35-armbru@redhat.com>
      668f62ec
    • Markus Armbruster's avatar
      qom: Make functions taking Error ** return bool, not 0/-1 · b783f54d
      Markus Armbruster authored
      
      Just for consistency.  Also fix the example in object_set_props()'s
      documentation.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-31-armbru@redhat.com>
      b783f54d
    • Markus Armbruster's avatar
      qom: Use returned bool to check for failure, Coccinelle part · 778a2dc5
      Markus Armbruster authored
      
      The previous commit enables conversion of
      
          foo(..., &err);
          if (err) {
              ...
          }
      
      to
      
          if (!foo(..., errp)) {
              ...
          }
      
      for QOM functions that now return true / false on success / error.
      Coccinelle script:
      
          @@
          identifier fun = {
              object_apply_global_props, object_initialize_child_with_props,
              object_initialize_child_with_propsv, object_property_get,
              object_property_get_bool, object_property_parse, object_property_set,
              object_property_set_bool, object_property_set_int,
              object_property_set_link, object_property_set_qobject,
              object_property_set_str, object_property_set_uint, object_set_props,
              object_set_propv, user_creatable_add_dict,
              user_creatable_complete, user_creatable_del
          };
          expression list args, args2;
          typedef Error;
          Error *err;
          @@
          -    fun(args, &err, args2);
          -    if (err)
          +    if (!fun(args, &err, args2))
               {
                   ...
               }
      
      Fails to convert hw/arm/armsse.c, because Coccinelle gets confused by
      ARMSSE being used both as typedef and function-like macro there.
      Convert manually.
      
      Line breaks tidied up manually.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-29-armbru@redhat.com>
      778a2dc5
    • Markus Armbruster's avatar
      qom: Make functions taking Error ** return bool, not void · 6fd5bef1
      Markus Armbruster authored
      
      See recent commit "error: Document Error API usage rules" for
      rationale.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-28-armbru@redhat.com>
      6fd5bef1
    • Markus Armbruster's avatar
      qom: Put name parameter before value / visitor parameter · 5325cc34
      Markus Armbruster authored
      
      The object_property_set_FOO() setters take property name and value in
      an unusual order:
      
          void object_property_set_FOO(Object *obj, FOO_TYPE value,
                                       const char *name, Error **errp)
      
      Having to pass value before name feels grating.  Swap them.
      
      Same for object_property_set(), object_property_get(), and
      object_property_parse().
      
      Convert callers with this Coccinelle script:
      
          @@
          identifier fun = {
              object_property_get, object_property_parse, object_property_set_str,
              object_property_set_link, object_property_set_bool,
              object_property_set_int, object_property_set_uint, object_property_set,
              object_property_set_qobject
          };
          expression obj, v, name, errp;
          @@
          -    fun(obj, v, name, errp)
          +    fun(obj, name, v, errp)
      
      Chokes on hw/arm/musicpal.c's lcd_refresh() with the unhelpful error
      message "no position information".  Convert that one manually.
      
      Fails to convert hw/arm/armsse.c, because Coccinelle gets confused by
      ARMSSE being used both as typedef and function-like macro there.
      Convert manually.
      
      Fails to convert hw/rx/rx-gdbsim.c, because Coccinelle gets confused
      by RXCPU being used both as typedef and function-like macro there.
      Convert manually.  The other files using RXCPU that way don't need
      conversion.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-27-armbru@redhat.com>
      [Straightforwad conflict with commit 2336172d "audio: set default
      value for pcspk.iobase property" resolved]
      5325cc34
    • Markus Armbruster's avatar
      qom: Use return values to check for error where that's simpler · 1c94a351
      Markus Armbruster authored
      
      When using the Error object to check for error, we need to receive it
      into a local variable, then propagate() it to @errp.
      
      Using the return value permits allows receiving it straight to @errp.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-26-armbru@redhat.com>
      1c94a351
    • Markus Armbruster's avatar
      qom: Rename qdev_get_type() to object_get_type() · 90c69fb9
      Markus Armbruster authored
      
      Commit 2f262e06 lifted qdev_get_type() from qdev to object without
      renaming it accordingly.  Do that now.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-23-armbru@redhat.com>
      90c69fb9
    • Markus Armbruster's avatar
      qapi: Use returned bool to check for failure, Coccinelle part · 62a35aaa
      Markus Armbruster authored
      
      The previous commit enables conversion of
      
          visit_foo(..., &err);
          if (err) {
              ...
          }
      
      to
      
          if (!visit_foo(..., errp)) {
              ...
          }
      
      for visitor functions that now return true / false on success / error.
      Coccinelle script:
      
          @@
          identifier fun =~ "check_list|input_type_enum|lv_start_struct|lv_type_bool|lv_type_int64|lv_type_str|lv_type_uint64|output_type_enum|parse_type_bool|parse_type_int64|parse_type_null|parse_type_number|parse_type_size|parse_type_str|parse_type_uint64|print_type_bool|print_type_int64|print_type_null|print_type_number|print_type_size|print_type_str|print_type_uint64|qapi_clone_start_alternate|qapi_clone_start_list|qapi_clone_start_struct|qapi_clone_type_bool|qapi_clone_type_int64|qapi_clone_type_null|qapi_clone_type_number|qapi_clone_type_str|qapi_clone_type_uint64|qapi_dealloc_start_list|qapi_dealloc_start_struct|qapi_dealloc_type_anything|qapi_dealloc_type_bool|qapi_dealloc_type_int64|qapi_dealloc_type_null|qapi_dealloc_type_number|qapi_dealloc_type_str|qapi_dealloc_type_uint64|qobject_input_check_list|qobject_input_check_struct|qobject_input_start_alternate|qobject_input_start_list|qobject_input_start_struct|qobject_input_type_any|qobject_input_type_bool|qobject_input_type_bool_keyval|qobject_input_type_int64|qobject_input_type_int64_keyval|qobject_input_type_null|qobject_input_type_number|qobject_input_type_number_keyval|qobject_input_type_size_keyval|qobject_input_type_str|qobject_input_type_str_keyval|qobject_input_type_uint64|qobject_input_type_uint64_keyval|qobject_output_start_list|qobject_output_start_struct|qobject_output_type_any|qobject_output_type_bool|qobject_output_type_int64|qobject_output_type_null|qobject_output_type_number|qobject_output_type_str|qobject_output_type_uint64|start_list|visit_check_list|visit_check_struct|visit_start_alternate|visit_start_list|visit_start_struct|visit_type_.*";
          expression list args;
          typedef Error;
          Error *err;
          @@
          -    fun(args, &err);
          -    if (err)
          +    if (!fun(args, &err))
               {
                   ...
               }
      
      A few line breaks tidied up manually.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-19-armbru@redhat.com>
      62a35aaa
  16. Jul 07, 2020
  17. Jun 17, 2020
    • David Hildenbrand's avatar
      hmp: Make json format optional for qom-set · 2d9e3dd9
      David Hildenbrand authored
      
      Commit 7d2ef6dc ("hmp: Simplify qom-set") switched to the json
      parser, making it possible to specify complex types. However, with this
      change it is no longer possible to specify proper sizes (e.g., 2G, 128M),
      turning the interface harder to use for properties that consume sizes.
      
      Let's switch back to the previous handling and allow to specify passing
      json via the "-j" parameter.
      
      Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Daniel P. Berrangé" <berrange@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200610075153.33892-1-david@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      2d9e3dd9
    • Pan Nengyuan's avatar
      qom-hmp-cmds: fix a memleak in hmp_qom_get · 246da7db
      Pan Nengyuan authored
      
      'obj' forgot to free at the end of hmp_qom_get(). Fix that.
      
      The leak stack:
      Direct leak of 40 byte(s) in 1 object(s) allocated from:
          #0 0x7f4e3a779ae8 in __interceptor_malloc (/lib64/libasan.so.5+0xefae8)
          #1 0x7f4e398f91d5 in g_malloc (/lib64/libglib-2.0.so.0+0x531d5)
          #2 0x55c9fd9a3999 in qstring_from_substr /build/qemu/src/qobject/qstring.c:45
          #3 0x55c9fd894bd3 in qobject_output_type_str /build/qemu/src/qapi/qobject-output-visitor.c:175
          #4 0x55c9fd894bd3 in qobject_output_type_str /build/qemu/src/qapi/qobject-output-visitor.c:168
          #5 0x55c9fd88b34d in visit_type_str /build/qemu/src/qapi/qapi-visit-core.c:308
          #6 0x55c9fd59aa6b in property_get_str /build/qemu/src/qom/object.c:2064
          #7 0x55c9fd5adb8a in object_property_get_qobject /build/qemu/src/qom/qom-qobject.c:38
          #8 0x55c9fd4a029d in hmp_qom_get /build/qemu/src/qom/qom-hmp-cmds.c:66
      
      Fixes: 89cf4fe3
      Reported-by: default avatarEuler Robot <euler.robot@huawei.com>
      Signed-off-by: default avatarPan Nengyuan <pannengyuan@huawei.com>
      Message-Id: <20200603070338.7922-1-pannengyuan@huawei.com>
      Reviewed-by: default avatarLi Qiang <liq3ea@gmail.com>
      Tested-by: default avatarLi Qiang <liq3ea@gmail.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      246da7db
Loading