]> Git Repo - qemu.git/commitdiff
block: Eliminate silly QERR_ macros used for encryption keys
authorMarkus Armbruster <[email protected]>
Thu, 29 Jan 2015 09:37:01 +0000 (10:37 +0100)
committerMax Reitz <[email protected]>
Fri, 6 Feb 2015 16:46:32 +0000 (11:46 -0500)
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 <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-id: 1422524221[email protected]
Reviewed-by: Max Reitz <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
block.c
include/qapi/qmp/qerror.h

diff --git a/block.c b/block.c
index 84af3cd210cc7732fa7648d2e341eef8a458545a..210fd5f997c5b5270d357235821a97e62f5700ae 100644 (file)
--- a/block.c
+++ b/block.c
@@ -3728,14 +3728,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));
         }
index 85f1699df7b6bd127e4112b4a47ed71eea3669a0..986260f4663e73bd67842d9c429311243667fcff 100644 (file)
@@ -49,9 +49,6 @@ void qerror_report_err(Error *err);
 #define QERR_BUS_NOT_FOUND \
     ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not 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"
 
@@ -67,9 +64,6 @@ void qerror_report_err(Error *err);
 #define QERR_DEVICE_NO_HOTPLUG \
     ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
 
-#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"
 
This page took 0.036802 seconds and 4 git commands to generate.