1. 02 11月, 2015 8 次提交
    • E
      qapi-visit: Split off visit_type_FOO_fields forward decl · d02cf377
      Eric Blake 提交于
      We generate a static visit_type_FOO_fields() for every type
      FOO.  However, sometimes we need a forward declaration. Split
      the code to generate the forward declaration out of
      gen_visit_implicit_struct() into a new gen_visit_fields_decl(),
      and also prepare for a forward declaration to be emitted
      during gen_visit_struct(), so that a future patch can switch
      from using visit_type_FOO_implicit() to the simpler
      visit_type_FOO_fields() as part of unboxing the base class
      of a struct.
      
      No change to generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-8-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d02cf377
    • E
      vnc: Hoist allocation of VncBasicInfo to callers · 98481bfc
      Eric Blake 提交于
      A future qapi patch will rework generated structs with a base
      class to be unboxed.  In preparation for that, change the code
      that allocates then populates an info struct to instead merely
      populate the fields of an info field passed in as a parameter
      (renaming vnc_basic_info_get* to vnc_init_basic_info*). Add
      rudimentary Error handling at the lowest levels for cases
      where the old code returned NULL; but rather than plumb Error
      all the way through the stack, the callers drop the error and
      return NULL as before.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      98481bfc
    • E
      qapi: Reserve 'q_*' and 'has_*' member names · 9fb081e0
      Eric Blake 提交于
      c_name() produces names starting with 'q_' when protecting a
      dictionary member name that would fail to directly compile, but
      in doing so can cause clashes with any member name already
      beginning with 'q-' or 'q_'.  Likewise, we create a C name 'has_'
      for any optional member that can clash with any member name
      beginning with 'has-' or 'has_'.
      
      Technically, rather than blindly reserving the namespace,
      we could try to complain about user names only when an actual
      collision occurs, or even teach c_name() how to munge names
      to avoid collisions.  But it is not trivial, especially when
      collisions can occur across multiple types (such as via
      inheritance or flat unions).  Besides, no existing .json
      files are trying to use these names.  So it's easier to just
      outright forbid the potential for collision.  We can always
      relax things in the future if a real need arises for QMP to
      express member names that have been forbidden here.
      
      'has_' only has to be reserved for struct/union member names,
      while 'q_' is reserved everywhere (matching the fact that
      only members can be optional, while we use c_name() for munging
      both members and entities).  Note that we could relax 'q_'
      restrictions on entities independently from member names; for
      example, c_name('qmp_' + 'unix') would result in a different
      function name than our current 'qmp_' + c_name('unix').
      
      Update and add tests to cover the new error messages.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-6-git-send-email-eblake@redhat.com>
      [Consistently pass protect=False to c_name(); commit message tweaked
      slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9fb081e0
    • E
      qapi: Reserve '*List' type names for list types · 255960dd
      Eric Blake 提交于
      Type names ending in 'List' can clash with qapi list types in
      generated C.  We don't currently use such names. It is easier to
      outlaw them now than to worry about how to resolve such a clash
      in the future. For precedence, see commit 4dc2e690, which did the
      same for names ending in 'Kind' versus implicit enum types for
      qapi unions.
      
      Update the testsuite to match.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-5-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      255960dd
    • E
      qapi: More robust conditions for when labels are needed · f9e6102b
      Eric Blake 提交于
      We were using regular expressions to see if ret included
      any earlier text that emitted a 'goto out;' line, to decide
      whether we needed to output an 'out:' label.  But this is
      fragile, if the ret text can possibly combine more than one
      generated function body, where the first function used a
      goto but the second does not.  Change the code to just check
      for the known conditions which cause an error check to be
      needed.  Besides, it's slightly more efficient to use plain
      checks than regular expression searching.
      
      No change to generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-4-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      f9e6102b
    • E
      qapi: More idiomatic string operations · 8712fa53
      Eric Blake 提交于
      Rather than slicing the end of a string, we can use python's
      endswith().  And rather than creating a set of characters,
      we can search for a character within a string.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-3-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      8712fa53
    • E
      tests/qapi-schema: Test for reserved names, empty struct · 19767083
      Eric Blake 提交于
      Add some testsuite coverage to ensure future patches are on
      the right track:
      
      Our current C representation of qapi arrays is done by appending
      'List' to the element name; but we are not preventing the
      creation of an object type with the same name.  Add
      reserved-type-list.json to test this.  Then rename
      enum-union-clash.json to reserved-type-kind.json to cover the
      reservation that we DO detect, and shorten it to match the fact
      that the name is reserved even if there is no clash.
      
      We are failing to detect a collision between a dictionary member
      and the implicit 'has_*' flag for another optional member. The
      easiest fix would be for a future patch to reserve the entire
      "has[-_]" namespace for member names (the collision is also
      possible for branch names within flat unions, but only as long as
      branch names can collide with (non-variant) members; however,
      since future patches are about to remove that, it is not worth
      testing here). Add reserved-member-has.json to test this.
      
      A similar collision exists between a dictionary member where
      c_name() munges what might otherwise be a reserved name to start
      with 'q_', and another member explicitly starts with "q[-_]".
      Again, the easiest solution for a future patch will be reserving
      the entire namespace, but here for commands as well as members.
      Add reserved-member-q.json and reserved-command-q.json to test
      this; separate tests since arguably our munging of command 'unix'
      to 'qmp_q_unix()' could be done without a q_, which is different
      than the munging of a member 'unix' to 'foo.q_unix'.
      
      Finally, our testsuite does not have any compilation coverage
      of struct inheritance with empty qapi structs.  Update
      qapi-schema-test.json to test this.
      
      Note that there is currently no technical reason to forbid type
      name patterns from member names, or member name patterns from
      types, since the two are not in the same namespace in C and
      won't collide; but it's not worth adding positive tests of these
      corner cases at this time, especially while there is other churn
      pending in patches that rearrange which collisions actually
      happen.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-2-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      19767083
    • D
      qapi-schema: mark InetSocketAddress as mandatory again · 2ea1793b
      Daniel P. Berrange 提交于
      Revert the qapi-schema.json change done in:
      
        commit 0983f5e6
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Tue Sep 1 14:46:50 2015 +0100
      
          sockets: allow port to be NULL when listening on IP address
      
      Switching "port" from mandatory to optional causes the QAPI
      code generator to add a 'has_port' field to the InetSocketAddress
      struct. No code that created InetSocketAddress objects was updated
      to set 'has_port = true', which caused the non-NULL port strings
      to be silently dropped when copying InetSocketAddress objects.
      Reported-by: NKnut Omang <knuto@ifi.uio.no>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1445509543-30679-1-git-send-email-berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      2ea1793b
  2. 31 10月, 2015 2 次提交
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging · 3a958f55
      Peter Maydell 提交于
      # gpg: Signature made Thu 29 Oct 2015 18:09:16 GMT using RSA key ID 81AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
      
      * remotes/stefanha/tags/block-pull-request:
        block: Consider all child nodes in bdrv_requests_pending()
        target-arm: xlnx-zynqmp: Add sdhci support.
        sdhci: Split sdhci.h for public and internal device usage
        sd.h: Move sd.h to include/hw/sd/
        virtio: sync the dataplane vring state to the virtqueue before virtio_save
        gdb command: qemu handlers
        virtio-blk: switch off scsi-passthrough by default
        ppc/spapr: add 2.4 compat props
        s390x: include HW_COMPAT_* props
        qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pc
        qemu-gdb: extract parts of "qemu coroutine" implementation
        qemu-gdb: allow using glibc_pointer_guard() on core dumps
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      3a958f55
    • P
      Merge remote-tracking branch 'remotes/lalrae/tags/mips-20151030' into staging · e79ea9e4
      Peter Maydell 提交于
      MIPS patches 2015-10-30
      
      Changes:
      * R6 CPU can be woken up by non-enabled interrupts
      * PC fix in KVM
      * Coprocessor 0 XContext calculation fix
      * various MIPS R6 updates
      
      # gpg: Signature made Fri 30 Oct 2015 14:51:56 GMT using RSA key ID 0B29DA6B
      # gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"
      
      * remotes/lalrae/tags/mips-20151030:
        target-mips: fix updating XContext on mmu exception
        target-mips: add SIGRIE instruction
        target-mips: Set Config5.XNP for R6 cores
        target-mips: add PC, XNP reg numbers to RDHWR
        hw/mips_malta: Fix KVM PC initialisation
        target-mips: Add enum for BREAK32
        target-mips: update writing to CP0.Status.KX/SX/UX in MIPS Release R6
        target-mips: implement the CPU wake-up on non-enabled interrupts in R6
        target-mips: move the test for enabled interrupts to a separate function
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      e79ea9e4
  3. 30 10月, 2015 26 次提交
  4. 29 10月, 2015 4 次提交