1. 31 5月, 2017 1 次提交
    • M
      qapi: Reject alternates that can't work with keyval_parse() · c0644771
      Markus Armbruster 提交于
      Alternates are sum types like unions, but use the JSON type on the
      wire / QType in QObject instead of an explicit tag.  That's why we
      require alternate members to have distinct QTypes.
      
      The recently introduced keyval_parse() (commit d454dbe0) can only
      produce string scalars.  The qobject_input_visitor_new_keyval() input
      visitor mostly hides the difference, so code using a QObject input
      visitor doesn't have to care whether its input was parsed from JSON or
      KEY=VALUE,...  The difference leaks for alternates, as noted in commit
      0ee9ae7c: a non-string, non-enum scalar alternate value can't currently
      be expressed.
      
      In part, this is just our insufficiently sophisticated implementation.
      Consider alternate type 'GuestFileWhence'.  It has an integer member
      and a 'QGASeek' member.  The latter is an enumeration with values
      'set', 'cur', 'end'.  The meaning of b=set, b=cur, b=end, b=0, b=1 and
      so forth is perfectly obvious.  However, our current implementation
      falls apart at run time for b=0, b=1, and so forth.  Fixable, but not
      today; add a test case and a TODO comment.
      
      Now consider an alternate type with a string and an integer member.
      What's the meaning of a=42?  Is it the string "42" or the integer 42?
      Whichever meaning you pick makes the other inexpressible.  This isn't
      just an implementation problem, it's fundamental.  Our current
      implementation will pick string.
      
      So far, we haven't needed such alternates.  To make sure we stop and
      think before we add one that cannot sanely work with keyval_parse(),
      let's require alternate members to have sufficiently distinct
      representation in KEY=VALUE,... syntax:
      
      * A string member clashes with any other scalar member
      
      * An enumeration member clashes with bool members when it has value
        'on' or 'off'.
      
      * An enumeration member clashes with numeric members when it has a
        value that starts with '-', '+', or a decimal digit.  This is a
        rather lazy approximation of the actual number syntax accepted by
        the visitor.
      
        Note that enumeration values starting with '-' and '+' are rejected
        elsewhere already, but better safe than sorry.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1495471335-23707-5-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      c0644771
  2. 19 5月, 2017 1 次提交
  3. 17 5月, 2017 1 次提交
  4. 12 5月, 2017 1 次提交
  5. 26 4月, 2017 1 次提交
  6. 21 4月, 2017 1 次提交
    • X
      trace: Put all trace.o into libqemuutil.a · 3d1baccb
      Xu, Anthony 提交于
      Currently all trace.o are linked into qemu-system, qemu-img,
      qemu-nbd, qemu-io etc., even the corresponding components
      are not included.
      Put all trace.o into libqemuutil.a that the linker would only pull in .o
      files containing symbols that are actually referenced by the
      program.
      
      Signed-off -by: Anthony Xu <anthony.xu@intel.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      3d1baccb
  7. 21 3月, 2017 2 次提交
  8. 16 3月, 2017 9 次提交
  9. 07 3月, 2017 3 次提交
    • M
      test-qapi-util: New, covering qapi/qapi-util.c · 6c873d11
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-Id: <1488317230-26248-18-git-send-email-armbru@redhat.com>
      6c873d11
    • M
      keyval: New keyval_parse() · d454dbe0
      Markus Armbruster 提交于
      keyval_parse() parses KEY=VALUE,... into a QDict.  Works like
      qemu_opts_parse(), except:
      
      * Returns a QDict instead of a QemuOpts (d'oh).
      
      * Supports nesting, unlike QemuOpts: a KEY is split into key
        fragments at '.' (dotted key convention; the block layer does
        something similar on top of QemuOpts).  The key fragments are QDict
        keys, and the last one's value is updated to VALUE.
      
      * Each key fragment may be up to 127 bytes long.  qemu_opts_parse()
        limits the entire key to 127 bytes.
      
      * Overlong key fragments are rejected.  qemu_opts_parse() silently
        truncates them.
      
      * Empty key fragments are rejected.  qemu_opts_parse() happily
        accepts empty keys.
      
      * It does not store the returned value.  qemu_opts_parse() stores it
        in the QemuOptsList.
      
      * It does not treat parameter "id" specially.  qemu_opts_parse()
        ignores all but the first "id", and fails when its value isn't
        id_wellformed(), or duplicate (a QemuOpts with the same ID is
        already stored).  It also screws up when a value contains ",id=".
      
      * Implied value is not supported.  qemu_opts_parse() desugars "foo" to
        "foo=on", and "nofoo" to "foo=off".
      
      * An implied key's value can't be empty, and can't contain ','.
      
      I intend to grow this into a saner replacement for QemuOpts.  It'll
      take time, though.
      
      Note: keyval_parse() provides no way to do lists, and its key syntax
      is incompatible with the __RFQDN_ prefix convention for downstream
      extensions, because it blindly splits at '.', even in __RFQDN_.  Both
      issues will be addressed later in the series.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488317230-26248-4-git-send-email-armbru@redhat.com>
      d454dbe0
    • M
      tests: Fix gcov-files-test-qemu-opts-y, gcov-files-test-logging-y · 112c9446
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-Id: <1488317230-26248-3-git-send-email-armbru@redhat.com>
      112c9446
  10. 05 3月, 2017 2 次提交
    • M
      tests-qobject-input-strict: Merge into test-qobject-input-visitor · 77c47de2
      Markus Armbruster 提交于
      Much of test-qobject-input-strict.c duplicates
      test-qobject-input-strict.c, but with less assertions on expected
      output:
      
      * test_validate_struct() duplicates test_visitor_in_struct()
      
      * test_validate_struct_nested() duplicates
        test_visitor_in_struct_nested()
      
      * test_validate_list() duplicates the first half of
        test_visitor_in_list()
      
      * test_validate_union_native_list() duplicates
        test_visitor_in_native_list_int()
      
      * test_validate_union_flat() duplicates test_visitor_in_union_flat()
      
      * test_validate_alternate() duplicates the first part of
        test_visitor_in_alternate()
      
      Merge the remaining test cases into test-qobject-input-visitor.c, and
      drop the now redundant test-qobject-input-strict.c.
      
      Test case "/visitor/input-strict/fail/list" isn't really about lists,
      it's about a bad struct nested in a list.  Rename accordingly.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-21-git-send-email-armbru@redhat.com>
      77c47de2
    • M
      qmp-test: New, covering basic QMP protocol · f66e7ac8
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-4-git-send-email-armbru@redhat.com>
      f66e7ac8
  11. 02 3月, 2017 1 次提交
  12. 28 2月, 2017 1 次提交
  13. 21 2月, 2017 2 次提交
    • P
      aio: introduce aio_co_schedule and aio_co_wake · 0c330a73
      Paolo Bonzini 提交于
      aio_co_wake provides the infrastructure to start a coroutine on a "home"
      AioContext.  It will be used by CoMutex and CoQueue, so that coroutines
      don't jump from one context to another when they go to sleep on a
      mutex or waitqueue.  However, it can also be used as a more efficient
      alternative to one-shot bottom halves, and saves the effort of tracking
      which AioContext a coroutine is running on.
      
      aio_co_schedule is the part of aio_co_wake that starts a coroutine
      on a remove AioContext, but it is also useful to implement e.g.
      bdrv_set_aio_context callbacks.
      
      The implementation of aio_co_schedule is based on a lock-free
      multiple-producer, single-consumer queue.  The multiple producers use
      cmpxchg to add to a LIFO stack.  The consumer (a per-AioContext bottom
      half) grabs all items added so far, inverts the list to make it FIFO,
      and goes through it one item at a time until it's empty.  The data
      structure was inspired by OSv, which uses it in the very code we'll
      "port" to QEMU for the thread-safe CoMutex.
      
      Most of the new code is really tests.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-id: 20170213135235.12274-3-pbonzini@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      0c330a73
    • P
      block: move AioContext, QEMUTimer, main-loop to libqemuutil · c2b38b27
      Paolo Bonzini 提交于
      AioContext is fairly self contained, the only dependency is QEMUTimer but
      that in turn doesn't need anything else.  So move them out of block-obj-y
      to avoid introducing a dependency from io/ to block-obj-y.
      
      main-loop and its dependency iohandler also need to be moved, because
      later in this series io/ will call iohandler_get_aio_context.
      
      [Changed copyright "the QEMU team" to "other QEMU contributors" as
      suggested by Daniel Berrange and agreed by Paolo.
      --Stefan]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-id: 20170213135235.12274-2-pbonzini@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      c2b38b27
  14. 01 2月, 2017 2 次提交
  15. 31 1月, 2017 5 次提交
  16. 28 1月, 2017 1 次提交
    • M
      tests: fix linking test-char on win32 · 7a008751
      Marc-André Lureau 提交于
      test.char.exe fails to link:
      qemu-char.o: In function `win_chr_free':
      /home/elmarco/src/qemu/qemu-char.c:2149: undefined reference to `qemu_del_polling_cb'
      /home/elmarco/src/qemu/qemu-char.c:2151: undefined reference to `qemu_del_polling_cb'
      qemu-char.o: In function `win_stdio_thread':
      /home/elmarco/src/qemu/qemu-char.c:2568: undefined reference to `qemu_del_wait_object'
      qemu-char.o: In function `qemu_chr_open_stdio':
      /home/elmarco/src/qemu/qemu-char.c:2661: undefined reference to `qemu_add_wait_object'
      /home/elmarco/src/qemu/qemu-char.c:2646: undefined reference to
      `qemu_add_wait_object'
      ...
      
      It needs main-loop.o symbols, among others. Linking with
      $(test-block-obj-y) brings what's necessary. We could try to eventually
      strip to the minimum if needed.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7a008751
  17. 17 1月, 2017 1 次提交
  18. 16 1月, 2017 1 次提交
    • M
      qapi: add qapi2texi script · 3313b612
      Marc-André Lureau 提交于
      As the name suggests, the qapi2texi script converts JSON QAPI
      description into a texi file suitable for different target
      formats (info/man/txt/pdf/html...).
      
      It parses the following kind of blocks:
      
      Free-form:
      
        ##
        # = Section
        # == Subsection
        #
        # Some text foo with *emphasis*
        # 1. with a list
        # 2. like that
        #
        # And some code:
        # | $ echo foo
        # | -> do this
        # | <- get that
        #
        ##
      
      Symbol description:
      
        ##
        # @symbol:
        #
        # Symbol body ditto ergo sum. Foo bar
        # baz ding.
        #
        # @param1: the frob to frobnicate
        # @param2: #optional how hard to frobnicate
        #
        # Returns: the frobnicated frob.
        #          If frob isn't frobnicatable, GenericError.
        #
        # Since: version
        # Notes: notes, comments can have
        #        - itemized list
        #        - like this
        #
        # Example:
        #
        # -> { "execute": "quit" }
        # <- { "return": {} }
        #
        ##
      
      That's roughly following the following EBNF grammar:
      
      api_comment = "##\n" comment "##\n"
      comment = freeform_comment | symbol_comment
      freeform_comment = { "# " text "\n" | "#\n" }
      symbol_comment = "# @" name ":\n" { member | tag_section | freeform_comment }
      member = "# @" name ':' [ text ] "\n" freeform_comment
      tag_section = "# " ( "Returns:", "Since:", "Note:", "Notes:", "Example:", "Examples:" ) [ text ]  "\n" freeform_comment
      text = free text with markup
      
      Note that the grammar is ambiguous: a line "# @foo:\n" can be parsed
      both as freeform_comment and as symbol_comment.  The actual parser
      recognizes symbol_comment.
      
      See docs/qapi-code-gen.txt for more details.
      
      Deficiencies and limitations:
      - the generated QMP documentation includes internal types
      - union type support is lacking
      - type information is lacking in generated documentation
      - doc comment error message positions are imprecise, they point
        to the beginning of the comment.
      - a few minor issues, all marked TODO/FIXME in the code
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20170113144135.5150-16-marcandre.lureau@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [test-qapi.py tweaked to avoid trailing empty lines in .out]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3313b612
  19. 11 1月, 2017 1 次提交
  20. 22 12月, 2016 1 次提交
  21. 16 12月, 2016 1 次提交
  22. 15 11月, 2016 1 次提交