mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
qmp: add x-debug-block-dirty-bitmap-sha256
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-id: 20170628120530.31251-26-vsementsov@virtuozzo.com Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
eb738bb50f
commit
a3b52535e8
7 changed files with 78 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "qemu/hbitmap.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "trace.h"
|
||||
#include "crypto/hash.h"
|
||||
|
||||
/* HBitmaps provides an array of bits. The bits are stored as usual in an
|
||||
* array of unsigned longs, but HBitmap is also optimized to provide fast
|
||||
|
@ -727,3 +728,13 @@ void hbitmap_free_meta(HBitmap *hb)
|
|||
hbitmap_free(hb->meta);
|
||||
hb->meta = NULL;
|
||||
}
|
||||
|
||||
char *hbitmap_sha256(const HBitmap *bitmap, Error **errp)
|
||||
{
|
||||
size_t size = bitmap->sizes[HBITMAP_LEVELS - 1] * sizeof(unsigned long);
|
||||
char *data = (char *)bitmap->levels[HBITMAP_LEVELS - 1];
|
||||
char *hash = NULL;
|
||||
qcrypto_hash_digest(QCRYPTO_HASH_ALG_SHA256, data, size, &hash, errp);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue