[Qemu-devel] [PATCH] block/file-posix: fix the wrong result of find_allocation() in macOS.

2018-09-08 Thread Yan-Jie Wang
In macOS, lseek with SEEK_DATA behaves differently. It seeks to the next data region even though offset is in the middle of a data region. In addition, there may be many data regions without any hole among them, like this: |---Data---|---Data---| Because of this, qemu-img convert with raw images a

Re: [Qemu-devel] [PATCH] block/file-posix: fix the wrong result of find_allocation() in macOS.

2018-09-08 Thread Peter Maydell
On 8 September 2018 at 15:15, Yan-Jie Wang wrote: > In macOS, lseek with SEEK_DATA behaves differently. > It seeks to the next data region even though offset is in the middle of > a data region. In addition, there may be many data regions without any > hole among them, like this: |---Data---|---Da

Re: [Qemu-devel] [PATCH] block/file-posix: fix the wrong result of find_allocation() in macOS.

2018-09-10 Thread Eric Blake
On 9/8/18 10:34 AM, Peter Maydell wrote: On 8 September 2018 at 15:15, Yan-Jie Wang wrote: In macOS, lseek with SEEK_DATA behaves differently. It seeks to the next data region even though offset is in the middle of a data region. In addition, there may be many data regions without any hole amon

Re: [Qemu-devel] [PATCH] block/file-posix: fix the wrong result of find_allocation() in macOS.

2018-09-10 Thread 王彥傑
This is the program I used to check the behavior of SEEK_DATA and SEEK_HOLE. #define _FILE_OFFSET_BITS 64 #define _LARGEFILE64_SOURCE 1 #include #include #include #include #include #include #include #include /* * This function is suitable for macOS and Solaris' lseek behavior, * since s