Skip to content
Snippets Groups Projects
  1. Nov 11, 2020
  2. Sep 02, 2020
  3. Jan 30, 2020
  4. Oct 14, 2019
  5. Jun 12, 2019
    • Markus Armbruster's avatar
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster authored
      
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
    • Markus Armbruster's avatar
      Include qemu/module.h where needed, drop it from qemu-common.h · 0b8fa32f
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-4-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      hw/usb/dev-hub.c hw/misc/exynos4210_rng.c hw/misc/bcm2835_rng.c
      hw/misc/aspeed_scu.c hw/display/virtio-vga.c hw/arm/stm32f205_soc.c;
      ui/cocoa.m fixed up]
      0b8fa32f
  6. Apr 17, 2019
  7. Oct 19, 2018
  8. Jun 11, 2018
  9. May 15, 2018
    • Hanna Reitz's avatar
      qemu-io: Use purely string blockdev options · 2a01c01f
      Hanna Reitz authored
      
      Currently, qemu-io only uses string-valued blockdev options (as all are
      converted directly from QemuOpts) -- with one exception: -U adds the
      force-share option as a boolean.  This in itself is already a bit
      questionable, but a real issue is that it also assumes the value already
      existing in the options QDict would be a boolean, which is wrong.
      
      That has the following effect:
      
      $ ./qemu-io -r -U --image-opts \
          driver=file,filename=/dev/null,force-share=off
      [1]    15200 segmentation fault (core dumped)  ./qemu-io -r -U
      --image-opts driver=file,filename=/dev/null,force-share=off
      
      Since @opts is converted from QemuOpts, the value must be a string, and
      we have to compare it as such.  Consequently, it makes sense to also set
      it as a string instead of a boolean.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Message-id: 20180502202051.15493-2-mreitz@redhat.com
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      2a01c01f
  10. May 04, 2018
  11. Mar 12, 2018
    • Thomas Huth's avatar
      Polish the version strings containing the package version · 7e563bfb
      Thomas Huth authored
      Since commit 67a1de0d there is no space anymore between the
      version number and the parentheses when running configure with
      --with-pkgversion=foo :
      
       $ qemu-system-s390x --version
       QEMU emulator version 2.11.50(foo)
      
      But the space is included when building without that option
      when building from a git checkout:
      
       $ qemu-system-s390x --version
       QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty)
      
      The same confusion exists with the "query-version" QMP command.
      Let's fix this by introducing a proper QEMU_FULL_VERSION definition
      that includes the space and parentheses, while the QEMU_PKGVERSION
      should just cleanly contain the package version string itself.
      Note that this also changes the behavior of the "query-version" QMP
      command (the space and parentheses are not included there anymore),
      but that's supposed to be OK since the strings there are not meant
      to be parsed by other tools.
      
      Fixes: 67a1de0d
      Buglink: https://bugs.launchpad.net/qemu/+bug/1673373
      
      
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      7e563bfb
  12. Mar 06, 2018
  13. Feb 13, 2018
    • Daniel P. Berrangé's avatar
      qemu-io: fix EOF Ctrl-D handling in qemu-io readline code · 0e448a05
      Daniel P. Berrangé authored
      
      qemu-io puts the TTY into non-canonical mode, which means no EOF processing is
      done and thus getchar() will never return the EOF constant. Instead we have to
      query the TTY attributes to determine the configured EOF character (usually
      Ctrl-D / 0x4), and then explicitly check for that value. This fixes the
      regression that prevented Ctrl-D from triggering an exit of qemu-io that has
      existed since readline was first added in
      
        commit 0cf17e18
        Author: Stefan Hajnoczi <stefanha@redhat.com>
        Date:   Thu Nov 14 11:54:17 2013 +0100
      
          qemu-io: use readline.c
      
      It also ensures that a newline is printed when exiting, to complete the
      line output by the "qemu-io> " prompt.
      
      Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      0e448a05
  14. Feb 09, 2018
  15. Oct 06, 2017
  16. Aug 08, 2017
  17. Jul 11, 2017
  18. Jul 10, 2017
    • Eric Blake's avatar
      qemu-io: Don't die on second open · 64ebf556
      Eric Blake authored
      
      Most callback commands in qemu-io return 0 to keep the interpreter
      loop running, or 1 to quit immediately.  However, open_f() just
      passed through the return value of openfile(), which has different
      semantics of returning 0 if a file was opened, or 1 on any failure.
      
      As a result of mixing the return semantics, we are forcing the
      qemu-io interpreter to exit early on any failures, which is rather
      annoying when some of the failures are obviously trying to give
      the user a hint of how to proceed (if we didn't then kill qemu-io
      out from under the user's feet):
      
      $ qemu-io
      qemu-io> open foo
      qemu-io> open foo
      file open already, try 'help close'
      $ echo $?
      0
      
      In general, we WANT openfile() to report failures, since it is the
      function used in the form 'qemu-io -c "$something" no_such_file'
      for performing one or more -c options on a single file, and it is
      not worth attempting $something if the file itself cannot be opened.
      So the solution is to fix open_f() to always return 0 (when we are
      in interactive mode, even failure to open should not end the
      session), and save the return value of openfile() for command line
      use in main().
      
      Note, however, that we do have some qemu-iotests that do 'qemu-io
      -c "open file" -c "$something"'; such tests will now proceed to
      attempt $something whether or not the open succeeded, the same way
      as if the two commands had been attempted in interactive mode.  As
      such, the expected output for those tests has to be modified.  But it
      also means that it is now possible to use -c close and have a single
      qemu-io command line operate on more than one file even without
      using interactive mode.  Although the '-c open' action is a subtle
      change in behavior, remember that qemu-io is for debugging purposes,
      so as long as it serves the needs of qemu-iotests while still being
      reasonable for interactive use, it should not be a problem that we
      are changing tests to the new behavior.
      
      This has been awkward since at least as far back as commit
      e3aff4f6, in 2009.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarFam Zheng <famz@redhat.com>
      Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      64ebf556
  19. May 23, 2017
  20. May 11, 2017
  21. May 09, 2017
  22. Feb 11, 2017
    • Nir Soffer's avatar
      qemu-io: Return non-zero exit code on failure · b7aa1315
      Nir Soffer authored
      
      The result of openfile was not checked, leading to failure deep in the
      actual command with confusing error message, and exiting with exit code 0.
      
      Here is a simple example - trying to read with the wrong format:
      
          $ touch file
          $ qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $?
          can't open device file: Image is not in qcow2 format
          no file open, try 'help open'
          0
      
      With this patch, we fail earlier with exit code 1:
      
          $ ./qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $?
          can't open device file: Image is not in qcow2 format
          1
      
      Failing earlier, we don't log this error now:
      
          no file open, try 'help open'
      
      But some tests expected it; the line was removed from the test output.
      
      Signed-off-by: default avatarNir Soffer <nirsof@gmail.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-id: 20170201003120.23378-2-nirsof@gmail.com
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      b7aa1315
  23. Oct 12, 2016
    • Daniel P. Berrangé's avatar
      trace: provide mechanism for registering trace events · fe4db84d
      Daniel P. Berrangé authored
      
      Remove the notion of there being a single global array
      of trace events, by introducing a method for registering
      groups of events.
      
      The module_call_init() needs to be invoked at the start
      of any program that wants to make use of the trace
      support. Currently this covers system emulators qemu-nbd,
      qemu-img and qemu-io.
      
      [Squashed the following fix from Daniel P. Berrange
      <berrange@redhat.com>:
      
      linux-user/bsd-user: initialize trace events subsystem
      
      The bsd-user/linux-user programs make use of the CPU emulation
      code and this now requires that the trace events subsystem
      is enabled, otherwise it'll crash trying to allocate an empty
      trace events bitmap for the CPU object.
      
      --Stefan]
      
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarLluís Vilanova <vilanova@ac.upc.edu>
      Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1475588159-30598-14-git-send-email-berrange@redhat.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      fe4db84d
  24. Jun 28, 2016
  25. May 20, 2016
  26. May 12, 2016
    • Eric Blake's avatar
      qemu-io: Make 'open' subcommand more like command line · b8d970f1
      Eric Blake authored
      
      The command line defaults to BDRV_O_UNMAP, but can use
      -d to reset it.  Meanwhile, the 'open' subcommand was
      defaulting to no discards, with no way to set it.
      
      The command line has both -n and -tMODE to set a variety
      of cache modes, but the 'open' subcommand had only -n.
      
      The 'open' subcommand had no way to set BDRV_O_NATIVE_AIO.
      
      Note that the 'reopen' subcommand uses '-c' where the
      command line and 'open' use -t.  Making that consistent
      would be a separate patch.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-id: 1462677405-4752-3-git-send-email-eblake@redhat.com
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      b8d970f1
    • Eric Blake's avatar
      qemu-io: Add missing option documentation · e4e12bb2
      Eric Blake authored
      
      The Usage: summary is missing several options, but rather than
      having to maintain it, it's simpler to just state [OPTIONS],
      since the options are spelled out below.
      
      Commit 499afa25 added --image-opts, but forgot to document it in
      --help.  Likewise for commit 9e8f1835 and -d/--discard.
      
      Commit e3aff4f6 put "-o/--offset" in the long opts, but it has
      never been honored.
      
      Add a note that '-n' is short for '-t none'.
      
      Commit 9a2d77ad killed the -C option, but forgot to undocument
      it for the 'open' subcommand.
      
      Finally, commit 10d9d75c removed -g/--growable, but forgot to
      cull it from the valid short options.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-id: 1462677405-4752-2-git-send-email-eblake@redhat.com
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      e4e12bb2
  27. Apr 28, 2016
    • Markus Armbruster's avatar
      qom: -object error messages lost location, restore it · 51b9b478
      Markus Armbruster authored
      
      qemu_opts_foreach() runs its callback with the error location set to
      the option's location.  Any errors the callback reports use the
      option's location automatically.
      
      Commit 90998d58 moved the actual error reporting from "inside"
      qemu_opts_foreach() to after it.  Here's a typical hunk:
      
      	 if (qemu_opts_foreach(qemu_find_opts("object"),
          -                          object_create,
          -                          object_create_initial, NULL)) {
          +                          user_creatable_add_opts_foreach,
          +                          object_create_initial, &err)) {
          +        error_report_err(err);
      	     exit(1);
      	 }
      
      Before, object_create() reports from within qemu_opts_foreach(), using
      the option's location.  Afterwards, we do it after
      qemu_opts_foreach(), using whatever location happens to be current
      there.  Commonly a "none" location.
      
      This is because Error objects don't have location information.
      Problematic.
      
      Reproducer:
      
          $ qemu-system-x86_64 -nodefaults -display none -object secret,id=foo,foo=bar
          qemu-system-x86_64: Property '.foo' not found
      
      Note no location.  This commit restores it:
      
          qemu-system-x86_64: -object secret,id=foo,foo=bar: Property '.foo' not found
      
      Note that the qemu_opts_foreach() bug just fixed could mask the bug
      here: if the location it leaves dangling hasn't been clobbered, yet,
      it's the correct one.
      
      Reported-by: default avatarEric Blake <eblake@redhat.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1461767349-15329-4-git-send-email-armbru@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      [Paragraph on Error added to commit message]
      51b9b478
  28. Apr 12, 2016
  29. Mar 30, 2016
  30. Mar 22, 2016
    • 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
  31. Mar 17, 2016
    • Hanna Reitz's avatar
      blockdev: Split monitor reference from BB creation · efaa7c4e
      Hanna Reitz authored
      
      Before this patch, blk_new() automatically assigned a name to the new
      BlockBackend and considered it referenced by the monitor. This patch
      removes the implicit monitor_add_blk() call from blk_new() (and
      consequently the monitor_remove_blk() call from blk_delete(), too) and
      thus blk_new() (and related functions) no longer take a BB name
      argument.
      
      In fact, there is only a single point where blk_new()/blk_new_open() is
      called and the new BB is monitor-owned, and that is in blockdev_init().
      Besides thus relieving us from having to invent names for all of the BBs
      we use in qemu-img, this fixes a bug where qemu cannot create a new
      image if there already is a monitor-owned BB named "image".
      
      If a BB and its BDS tree are created in a single operation, as of this
      patch the BDS tree will be created before the BB is given a name
      (whereas it was the other way around before). This results in minor
      change to the output of iotest 087, whose reference output is amended
      accordingly.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      efaa7c4e
  32. Feb 22, 2016
Loading