mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
iotests/qcow2.py: Split feature fields into bits
Print the feature fields as a set of bits so that filtering is easier. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-id: 20191107163708.833192-4-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
1aa6630e7b
commit
0485e6ee4c
7 changed files with 99 additions and 89 deletions
|
@ -42,9 +42,9 @@ class QcowHeader:
|
|||
[ uint64_t, '%#x', 'snapshot_offset' ],
|
||||
|
||||
# Version 3 header fields
|
||||
[ uint64_t, '%#x', 'incompatible_features' ],
|
||||
[ uint64_t, '%#x', 'compatible_features' ],
|
||||
[ uint64_t, '%#x', 'autoclear_features' ],
|
||||
[ uint64_t, 'mask', 'incompatible_features' ],
|
||||
[ uint64_t, 'mask', 'compatible_features' ],
|
||||
[ uint64_t, 'mask', 'autoclear_features' ],
|
||||
[ uint32_t, '%d', 'refcount_order' ],
|
||||
[ uint32_t, '%d', 'header_length' ],
|
||||
];
|
||||
|
@ -130,7 +130,17 @@ class QcowHeader:
|
|||
|
||||
def dump(self):
|
||||
for f in QcowHeader.fields:
|
||||
print("%-25s" % f[2], f[1] % self.__dict__[f[2]])
|
||||
value = self.__dict__[f[2]]
|
||||
if f[1] == 'mask':
|
||||
bits = []
|
||||
for bit in range(64):
|
||||
if value & (1 << bit):
|
||||
bits.append(bit)
|
||||
value_str = str(bits)
|
||||
else:
|
||||
value_str = f[1] % value
|
||||
|
||||
print("%-25s" % f[2], value_str)
|
||||
print("")
|
||||
|
||||
def dump_extensions(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue