From: Wensheng Tang <sp3478@gmail.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Wensheng Tang <sp3478@gmail.com>,
"open list:All patches CC here" <qemu-devel@nongnu.org>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH] block: Make block error codes consistent
Date: Sun, 12 May 2019 23:10:48 +0800 [thread overview]
Message-ID: <20190512151048.72412-1-sp3478@gmail.com> (raw)
We should keep the error handling consistent. ENOMEDIUM is more meaningful than ENOENT a when driver cannot be loaded.
---
block.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 5c2c6aa..6685be7 100644
--- a/block.c
+++ b/block.c
@@ -770,7 +770,7 @@ static int find_image_format(BlockBackend *file, const char *filename,
if (!drv) {
error_setg(errp, "Could not determine image format: No compatible "
"driver found");
- ret = -ENOENT;
+ ret = -ENOMEDIUM;
}
*pdrv = drv;
return ret;
@@ -1619,7 +1619,7 @@ static int bdrv_fill_options(QDict **options, const char *filename,
drv = bdrv_find_format(drvname);
if (!drv) {
error_setg(errp, "Unknown driver '%s'", drvname);
- return -ENOENT;
+ return -ENOMEDIUM;
}
/* If the user has explicitly specified the driver, this choice should
* override the BDRV_O_PROTOCOL flag */
@@ -1655,7 +1655,7 @@ static int bdrv_fill_options(QDict **options, const char *filename,
if (filename) {
drv = bdrv_find_protocol(filename, parse_filename, errp);
if (!drv) {
- return -EINVAL;
+ return -ENOMEDIUM;
}
drvname = drv->format_name;
--
2.20.1 (Apple Git-117)
next reply other threads:[~2019-05-12 16:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-12 15:10 Wensheng Tang [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-05-12 15:46 [Qemu-devel] [PATCH] block: Make block error codes consistent Wensheng Tang
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=20190512151048.72412-1-sp3478@gmail.com \
--to=sp3478@gmail.com \
--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 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).