qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure wit


From: Samuel Thibault
Subject: Re: [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure with an union
Date: Mon, 22 Feb 2016 02:48:48 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Hello,

Thomas Huth, on Fri 19 Feb 2016 14:44:59 +0100, wrote:
> > +   m->m_data -= sizeof(struct tcpiphdr) - (sizeof(struct ip)
> > +                                        + sizeof(struct tcphdr));
> > +   m->m_len += sizeof(struct tcpiphdr) - (sizeof(struct ip)
> > +                                       + sizeof(struct tcphdr));
> 
> I'm somewhat having a hard time to understand the  "+ sizeof(struct
> tcphdr))" here.
> 
> In the tcp_output.c code, there is this:
> 
>       m->m_data += sizeof(struct tcpiphdr) - sizeof(struct tcphdr)
>                                            - sizeof(struct ip);
> 
> So with my limited point of view, I'd rather expect this here in
> tcp_input.c:
> 
>       m->m_data -= sizeof(struct tcpiphdr) - (sizeof(struct ip)
>                                            - sizeof(struct tcphdr));
> i.e. "-" instead of "+" here ----------------^

The parentheses and indentation were misleading actually, here is how it
should actually looks like:

> > +   m->m_data -= sizeof(struct tcpiphdr) - ( sizeof(struct ip)
> > +                                            + sizeof(struct tcphdr));

I've now dropped the parentheses, so it looks like the tcp_output.c code:

        m->m_data -= sizeof(struct tcpiphdr) - sizeof(struct ip)
                                             - sizeof(struct tcphdr);

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]