From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfYME-0007vr-GK for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:22:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfYM8-00006Y-0g for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:22:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfYM7-00005c-Os for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:22:35 -0400 Message-ID: <4FDB5312.8000903@redhat.com> Date: Fri, 15 Jun 2012 09:21:54 -0600 From: Eric Blake 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> In-Reply-To: <1339689305-27031-5-git-send-email-coreyb@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDCF496CCD6DA59C4FF39A403" 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: Corey Bryant 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 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDCF496CCD6DA59C4FF39A403 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Note that this adds the O_CLOEXEC flag to the changed open paths > when the O_CLOEXEC macro is defined. >=20 > @@ -741,7 +741,7 @@ static int hdev_open(BlockDriverState *bs, const ch= ar *filename, int flags) > if ( bsdPath[ 0 ] !=3D '\0' ) { > strcat(bsdPath,"s0"); > /* some CDs don't have a partition 0 */ > - fd =3D open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFILE); > + fd =3D qemu_open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFIL= E); 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? > +++ b/block/vdi.c > @@ -648,8 +648,9 @@ static int vdi_create(const char *filename, QEMUOpt= ionParameter *options) > options++; > } > =20 > - fd =3D open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_= LARGEFILE, > - 0644); > + fd =3D qemu_open(filename, > + O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFI= LE, More instances. In fact, scrubbing O_LARGEFILE, is probably worth a separate patch. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigDCF496CCD6DA59C4FF39A403 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJP21MSAAoJEKeha0olJ0Nqc00IAILD+JhfhSMBDmNTEPdseLzb f3Ji/7meWfFlNVGb/2I1qkPHREy5ZjHE0Q7m/x2h1i52qJQ0RlKdpHiHFbqRtt7s 4SjmNJvk9p64Ncpg31d1c2pasT2kHzwK2J3GzpWBFFAxfWOzUZ1NVgvoR6j6zVUi YAkztbMp8B1NBxr9hwY1h63fey7M9jzmQ45CBSJVmOJr8bq0HPbH1k4UmYF75VWZ Sv6yrYpUCEJ4HVyH413Uq4cB70iJp566Oc3s+MB+EfuiLhSejyUlk7/ZZj6vrBrG U2vE3PTbkafSU4y8HyLvEJ1fQlZVwHgqCKaYbnw2kXHEOOqcg7e7gw4VEbFj4Vo= =5D5+ -----END PGP SIGNATURE----- --------------enigDCF496CCD6DA59C4FF39A403--