[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 4/6] block: Convert open calls to qemu_open
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5 4/6] block: Convert open calls to qemu_open |
Date: |
Wed, 25 Jul 2012 13:22:20 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 |
On 07/23/2012 07:08 AM, Corey Bryant wrote:
> This patch converts all block layer open calls to qemu_open.
>
> Note that this adds the O_CLOEXEC flag to the changed open paths
> when the O_CLOEXEC macro is defined.
Is it actually adding O_CLOEXEC, or just the ability to use O_CLOEXEC?
Or is the actual change that the end result is that the fd now has
FD_CLOEXEC set unconditionally, whether by O_CLOEXEC (which the caller
need not pass) or by fcntl()?
> +++ b/block/raw-posix.c
> @@ -572,8 +572,8 @@ static int raw_create(const char *filename,
> QEMUOptionParameter *options)
> options++;
> }
>
> - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
> - 0644);
> + fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
> + 0644);
After all, I don't see O_CLOEXEC used here.
> if (fd < 0) {
> result = -errno;
> } else {
> @@ -846,7 +846,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);
Also, I still stand by my earlier claim that we don't need O_LARGEFILE
here (we should already be configuring for 64-bit off_t by default),
although cleaning that up is probably worth an independent commit.
> +++ b/block/vdi.c
> @@ -653,8 +653,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,
> + 0644);
Another pointless O_LARGEFILE, and so forth.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v5 6/6] block: Enable qemu_open/close to work with fd sets, (continued)
Re: [Qemu-devel] [PATCH v5 6/6] block: Enable qemu_open/close to work with fd sets, Eric Blake, 2012/07/25
[Qemu-devel] [PATCH v5 5/6] block: Convert close calls to qemu_close, Corey Bryant, 2012/07/23
[Qemu-devel] [PATCH v5 1/6] qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg, Corey Bryant, 2012/07/23
[Qemu-devel] [PATCH v5 4/6] block: Convert open calls to qemu_open, Corey Bryant, 2012/07/23
- Re: [Qemu-devel] [PATCH v5 4/6] block: Convert open calls to qemu_open,
Eric Blake <=
[Qemu-devel] [PATCH v5 2/6] qapi: Introduce add-fd, remove-fd, query-fdsets, Corey Bryant, 2012/07/23
Re: [Qemu-devel] [PATCH v5 0/6] file descriptor passing using fd sets, Kevin Wolf, 2012/07/24