From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpzoX-0006A3-0R for qemu-devel@nongnu.org; Fri, 30 Sep 2016 11:33:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpzoV-0000gE-Vf for qemu-devel@nongnu.org; Fri, 30 Sep 2016 11:33:28 -0400 MIME-Version: 1.0 In-Reply-To: <20160913153518.GA5677@stefanha-x1.localdomain> References: <20160826071940.1179-1-fullmanet@gmail.com> <20160913153518.GA5677@stefanha-x1.localdomain> From: Stefan Hajnoczi Date: Fri, 30 Sep 2016 16:33:27 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [Qemu-block] [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: Stefan Hajnoczi Cc: Reda Sallahi , Kevin Wolf , Fam Zheng , qemu-devel , qemu block , Max Reitz On Tue, Sep 13, 2016 at 4:35 PM, Stefan Hajnoczi wrote: > 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? Ping