1. 08 8月, 2016 2 次提交
  2. 02 8月, 2016 1 次提交
  3. 27 7月, 2016 1 次提交
    • D
      iotest: fix python based IO tests · 4c44b4a4
      Daniel P. Berrange 提交于
      The previous commit refactoring iotests.py:
      
        commit 66613974
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Wed Jul 20 14:23:10 2016 +0100
      
          scripts: refactor the VM class in iotests for reuse
      
      was not properly tested and included a number of broken
      bits.
      
       - The 'event_match' method was not moved into qemu.py
       - The 'self._args' list parameter in QEMUMachine needs
         to be copied otherwise modifications will affect the
         global 'qemu_opts' variable in iotests.py
       - The QEMUQtestMachine class methods had inverted
         parameter order for the super() calls
       - The QEMUQtestMachine class forgot to add
         '-machine accel=qtest'
       - The QEMUQtestMachine class constructor needs to set
         a default 'name' value before using it as it may
         be None
       - The QEMUQtestMachine class constructor needs to use
         named parameters when calling the super constructor
         as it is leaving out some positional parameters.
       - The 'qemu_prog' variable should be a string not a
         list in iotests.py
       - The VM classs constructor needs to use named
         parameters when calling the super constructor
         as it is leaving out some positional parameters.
       - The path to the socket-scm-helper needs to be
         passed into the QEMUMachine class
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1469549767-27249-1-git-send-email-berrange@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      4c44b4a4
  4. 22 7月, 2016 5 次提交
  5. 19 7月, 2016 10 次提交
    • E
      qapi: Implement boxed types for commands/events · c818408e
      Eric Blake 提交于
      Turn on the ability to pass command and event arguments in
      a single boxed parameter, which must name a non-empty type
      (although the type can be a struct with all optional members).
      For structs, it makes it possible to pass a single qapi type
      instead of a breakout of all struct members (useful if the
      arguments are already in a struct or if the number of members
      is large); for other complex types, it is now possible to use
      a union or alternate as the data for a command or event.
      
      The empty type may be technically feasible if needed down the
      road, but it's easier to forbid it now and relax things to allow
      it later, than it is to allow it now and have to special case
      how the generated 'q_empty' type is handled (see commit 7ce106a9
      for reasons why nothing is generated for the empty type).  An
      alternate type is never considered empty, but now that a boxed
      type can be either an object or an alternate, we have to provide
      a trivial QAPISchemaAlternateType.is_empty().  The new call to
      arg_type.is_empty() during QAPISchemaCommand.check() requires
      that we first check the type in question; but there is no chance
      of introducing a cycle since objects do not refer back to commands.
      
      We still have a split in syntax checking between ad-hoc parsing
      up front (merely validates that 'boxed' has a sane value) and
      during .check() methods (if 'boxed' is set, then 'data' must name
      a non-empty user-defined type).
      
      Generated code is unchanged, as long as no client uses the
      new feature.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-10-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [Test files renamed to *-boxed-*]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      c818408e
    • E
      qapi: Plumb in 'boxed' to qapi generator lower levels · 48825ca4
      Eric Blake 提交于
      The next patch will add support for passing a qapi union type
      as the 'data' of a command.  But to do that, the user function
      for implementing the command, as called by the generated
      marshal command, must take the corresponding C struct as a
      single boxed pointer, rather than a breakdown into one
      parameter per member.  Even without a union, being able to use
      a C struct rather than a list of parameters can make it much
      easier to handle coding with QAPI.
      
      This patch adds the internal plumbing of a 'boxed' flag
      associated with each command and event.  In several cases,
      this means adding indentation, with one new dead branch and
      the remaining branch being the original code more deeply
      nested; this was done so that the new implementation in the
      next patch is easier to review without also being mixed with
      indentation changes.
      
      For this patch, no behavior or generated output changes, other
      than the testsuite outputting the value of the new flag
      (always False for now).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-9-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [Identifier box renamed to boxed in two places]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      48825ca4
    • E
      qapi-event: Simplify visit of non-implicit data · 4d0b268f
      Eric Blake 提交于
      Commit 7ce106a9 documented why we don't generated a visit_type_FOO()
      for implicit types; and therefore events with an anonymous type for
      'data' have to open-code a visit.  Note that the open-coded visit in
      qapi-event.c is slightly different from what is done in
      qapi-visit.c for normal types, in part because we don't have to
      check for *obj being NULL or free things on error.  But where the
      type is not implicit, it is nicer to reuse the normal visit instead
      of open-coding a duplicate.
      
      At the moment, the only event with a non-implicit 'data' is in the
      testsuite, where test-qapi-event.c changes as follows:
      
      |@@ -155,6 +155,7 @@ void qapi_event_send___org_qemu_x_event(
      |     __org_qemu_x_Struct param = {
      |         __org_qemu_x_member1, (char *)__org_qemu_x_member2, has_q_wchar_t, q_wchar_t
      |     };
      |+    __org_qemu_x_Struct *arg = &param;
      |
      |     emit = qmp_event_get_func_emit();
      |     if (!emit) {
      |@@ -164,16 +165,7 @@ void qapi_event_send___org_qemu_x_event(
      |     qmp = qmp_event_build_dict("__ORG.QEMU_X-EVENT");
      |
      |     v = qmp_output_visitor_new(&obj);
      |-
      |-    visit_start_struct(v, "__ORG.QEMU_X-EVENT", NULL, 0, &err);
      |-    if (err) {
      |-        goto out;
      |-    }
      |-    visit_type___org_qemu_x_Struct_members(v, &param, &err);
      |-    if (!err) {
      |-    if (!err) {
      |-        visit_check_struct(v, &err);
      |-    }
      |-    visit_end_struct(v, NULL);
      |+    visit_type___org_qemu_x_Struct(v, "__ORG.QEMU_X-EVENT", &arg, &err);
      |     if (err) {
      |         goto out;
      |     }
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-8-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      4d0b268f
    • E
      qapi: Drop useless gen_err_check() · fa274ed6
      Eric Blake 提交于
      Ever since commit 12f254fd removed the last parameterization
      of gen_err_check(), it no longer makes sense to hide the three
      lines of generated C code behind a macro call. Just inline it
      into the remaining users.
      
      No change to generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-7-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      fa274ed6
    • E
      qapi: Add type.is_empty() helper · b6167706
      Eric Blake 提交于
      In the near future, we want to lift our artificial restriction of
      no variants at the top level of an event, at which point the
      currently open-coded check for empty members will become
      insufficient.  Factor it out into a new helper method is_empty()
      now, and future-proof it by checking variants, too, along with an
      assert that it is not used prior to the completion of .check().
      Update places that were checking for (non-)empty .members to use
      the new helper.
      
      All of the current callers assert that there are no variants (either
      directly, or by qapi.py asserting that base types have no variants),
      so this is not a semantic change.
      
      No change to generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-6-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b6167706
    • E
      qapi: Hide tag_name data member of variants · da9cb193
      Eric Blake 提交于
      Clean up the only remaining external use of the tag_name field of
      QAPISchemaObjectTypeVariants, by explicitly listing the generated
      'type' tag for all variants in the testsuite (you can still tell
      simple unions by the -wrapper types).  Then we can mark the
      tag_name field as private by adding a leading underscore to prevent
      any further use.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-5-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      da9cb193
    • E
      qapi: Special case c_name() for empty type · cd50a256
      Eric Blake 提交于
      Commit 7ce106a9 rendered QAPISchemaObjectType.c_name() redundant,
      since it now does nothing more than delegate to its superclass.
      However, rather than deleting it, we can restore part of the
      assertion that was removed in that commit, to prove that we never
      emit the empty type directly in generated code, but rather
      special-case it as a built-in that makes other aspects of code
      generation easier to reason about.
      Reported-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-4-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      cd50a256
    • E
      qapi: Require all branches of flat union enum to be covered · d0b18239
      Eric Blake 提交于
      We were previously enforcing that all flat union branches were
      found in the corresponding enum, but not that all enum values
      were covered by branches.  The resulting generated code would
      abort() if the user passes the uncovered enum value.
      
      We don't automatically treat non-present branches in a flat
      union as empty types, for symmetry with simple unions (there,
      the enum type is generated from the list of all branches, so
      there is no way to omit a branch but still have it be part of
      the union).
      
      A later patch will add shorthand so that branches that are empty
      in flat unions can be declared as 'branch':{} instead of
      'branch':'Empty', to avoid the need for an otherwise useless
      explicit empty type.  [Such shorthand for simple unions is a bit
      harder to justify, since we would still have to generate a
      wrapper type that parses 'data':{}, rather than truly being an
      empty branch with no additional siblings to the 'type' member.]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-3-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d0b18239
    • L
      trace: Conditionally trace events based on their per-vCPU state · 40b9cd25
      Lluís Vilanova 提交于
      Events with the 'vcpu' property are conditionally emitted according to
      their per-vCPU state. Other events are emitted normally based on their
      global tracing state.
      
      Note that the per-vCPU condition check applies to all tracing backends.
      Signed-off-by: NLluís Vilanova <vilanova@ac.upc.edu>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      40b9cd25
    • L
      trace: Identify events with the 'vcpu' property · 17f7ac75
      Lluís Vilanova 提交于
      A new event attribute 'cpu_id' is added to have a separate ID
      space ('TRACE_VCPU_*') for all events with the 'vcpu' property.
      
      These are later used to identify which events are enabled on each vCPU.
      Signed-off-by: NLluís Vilanova <vilanova@ac.upc.edu>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      17f7ac75
  6. 18 7月, 2016 1 次提交
  7. 17 7月, 2016 1 次提交
    • S
      checkpatch: consider git extended headers valid patches · d211bd60
      Stefan Hajnoczi 提交于
      Renames look like this with git-diff(1) when diff.renames = true is set:
      
        diff --git a/a b/b
        similarity index 100%
        rename from a
        rename to b
      
      This raises the "Does not appear to be a unified-diff format patch"
      error because checkpatch.pl only considers a diff valid if it contains
      at least one "@@" hunk.
      
      This patch accepts renames and copies too so that checkpatch.pl exits
      successfully when a diff only renames/copies files.  The git diff
      extended header format is described on the git-diff(1) man page.
      Reported-by: NColin Lord <clord@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <1468576014-28788-1-git-send-email-stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d211bd60
  8. 12 7月, 2016 1 次提交
    • M
      scripts: New clean-header-guards.pl · 2dbc4ebc
      Markus Armbruster 提交于
      The conventional way to ensure a header can be included multiple times
      is to bracket it like this:
      
          #ifndef HEADER_NAME_H
          #define HEADER_NAME_H
          ...
          #endif
      
      where HEADER_NAME_H is a symbol unique to this header.
      
      The endif may be optionally decorated like this:
      
          #endif /* HEADER_NAME_H */
      
      Unconventional ways present in our code:
      
      * Identifiers reserved for any use:
          #define _FILEOP_H
      
      * Lowercase (bad idea for object-like macros):
          #define __linux_video_vga_h__
      
      * Roundabout ways to say the same thing (and hide from grep):
          #if !defined(__PPC_MAC_H__)
          #endif /* !defined(__PPC_MAC_H__) */
      
      * Redundant values:
          #define HW_ALPHA_H 1
      
      * Funny redundant values:
          # define PXA_H                 "pxa.h"
      
      * Decorations with bangs:
      
          #endif /* !QEMU_ARM_GIC_INTERNAL_H */
      
        The negation actually makes sense, but almost all our header guard
        #endif decorations don't negate.
      
      * Useless decorations:
      
         #endif  /* audio.h */
      
      Header guards are not the place to show off creativity.  This script
      normalizes them to the conventional way, and cleans up whitespace
      while there.  It warns when it renames guard symbols, and explains how
      to find occurences of these symbols that may have to be updated
      manually.
      
      Another issue is use of the same guard symbol in multiple headers.
      That's okay only for headers that cannot be used together, such as the
      *-user/*/target_syscall.h.  This script can't tell, so it warns when
      it sees a reuse.
      
      The script also warns when preprocessing a header with its guard
      symbol defined produces anything but whitespace.
      
      The next commits will put the script to use.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      2dbc4ebc
  9. 06 7月, 2016 4 次提交
    • E
      qapi: Add new visit_complete() function · 3b098d56
      Eric Blake 提交于
      Making each output visitor provide its own output collection
      function was the only remaining reason for exposing visitor
      sub-types to the rest of the code base.  Add a polymorphic
      visit_complete() function which is a no-op for input visitors,
      and which populates an opaque pointer for output visitors.  For
      maximum type-safety, also add a parameter to the output visitor
      constructors with a type-correct version of the output pointer,
      and assert that the two uses match.
      
      This approach was considered superior to either passing the
      output parameter only during construction (action at a distance
      during visit_free() feels awkward) or only during visit_complete()
      (defeating type safety makes it easier to use incorrectly).
      
      Most callers were function-local, and therefore a mechanical
      conversion; the testsuite was a bit trickier, but the previous
      cleanup patch minimized the churn here.
      
      The visit_complete() function may be called at most once; doing
      so lets us use transfer semantics rather than duplication or
      ref-count semantics to get the just-built output back to the
      caller, even though it means our behavior is not idempotent.
      
      Generated code is simplified as follows for events:
      
      |@@ -26,7 +26,7 @@ void qapi_event_send_acpi_device_ost(ACP
      |     QDict *qmp;
      |     Error *err = NULL;
      |     QMPEventFuncEmit emit;
      |-    QmpOutputVisitor *qov;
      |+    QObject *obj;
      |     Visitor *v;
      |     q_obj_ACPI_DEVICE_OST_arg param = {
      |         info
      |@@ -39,8 +39,7 @@ void qapi_event_send_acpi_device_ost(ACP
      |
      |     qmp = qmp_event_build_dict("ACPI_DEVICE_OST");
      |
      |-    qov = qmp_output_visitor_new();
      |-    v = qmp_output_get_visitor(qov);
      |+    v = qmp_output_visitor_new(&obj);
      |
      |     visit_start_struct(v, "ACPI_DEVICE_OST", NULL, 0, &err);
      |     if (err) {
      |@@ -55,7 +54,8 @@ void qapi_event_send_acpi_device_ost(ACP
      |         goto out;
      |     }
      |
      |-    qdict_put_obj(qmp, "data", qmp_output_get_qobject(qov));
      |+    visit_complete(v, &obj);
      |+    qdict_put_obj(qmp, "data", obj);
      |     emit(QAPI_EVENT_ACPI_DEVICE_OST, qmp, &err);
      
      and for commands:
      
      | {
      |     Error *err = NULL;
      |-    QmpOutputVisitor *qov = qmp_output_visitor_new();
      |     Visitor *v;
      |
      |-    v = qmp_output_get_visitor(qov);
      |+    v = qmp_output_visitor_new(ret_out);
      |     visit_type_AddfdInfo(v, "unused", &ret_in, &err);
      |-    if (err) {
      |-        goto out;
      |+    if (!err) {
      |+        visit_complete(v, ret_out);
      |     }
      |-    *ret_out = qmp_output_get_qobject(qov);
      |-
      |-out:
      |     error_propagate(errp, err);
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-13-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3b098d56
    • E
      qmp-input-visitor: Favor new visit_free() function · b70ce101
      Eric Blake 提交于
      Now that we have a polymorphic visit_free(), we no longer need
      qmp_input_visitor_cleanup(); which in turn means we no longer
      need to return a subtype from qmp_input_visitor_new() nor a
      public upcast function.
      
      Generated code changes to qmp-marshal.c look like:
      
      |@@ -52,11 +52,10 @@ void qmp_marshal_add_fd(QDict *args, QOb
      | {
      |     Error *err = NULL;
      |     AddfdInfo *retval;
      |-    QmpInputVisitor *qiv = qmp_input_visitor_new(QOBJECT(args), true);
      |     Visitor *v;
      |     q_obj_add_fd_arg arg = {0};
      |
      |-    v = qmp_input_get_visitor(qiv);
      |+    v = qmp_input_visitor_new(QOBJECT(args), true);
      |     visit_start_struct(v, NULL, NULL, 0, &err);
      |     if (err) {
      |         goto out;
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-8-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b70ce101
    • E
      qapi: Add new visit_free() function · 2c0ef9f4
      Eric Blake 提交于
      Making each visitor provide its own (awkwardly-named) FOO_cleanup()
      is unusual, when we can instead have a polymorphic visit_free()
      interface.  Over the next few patches, we can use the polymorphic
      functions to eliminate the need for a FOO_get_visitor() function
      for accessing specific visitor functionality, once everything can
      be accessed directly through the Visitor* interfaces.
      
      The dealloc visitor is the first one converted to completely use
      the new entry point, since qapi_dealloc_visitor_cleanup() was the
      only reason that qapi_dealloc_get_visitor() existed, and only
      generated and testsuite code was even using it.  With the new
      visit_free() entry point in place, we no longer need to expose
      the QapiDeallocVisitor subtype through qapi_dealloc_visitor_new(),
      and can get by with less generated code, with diffs that look like:
      
      | void qapi_free_ACPIOSTInfo(ACPIOSTInfo *obj)
      | {
      |-    QapiDeallocVisitor *qdv;
      |     Visitor *v;
      |
      |     if (!obj) {
      |         return;
      |     }
      |
      |-    qdv = qapi_dealloc_visitor_new();
      |-    v = qapi_dealloc_get_visitor(qdv);
      |+    v = qapi_dealloc_visitor_new();
      |     visit_type_ACPIOSTInfo(v, NULL, &obj, NULL);
      |-    qapi_dealloc_visitor_cleanup(qdv);
      |+    visit_free(v);
      |}
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-5-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      2c0ef9f4
    • E
      qapi: Add parameter to visit_end_* · 1158bb2a
      Eric Blake 提交于
      Rather than making the dealloc visitor track of stack of pointers
      remembered during visit_start_* in order to free them during
      visit_end_*, it's a lot easier to just make all callers pass the
      same pointer to visit_end_*.  The generated code has access to the
      same pointer, while all other users are doing virtual walks and
      can pass NULL.  The dealloc visitor is then greatly simplified.
      
      All three visit_end_*() functions intentionally take a void**,
      even though the visit_start_*() functions differ between void**,
      GenericList**, and GenericAlternate**.  This is done for several
      reasons: when doing a virtual walk, passing NULL doesn't care
      what the type is, but when doing a generated walk, we already
      have to cast the caller's specific FOO* to call visit_start,
      while using void** lets us use visit_end without a cast. Also,
      an upcoming patch will add a clone visitor that wants to use
      the same implementation for all three visit_end callbacks,
      which is made easier if all three share the same signature.
      
      For visitors with already track per-object state (the QMP visitors
      via a stack, and the string visitors which do not allow nesting),
      add an assertion that the caller is indeed passing the same
      pointer to paired calls.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-4-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      1158bb2a
  10. 30 6月, 2016 2 次提交
    • E
      qapi: Fix crash on missing alternate member of QAPI struct · 9b4e38fe
      Eric Blake 提交于
      If a QAPI struct has a mandatory alternate member which is not
      present on input, the input visitor reports an error for the
      missing alternate without setting the discriminator, but the
      cleanup code for the struct still tries to use the dealloc
      visitor to clean up the alternate.
      
      Commit dbf11922 changed visit_start_alternate to set *obj to NULL
      when an error occurs, where it was previously left untouched.
      Thus, before the patch, the dealloc visitor is blindly trying to
      cleanup whatever branch corresponds to (*obj)->type == 0 (that is,
      QTYPE_NONE, because *obj still pointed to zeroed memory), which
      selects the default branch of the switch and sets an error, but
      this second error is ignored by the way the dealloc visitor is
      used; but after the patch, the attempt to switch dereferences NULL.
      
      When cleaning up after a partial object parse, we specifically
      check for !*obj after visit_start_struct() (see gen_visit_object());
      doing the same for alternates fixes the crash. Enhance the testsuite
      to give coverage for both missing struct and missing alternate
      members.
      
      Also add an abort - we expect visit_start_alternate() to either set an
      error or to set (*obj)->type to a valid QType that corresponds to
      actual user input, and QTYPE_NONE should never be reachable from valid
      input.  Had the abort() been in place earlier, we might have noticed
      the dealloc visitor dereferencing bogus zeroed memory prior to when
      commit dbf11922 forced our hand by setting *obj to NULL and causing a
      fault.
      
      Test case:
      
      {'execute':'blockdev-add', 'arguments':{'options':{'driver':'raw'}}}
      
      The choice of 'driver':'raw' selects a BlockdevOptionsGenericFormat
      struct, which has a mandatory 'file':'BlockdevRef' in QAPI.  Since
      'file' is missing as a sibling of 'driver', this should report a
      graceful error rather than fault.  After this patch, we are back to:
      
      {"error": {"class": "GenericError", "desc": "Parameter 'file' is missing"}}
      
      Generated code in qapi-visit.c changes as:
      
      |@@ -2444,6 +2444,9 @@ void visit_type_BlockdevRef(Visitor *v,
      |     if (err) {
      |         goto out;
      |     }
      |+    if (!*obj) {
      |+        goto out_obj;
      |+    }
      |     switch ((*obj)->type) {
      |     case QTYPE_QDICT:
      |         visit_start_struct(v, name, NULL, 0, &err);
      |@@ -2459,10 +2462,13 @@ void visit_type_BlockdevRef(Visitor *v,
      |     case QTYPE_QSTRING:
      |         visit_type_str(v, name, &(*obj)->u.reference, &err);
      |         break;
      |+    case QTYPE_NONE:
      |+        abort();
      |     default:
      |         error_setg(&err, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
      |                    "BlockdevRef");
      |     }
      |+out_obj:
      |     visit_end_alternate(v);
      
      Reported by Kashyap Chamarthy <kchamart@redhat.com>
      CC: qemu-stable@nongnu.org
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1466012271-5204-1-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Tested-by: NKashyap Chamarthy <kchamart@redhat.com>
      [Commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9b4e38fe
    • E
      checkpatch: There is no qemu_strtod() · 01fb8e19
      Eric Blake 提交于
      Maybe there should be; but until there is, we should not flag
      strtod() calls as something to replaced with qemu_strtod().
      
      We also lack qemu_strtof() and qemu_strtold(), but as no one
      has been using strtof() or strtold(), it's not worth complicating
      the regex for them.
      
      (Ironically, I had to use 'git commit -n' since checkpatch uses
      TAB indents, in violation of its own recommendations.)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465526889-8339-3-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      01fb8e19
  11. 20 6月, 2016 3 次提交
  12. 17 6月, 2016 2 次提交
  13. 07 6月, 2016 6 次提交
  14. 29 5月, 2016 1 次提交