[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v13 04/11] qcow2_format.py: dump bitmap flags in human readable w
From: |
Andrey Shinkevich |
Subject: |
[PATCH v13 04/11] qcow2_format.py: dump bitmap flags in human readable way. |
Date: |
Thu, 6 Aug 2020 22:35:50 +0300 |
Introduce the class BitmapFlags that parses a bitmap flags mask.
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
tests/qemu-iotests/qcow2_format.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/qemu-iotests/qcow2_format.py
b/tests/qemu-iotests/qcow2_format.py
index d4a9974..b447344 100644
--- a/tests/qemu-iotests/qcow2_format.py
+++ b/tests/qemu-iotests/qcow2_format.py
@@ -40,6 +40,22 @@ class Flags64(Qcow2Field):
return str(bits)
+class BitmapFlags(Qcow2Field):
+
+ flags = {
+ 0x1: 'in-use',
+ 0x2: 'auto'
+ }
+
+ def __str__(self):
+ bits = []
+ for bit in range(64):
+ flag = self.value & (1 << bit)
+ if flag:
+ bits.append(self.flags.get(flag, f'bit-{bit}'))
+ return f'{self.value:#x} ({bits})'
+
+
class Enum(Qcow2Field):
def __str__(self):
--
1.8.3.1
- Re: [PATCH v13 09/11] qcow2_format.py: collect fields to dump in JSON format, (continued)
[PATCH v13 01/11] iotests: add test for QCOW2 header dump, Andrey Shinkevich, 2020/08/06
[PATCH v13 02/11] qcow2_format.py: make printable data an extension class member, Andrey Shinkevich, 2020/08/06
[PATCH v13 10/11] qcow2_format.py: support dumping metadata in JSON format, Andrey Shinkevich, 2020/08/06
[PATCH v13 03/11] qcow2_format.py: change Qcow2BitmapExt initialization method, Andrey Shinkevich, 2020/08/06
[PATCH v13 07/11] qcow2_format.py: Dump bitmap table serialized entries, Andrey Shinkevich, 2020/08/06
[PATCH v13 05/11] qcow2_format.py: Dump bitmap directory information, Andrey Shinkevich, 2020/08/06
[PATCH v13 11/11] iotests: dump QCOW2 header in JSON in #303, Andrey Shinkevich, 2020/08/06
[PATCH v13 08/11] qcow2.py: Introduce '-j' key to dump in JSON format, Andrey Shinkevich, 2020/08/06
[PATCH v13 04/11] qcow2_format.py: dump bitmap flags in human readable way.,
Andrey Shinkevich <=
[PATCH v13 06/11] qcow2_format.py: pass cluster size to substructures, Andrey Shinkevich, 2020/08/06
Re: [PATCH v13 00/11] iotests: Dump QCOW2 dirty bitmaps metadata, Andrey Shinkevich, 2020/08/14