From patchwork Wed Sep 21 04:27:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 672575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sf6G51vy9z9t0q for ; Wed, 21 Sep 2016 14:34:05 +1000 (AEST) Received: from localhost ([::1]:39744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmZEQ-0007PO-T0 for incoming@patchwork.ozlabs.org; Wed, 21 Sep 2016 00:34:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmZ8f-0002Yj-Km for qemu-devel@nongnu.org; Wed, 21 Sep 2016 00:28:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmZ8d-0002Uz-Ir for qemu-devel@nongnu.org; Wed, 21 Sep 2016 00:28:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmZ8b-0002UB-5j; Wed, 21 Sep 2016 00:28:01 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A578075C; Wed, 21 Sep 2016 04:28:00 +0000 (UTC) Received: from lemon.redhat.com (vpn1-5-197.pek2.redhat.com [10.72.5.197]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8L4RQhb018394; Wed, 21 Sep 2016 00:27:56 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Wed, 21 Sep 2016 12:27:19 +0800 Message-Id: <1474432046-325-7-git-send-email-famz@redhat.com> In-Reply-To: <1474432046-325-1-git-send-email-famz@redhat.com> References: <1474432046-325-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 21 Sep 2016 04:28:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v9 06/13] crypto: Switch to QEMU UUID API X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org, sw@weilnetz.de, jcody@redhat.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com, pbonzini@redhat.com, mreitz@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The uuid generation doesn't return error, so update the function signature and calling code accordingly. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Reviewed-by: Jeff Cody Reviewed-by: Daniel P. Berrange --- crypto/block-luks.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index a848232..4530f82 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -29,10 +29,7 @@ #include "crypto/pbkdf.h" #include "crypto/secret.h" #include "crypto/random.h" - -#ifdef CONFIG_UUID -#include -#endif +#include "qemu/uuid.h" #include "qemu/coroutine.h" @@ -877,18 +874,12 @@ qcrypto_block_luks_open(QCryptoBlock *block, } -static int -qcrypto_block_luks_uuid_gen(uint8_t *uuidstr, Error **errp) +static void +qcrypto_block_luks_uuid_gen(uint8_t *uuidstr) { -#ifdef CONFIG_UUID - uuid_t uuid; - uuid_generate(uuid); - uuid_unparse(uuid, (char *)uuidstr); - return 0; -#else - error_setg(errp, "Unable to generate uuids on this platform"); - return -1; -#endif + QemuUUID uuid; + qemu_uuid_generate(&uuid); + qemu_uuid_unparse(&uuid, (char *)uuidstr); } static int @@ -965,10 +956,7 @@ qcrypto_block_luks_create(QCryptoBlock *block, * it out to disk */ luks->header.version = QCRYPTO_BLOCK_LUKS_VERSION; - if (qcrypto_block_luks_uuid_gen(luks->header.uuid, - errp) < 0) { - goto error; - } + qcrypto_block_luks_uuid_gen(luks->header.uuid); cipher_alg = qcrypto_block_luks_cipher_alg_lookup(luks_opts.cipher_alg, errp);