diff mbox series

[v2,08/10] qcow2/bitmap: track extra_data_size

Message ID 20180613020613.1343-9-jsnow@redhat.com
State New
Headers show
Series qemu-img: add bitmap info output | expand

Commit Message

John Snow June 13, 2018, 2:06 a.m. UTC
Similarly to the last patch, track the extra_data_size field that we read.
We do reject anything other than zero, but if this restriction is lifted
in the future, we'll need to update the _info field, so loosen this now.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/qcow2-bitmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 36573f7b52..3c2e974458 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -86,6 +86,7 @@  typedef struct Qcow2Bitmap {
     uint8_t type;
     uint8_t granularity_bits;
     char *name;
+    uint32_t extra_data_size;
 
     BdrvDirtyBitmap *dirty_bitmap;
 
@@ -609,6 +610,7 @@  static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, Error **errp)
         bm->table.size = e->bitmap_table_size;
         bm->flags = e->flags;
         bm->type = e->type;
+        bm->extra_data_size = e->extra_data_size;
         bm->granularity_bits = e->granularity_bits;
         bm->name = dir_entry_copy_name(e);
         QSIMPLEQ_INSERT_TAIL(bm_list, bm, entry);
@@ -782,7 +784,7 @@  static int bitmap_list_store(BlockDriverState *bs, Qcow2BitmapList *bm_list,
         e->type = bm->type;
         e->granularity_bits = bm->granularity_bits;
         e->name_size = strlen(bm->name);
-        e->extra_data_size = 0;
+        e->extra_data_size = bm->extra_data_size;
         memcpy(e + 1, bm->name, e->name_size);
 
         if (check_dir_entry(bs, e) < 0) {