From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Zhao Liu <zhao1.liu@intel.com>, Michael Tokarev <mjt@tls.msk.ru>,
Laurent Vivier <laurent@vivier.eu>
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
"Laurent Vivier" <lvivier@redhat.com>,
"Amit Shah" <amit@kernel.org>
Subject: Re: [PATCH 7/7] backends/rng-random: Get rid of qemu_open_old()
Date: Mon, 15 Jul 2024 11:46:54 +0200 [thread overview]
Message-ID: <01245850-b5df-4bf6-9a22-775d12fc07a0@linaro.org> (raw)
In-Reply-To: <20240715082155.28771-8-zhao1.liu@intel.com>
On 15/7/24 10:21, Zhao Liu wrote:
> For qemu_open_old(), osdep.h said:
>
>> Don't introduce new usage of this function, prefer the following
>> qemu_open/qemu_create that take an "Error **errp".
>
> So replace qemu_open_old() with qemu_open(). And considering
> rng_random_opened() will lose its obvious error handling case after
> removing error_setg_file_open(), add comment to remind here.
>
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Amit Shah <amit@kernel.org>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
> backends/rng-random.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/backends/rng-random.c b/backends/rng-random.c
> index 80eb5be138ce..3cdb982533b5 100644
> --- a/backends/rng-random.c
> +++ b/backends/rng-random.c
> @@ -75,10 +75,11 @@ static void rng_random_opened(RngBackend *b, Error **errp)
> error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
> "filename", "a valid filename");
> } else {
> - s->fd = qemu_open_old(s->filename, O_RDONLY | O_NONBLOCK);
> - if (s->fd == -1) {
> - error_setg_file_open(errp, errno, s->filename);
> - }
> + /*
> + * Once the open fails, the error message is integrated into
> + * the *errp object by qemu_open().
> + */
IMHO this comment is superfluous, I'd drop it, otherwise:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> + s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK, errp);
> }
> }
>
next prev parent reply other threads:[~2024-07-15 9:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 8:21 [PATCH 0/7] trivial: Replace some qemu_open_old() with qemu_open() Zhao Liu
2024-07-15 8:21 ` [PATCH 1/7] hw/i386/sgx: Get rid of qemu_open_old() Zhao Liu
2024-07-15 8:21 ` [PATCH 2/7] hw/usb/host-libusb: " Zhao Liu
2024-07-15 9:44 ` Philippe Mathieu-Daudé
2024-07-15 8:21 ` [PATCH 3/7] hw/usb/u2f-passthru: " Zhao Liu
2024-07-15 9:44 ` Philippe Mathieu-Daudé
2024-07-15 8:21 ` [PATCH 4/7] hw/vfio/container: " Zhao Liu
2024-07-15 9:46 ` Philippe Mathieu-Daudé
2024-07-16 13:43 ` Cédric Le Goater
2024-07-15 8:21 ` [PATCH 5/7] backends/hostmem-epc: " Zhao Liu
2024-07-15 9:45 ` Philippe Mathieu-Daudé
2024-07-15 14:02 ` Igor Mammedov
2024-07-15 8:21 ` [PATCH 6/7] backends/iommufd: " Zhao Liu
2024-07-15 9:45 ` Philippe Mathieu-Daudé
2024-07-16 8:10 ` Yi Liu
2024-07-15 8:21 ` [PATCH 7/7] backends/rng-random: " Zhao Liu
2024-07-15 9:46 ` Philippe Mathieu-Daudé [this message]
2024-07-15 10:10 ` Zhao Liu
2024-07-15 11:07 ` Michael Tokarev
2024-07-15 12:44 ` Zhao Liu
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=01245850-b5df-4bf6-9a22-775d12fc07a0@linaro.org \
--to=philmd@linaro.org \
--cc=amit@kernel.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=laurent@vivier.eu \
--cc=lvivier@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=zhao1.liu@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).