summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2016-11-15 23:57:45 +0100
committerFam Zheng <famz@redhat.com>2017-01-26 10:25:01 +0800
commit20a579de8484096d18e65751ebe63fee31551f04 (patch)
treeb18432ea3cce4bb67817676b72a8c1e2ee0c3bb3 /include
parentc7f1cf01b8245762ca5864e835d84f6677ae8b1f (diff)
downloadqemu-20a579de8484096d18e65751ebe63fee31551f04.tar.gz
hbitmap: Add hbitmap_is_serializable()
Bitmaps with a granularity of 58 or above can be neither serialized nor deserialized (see the comment in the function added in this series for an explanation). This patch adds a function so that we can check whether a bitmap actually can be (de-)serialized at all, thus avoiding failing the necessary assertion in hbitmap_serialization_granularity(). Signed-off-by: Max Reitz <mreitz@redhat.com> Message-Id: <20161115225746.3590-2-mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/hbitmap.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h
index eb464759d5..9239fe515e 100644
--- a/include/qemu/hbitmap.h
+++ b/include/qemu/hbitmap.h
@@ -146,6 +146,19 @@ void hbitmap_reset_all(HBitmap *hb);
bool hbitmap_get(const HBitmap *hb, uint64_t item);
/**
+ * hbitmap_is_serializable:
+ * @hb: HBitmap which should be (de-)serialized.
+ *
+ * Returns whether the bitmap can actually be (de-)serialized. Other
+ * (de-)serialization functions may only be invoked if this function returns
+ * true.
+ *
+ * Calling (de-)serialization functions does not affect a bitmap's
+ * (de-)serializability.
+ */
+bool hbitmap_is_serializable(const HBitmap *hb);
+
+/**
* hbitmap_serialization_granularity:
* @hb: HBitmap to operate on.
*