[Spice-devel] [PATCH spice-server] reds: Send link replies with less chunks

Christophe Fergeau cfergeau at redhat.com
Mon Mar 6 16:50:27 UTC 2017


On Mon, Mar 06, 2017 at 11:36:16AM -0500, Frediano Ziglio wrote:
> 
> > 
> > On Mon, Mar 06, 2017 at 04:12:33PM +0000, Frediano Ziglio wrote:
> > > Send header and reply together
> > 
> > The log is missing a "Why?"
> > 
> 
> Potentially to safe up to 160 bytes!

And this is not worth mentioning in the log because .. ?

> 
> > > 
> > > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > > ---
> > >  server/reds.c | 56
> > >  +++++++++++++++++++++++++++++---------------------------
> > >  1 file changed, 29 insertions(+), 27 deletions(-)
> > > 
> > > diff --git a/server/reds.c b/server/reds.c
> > > index fc720a3..e94d0c4 100644
> > > --- a/server/reds.c
> > > +++ b/server/reds.c
> > > @@ -1459,8 +1459,10 @@ static bool red_link_info_test_capability(const
> > > RedLinkInfo *link, uint32_t cap)
> > >  
> > >  static int reds_send_link_ack(RedsState *reds, RedLinkInfo *link)
> > >  {
> > > -    SpiceLinkHeader header;
> > > -    SpiceLinkReply ack;
> > > +    struct {
> > > +        SpiceLinkHeader header;
> > > +        SpiceLinkReply ack;
> > > +    } msg;
> > 
> > I guess the compiler could decide to insert some padding between the 2
> > structs? If this happens, is this going to break the client/server
> > communication?
> > 
> > Christophe
> > 
> 
> I can copy the same paranoid check:
> 
> SPICE_VERIFY(sizeof(msg) == sizeof(SpiceLinkHeader) + sizeof(SpiceLinkReply));
> 
> Note that these structures are packed ones so compiler would
> break its ABI.

The anonymous struct you introduce is not packed, I don't expect the
packed attribute to apply to it. But yes, best to have the static
assert.

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/20170306/bb974c78/attachment.sig>


More information about the Spice-devel mailing list