aboutsummaryrefslogtreecommitdiffstats
path: root/net/caif/cfpkt_skbuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/caif/cfpkt_skbuff.c')
-rw-r--r--net/caif/cfpkt_skbuff.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/net/caif/cfpkt_skbuff.c b/net/caif/cfpkt_skbuff.c
index df08c47183d4..e335ba859b97 100644
--- a/net/caif/cfpkt_skbuff.c
+++ b/net/caif/cfpkt_skbuff.c
@@ -63,7 +63,6 @@ static inline struct cfpkt *skb_to_pkt(struct sk_buff *skb)
63 return (struct cfpkt *) skb; 63 return (struct cfpkt *) skb;
64} 64}
65 65
66
67struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt) 66struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt)
68{ 67{
69 struct cfpkt *pkt = skb_to_pkt(nativepkt); 68 struct cfpkt *pkt = skb_to_pkt(nativepkt);
@@ -105,14 +104,12 @@ void cfpkt_destroy(struct cfpkt *pkt)
105 kfree_skb(skb); 104 kfree_skb(skb);
106} 105}
107 106
108
109inline bool cfpkt_more(struct cfpkt *pkt) 107inline bool cfpkt_more(struct cfpkt *pkt)
110{ 108{
111 struct sk_buff *skb = pkt_to_skb(pkt); 109 struct sk_buff *skb = pkt_to_skb(pkt);
112 return skb->len > 0; 110 return skb->len > 0;
113} 111}
114 112
115
116int cfpkt_peek_head(struct cfpkt *pkt, void *data, u16 len) 113int cfpkt_peek_head(struct cfpkt *pkt, void *data, u16 len)
117{ 114{
118 struct sk_buff *skb = pkt_to_skb(pkt); 115 struct sk_buff *skb = pkt_to_skb(pkt);
@@ -144,9 +141,11 @@ int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len)
144 } 141 }
145 from = skb_pull(skb, len); 142 from = skb_pull(skb, len);
146 from -= len; 143 from -= len;
147 memcpy(data, from, len); 144 if (data)
145 memcpy(data, from, len);
148 return 0; 146 return 0;
149} 147}
148EXPORT_SYMBOL(cfpkt_extr_head);
150 149
151int cfpkt_extr_trail(struct cfpkt *pkt, void *dta, u16 len) 150int cfpkt_extr_trail(struct cfpkt *pkt, void *dta, u16 len)
152{ 151{
@@ -170,13 +169,11 @@ int cfpkt_extr_trail(struct cfpkt *pkt, void *dta, u16 len)
170 return 0; 169 return 0;
171} 170}
172 171
173
174int cfpkt_pad_trail(struct cfpkt *pkt, u16 len) 172int cfpkt_pad_trail(struct cfpkt *pkt, u16 len)
175{ 173{
176 return cfpkt_add_body(pkt, NULL, len); 174 return cfpkt_add_body(pkt, NULL, len);
177} 175}
178 176
179
180int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len) 177int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len)
181{ 178{
182 struct sk_buff *skb = pkt_to_skb(pkt); 179 struct sk_buff *skb = pkt_to_skb(pkt);
@@ -255,21 +252,19 @@ int cfpkt_add_head(struct cfpkt *pkt, const void *data2, u16 len)
255 memcpy(to, data, len); 252 memcpy(to, data, len);
256 return 0; 253 return 0;
257} 254}
258 255EXPORT_SYMBOL(cfpkt_add_head);
259 256
260inline int cfpkt_add_trail(struct cfpkt *pkt, const void *data, u16 len) 257inline int cfpkt_add_trail(struct cfpkt *pkt, const void *data, u16 len)
261{ 258{
262 return cfpkt_add_body(pkt, data, len); 259 return cfpkt_add_body(pkt, data, len);
263} 260}
264 261
265
266inline u16 cfpkt_getlen(struct cfpkt *pkt) 262inline u16 cfpkt_getlen(struct cfpkt *pkt)
267{ 263{
268 struct sk_buff *skb = pkt_to_skb(pkt); 264 struct sk_buff *skb = pkt_to_skb(pkt);
269 return skb->len; 265 return skb->len;
270} 266}
271 267
272
273inline u16 cfpkt_iterate(struct cfpkt *pkt, 268inline u16 cfpkt_iterate(struct cfpkt *pkt,
274 u16 (*iter_func)(u16, void *, u16), 269 u16 (*iter_func)(u16, void *, u16),
275 u16 data) 270 u16 data)
@@ -287,7 +282,6 @@ inline u16 cfpkt_iterate(struct cfpkt *pkt,
287 return iter_func(data, pkt->skb.data, cfpkt_getlen(pkt)); 282 return iter_func(data, pkt->skb.data, cfpkt_getlen(pkt));
288} 283}
289 284
290
291int cfpkt_setlen(struct cfpkt *pkt, u16 len) 285int cfpkt_setlen(struct cfpkt *pkt, u16 len)
292{ 286{
293 struct sk_buff *skb = pkt_to_skb(pkt); 287 struct sk_buff *skb = pkt_to_skb(pkt);
@@ -399,3 +393,4 @@ struct caif_payload_info *cfpkt_info(struct cfpkt *pkt)
399{ 393{
400 return (struct caif_payload_info *)&pkt_to_skb(pkt)->cb; 394 return (struct caif_payload_info *)&pkt_to_skb(pkt)->cb;
401} 395}
396EXPORT_SYMBOL(cfpkt_info);