[Spice-devel] [PATCH spice-server v3] red-channel: Initialize statistic node correctly
Christophe Fergeau
cfergeau at redhat.com
Fri Mar 31 08:23:48 UTC 2017
On Thu, Mar 30, 2017 at 02:50:12PM -0400, Frediano Ziglio wrote:
> >
> > On Thu, Mar 30, 2017 at 01:45:05PM +0100, Frediano Ziglio wrote:
> > > The default memset(0) on the node did not init it correctly.
> >
> > "Doing a memset(0) on a SpiceStatNode does not create an empty/unattached
> > node, but instead creates a node whose parent is the node '0'. This node
> > could be non-existing, or totally unrelated to the empty node we wanted
> > to create."
> >
>
> SpiceStatNode contains a reference to the node which is basically
> an index (0-based) on an array inside the statistic file.
> The value ~0 is special and for a parent/node means invalid and the
> child will appended as sibling from the root.
> The memset(0) basically will initialize the node to the first node
> in the array whatever is it. So node/counters created with parent as
> this not initialized node will be child of the node 0
> (being the first will be the first node/counter created).
>
> > > This patch create the 0 node as soon as the file is created
> > > to use as default memset(0) compatible node.
> >
> > "This patch creates a default '0' node as soon as the file is created.
> > This will make the behaviour of 0-filled nodes more in line with what
> > one would expect."
> >
>
> Yes. As all counters are created for channels creating a "default_channel"
> node make sense and being 0 make the trick work.
These were suggestions for improving the commit log in cas this was not
clear, ACK from me with a more detailed commit log along these lines.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170331/3fc1a5c0/attachment-0001.sig>
More information about the Spice-devel
mailing list