qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Alberto Garcia <berto@igalia.com>,
	Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>
Subject: [Qemu-devel] [PATCH v1 2/2] Revert "block: don't register quorum driver if SHA256 support is unavailable"
Date: Tue,  5 Jul 2016 11:50:00 +0100	[thread overview]
Message-ID: <1467715800-20379-3-git-send-email-berrange@redhat.com> (raw)
In-Reply-To: <1467715800-20379-1-git-send-email-berrange@redhat.com>

The qcrypto hash APIs now guarantee that sha256 is available at
compile time, so skipping registration is rarely needed. A check
at time of open is kept to ensure good error reporting in the
(unlikely) case sha256 is runtime disabled.

This reverts commit e94867ed5f241008d0f53142b2704a075f9ed505.
---
 block/quorum.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index 331b726..ed02cce 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -878,6 +878,12 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
     int i;
     int ret = 0;
 
+    if (!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA256)) {
+        error_setg(errp,
+                   "SHA256 hash support is required for quorum device");
+        return -EINVAL;
+    }
+
     qdict_flatten(options);
 
     /* count how many different children are present */
@@ -1113,10 +1119,6 @@ static BlockDriver bdrv_quorum = {
 
 static void bdrv_quorum_init(void)
 {
-    if (!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA256)) {
-        /* SHA256 hash support is required for quorum device */
-        return;
-    }
     bdrv_register(&bdrv_quorum);
 }
 
-- 
2.7.4

  parent reply	other threads:[~2016-07-05 10:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 10:49 [Qemu-devel] [PATCH v1 0/2] Use GChecksum as fallback hash impl Daniel P. Berrange
2016-07-05 10:49 ` [Qemu-devel] [PATCH v1 1/2] crypto: use glib as fallback for hash algorithm Daniel P. Berrange
2016-07-05 15:03   ` Eric Blake
2016-07-05 15:32     ` Daniel P. Berrange
2016-07-06 11:58   ` Alberto Garcia
2016-07-06 14:53     ` Eric Blake
2016-07-07  9:18       ` Daniel P. Berrange
2016-07-07  8:52   ` Alberto Garcia
2016-07-05 10:50 ` Daniel P. Berrange [this message]
2016-07-05 15:04   ` [Qemu-devel] [PATCH v1 2/2] Revert "block: don't register quorum driver if SHA256 support is unavailable" Eric Blake
2016-07-07  8:53   ` Alberto Garcia
2016-07-05 16:43 ` [Qemu-devel] [PATCH v1 3/2] crypto: don't open-code qcrypto_hash_supports Daniel P. Berrange
2016-07-05 22:26   ` Eric Blake
2016-07-07  8:55   ` Alberto Garcia

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=1467715800-20379-3-git-send-email-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=berto@igalia.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).