1. 28 4月, 2015 2 次提交
  2. 24 1月, 2015 1 次提交
    • J
      block: vhdx - force FileOffsetMB field to '0' for certain block states · cdf9634b
      Jeff Cody 提交于
      The v1.0.0 spec calls out PAYLOAD_BLOCK_ZERO FileOffsetMB field as being
      'reserved'.  In practice, this means that Hyper-V will fail to read a
      disk image with PAYLOAD_BLOCK_ZERO block states with a FileOffsetMB
      value other than 0.
      
      The other states that indicate a block that is not there
      (PAYLOAD_BLOCK_UNDEFINED, PAYLOAD_BLOCK_NOT_PRESENT,
       PAYLOAD_BLOCK_UNMAPPED) have multiple options for what FileOffsetMB may
      be set to, and '0' is explicitly called out as an option.
      
      For all the above states, we will also just set the FileOffsetMB value
      to 0.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: a9fe92f53f07e6ab1693811e4312c0d1e958500b.1421787566.git.jcody@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      cdf9634b
  3. 13 12月, 2014 1 次提交
  4. 12 12月, 2014 3 次提交
  5. 20 10月, 2014 1 次提交
  6. 22 9月, 2014 3 次提交
  7. 12 9月, 2014 1 次提交
  8. 20 8月, 2014 1 次提交
    • M
      block: Use g_new() & friends where that makes obvious sense · 5839e53b
      Markus Armbruster 提交于
      g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
      for two reasons.  One, it catches multiplication overflowing size_t.
      Two, it returns T * rather than void *, which lets the compiler catch
      more type errors.
      
      Patch created with Coccinelle, with two manual changes on top:
      
      * Add const to bdrv_iterate_format() to keep the types straight
      
      * Convert the allocation in bdrv_drop_intermediate(), which Coccinelle
        inexplicably misses
      
      Coccinelle semantic patch:
      
          @@
          type T;
          @@
          -g_malloc(sizeof(T))
          +g_new(T, 1)
          @@
          type T;
          @@
          -g_try_malloc(sizeof(T))
          +g_try_new(T, 1)
          @@
          type T;
          @@
          -g_malloc0(sizeof(T))
          +g_new0(T, 1)
          @@
          type T;
          @@
          -g_try_malloc0(sizeof(T))
          +g_try_new0(T, 1)
          @@
          type T;
          expression n;
          @@
          -g_malloc(sizeof(T) * (n))
          +g_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc(sizeof(T) * (n))
          +g_try_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_malloc0(sizeof(T) * (n))
          +g_new0(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc0(sizeof(T) * (n))
          +g_try_new0(T, n)
          @@
          type T;
          expression p, n;
          @@
          -g_realloc(p, sizeof(T) * (n))
          +g_renew(T, p, n)
          @@
          type T;
          expression p, n;
          @@
          -g_try_realloc(p, sizeof(T) * (n))
          +g_try_renew(T, p, n)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5839e53b
  9. 15 8月, 2014 2 次提交
  10. 16 6月, 2014 3 次提交
  11. 19 5月, 2014 1 次提交
    • J
      block: vhdx - account for identical header sections · 69060461
      Jeff Cody 提交于
      The VHDX spec v1.00 declares that "a header is current if it is the only
      valid header or if it is valid and its SequenceNumber field is greater
      than the other header’s SequenceNumber field. The parser must only use
      data from the current header. If there is no current header, then the
      VHDX file is corrupt."
      
      However, the Disk2VHD tool from Microsoft creates a VHDX image file that
      has 2 identical headers, including matching checksums and matching
      sequence numbers.  Likely, as a shortcut the tool is just writing the
      header twice, for the active and inactive headers, during the image
      creation.  Technically, this should be considered a corrupt VHDX file
      (at least per the 1.00 spec, and that is how we currently treat it).
      
      But in order to accomodate images created with Disk2VHD, we can safely
      create an exception for this case.  If we find identical sequence
      numbers, then we check the VHDXHeader-sized chunks of each 64KB header
      sections (we won't rely just on the crc32c to indicate the headers are
      the same).  If they are identical, then we go ahead and use the first
      one.
      Reported-by: NNerijus Baliūnas <nerijus@users.sourceforge.net>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      69060461
  12. 01 4月, 2014 1 次提交
  13. 22 2月, 2014 2 次提交
  14. 01 2月, 2014 1 次提交
  15. 22 1月, 2014 1 次提交
  16. 20 12月, 2013 1 次提交
    • J
      block: vhdx - improve error message, and .bdrv_check implementation · 7e30e6a6
      Jeff Cody 提交于
      If there is a dirty log file to be replayed in a VHDX image, it is
      replayed in .vhdx_open().  However, if the file is opened read-only,
      then a somewhat cryptic error message results.
      
      This adds a more helpful error message for the user.  If an image file
      contains a log to be replayed, and is opened read-only, the user is
      instructed to run 'qemu-img check -r all' on the image file.
      
      Running qemu-img check -r all will cause the image file to be opened
      r/w, which will replay the log file.  If a log file replay is detected,
      this is flagged, and bdrv_check will increase the corruptions_fixed
      count for the image.
      
      [Fixed typo in error message that was pointed out by Eric Blake
      <eblake@redhat.com>.
      --Stefan]
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7e30e6a6
  17. 03 12月, 2013 2 次提交
  18. 07 11月, 2013 13 次提交