[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 46/47] block: Eliminate silly QERR_ macros used fo
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL v2 46/47] block: Eliminate silly QERR_ macros used for encryption keys |
Date: |
Fri, 6 Feb 2015 18:35:06 +0100 |
From: Markus Armbruster <address@hidden>
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
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 84af3cd..210fd5f 100644
--- 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));
}
diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
index 85f1699..986260f 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -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"
--
1.8.3.1
- [Qemu-devel] [PULL v2 00/47] Block patches, Kevin Wolf, 2015/02/06
- [Qemu-devel] [PULL v2 44/47] blockdev: Eliminate silly QERR_BLOCK_JOB_NOT_ACTIVE macro, Kevin Wolf, 2015/02/06
- [Qemu-devel] [PULL v2 45/47] block: New bdrv_add_key(), convert monitor to use it, Kevin Wolf, 2015/02/06
- [Qemu-devel] [PULL v2 43/47] blockdev: Give find_block_job() an Error ** parameter, Kevin Wolf, 2015/02/06
- [Qemu-devel] [PULL v2 46/47] block: Eliminate silly QERR_ macros used for encryption keys,
Kevin Wolf <=
- [Qemu-devel] [PULL v2 47/47] block/raw-posix.c: Fix raw_getlength() on Mac OS X block devices, Kevin Wolf, 2015/02/06
- Re: [Qemu-devel] [PULL v2 00/47] Block patches, Peter Maydell, 2015/02/09