[Qemu-block] [PATCH v6 0/3] block: Fix unaligned bdrv_aio_write_zeroes

2015-05-12 Thread Fam Zheng
An unaligned zero write causes NULL deferencing in bdrv_co_do_pwritev. That path is reachable from bdrv_co_write_zeroes and bdrv_aio_write_zeroes. You can easily trigger through the former with qemu-io, as the test case added by 61815d6e0aa. For bdrv_aio_write_zeroes, in common cases there's

[Qemu-block] [PATCH v6 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-05-12 Thread Fam Zheng
For zero write, callers pass in NULL qiov (qemu-io write -z or scsi-disk write same). Commit fc3959e466 fixed bdrv_co_write_zeroes which is the common case for this bug, but it still exists in bdrv_aio_write_zeroes. A simpler fix would be in bdrv_co_do_pwritev which is the NULL dereference point

[Qemu-block] [PATCH v6 1/3] Revert block: Fix unaligned zero write

2015-05-12 Thread Fam Zheng
This reverts commit fc3959e4669a1c2149b91ccb05101cfc7ae1fc05. The core write code already handles the case, so remove this duplication. Because commit 61007b316 moved the touched code from block.c to block/io.c, the change is manually reverted. Signed-off-by: Fam Zheng f...@redhat.com

[Qemu-block] [PATCH v6 3/3] qemu-iotests: Test unaligned sub-block zero write

2015-05-12 Thread Fam Zheng
Test zero write in byte range 512~1024 for 4k alignment. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com --- tests/qemu-iotests/033 | 13 + tests/qemu-iotests/033.out | 30 ++ 2 files changed, 43 insertions(+)

Re: [Qemu-block] [Qemu-devel] [PATCH v2 2/6] block: Fix dirty bitmap in bdrv_co_discard

2015-05-12 Thread Fam Zheng
On Mon, 05/11 15:22, John Snow wrote: On 05/06/2015 12:52 AM, Fam Zheng wrote: Unsetting dirty globally with discard is not very correct. The discard may zero out sectors (depending on can_write_zeroes_with_unmap), we should replicate this change to destinition side to make sure that

[Qemu-block] [PATCH 5/5] tests: add test case for encrypted qcow2 read/write

2015-05-12 Thread Daniel P. Berrange
Add a simple test case for qemu-iotests that covers read/write with encrypted qcow2 files. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- tests/qemu-iotests/131 | 69 ++ tests/qemu-iotests/131.out | 46 +++

[Qemu-block] [PATCH 3/5] util: allow \n to terminate password input

2015-05-12 Thread Daniel P. Berrange
The qemu_read_password() method looks for \r to terminate the reading of the a password. This is what will be seen when reading the password from a TTY. When scripting though, it is useful to be able to send the password via a pipe, in which case we must look for \n to terminate password input.

[Qemu-block] [PATCH 1/5] qcow2/qcow: protect against uninitialized encryption key

2015-05-12 Thread Daniel P. Berrange
When a qcow[2] file is opened, if the header reports an encryption method, this is used to set the 'crypt_method_header' field on the BDRVQcow[2]State struct, and the 'encrypted' flag in the BDRVState struct. When doing I/O operations, the 'crypt_method' field on the BDRVQcow[2]State struct is

[Qemu-block] [PATCH 2/5] util: move read_password method out of qemu-img into osdep/oslib

2015-05-12 Thread Daniel P. Berrange
The qemu-img.c file has a read_password() method impl that is used to prompt for passwords on the console, with impls for POSIX and Windows. This will be needed by qemu-io.c too, so move it into the QEMU osdep/oslib files where it can be shared without code duplication Signed-off-by: Daniel P.

[Qemu-block] [PATCH 0/5] Misc fixes and testing of qcow[2] encryption

2015-05-12 Thread Daniel P. Berrange
I realize that qcow[2] encryption is a feature we have deprecated and will remove support for running it with the QEMU system emulators in this cycle. We do still need to make sure it continues to work for the sake of letting people run qemu-img convert to retrieve their data though. Some of the

Re: [Qemu-block] [Qemu-devel] [PATCH 1/5] qcow2/qcow: protect against uninitialized encryption key

2015-05-12 Thread Eric Blake
On 05/12/2015 10:09 AM, Daniel P. Berrange wrote: When a qcow[2] file is opened, if the header reports an encryption method, this is used to set the 'crypt_method_header' field on the BDRVQcow[2]State struct, and the 'encrypted' flag in the BDRVState struct. When doing I/O operations, the

Re: [Qemu-block] [Qemu-devel] [PATCH 3/5] util: allow \n to terminate password input

2015-05-12 Thread Eric Blake
On 05/12/2015 10:09 AM, Daniel P. Berrange wrote: The qemu_read_password() method looks for \r to terminate the reading of the a password. This is what will be seen when reading the password from a TTY. When scripting though, it is useful to be able to send the password via a pipe, in which

Re: [Qemu-block] [PATCH 05/34] block: Use macro for cache option names

2015-05-12 Thread Jeff Cody
On Fri, May 08, 2015 at 07:21:37PM +0200, Kevin Wolf wrote: Signed-off-by: Kevin Wolf kw...@redhat.com --- blockdev.c| 24 include/block/block.h | 8 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/blockdev.c b/blockdev.c

Re: [Qemu-block] [Qemu-devel] [PATCH 5/5] tests: add test case for encrypted qcow2 read/write

2015-05-12 Thread John Snow
On 05/12/2015 03:52 PM, Eric Blake wrote: On 05/12/2015 01:06 PM, John Snow wrote: tests/qemu-iotests/131 | 69 ++ tests/qemu-iotests/131.out | 46 +++ Fam Zheng already has a patch on-list that uses test 131,

Re: [Qemu-block] [PATCH 04/34] vmdk: Use bdrv_open_image()

2015-05-12 Thread Jeff Cody
On Fri, May 08, 2015 at 07:21:36PM +0200, Kevin Wolf wrote: Besides standardising on a single interface for opening child nodes, this patch allows the user to specify options to individual extent nodes. Overriding file names isn't possible with this yet, so it's of limited usefulness, but

Re: [Qemu-block] [Qemu-devel] [PATCH 18/34] qcow2: Fix memory leak in qcow2_update_options() error path

2015-05-12 Thread Eric Blake
On 05/08/2015 11:21 AM, Kevin Wolf wrote: Signed-off-by: Kevin Wolf kw...@redhat.com --- block/qcow2.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) Reviewed-by: Eric Blake ebl...@redhat.com -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization

