<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div>On Thu, 2019-01-03 at 16:46 +0000, Frediano Ziglio wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>The SpiceStat structure can be 20 or 24 bytes depending on alignment.</div><div>Being a memory mapped structure potentially used with lockless access<font color="#ff6600">, it</font></div><div>is not good to have it unaligned.</div><div>The current tool that reads this memory mapped file (reds_stats) is</div><div>able to detect if the structure is either 20 or 24 bytes and act</div><div>according<font color="#ff6600">ly</font> so changing this structure won't affect the behaviour</div><div>(unless you have an old tool but as they are usually package<font color="#ff6600">d</font> together</div><div><font color="#ff6600">this </font>is quite improbable).</div><div>This will also help on Windows as in that system <font color="#ff6600">it</font> is not possible for</div><div>reds_stats to implement the same discovery trick implemented on Linux.</div><div><strike><font color="#ff6600">as </font></strike><font color="#ff6600">O</font>n Windows <font color="#ff6600">it</font> is not possible to read the size of the file mapping</div><div>(on Windows to implement shared memory you can use a file mapping</div><div>not associated to a file).</div><div>The structure will change layout only on 32-bit <font color="#ff6600">architectures </font>which <font color="#ff6600">is</font> not <strike><font color="#ff6600">that</font></strike></div><div>recommended nowadays (<font color="#ff6600">the </font>64-bit platforms <font color="#ff6600">that</font> we support align 64-bit integer<font color="#ff6600">s</font></div><div>to 64 bits).</div><div><br></div><div>Signed-off-by: Frediano Ziglio <<a href="mailto:fziglio@redhat.com">fziglio@redhat.com</a>></div></blockquote><div><br></div><div>Suggested wording tweaks highlighted in red above.</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>---</div><div> spice/stats.h | 2 ++</div><div> 1 file changed, 2 insertions(+)</div><div><br></div><div>Changes since v1:</div><div>- update commit message and comment.</div><div><br></div><div>diff --git a/spice/stats.h b/spice/stats.h</div><div>index d4c45ab..44c6482 100644</div><div>--- a/spice/stats.h</div><div>+++ b/spice/stats.h</div><div>@@ -66,6 +66,8 @@ typedef struct SpiceStat {</div><div> uint32_t generation;</div><div> uint32_t num_of_nodes;</div><div> uint32_t root_index;</div><div>+ /* to avoid holes in the structure on some platforms */</div><div>+ uint32_t padding;</div><div> SpiceStatNode nodes[];</div><div> } SpiceStat;</div><div> </div></blockquote></body></html>