aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2006-11-10 08:22:32 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:55 -0500
commit9b42078ed6edfe04e9dc9a59b946ad912aeef717 (patch)
treed3d20e17aa85e1bb16b99397f98f151d197b3177 /include/linux
parent89e7e57778ecd8744fee97491300f05a9fb1388a (diff)
[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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dccp.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 53553c99cad6..90d04ffddae8 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -256,6 +256,13 @@ static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
256 return (struct dccp_hdr *)skb->h.raw; 256 return (struct dccp_hdr *)skb->h.raw;
257} 257}
258 258
259static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
260{
261 skb->h.raw = skb_push(skb, headlen);
262 memset(skb->h.raw, 0, headlen);
263 return dccp_hdr(skb);
264}
265
259static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) 266static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
260{ 267{
261 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); 268 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));