Re: [Qemu-block] [Qemu-devel] [PATCH 15/34] qcow2: Move qcow2_update_options() call up

2015-05-12 Thread Eric Blake
On 05/08/2015 11:21 AM, Kevin Wolf wrote: qcow2_update_options() only updates some variables in BDRVQcowState and doesn't really depend on other parts of it being initialised yet, so it can be moved so that it immediately follows the other half of option handling code in qcow2_open().

Re: [Qemu-block] [Qemu-devel] [PATCH 17/34] qcow2: Leave s unchanged on qcow2_update_options() failure

2015-05-12 Thread Eric Blake
On 05/08/2015 11:21 AM, Kevin Wolf wrote: On return, either all new options should be applied to BDRVQcowState (on success), or all of the old setting should be preserved (on failure). s/setting/settings/ Signed-off-by: Kevin Wolf kw...@redhat.com --- block/qcow2.c | 52

Re: [Qemu-block] [Qemu-devel] [PATCH 19/34] qcow2: Make qcow2_update_options() suitable for transactions

2015-05-12 Thread Eric Blake
On 05/08/2015 11:21 AM, Kevin Wolf wrote: Before we can allow updating options at runtime with bdrv_reopen(), we need to split the function into prepare/commit/abort parts. Signed-off-by: Kevin Wolf kw...@redhat.com --- block/qcow2.c | 101

