From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv2P1-0001eO-TS for qemu-devel@nongnu.org; Thu, 12 Jun 2014 06:38:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wv2Ou-00077j-7X for qemu-devel@nongnu.org; Thu, 12 Jun 2014 06:38:39 -0400 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]:62131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv2Ot-00077Y-U1 for qemu-devel@nongnu.org; Thu, 12 Jun 2014 06:38:32 -0400 Received: by mail-pd0-f169.google.com with SMTP id w10so841498pde.14 for ; Thu, 12 Jun 2014 03:38:30 -0700 (PDT) From: Sanidhya Kashyap Date: Thu, 12 Jun 2014 16:06:40 +0530 Message-Id: <1402569400-12242-8-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1402569400-12242-1-git-send-email-sanidhya.iiith@gmail.com> References: <1402569400-12242-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [PATCH v3 7/7] python script for extracting bitmap from a binary file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela The script has been modified to store the blocks' information in dictionary format that can be used by the user. Besides, that there was some issue with the script which I have rectified and it is working perfectly. For every iteration, the bitmap is followed by a character - 'M' which acts as a marker identifying as the end of that bitmap. If the 'M' is missing while reading the file, then dump is incomplete. Signed-off-by: Sanidhya Kashyap --- scripts/extract-bitmap.py | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 scripts/extract-bitmap.py diff --git a/scripts/extract-bitmap.py b/scripts/extract-bitmap.py new file mode 100755 index 0000000..5edc49d --- /dev/null +++ b/scripts/extract-bitmap.py @@ -0,0 +1,97 @@ +#!/usr/bin/python +# This python script helps in extracting the dirty bitmap present +# in the file after executing the log-dirty-bitmap command either +# from the qmp or hmp interface. This file only processes binary +# file obtained via command. +# +# Copyright (C) 2014 Sanidhya Kashyap +# +# Authors: +# Sanidhya Kashyap +# +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. + +import struct +import argparse +from functools import partial + +long_bytes = 8 +byte_size = 8 +int_bytes = 4 +string_bytes = 256 +complete_bitmap_list = [] +block_list = [] + +def get_unsigned_long_integer(value): + return struct.unpack('