From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjpkG-0001cT-6U for qemu-devel@nongnu.org; Tue, 13 Sep 2016 11:35:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjpkA-00021i-Gj for qemu-devel@nongnu.org; Tue, 13 Sep 2016 11:35:35 -0400 Date: Tue, 13 Sep 2016 16:35:18 +0100 From: Stefan Hajnoczi Message-ID: <20160913153518.GA5677@stefanha-x1.localdomain> References: <20160826071940.1179-1-fullmanet@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LQksG6bCIzRHxTLp" Content-Disposition: inline In-Reply-To: <20160826071940.1179-1-fullmanet@gmail.com> Subject: Re: [Qemu-devel] [PATCH v5] qemu-img: change opening method for the output in dd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Reda Sallahi Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Kevin Wolf , Max Reitz , Fam Zheng --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 26, 2016 at 09:19:40AM +0200, Reda Sallahi wrote: > - blk2 = img_open(image_opts, out.filename, out_fmt, BDRV_O_RDWR, > - false, false); > + ret = access(out_filename, F_OK); /* Check if file exists */ The QEMU block layer does not use POSIX file I/O because it needs to support protocols like iSCSI and ssh. The only way to test for the existence of a disk image is by opening it with block layer APIs. Can you just move the img_open() call from the else statement up here instead? --LQksG6bCIzRHxTLp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJX2By2AAoJEJykq7OBq3PInmQH/2S46MImk2mKQTdtLnD8gCyw 8tI+T3j3VyXrF3YAt2D8tzERHPYag2PyUGmwbjSsoecqUkozE8DsnqN71FuD1Fpq 9t+6L7xT8XeULWsN1b7Kz1efQ/wVGKQKwJUWrXCsa1jiSwIyEswIOc6PilocBadG I/0ixZ3f6e56HFGsKZeq9vfD3QUsgWRgUdOrdYfZr4gY2oXFObhtsgDmsGq8kf8u BbCH5CYI6N7YvtqZ0DqpGpT9svJ+VY/Kl0pzlX8kFF8Q8sFkw1T10lwt3fk8jaBh Yjx/HxGvlG8hTfATVp+T7X0kBo+3S1j/LgkQD9L52zUJ4lsNQMKXA3XnmVLR1j4= =uf8O -----END PGP SIGNATURE----- --LQksG6bCIzRHxTLp--