Re: [Qemu-block] [PATCH v5 0/2] block: enforce minimal 4096 alignment in qemu_blockalign

2015-05-12 Thread Denis V. Lunev
On 12/05/15 13:01, Stefan Hajnoczi wrote: On Mon, May 11, 2015 at 07:47:41PM +0300, Denis V. Lunev wrote: On 11/05/15 19:07, Denis V. Lunev wrote: On 11/05/15 18:08, Stefan Hajnoczi wrote: On Mon, May 04, 2015 at 04:42:22PM +0300, Denis V. Lunev wrote: The difference is quite reliable and

Re: [Qemu-block] [PATCH v5 0/2] block: enforce minimal 4096 alignment in qemu_blockalign

2015-05-12 Thread Paolo Bonzini
On 12/05/2015 12:19, Denis V. Lunev wrote: hades /vol $ strace -f -e pwrite -e raw=write,pwrite qemu-io -n -c write -P 0x11 0 64M ./1.img Process 19326 attached [pid 19326] pwrite(0x6, 0x7fac07fff200, 0x400, 0x5) = 0x400 1 GB Write from userspace FWIW this is 64 MB

Re: [Qemu-block] [PATCH 1/2] block: minimal bounce buffer alignment

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 07:47 hat Denis V. Lunev geschrieben: The patch introduces new concept: minimal memory alignment for bounce buffers. Original so called optimal value is actually minimal required value for aligment. It should be used for validation that the IOVec is properly aligned and bounce

Re: [Qemu-block] [PATCH v3 0/8] qcow2 L2/refcount cache improvements

2015-05-12 Thread Kevin Wolf
Am 11.05.2015 um 14:54 hat Alberto Garcia geschrieben: New version of the qcow2 cache patches: v3: - Removed a dead comment in patch #3 - New document explaining how to configure the cache sizes v2: https://lists.nongnu.org/archive/html/qemu-devel/2015-05/msg00833.html - Don't do pointer

[Qemu-block] [PATCH v3 5/6] qemu-iotests: Add test case for mirror with unmap

2015-05-12 Thread Fam Zheng
This checks that the discard on mirror source that effectively zeroes data is also reflected by the data of target. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: John Snow js...@redhat.com --- tests/qemu-iotests/131 | 59 ++

[Qemu-block] [PATCH v3 3/6] block: Remove bdrv_reset_dirty

2015-05-12 Thread Fam Zheng
Using this function would always be wrong because a dirty bitmap must have a specific owner that consumes the dirty bits and calls bdrv_reset_dirty_bitmap(). Remove the unused function to avoid future misuse. Reviewed-by: Eric Blake ebl...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com

[Qemu-block] [PATCH 1/1] docs: document how to configure the qcow2 L2/refcount caches

2015-05-12 Thread Alberto Garcia
QEMU has options to configure the size of the L2 and refcount caches for the qcow2 format. However, choosing the right sizes for a particular disk image is not a straightforward operation since the ratio between the cache size and the allocated disk space is not obvious and depends on the size of

Re: [Qemu-block] [PATCH v6 1/3] Revert block: Fix unaligned zero write

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 08:09 hat Fam Zheng geschrieben: This reverts commit fc3959e4669a1c2149b91ccb05101cfc7ae1fc05. The core write code already handles the case, so remove this duplication. Because commit 61007b316 moved the touched code from block.c to block/io.c, the change is manually

[Qemu-block] [PATCH v2 0/1] Document how to configure the qcow2 L2/refcount caches

