aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-01-29 10:37:01 +0100
committerMax Reitz <mreitz@redhat.com>2015-02-06 11:46:32 -0500
commitb1ca639184d93984551b423d8e538ad4add5eb15 (patch)
tree76aa97eea763dd725edada2b3d210f27b8f7af5a /block.c
parent4d2855a348c5e90f56584ab9777fc877965ca2e0 (diff)
block: Eliminate silly QERR_ macros used for encryption keys
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> Message-id: 1422524221-8566-5-git-send-email-armbru@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block.c b/block.c
index 84af3cd210..210fd5f997 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));
}