[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V5 08/36] qcow2: Implement qcow2_compute_cluster_hash.
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [RFC V5 08/36] qcow2: Implement qcow2_compute_cluster_hash. |
Date: |
Wed, 16 Jan 2013 17:24:29 +0100 |
Add detection of libgnutls used to compute SHA256 hashes
Signed-off-by: Benoit Canet <address@hidden>
---
block/qcow2-dedup.c | 13 ++++++++++++-
configure | 22 ++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
index a424af8..45b2326 100644
--- a/block/qcow2-dedup.c
+++ b/block/qcow2-dedup.c
@@ -25,6 +25,8 @@
* THE SOFTWARE.
*/
+#include <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
#include "block/block_int.h"
#include "qemu-common.h"
#include "qcow2.h"
@@ -157,7 +159,16 @@ static int qcow2_compute_cluster_hash(BlockDriverState *bs,
QCowHash *hash,
uint8_t *data)
{
- return 0;
+ BDRVQcowState *s = bs->opaque;
+ switch (s->dedup_hash_algo) {
+ case QCOW_HASH_SHA256:
+ return gnutls_hash_fast(GNUTLS_DIG_SHA256, data,
+ s->cluster_size, hash->data);
+ default:
+ error_report("Invalid deduplication hash algorithm %i",
+ s->dedup_hash_algo);
+ abort();
+ }
}
/*
diff --git a/configure b/configure
index 99c1ec3..390326e 100755
--- a/configure
+++ b/configure
@@ -1724,6 +1724,28 @@ EOF
fi
##########################################
+# QCOW Deduplication gnutls detection
+cat > $TMPC <<EOF
+#include <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
+int main(void) {char data[4096], digest[32];
+gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
+return 0;
+}
+EOF
+qcow_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
+qcow_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
+if compile_prog "$qcow_tls_cflags" "$qcow_tls_libs" ; then
+ qcow_tls=yes
+ libs_softmmu="$qcow_tls_libs $libs_softmmu"
+ libs_tools="$qcow_tls_libs $libs_softmmu"
+ QEMU_CFLAGS="$QEMU_CFLAGS $qcow_tls_cflags"
+else
+ echo "gnutls > 2.10.0 required to compile QEMU"
+ exit 1
+fi
+
+##########################################
# VNC SASL detection
if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
cat > $TMPC <<EOF
--
1.7.10.4
- [Qemu-devel] [RFC V5 23/36] qcow2: Integrate deduplication in qcow2_co_writev loop., (continued)
- [Qemu-devel] [RFC V5 23/36] qcow2: Integrate deduplication in qcow2_co_writev loop., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 24/36] qcow2: Serialize write requests when deduplication is activated., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 28/36] qcow2: Do not overwrite existing entries with QCOW_OFLAG_COPIED., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 30/36] qcow2: Add lazy refcounts to deduplication to prevent qcow2_cache_set_dependency loops, Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 32/36] qcow: Set large dedup hash block size., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 15/36] qcow2: Extract qcow2_do_table_init., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 22/36] qcow2: Add qcow2_dedup_is_running to probe if dedup is running., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 18/36] block: Add qemu-img dedup create option., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 29/36] qcow2: Integrate SKEIN hash algorithm in deduplication., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 27/36] qcow2: Add check_dedup_l2 in order to check l2 of dedup table., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 08/36] qcow2: Implement qcow2_compute_cluster_hash.,
Benoît Canet <=
- [Qemu-devel] [RFC V5 34/36] qcow2: Add qcow2_dedup_init and qcow2_dedup_close., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 09/36] qcow2: Extract qcow2_dedup_grow_table, Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 07/36] qcow2: Add qcow2_dedup_store_new_hashes., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 33/36] qemu-iotests: Filter dedup=on/off so existing tests don't break., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 35/36] qcow2: Add qcow2_co_dedup_resume to restart deduplication., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 31/36] qcow2: Use large L2 table for deduplication., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 36/36] qcow2: Enable the deduplication feature., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V5 20/36] qcow2: Drop hash for a given cluster when dedup makes refcount > 2^16/2., Benoît Canet, 2013/01/16