2015-05-12 Thread Alberto Garcia
Kevin applied all other patches from this series, so this is the only one left. Thanks to Max for all the feedback. v2: - Add copyright notice - Document refcount_bits and its effects v1: https://lists.gnu.org/archive/html/qemu-devel/2015-05/msg01891.html Regards, Berto Alberto Garcia (1):

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Denis V. Lunev
On 12/05/15 13:27, Kevin Wolf wrote: Am 12.05.2015 um 07:47 hat Denis V. Lunev geschrieben: The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i 10; i++) write(fd, buf, 4096); performs 5% better if buf is aligned to 4096

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 12:36 hat Denis V. Lunev geschrieben: On 12/05/15 13:27, Kevin Wolf wrote: Am 12.05.2015 um 07:47 hat Denis V. Lunev geschrieben: The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i 10; i++) write(fd,

[Qemu-block] [PATCH v3 1/6] mirror: Do zero write on target if sectors not allocated

2015-05-12 Thread Fam Zheng
If guest discards a source cluster during mirror, we would want to skip the read-write steps. Source and target may have different can_write_zeroes_with_unmap values and different discard granularity. It's important to replicate the exact zeroing on the destination, so bdrv_aio_discard is only

[Qemu-block] [PATCH v3 2/6] block: Fix dirty bitmap in bdrv_co_discard

2015-05-12 Thread Fam Zheng
Unsetting dirty globally with discard is not very correct. The discard may zero out sectors (depending on can_write_zeroes_with_unmap), we should replicate this change to destinition side to make sure that the guest sees the same data. Calling bdrv_reset_dirty also troubles mirror job because the

[Qemu-block] [PATCH v3 4/6] qemu-iotests: Make block job methods common

2015-05-12 Thread Fam Zheng
Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: John Snow js...@redhat.com --- tests/qemu-iotests/041| 66 ++- tests/qemu-iotests/iotests.py | 28 ++ 2 files changed, 43 insertions(+), 51 deletions(-) diff --git

Re: [Qemu-block] [PATCH v6 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 08:09 hat Fam Zheng geschrieben: For zero write, callers pass in NULL qiov (qemu-io write -z or scsi-disk write same). Commit fc3959e466 fixed bdrv_co_write_zeroes which is the common case for this bug, but it still exists in bdrv_aio_write_zeroes. A simpler fix would be in

Re: [Qemu-block] [PATCH v6 3/3] qemu-iotests: Test unaligned sub-block zero write

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 08:09 hat Fam Zheng geschrieben: Test zero write in byte range 512~1024 for 4k alignment. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com Reviewed-by: Kevin Wolf kw...@redhat.com

Re: [Qemu-block] [PATCH v6 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-05-12 Thread Stefan Hajnoczi
On Tue, May 12, 2015 at 02:09:31PM +0800, Fam Zheng wrote: +static int coroutine_fn bdrv_co_do_zero_pwritev(BlockDriverState *bs, +int64_t offset, +unsigned int bytes, +

Re: [Qemu-block] [PATCH v6 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-05-12 Thread Fam Zheng
On Tue, 05/12 13:52, Kevin Wolf wrote: Am 12.05.2015 um 08:09 hat Fam Zheng geschrieben: For zero write, callers pass in NULL qiov (qemu-io write -z or scsi-disk write same). Commit fc3959e466 fixed bdrv_co_write_zeroes which is the common case for this bug, but it still exists in

[Qemu-block] [PATCH v7 3/3] qemu-iotests: Test unaligned sub-block zero write

2015-05-12 Thread Fam Zheng
Test zero write in byte range 512~1024 for 4k alignment. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com Reviewed-by: Kevin Wolf kw...@redhat.com --- tests/qemu-iotests/033 | 13 + tests/qemu-iotests/033.out | 30

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 15:41 hat Denis V. Lunev geschrieben: The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i 10; i++) write(fd, buf, 4096); performs 5% better if buf is aligned to 4096 bytes. The difference is quite

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Denis V. Lunev
On 12/05/15 17:08, Kevin Wolf wrote: Am 12.05.2015 um 15:41 hat Denis V. Lunev geschrieben: The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i 10; i++) write(fd, buf, 4096); performs 5% better if buf is aligned to 4096

Re: [Qemu-block] [PATCH 08/34] block: Add list of children to BlockDriverState

2015-05-12 Thread Kevin Wolf
Am 11.05.2015 um 17:45 hat Max Reitz geschrieben: On 08.05.2015 19:21, Kevin Wolf wrote: This allows iterating over all children of a given BDS, not only including bs-file and bs-backing_hd, but also driver-specific ones like VMDK extents or Quorum children. Signed-off-by: Kevin Wolf

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 16:20 hat Denis V. Lunev geschrieben: On 12/05/15 17:08, Kevin Wolf wrote: Am 12.05.2015 um 15:41 hat Denis V. Lunev geschrieben: The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i 10; i++) write(fd,

[Qemu-block] [PATCH v8 0/2] block: enforce minimal 4096 alignment in qemu_blockalign

2015-05-12 Thread Denis V. Lunev
I have used the following program to test #define _GNU_SOURCE #include stdio.h #include unistd.h #include fcntl.h #include sys/types.h #include malloc.h #include string.h int main(int argc, char *argv[]) { int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); void *buf; int i =

Re: [Qemu-block] [Qemu-devel] [PATCH 10/34] block: Fix reopen flag inheritance

2015-05-12 Thread Eric Blake
On 05/08/2015 11:21 AM, Kevin Wolf wrote: When reopening an image, the block layer already takes care to reopen bs-file as well with recalculated inherited flags. The same must happen for any other child (most notably missing before this patch: backing files). If bs-file (or any other

Re: [Qemu-block] [PATCH v5 0/2] block: enforce minimal 4096 alignment in qemu_blockalign

2015-05-12 Thread Stefan Hajnoczi
On Mon, May 11, 2015 at 07:47:41PM +0300, Denis V. Lunev wrote: On 11/05/15 19:07, Denis V. Lunev wrote: On 11/05/15 18:08, Stefan Hajnoczi wrote: On Mon, May 04, 2015 at 04:42:22PM +0300, Denis V. Lunev wrote: The difference is quite reliable and the same 5%. qemu-io -n -c 'write -P 0xaa

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Kevin Wolf
Am 12.05.2015 um 07:47 hat Denis V. Lunev geschrieben: The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i 10; i++) write(fd, buf, 4096); performs 5% better if buf is aligned to 4096 bytes. The difference is quite

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Denis V. Lunev
On 12/05/15 17:26, Kevin Wolf wrote: Am 12.05.2015 um 16:20 hat Denis V. Lunev geschrieben: On 12/05/15 17:08, Kevin Wolf wrote: Am 12.05.2015 um 15:41 hat Denis V. Lunev geschrieben: The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i

[Qemu-block] [PATCH v7 1/3] Revert block: Fix unaligned zero write

2015-05-12 Thread Fam Zheng
This reverts commit fc3959e4669a1c2149b91ccb05101cfc7ae1fc05. The core write code already handles the case, so remove this duplication. Because commit 61007b316 moved the touched code from block.c to block/io.c, the change is manually reverted. Signed-off-by: Fam Zheng f...@redhat.com

[Qemu-block] [PATCH v7 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-05-12 Thread Fam Zheng
For zero write, callers pass in NULL qiov (qemu-io write -z or scsi-disk write same). Commit fc3959e466 fixed bdrv_co_write_zeroes which is the common case for this bug, but it still exists in bdrv_aio_write_zeroes. A simpler fix would be in bdrv_co_do_pwritev which is the NULL dereference point

[Qemu-block] [PATCH v7 0/3] block: Fix unaligned bdrv_aio_write_zeroes

2015-05-12 Thread Fam Zheng
v7: Add Kevin's rev-by in patch 1 and 3. Address Stefan's and Kevin's comments on patch 2: - Don't duplicate tracked_request_begin and tracked_request_end; - Don't forget to remove debug printf; - Call qemu_vfree unconditionally; - Don't serialize aligned part of the zero write

Re: [Qemu-block] [Qemu-devel] [PATCH] block/mirror: Sleep periodically during bitmap scanning

2015-05-12 Thread Wen Congyang
On 05/13/2015 11:11 AM, Fam Zheng wrote: Before, we only yield after initializing dirty bitmap, where the QMP command would return. That may take very long, and guest IO will be blocked. Do you have such case to reproduce it? If the disk image is too larger, and I think qemu doesn't cache all

[Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Denis V. Lunev
The following sequence int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); for (i = 0; i 10; i++) write(fd, buf, 4096); performs 5% better if buf is aligned to 4096 bytes. The difference is quite reliable. On the other hand we do not want at the moment to enforce

[Qemu-block] [PATCH v7 0/2] block: enforce minimal 4096 alignment in qemu_blockalign

2015-05-12 Thread Denis V. Lunev
I have used the following program to test #define _GNU_SOURCE #include stdio.h #include unistd.h #include fcntl.h #include sys/types.h #include malloc.h #include string.h int main(int argc, char *argv[]) { int fd = open(argv[1], O_RDWR | O_CREAT | O_DIRECT, 0644); void *buf; int i =

[Qemu-block] [PATCH 1/2] block: minimal bounce buffer alignment

2015-05-12 Thread Denis V. Lunev
The patch introduces new concept: minimal memory alignment for bounce buffers. Original so called optimal value is actually minimal required value for aligment. It should be used for validation that the IOVec is properly aligned and bounce buffer is not required. Though, from the performance

Re: [Qemu-block] [PATCH 2/2] block: align bounce buffers to page

2015-05-12 Thread Paolo Bonzini
On 12/05/2015 12:27, Kevin Wolf wrote: I think it would make more sense to keep this specific to the raw-posix driver. After all, it's only the kernel page cache that we optimise here. Other backends probably don't take advantage of page alignment. I don't think it makes sense to keep it

Re: [Qemu-block] [PATCH] qemu-io: Use getopt() correctly

2015-05-12 Thread Alberto Garcia
On Tue 12 May 2015 05:10:56 PM CEST, Eric Blake ebl...@redhat.com wrote: POSIX says getopt() returns -1 on completion. While Linux happens to define EOF as -1, this definition is not required by POSIX, and there may be platforms where checking for EOF instead of -1 would lead to an infinite

Re: [Qemu-block] [Qemu-devel] [PATCH 13/34] qemu-io: Add command 'reopen'

2015-05-12 Thread Eric Blake
On 05/08/2015 11:21 AM, Kevin Wolf wrote: Signed-off-by: Kevin Wolf kw...@redhat.com --- qemu-io-cmds.c | 71 ++ 1 file changed, 71 insertions(+) + +while ((c = getopt(argc, argv, c:o:r)) != EOF) { POSIX says getopt() returns

[Qemu-block] [PATCH] qemu-io: Use getopt() correctly

2015-05-12 Thread Eric Blake
POSIX says getopt() returns -1 on completion. While Linux happens to define EOF as -1, this definition is not required by POSIX, and there may be platforms where checking for EOF instead of -1 would lead to an infinite loop. Signed-off-by: Eric Blake ebl...@redhat.com --- qemu-io-cmds.c | 16

Re: [Qemu-block] [Qemu-devel] [PATCH 12/34] block: Allow specifying driver-specific options to reopen

2015-05-12 Thread Eric Blake
On 05/08/2015 11:21 AM, Kevin Wolf wrote: Signed-off-by: Kevin Wolf kw...@redhat.com --- block.c | 42 +++--- block/commit.c| 4 ++-- include/block/block.h | 4 +++- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git