On Wed, Mar 08, 2017 at 02:55:30PM +0000, Frediano Ziglio wrote: > The default memset(0) on the node does not init it correctly. > Do so to avoid other nodes/counters appended to unwanted nodes. I don't understand this sentence. Do you mean it's required to correctly mark the node as invalid, otherwise we'll append other nodes/counters to incorrect nodes? > This is due to INVALID_STAT_REF being ~0. We could not change > this value easily as this is used as ABI for the statistics file. Fwiw I would not consider the ABI of the stat file as something we need to provide a strong guarantee on. > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/red-channel.c | 4 ++++ > server/stat.h | 8 ++++++++ > 2 files changed, 12 insertions(+) > > Changes since v1: > - improve comment; > - rename initialization function. > > diff --git a/server/red-channel.c b/server/red-channel.c > index 8ae6ece..8e4d582 100644 > --- a/server/red-channel.c > +++ b/server/red-channel.c > @@ -300,6 +300,10 @@ red_channel_init(RedChannel *self) > self->priv->client_cbs.connect = red_channel_client_default_connect; > self->priv->client_cbs.disconnect = red_channel_client_default_disconnect; > self->priv->client_cbs.migrate = red_channel_client_default_migrate; > + > + /* this is necessary as invalid value is not all fields 0 > + * so the default memset(0) is not enough */ /* This is necessary as a 0-filled RedStatNode is not an empty invalid * node, some of its fields must be set to magic values first */ > + stat_node_set_invalid(&self->priv->stat); stat_reset_node() maybe? Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel