qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 4/4] block: Eliminate silly QERR_ macros used for encryption keys
Date: Thu, 29 Jan 2015 10:37:01 +0100	[thread overview]
Message-ID: <1422524221-8566-5-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1422524221-8566-1-git-send-email-armbru@redhat.com>

The QERR_ macros are leftovers from the days of "rich" error objects.
They're used with error_set() and qerror_report(), and expand into the
first *two* arguments.  This trickiness has become pointless.  Clean
up QERR_DEVICE_ENCRYPTED and QERR_DEVICE_NOT_ENCRYPTED.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 block.c                   | 5 +++--
 include/qapi/qmp/qerror.h | 6 ------
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/block.c b/block.c
index aa12160..ad6fcef 100644
--- a/block.c
+++ b/block.c
@@ -3734,14 +3734,15 @@ void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp)
 {
     if (key) {
         if (!bdrv_is_encrypted(bs)) {
-            error_set(errp, QERR_DEVICE_NOT_ENCRYPTED,
+            error_setg(errp, "Device '%s' is not encrypted",
                       bdrv_get_device_name(bs));
         } else if (bdrv_set_key(bs, key) < 0) {
             error_set(errp, QERR_INVALID_PASSWORD);
         }
     } else {
         if (bdrv_key_required(bs)) {
-            error_set(errp, QERR_DEVICE_ENCRYPTED,
+            error_set(errp, ERROR_CLASS_DEVICE_ENCRYPTED,
+                      "'%s' (%s) is encrypted",
                       bdrv_get_device_name(bs),
                       bdrv_get_encrypted_filename(bs));
         }
diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
index becdca6..423d8a3 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -52,9 +52,6 @@ void qerror_report_err(Error *err);
 #define QERR_COMMAND_NOT_FOUND \
     ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found"
 
-#define QERR_DEVICE_ENCRYPTED \
-    ERROR_CLASS_DEVICE_ENCRYPTED, "'%s' (%s) is encrypted"
-
 #define QERR_DEVICE_HAS_NO_MEDIUM \
     ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
 
@@ -73,9 +70,6 @@ void qerror_report_err(Error *err);
 #define QERR_DEVICE_NOT_ACTIVE \
     ERROR_CLASS_DEVICE_NOT_ACTIVE, "No %s device has been activated"
 
-#define QERR_DEVICE_NOT_ENCRYPTED \
-    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not encrypted"
-
 #define QERR_DEVICE_NOT_FOUND \
     ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found"
 
-- 
1.9.3

  parent reply	other threads:[~2015-01-29  9:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29  9:36 [Qemu-devel] [PATCH v2 0/4] block: Cleanups around error reporting Markus Armbruster
2015-01-29  9:36 ` [Qemu-devel] [PATCH v2 1/4] blockdev: Give find_block_job() an Error ** parameter Markus Armbruster
2015-01-30 15:10   ` Max Reitz
2015-02-02  9:21     ` Markus Armbruster
2015-01-29  9:36 ` [Qemu-devel] [PATCH v2 2/4] blockdev: Eliminate silly QERR_BLOCK_JOB_NOT_ACTIVE macro Markus Armbruster
2015-01-30 15:14   ` Max Reitz
2015-01-29  9:37 ` [Qemu-devel] [PATCH v2 3/4] block: New bdrv_add_key(), convert monitor to use it Markus Armbruster
2015-01-30 15:18   ` Max Reitz
2015-01-29  9:37 ` Markus Armbruster [this message]
2015-01-30 15:20   ` [Qemu-devel] [PATCH v2 4/4] block: Eliminate silly QERR_ macros used for encryption keys Max Reitz
2015-02-02 17:52 ` [Qemu-devel] [PATCH v2 0/4] block: Cleanups around error reporting Max Reitz

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=1422524221-8566-5-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).