1. 27 3月, 2018 1 次提交
  2. 09 3月, 2018 1 次提交
  3. 03 3月, 2018 2 次提交
  4. 09 2月, 2018 1 次提交
  5. 23 1月, 2018 2 次提交
  6. 08 8月, 2017 1 次提交
  7. 18 7月, 2017 1 次提交
    • P
      block/vmdk: Report failures in vmdk_read_cid() · 9877860e
      Peter Maydell 提交于
      The function vmdk_read_cid() can fail if the read on the underlying
      block device fails, or if there's a format error in the VMDK file.
      However its API doesn't provide a mechanism to report these errors,
      and in some cases we were returning a CID of 0 and in some cases a
      CID of 0xffffffff, either of which might potentially be valid values.
      
      Change the function to return 0 on success or a negative errno, and
      return the CID via a uint32_t* argument. Update the callsites to
      handle and propagate the error appropriately.
      
      This fixes in passing a Coverity-spotted issue (CID 1350038) where
      we weren't checking the return value from sscanf().
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      9877860e
  8. 11 7月, 2017 1 次提交
  9. 17 5月, 2017 1 次提交
  10. 28 4月, 2017 1 次提交
  11. 01 3月, 2017 2 次提交
    • K
      block: Add BDRV_O_RESIZE for blk_new_open() · 55880601
      Kevin Wolf 提交于
      blk_new_open() is a convenience function that processes flags rather
      than QDict options as a simple way to just open an image file.
      
      In order to keep it convenient in the future, it must automatically
      request the necessary permissions. This can easily be inferred from the
      flags for read and write, but we need another flag that tells us whether
      to get the resize permission.
      
      We can't just always request it because that means that no block jobs
      can run on the resulting BlockBackend (which is something that e.g.
      qemu-img commit wants to do), but we also can't request it never because
      most of the .bdrv_create() implementations call blk_truncate().
      
      The solution is to introduce another flag that is passed by all users
      that want to resize the image.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Acked-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      55880601
    • K
      block: Request child permissions in format drivers · 862f215f
      Kevin Wolf 提交于
      This makes use of the .bdrv_child_perm() implementation for formats that
      we just added. All format drivers expose the permissions they actually
      need nows, so that they can be set accordingly and updated when parents
      are attached or detached.
      
      The only format not included here is raw, which was already converted
      with the other filter drivers.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Acked-by: NFam Zheng <famz@redhat.com>
      862f215f
  12. 24 2月, 2017 1 次提交
    • K
      block: Attach bs->file only during .bdrv_open() · 4e4bf5c4
      Kevin Wolf 提交于
      The way that attaching bs->file worked was a bit unusual in that it was
      the only child that would be attached to a node which is not opened yet.
      Because of this, the block layer couldn't know yet which permissions the
      driver would eventually need.
      
      This patch moves the point where bs->file is attached to the beginning
      of the individual .bdrv_open() implementations, so drivers already know
      what they are going to do with the child. This is also more consistent
      with how driver-specific children work.
      
      For a moment, bdrv_open() gets its own BdrvChild to perform image
      probing, but instead of directly assigning this BdrvChild to the BDS, it
      becomes a temporary one and the node name is passed as an option to the
      drivers, so that they can simply use bdrv_open_child() to create another
      reference for their own use.
      
      This duplicated child for (the not opened yet) bs is not the final
      state, a follow-up patch will change the image probing code to use a
      BlockBackend, which is completely independent of bs.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      4e4bf5c4
  13. 12 2月, 2017 1 次提交
    • Q
      block/vmdk: Fix the endian problem of buf_len and lba · 4545d4f4
      QingFeng Hao 提交于
      The problem was triggered by qemu-iotests case 055. It failed when it
      was comparing the compressed vmdk image with original test.img.
      
      The cause is that buf_len in vmdk_write_extent wasn't converted to
      little-endian before it was stored to disk. But later vmdk_read_extent
      read it and converted it from little-endian to cpu endian.
      If the cpu is big-endian like s390, the problem will happen and
      the data length read by vmdk_read_extent will become invalid!
      The fix is to add the conversion in vmdk_write_extent, meanwhile,
      repair the endianness problem of lba field which shall also be converted
      to little-endian before storing to disk.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NQingFeng Hao <haoqf@linux.vnet.ibm.com>
      Signed-off-by: NJing Liu <liujbjl@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-id: 20161216052040.53067-2-haoqf@linux.vnet.ibm.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      4545d4f4
  14. 25 1月, 2017 1 次提交
  15. 06 9月, 2016 1 次提交
  16. 13 7月, 2016 2 次提交
    • R
      vmdk: fix metadata write regression · 524089bc
      Reda Sallahi 提交于
      Commit "cdeaf1f1 vmdk: add bdrv_co_write_zeroes" causes a regression on
      writes. It writes metadata after every write instead of doing it only once
      for each cluster.
      
      vmdk_pwritev() writes metadata whenever m_data is set as valid so this patch
      sets m_data as valid only when we have a new cluster which hasn't been
      allocated before or a zero grain.
      Signed-off-by: NReda Sallahi <fullmanet@gmail.com>
      Message-id: 20160707084249.29084-1-fullmanet@gmail.com
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      524089bc
    • P
      coroutine: move entry argument to qemu_coroutine_create · 0b8b8753
      Paolo Bonzini 提交于
      In practice the entry argument is always known at creation time, and
      it is confusing that sometimes qemu_coroutine_enter is used with a
      non-NULL argument to re-enter a coroutine (this happens in
      block/sheepdog.c and tests/test-coroutine.c).  So pass the opaque value
      at creation time, for consistency with e.g. aio_bh_new.
      
      Mostly done with the following semantic patch:
      
      @ entry1 @
      expression entry, arg, co;
      @@
      - co = qemu_coroutine_create(entry);
      + co = qemu_coroutine_create(entry, arg);
        ...
      - qemu_coroutine_enter(co, arg);
      + qemu_coroutine_enter(co);
      
      @ entry2 @
      expression entry, arg;
      identifier co;
      @@
      - Coroutine *co = qemu_coroutine_create(entry);
      + Coroutine *co = qemu_coroutine_create(entry, arg);
        ...
      - qemu_coroutine_enter(co, arg);
      + qemu_coroutine_enter(co);
      
      @ entry3 @
      expression entry, arg;
      @@
      - qemu_coroutine_enter(qemu_coroutine_create(entry), arg);
      + qemu_coroutine_enter(qemu_coroutine_create(entry, arg));
      
      @ reentry @
      expression co;
      @@
      - qemu_coroutine_enter(co, NULL);
      + qemu_coroutine_enter(co);
      
      except for the aforementioned few places where the semantic patch
      stumbled (as expected) and for test_co_queue, which would otherwise
      produce an uninitialized variable warning.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0b8b8753
  17. 05 7月, 2016 3 次提交
  18. 20 6月, 2016 1 次提交
    • E
      coccinelle: Remove unnecessary variables for function return value · 9be38598
      Eduardo Habkost 提交于
      Use Coccinelle script to replace 'ret = E; return ret' with
      'return E'. The script will do the substitution only when the
      function return type and variable type are the same.
      
      Manual fixups:
      
      * audio/audio.c: coding style of "read (...)" and "write (...)"
      * block/qcow2-cluster.c: wrap line to make it shorter
      * block/qcow2-refcount.c: change indentation of wrapped line
      * target-tricore/op_helper.c: fix coding style of
        "remainder|quotient"
      * target-mips/dsp_helper.c: reverted changes because I don't
        want to argue about checkpatch.pl
      * ui/qemu-pixman.c: fix line indentation
      * block/rbd.c: restore blank line between declarations and
        statements
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1465855078-19435-4-git-send-email-ehabkost@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [Unused Coccinelle rule name dropped along with a redundant comment;
      whitespace touched up in block/qcow2-cluster.c; stale commit message
      paragraph deleted]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9be38598
  19. 08 6月, 2016 2 次提交
    • E
      vmdk: Convert to bdrv_co_pwrite_zeroes() · a620f2ae
      Eric Blake 提交于
      Another step on our continuing quest to switch to byte-based
      interfaces.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a620f2ae
    • E
      block: Track write zero limits in bytes · cf081fca
      Eric Blake 提交于
      Another step towards removing sector-based interfaces: convert
      the maximum write and minimum alignment values from sectors to
      bytes.  Rename the variables to let the compiler check that all
      users are converted to the new semantics.
      
      The maximum remains an int as long as BDRV_REQUEST_MAX_SECTORS
      is constrained by INT_MAX (this means that we can't even
      support a 2G write_zeroes, but just under it) - changing
      operation lengths to unsigned or to 64-bits is a much bigger
      audit, and debatable if we even want to do it (since at the
      core, a 32-bit platform will still have ssize_t as its
      underlying limit on write()).
      
      Meanwhile, alignment is changed to 'uint32_t', since it makes no
      sense to have an alignment larger than the maximum write, and
      less painful to use an unsigned type with well-defined behavior
      in bit operations than to have to worry about what happens if
      a driver mistakenly supplies a negative alignment.
      
      Add an assert that no one was trying to use sectors to get a
      write zeroes larger than 2G, and therefore that a later conversion
      to bytes won't be impacted by keeping the limit at 32 bits.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      cf081fca
  20. 07 6月, 2016 1 次提交
  21. 19 5月, 2016 2 次提交
  22. 12 5月, 2016 5 次提交
  23. 30 3月, 2016 1 次提交
    • K
      block: Always set writeback mode in blk_new_open() · 72e775c7
      Kevin Wolf 提交于
      All callers of blk_new_open() either don't rely on the WCE bit set after
      blk_new_open() because they explicitly set it anyway, or they pass
      BDRV_O_CACHE_WB unconditionally.
      
      This patch changes blk_new_open() so that it always enables writeback
      mode and asserts that BDRV_O_CACHE_WB is clear. For those callers that
      used to pass BDRV_O_CACHE_WB unconditionally, the flag is removed now.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      72e775c7
  24. 23 3月, 2016 2 次提交
    • V
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa 提交于
      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: NVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f348b6d1
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      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: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  25. 18 3月, 2016 1 次提交
    • E
      qapi: Don't special-case simple union wrappers · 32bafa8f
      Eric Blake 提交于
      Simple unions were carrying a special case that hid their 'data'
      QMP member from the resulting C struct, via the hack method
      QAPISchemaObjectTypeVariant.simple_union_type().  But by using
      the work we started by unboxing flat union and alternate
      branches, coupled with the ability to visit the members of an
      implicit type, we can now expose the simple union's implicit
      type in qapi-types.h:
      
      | struct q_obj_ImageInfoSpecificQCow2_wrapper {
      |     ImageInfoSpecificQCow2 *data;
      | };
      |
      | struct q_obj_ImageInfoSpecificVmdk_wrapper {
      |     ImageInfoSpecificVmdk *data;
      | };
      ...
      | struct ImageInfoSpecific {
      |     ImageInfoSpecificKind type;
      |     union { /* union tag is @type */
      |         void *data;
      |-        ImageInfoSpecificQCow2 *qcow2;
      |-        ImageInfoSpecificVmdk *vmdk;
      |+        q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
      |+        q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
      |     } u;
      | };
      
      Doing this removes asymmetry between QAPI's QMP side and its
      C side (both sides now expose 'data'), and means that the
      treatment of a simple union as sugar for a flat union is now
      equivalent in both languages (previously the two approaches used
      a different layer of dereferencing, where the simple union could
      be converted to a flat union with equivalent C layout but
      different {} on the wire, or to an equivalent QMP wire form
      but with different C representation).  Using the implicit type
      also lets us get rid of the simple_union_type() hack.
      
      Of course, now all clients of simple unions have to adjust from
      using su->u.member to using su->u.member.data; while this touches
      a number of files in the tree, some earlier cleanup patches
      helped minimize the change to the initialization of a temporary
      variable rather than every single member access.  The generated
      qapi-visit.c code is also affected by the layout change:
      
      |@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
      |     }
      |     switch (obj->type) {
      |     case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
      |-        visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
      |+        visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
      |         break;
      |     case IMAGE_INFO_SPECIFIC_KIND_VMDK:
      |-        visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
      |+        visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
      |         break;
      |     default:
      |         abort();
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      32bafa8f
  26. 17 3月, 2016 2 次提交
    • M
      blockdev: Split monitor reference from BB creation · efaa7c4e
      Max Reitz 提交于
      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: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      efaa7c4e
    • M
      qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE · a55448b3
      Max Reitz 提交于
      Just specifying a custom string is simpler in basically all places that
      used it, and in addition, specifying the BB or node name is something we
      generally do not do in other error messages when opening a BDS, so we
      should not do it here.
      
      This changes the output for iotest 036 (to the better, in my opinion),
      so the reference output needs to be changed accordingly.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a55448b3