Skip to content
Snippets Groups Projects
  1. Nov 04, 2020
  2. Jul 10, 2020
  3. Sep 24, 2019
  4. Mar 22, 2017
  5. Mar 05, 2017
    • Markus Armbruster's avatar
      qapi: Make input visitors detect unvisited list tails · a4a1c70d
      Markus Armbruster authored
      
      Fix the design flaw demonstrated in the previous commit: new method
      check_list() lets input visitors report that unvisited input remains
      for a list, exactly like check_struct() lets them report that
      unvisited input remains for a struct or union.
      
      Implement the method for the qobject input visitor (straightforward),
      and the string input visitor (less so, due to the magic list syntax
      there).  The opts visitor's list magic is even more impenetrable, and
      all I can do there today is a stub with a FIXME comment.  No worse
      than before.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488544368-30622-26-git-send-email-armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      a4a1c70d
    • Markus Armbruster's avatar
      qapi: Make string input and opts visitor require non-null input · f332e830
      Markus Armbruster authored
      
      The string input visitor tries to cope with null input.  Null input
      isn't used anywhere, and isn't covered by tests.  Unsurprisingly, it
      doesn't fully work: start_list() crashes because it passes the input
      via parse_str() to strtoll() unchecked.
      
      Make string_input_visitor_new() assert its argument isn't null, and
      drop the code trying to deal with null input.
      
      The opts visitor crashes when you try to actually visit something with
      null input.  Make opts_visitor_new() assert its argument isn't null,
      mostly for clarity.
      
      qobject_input_visitor_new() already asserts its argument isn't null.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-17-git-send-email-armbru@redhat.com>
      f332e830
  6. Feb 23, 2017
  7. Jul 06, 2016
    • Eric Blake's avatar
      opts-visitor: Favor new visit_free() function · 09204eac
      Eric Blake authored
      
      Now that we have a polymorphic visit_free(), we no longer need
      opts_visitor_cleanup(); which in turn means we no longer need
      to return a subtype from opts_visitor_new() nor a public upcast
      function.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-6-git-send-email-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      09204eac
    • Eric Blake's avatar
      qapi: Add new visit_free() function · 2c0ef9f4
      Eric Blake authored
      
      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: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-5-git-send-email-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      2c0ef9f4
    • Eric Blake's avatar
      qapi: Add parameter to visit_end_* · 1158bb2a
      Eric Blake authored
      
      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: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-4-git-send-email-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      1158bb2a
  8. May 12, 2016
    • Eric Blake's avatar
      qapi: Simplify semantics of visit_next_list() · d9f62dde
      Eric Blake authored
      
      The semantics of the list visit are somewhat baroque, with the
      following pseudocode when FooList is used:
      
      start()
      for (prev = head; cur = next(prev); prev = &cur) {
          visit(&cur->value)
      }
      
      Note that these semantics (advance before visit) requires that
      the first call to next() return the list head, while all other
      calls return the next element of the list; that is, every visitor
      implementation is required to track extra state to decide whether
      to return the input as-is, or to advance.  It also requires an
      argument of 'GenericList **' to next(), solely because the first
      iteration might need to modify the caller's GenericList head, so
      that all other calls have to do a layer of dereferencing.
      
      Thankfully, we only have two uses of list visits in the entire
      code base: one in spapr_drc (which completely avoids
      visit_next_list(), feeding in integers from a different source
      than uint8List), and one in qapi-visit.py.  That is, all other
      list visitors are generated in qapi-visit.c, and share the same
      paradigm based on a qapi FooList type, so we can refactor how
      lists are laid out with minimal churn among clients.
      
      We can greatly simplify things by hoisting the special case
      into the start() routine, and flipping the order in the loop
      to visit before advance:
      
      start(head)
      for (tail = *head; tail; tail = next(tail)) {
          visit(&tail->value)
      }
      
      With the simpler semantics, visitors have less state to track,
      the argument to next() is reduced to 'GenericList *', and it
      also becomes obvious whether an input visitor is allocating a
      FooList during visit_start_list() (rather than the old way of
      not knowing if an allocation happened until the first
      visit_next_list()).  As a minor drawback, we now allocate in
      two functions instead of one, and have to pass the size to
      both functions (unless we were to tweak the input visitors to
      cache the size to start_list for reuse during next_list, but
      that defeats the goal of less visitor state).
      
      The signature of visit_start_list() is chosen to match
      visit_start_struct(), with the new parameters after 'name'.
      
      The spapr_drc case is a virtual visit, done by passing NULL for
      list, similarly to how NULL is passed to visit_start_struct()
      when a qapi type is not used in those visits.  It was easy to
      provide these semantics for qmp-output and dealloc visitors,
      and a bit harder for qmp-input (several prerequisite patches
      refactored things to make this patch straightforward).  But it
      turned out that the string and opts visitors munge enough other
      state during visit_next_list() to make it easier to just
      document and require a GenericList visit for now; an assertion
      will remind us to adjust things if we need the semantics in the
      future.
      
      Several pre-requisite cleanup patches made the reshuffling of
      the various visitors easier; particularly the qmp input visitor.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-24-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      d9f62dde
    • Eric Blake's avatar
      qapi: Split visit_end_struct() into pieces · 15c2f669
      Eric Blake authored
      
      As mentioned in previous patches, we want to call visit_end_struct()
      functions unconditionally, so that visitors can release resources
      tied up since the matching visit_start_struct() without also having
      to worry about error priority if more than one error occurs.
      
      Even though error_propagate() can be safely used to ignore a second
      error during cleanup caused by a first error, it is simpler if the
      cleanup cannot set an error.  So, split out the error checking
      portion (basically, input visitors checking for unvisited keys) into
      a new function visit_check_struct(), which can be safely skipped if
      any earlier errors are encountered, and leave the cleanup portion
      (which never fails, but must be called unconditionally if
      visit_start_struct() succeeded) in visit_end_struct().
      
      Generated code in qapi-visit.c has diffs resembling:
      
      |@@ -59,10 +59,12 @@ void visit_type_ACPIOSTInfo(Visitor *v,
      |         goto out_obj;
      |     }
      |     visit_type_ACPIOSTInfo_members(v, obj, &err);
      |-    error_propagate(errp, err);
      |-    err = NULL;
      |+    if (err) {
      |+        goto out_obj;
      |+    }
      |+    visit_check_struct(v, &err);
      | out_obj:
      |-    visit_end_struct(v, &err);
      |+    visit_end_struct(v);
      | out:
      
      and in qapi-event.c:
      
      @@ -47,7 +47,10 @@ void qapi_event_send_acpi_device_ost(ACP
      |         goto out;
      |     }
      |     visit_type_q_obj_ACPI_DEVICE_OST_arg_members(v, &param, &err);
      |-    visit_end_struct(v, err ? NULL : &err);
      |+    if (!err) {
      |+        visit_check_struct(v, &err);
      |+    }
      |+    visit_end_struct(v);
      |     if (err) {
      |         goto out;
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-20-git-send-email-eblake@redhat.com>
      [Conflict with a doc fixup resolved]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      15c2f669
    • Eric Blake's avatar
      qapi: Guarantee NULL obj on input visitor callback error · e58d695e
      Eric Blake authored
      
      Our existing input visitors were not very consistent on errors in a
      function taking 'TYPE **obj'.  These are start_struct(),
      start_alternate(), type_str(), and type_any().  next_list() is
      similar, but can't fail (see commit 08f9541d).  While all of them set
      '*obj' to allocated storage on success, it was not obvious whether
      '*obj' was guaranteed safe on failure, or whether it was left
      uninitialized.  But a future patch wants to guarantee that
      visit_type_FOO() does not leak a partially-constructed obj back to
      the caller; it is easier to implement this if we can reliably state
      that input visitors assign '*obj' regardless of success or failure,
      and that on failure *obj is NULL.  Add assertions to enforce
      consistency in the final setting of err vs. *obj.
      
      The opts-visitor start_struct() doesn't set an error, but it
      also was doing a weird check for 0 size; all callers pass in
      non-zero size if obj is non-NULL.
      
      The testsuite has at least one spot where we no longer need
      to pre-initialize a variable prior to a visit; valgrind confirms
      that the test is still fine with the cleanup.
      
      A later patch will document the design constraint implemented
      here.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-3-git-send-email-eblake@redhat.com>
      [visit_start_alternate()'s assertion tightened, commit message tweaked]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      e58d695e
    • Eric Blake's avatar
      qapi-visit: Add visitor.type classification · 983f52d4
      Eric Blake authored
      
      We have three classes of QAPI visitors: input, output, and dealloc.
      Currently, all implementations of these visitors have one thing in
      common based on their visitor type: the implementation used for the
      visit_type_enum() callback.  But since we plan to add more such
      common behavior, in relation to documenting and further refining
      the semantics, it makes more sense to have the visitor
      implementations advertise which class they belong to, so the common
      qapi-visit-core code can use that information in multiple places.
      
      A later patch will better document the types of visitors directly
      in visitor.h.
      
      For this patch, knowing the class of a visitor implementation lets
      us make input_type_enum() and output_type_enum() become static
      functions, by replacing the callback function Visitor.type_enum()
      with the simpler enum member Visitor.type.  Share a common
      assertion in qapi-visit-core as part of the refactoring.
      
      Move comments in opts-visitor.c to match the refactored layout.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-2-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      983f52d4
  9. Mar 22, 2016
    • Veronia Bahaa's avatar
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa authored
      
      Move declarations out of qemu-common.h for functions declared in
      utils/ files: e.g. include/qemu/path.h for utils/path.c.
      Move inline functions out of qemu-common.h and into new files (e.g.
      include/qemu/bcd.h)
      
      Signed-off-by: default avatarVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f348b6d1
    • Markus Armbruster's avatar
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster authored
      
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  10. Feb 19, 2016
    • Eric Blake's avatar
      qapi: Adjust layout of FooList types · e65d89bf
      Eric Blake authored
      
      By sticking the next pointer first, we don't need a union with
      64-bit padding for smaller types.  On 32-bit platforms, this
      can reduce the size of uint8List from 16 bytes (or 12, depending
      on whether 64-bit ints can tolerate 4-byte alignment) down to 8.
      It has no effect on 64-bit platforms (where alignment still
      dictates a 16-byte struct); but fewer anonymous unions is still
      a win in my book.
      
      It requires visit_next_list() to gain a size parameter, to know
      what size element to allocate; comparable to the size parameter
      of visit_start_struct().
      
      I debated about going one step further, to allow for fewer casts,
      by doing:
          typedef GenericList GenericList;
          struct GenericList {
              GenericList *next;
          };
          struct FooList {
              GenericList base;
              Foo *value;
          };
      so that you convert to 'GenericList *' by '&foolist->base', and
      back by 'container_of(generic, GenericList, base)' (as opposed to
      the existing '(GenericList *)foolist' and '(FooList *)generic').
      But doing that would require hoisting the declaration of
      GenericList prior to inclusion of qapi-types.h, rather than its
      current spot in visitor.h; it also makes iteration a bit more
      verbose through 'foolist->base.next' instead of 'foolist->next'.
      
      Note that for lists of objects, the 'value' payload is still
      hidden behind a boxed pointer.  Someday, it would be nice to do:
      
      struct FooList {
          FooList *next;
          Foo value;
      };
      
      for one less level of malloc for each list element.  This patch
      is a step in that direction (now that 'next' is no longer at a
      fixed non-zero offset within the struct, we can store more than
      just a pointer's-worth of data as the value payload), but the
      actual conversion would be a task for another series, as it will
      touch a lot of code.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1455778109-6278-10-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      e65d89bf
    • Eric Blake's avatar
      qapi: Simplify excess input reporting in input visitors · f96493b1
      Eric Blake authored
      
      When reporting that an unvisited member remains at the end of an
      input visit for a struct, we were using g_hash_table_find()
      coupled with a callback function that always returns true, to
      locate an arbitrary member of the hash table.  But if all we
      need is an arbitrary entry, we can get that from a single-use
      iterator, without needing a tautological callback function.
      
      Technically, our cast of &(GQueue *) to (void **) is not strict
      C (while void * must be able to hold all other pointers, nothing
      says a void ** has to be the same width or representation as a
      GQueue **).  The kosher way to write it would be the verbose:
      
          void *tmp;
          GQueue *any;
          if (g_hash_table_iter_next(&iter, NULL, &tmp)) {
              any = tmp;
      
      But our code base (not to mention glib itself) already has other
      cases of assuming that ALL pointers have the same width and
      representation, where a compiler would have to go out of its way
      to mis-compile our borderline behavior.
      
      Suggested-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1455778109-6278-2-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      f96493b1
  11. Feb 08, 2016
    • Eric Blake's avatar
      qapi: Drop unused error argument for list and implicit struct · 08f9541d
      Eric Blake authored
      
      No backend was setting an error when ending the visit of a list or
      implicit struct, or when moving to the next list node.  Make the
      callers a bit easier to follow by making this a part of the contract,
      and removing the errp argument - callers can then unconditionally end
      an object as part of cleanup without having to think about whether a
      second error is dominated by a first, because there is no second
      error.
      
      A later patch will then tackle the larger task of splitting
      visit_end_struct(), which can indeed set an error.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1454075341-13658-24-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      08f9541d
    • Eric Blake's avatar
      qapi: Drop unused 'kind' for struct/enum visit · 337283df
      Eric Blake authored
      
      visit_start_struct() and visit_type_enum() had a 'kind' argument
      that was usually set to either the stringized version of the
      corresponding qapi type name, or to NULL (although some clients
      didn't even get that right).  But nothing ever used the argument.
      It's even hard to argue that it would be useful in a debugger,
      as a stack backtrace also tells which type is being visited.
      
      Therefore, drop the 'kind' argument as dead.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-22-git-send-email-eblake@redhat.com>
      [Harmless rebase mistake cleaned up]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      337283df
    • Eric Blake's avatar
      qapi: Swap 'name' in visit_* callbacks to match public API · 0b2a0d6b
      Eric Blake authored
      
      As explained in the previous patches, matching argument order of
      'name, &value' to JSON's "name":value makes sense.  However,
      while the last two patches were easy with Coccinelle, I ended up
      doing this one all by hand.  Now all the visitor callbacks match
      the main interface.
      
      The compiler is able to enforce that all clients match the changed
      interface in visitor-impl.h, even where two pointers are being
      swapped, because only one of the two pointers is const (if that
      were not the case, then C's looseness on treating 'char *' like
      'void *' would have made review a bit harder).
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-21-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      0b2a0d6b
    • Eric Blake's avatar
      qapi: Prefer type_int64 over type_int in visitors · 4c40314a
      Eric Blake authored
      
      The qapi builtin type 'int' is basically shorthand for the type
      'int64'.  In fact, since no visitor was providing the optional
      type_int64() callback, visit_type_int64() was just always falling
      back to type_int(), cementing the equivalence between the types.
      
      However, some visitors are providing a type_uint64() callback.
      For purposes of code consistency, it is nicer if all visitors
      use the paired type_int64/type_uint64 names rather than the
      mismatched type_int/type_uint64.  So this patch just renames
      the signed int callbacks in place, dropping the type_int()
      callback as redundant, and a later patch will focus on the
      unsigned int callbacks.
      
      Add some FIXMEs to questionable reuse of errp in code touched
      by the rename, while at it (the reuse works as long as the
      callbacks don't modify value when setting an error, but it's not
      a good example to set) - a later patch will then fix those.
      
      No change in functionality here, although further cleanups are
      in the pipeline.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1454075341-13658-14-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      4c40314a
    • Eric Blake's avatar
      qapi: Avoid use of misnamed DO_UPCAST() · d7bea75d
      Eric Blake authored
      
      The macro DO_UPCAST() is incorrectly named: it converts from a
      parent class to a derived class (which is a downcast).  Better,
      and more consistent with some of the other qapi visitors, is
      to use the container_of() macro through a to_FOO() helper.  Names
      like 'to_ov()' may be a bit short, but for a static helper it
      doesn't hurt too much, and matches existing practice in files
      like qmp-input-visitor.c.
      
      Our current definition of container_of() is weaker than
      DO_UPCAST(), in that it does not require the derived class to
      have Visitor as its first member, but this does not hurt our
      usage patterns in qapi visitors.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-3-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      d7bea75d
  12. Feb 04, 2016
  13. Dec 17, 2015
    • Eric Blake's avatar
      qapi: Simplify visits of optional fields · 5cdc8831
      Eric Blake authored
      
      None of the visitor callbacks would set an error when testing
      if an optional field was present; make this part of the interface
      contract by eliminating the errp argument.
      
      The resulting generated code has a nice diff:
      
      |-    visit_optional(v, &has_fdset_id, "fdset-id", &err);
      |-    if (err) {
      |-        goto out;
      |-    }
      |+    visit_optional(v, &has_fdset_id, "fdset-id");
      |     if (has_fdset_id) {
      |         visit_type_int(v, &fdset_id, "fdset-id", &err);
      |         if (err) {
      |             goto out;
      |         }
      |     }
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1449033659-25497-9-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      5cdc8831
  14. Sep 25, 2015
  15. Jun 22, 2015
  16. Jun 16, 2014
  17. May 15, 2014
    • Markus Armbruster's avatar
      qapi: Replace start_optional()/end_optional() by optional() · e2cd0f4f
      Markus Armbruster authored
      
      Semantics of end_optional() differ subtly from the other end_FOO()
      callbacks: when start_FOO() succeeds, the matching end_FOO() gets
      called regardless of what happens in between.  end_optional() gets
      called only when everything in between succeeds as well.  Entirely
      undocumented, like all of the visitor API.
      
      The only user of Visitor Callback end_optional() never did anything,
      and was removed in commit 9f9ab465.
      
      I'm about to clean up error handling in the generated visitor code,
      and end_optional() is in my way.  No users mean no test cases, and
      making non-trivial cleanup transformations without test cases doesn't
      strike me as a good idea.
      
      Drop end_optional(), and rename start_optional() to optional().  We
      can always go back to a pair of callbacks when we have an actual need.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
      e2cd0f4f
  18. May 08, 2014
  19. Mar 03, 2014
  20. Aug 20, 2013
Loading