Skip to contentSkip to conversation

qcow2: Explicit mention of padding bytes

PATCH Superseded Eric Blake 3 participants 3 messages Feb 27, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

PATCH 1/1 qcow2: Explicit mention of padding bytes

Although we already covered the need for padding bytes with our changes in commit 3ae3fcfa, commit 66fcbca5 just added one byte and relied on the earlier text for implicitly covering 7 padding bytes. For consistency with other parts of the header, it does not hurt to be explicit that this version of the header is using padding bytes, and if we later add other extension fields, we can rework the allocation of those padding bytes to match those additions.

---
 docs/interop/qcow2.txt | 2 ++
 1 file changed, 2 insertions(+)
docs/interop/qcow2.txt +2 -0
index 5597e244746e..193ac7c5c1af 100644
@@ -209,6 +209,8 @@ version 2.
                     Available compression type values:
                         0: zlib <https://www.zlib.net/>
 
+          105 - m:  Zero padding to round up the header size to the next
+                    multiple of 8.
 
 === Header padding ===
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Eric Blake

Although we already covered the need for padding bytes with our changes in commit 3ae3fcfa, commit 66fcbca5 just added one byte and relied on the earlier text for implicitly covering 7 padding bytes. For consistency with other parts of the header,

Those other places are about table entries where there is padding to the next entry of the table, though. In addition, for those other places it’s the only mention that they are padded.

For the header, there is a whole own section describing the padding, so I don’t quite see the point.

Quoted 15 lines

it does not hurt to be
explicit that this version of the header is using padding bytes, and if we later add other extension fields, we can rework the allocation of those padding bytes to match those additions.

---
 docs/interop/qcow2.txt | 2 ++
 1 file changed, 2 insertions(+)
docs/interop/qcow2.txt +0 -0
index 5597e244746e..193ac7c5c1af 100644

docs/interop/qcow2.txt version 2. · line 213

Quoted 5 lines
docs/interop/qcow2.txt +2 -0
@@ -209,6 +209,8 @@ version 2.
                     Available compression type values:
                         0: zlib <https://www.zlib.net/>
 
+          105 - m:  Zero padding to round up the header size to the next
+                    multiple of 8.

And if we really want this, I think it might as well be specific, i.e. “105 - 112”. We would have to adjust it every time we add a new field anyway.

Max

Quoted 2 lines
docs/interop/qcow2.txt +0 -0
 === Header padding ===
 
#2 lore raw
In reply to Eric Blake
Quoted 18 lines · Eric Blake

Although we already covered the need for padding bytes with our changes in commit 3ae3fcfa, commit 66fcbca5 just added one byte and relied on the earlier text for implicitly covering 7 padding bytes. For consistency with other parts of the header, it does not hurt to be explicit that this version of the header is using padding bytes, and if we later add other extension fields, we can rework the allocation of those padding bytes to match those additions.

---
  docs/interop/qcow2.txt | 2 ++
  1 file changed, 2 insertions(+)
docs/interop/qcow2.txt +0 -0
index 5597e244746e..193ac7c5c1af 100644

docs/interop/qcow2.txt version 2. · line 214

Quoted 6 lines
docs/interop/qcow2.txt +2 -0
@@ -209,6 +209,8 @@ version 2.
                      Available compression type values:
                          0: zlib <https://www.zlib.net/>
 
+          105 - m:  Zero padding to round up the header size to the next
+                    multiple of 8.
 

Hmm. Strictly speaking, you defined it as one of additional fields. And by this definition, we may start to check in qemu that these bytes are zero, instead of ignoring them and keeping as is..

But may be it's just a nitpicking..

Signature · 2 lines
Best regards,
Vladimir