mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
[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:
parent
89e7e57778
commit
9b42078ed6
4 changed files with 14 additions and 24 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue