[DCCP]: Combine allocating & zeroing header space on skb

This is a code simplification:
it combines three often recurring operations into one inline function,

        * allocate `len' bytes header space in skb
        * fill these `len' bytes with zeroes
        * cast the start of this header space as dccp_hdr

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Gerrit Renker 2006-11-10 11:22:32 -02:00 committed by David S. Miller
parent 89e7e57778
commit 9b42078ed6
4 changed files with 14 additions and 24 deletions

View file

@ -256,6 +256,13 @@ static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
return (struct dccp_hdr *)skb->h.raw;
}
static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
{
skb->h.raw = skb_push(skb, headlen);
memset(skb->h.raw, 0, headlen);
return dccp_hdr(skb);
}
static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
{
return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));