All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Max Reitz" <mreitz@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-block@nongnu.org, "Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH v3 2/4] util: introduce qemu_open and qemu_create with error reporting
Date: Fri, 24 Jul 2020 09:02:03 -0500	[thread overview]
Message-ID: <611703da-8c04-8e33-5610-5e15e6d49941@redhat.com> (raw)
In-Reply-To: <20200724132510.3250311-3-berrange@redhat.com>

On 7/24/20 8:25 AM, Daniel P. Berrangé wrote:
> This introduces two new helper metohds
> 
>    int qemu_open(const char *name, int flags, Error **errp);
>    int qemu_create(const char *name, int flags, mode_t mode, Error **errp);
> 
> Note that with this design we no longer require or even accept the
> O_CREAT flag. Avoiding overloading the two distinct operations
> means we can avoid variable arguments which would prevent 'errp' from
> being the last argument. It also gives us a guarantee that the 'mode' is
> given when creating files, avoiding a latent security bug.

I like it.

> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   include/qemu/osdep.h |  6 ++++
>   util/osdep.c         | 78 ++++++++++++++++++++++++++++++++++++--------
>   2 files changed, 71 insertions(+), 13 deletions(-)
> 
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 3a16e58932..ca24ebe211 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -494,7 +494,13 @@ int qemu_madvise(void *addr, size_t len, int advice);
>   int qemu_mprotect_rwx(void *addr, size_t size);
>   int qemu_mprotect_none(void *addr, size_t size);
>   
> +/*
> + * Don't introduce new usage of this function, prefer the following
> + * qemu_open/qemu_create that take a "Error **errp"

s/a /an /

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2020-07-24 14:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24 13:25 [PATCH v3 0/4] block: improve error reporting for unsupported O_DIRECT Daniel P. Berrangé
2020-07-24 13:25 ` [PATCH v3 1/4] util: rename qemu_open() to qemu_open_old() Daniel P. Berrangé
2020-07-24 13:54   ` Eric Blake
2020-07-24 14:24   ` Philippe Mathieu-Daudé
2020-07-24 13:25 ` [PATCH v3 2/4] util: introduce qemu_open and qemu_create with error reporting Daniel P. Berrangé
2020-07-24 14:02   ` Eric Blake [this message]
2020-07-24 14:33   ` Philippe Mathieu-Daudé
2020-07-27  7:37   ` Markus Armbruster
2020-07-24 13:25 ` [PATCH v3 3/4] util: give a specific error message when O_DIRECT doesn't work Daniel P. Berrangé
2020-07-24 14:05   ` Eric Blake
2020-07-24 13:25 ` [PATCH v3 4/4] block: switch to use qemu_open/qemu_create for improved errors Daniel P. Berrangé
2020-07-24 14:10   ` Eric Blake
2020-07-24 14:26     ` Daniel P. Berrangé
2020-07-24 14:37   ` Philippe Mathieu-Daudé
2020-07-27  7:43   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=611703da-8c04-8e33-5610-5e15e6d49941@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.