From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfbKc-00080V-Ai for qemu-devel@nongnu.org; Fri, 15 Jun 2012 14:33:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfbKa-0002rN-IV for qemu-devel@nongnu.org; Fri, 15 Jun 2012 14:33:13 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:36409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfbKa-0002pv-BM for qemu-devel@nongnu.org; Fri, 15 Jun 2012 14:33:12 -0400 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Jun 2012 12:33:06 -0600 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id DF668C90060 for ; Fri, 15 Jun 2012 14:32:59 -0400 (EDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5FIX0J3178302 for ; Fri, 15 Jun 2012 14:33:00 -0400 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5FIWxdh006602 for ; Fri, 15 Jun 2012 12:32:59 -0600 Message-ID: <4FDB7FD8.6090500@linux.vnet.ibm.com> Date: Fri, 15 Jun 2012 14:32:56 -0400 From: Corey Bryant MIME-Version: 1.0 References: <1339689305-27031-1-git-send-email-coreyb@linux.vnet.ibm.com> <1339689305-27031-5-git-send-email-coreyb@linux.vnet.ibm.com> <4FDB5312.8000903@redhat.com> In-Reply-To: <4FDB5312.8000903@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 4/5] block: Convert open calls to qemu_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, libvir-list@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, pbonzini@redhat.com On 06/15/2012 11:21 AM, Eric Blake wrote: > On 06/14/2012 09:55 AM, Corey Bryant wrote: >> This patch converts all block layer open calls to qemu_open. This >> enables all block layer open paths to dup(X) a pre-opened file >> descriptor if the filename is of the format /dev/fd/X. This is >> useful if QEMU is restricted from opening certain files. >> >> Note that this adds the O_CLOEXEC flag to the changed open paths >> when the O_CLOEXEC macro is defined. >> > >> @@ -741,7 +741,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) >> if ( bsdPath[ 0 ] != '\0' ) { >> strcat(bsdPath,"s0"); >> /* some CDs don't have a partition 0 */ >> - fd = open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFILE); >> + fd = qemu_open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFILE); > > Why are we even bothering with O_LARGEFILE? Shouldn't we be compiling > with large file support always enabled, so that we are always calling > open64 in the cases where it matters, without having to explicitly add > the O_LARGEFILE flag ourselves? > That might be a no-op too since large file support looks to already be set at compile time: 257 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" > >> +++ b/block/vdi.c >> @@ -648,8 +648,9 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options) >> options++; >> } >> >> - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, >> - 0644); >> + fd = qemu_open(filename, >> + O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, > > More instances. In fact, scrubbing O_LARGEFILE, is probably worth a > separate patch. > I'm happy to do it. Kevin or anyone else want to weigh in first? -- Regards, Corey