diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-19 23:43:29 -0400 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:29 -0400 |
| commit | 4305b541357ddbd205aa145dc378926b7cb12283 (patch) | |
| tree | 9b1f57ee4ee757a9324c48a7dea84bc8c279ad82 /include/linux | |
| parent | 27a884dc3cb63b93c2b3b643f5b31eed5f8a4d26 (diff) | |
[SK_BUFF]: Convert skb->end to sk_buff_data_t
Now to convert the last one, skb->data, that will allow many simplifications
and removal of some of the offset helpers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/skbuff.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e1c2392ecb56..656dc0e901cc 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -305,9 +305,9 @@ struct sk_buff { | |||
| 305 | sk_buff_data_t mac_header; | 305 | sk_buff_data_t mac_header; |
| 306 | /* These elements must be at the end, see alloc_skb() for details. */ | 306 | /* These elements must be at the end, see alloc_skb() for details. */ |
| 307 | sk_buff_data_t tail; | 307 | sk_buff_data_t tail; |
| 308 | sk_buff_data_t end; | ||
| 308 | unsigned char *head, | 309 | unsigned char *head, |
| 309 | *data, | 310 | *data; |
| 310 | *end; | ||
| 311 | unsigned int truesize; | 311 | unsigned int truesize; |
| 312 | atomic_t users; | 312 | atomic_t users; |
| 313 | }; | 313 | }; |
| @@ -392,8 +392,20 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, | |||
| 392 | unsigned int to, struct ts_config *config, | 392 | unsigned int to, struct ts_config *config, |
| 393 | struct ts_state *state); | 393 | struct ts_state *state); |
| 394 | 394 | ||
| 395 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
| 396 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | ||
| 397 | { | ||
| 398 | return skb->head + skb->end; | ||
| 399 | } | ||
| 400 | #else | ||
| 401 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | ||
| 402 | { | ||
| 403 | return skb->end; | ||
| 404 | } | ||
| 405 | #endif | ||
| 406 | |||
| 395 | /* Internal */ | 407 | /* Internal */ |
| 396 | #define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) | 408 | #define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB))) |
| 397 | 409 | ||
| 398 | /** | 410 | /** |
| 399 | * skb_queue_empty - check if a queue is empty | 411 | * skb_queue_empty - check if a queue is empty |
| @@ -843,6 +855,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | |||
| 843 | { | 855 | { |
| 844 | skb->tail = skb->data + offset; | 856 | skb->tail = skb->data + offset; |
| 845 | } | 857 | } |
| 858 | |||
| 846 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | 859 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ |
| 847 | 860 | ||
| 848 | /* | 861 | /* |
| @@ -872,7 +885,7 @@ static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | |||
| 872 | SKB_LINEAR_ASSERT(skb); | 885 | SKB_LINEAR_ASSERT(skb); |
| 873 | skb->tail += len; | 886 | skb->tail += len; |
| 874 | skb->len += len; | 887 | skb->len += len; |
| 875 | if (unlikely(skb_tail_pointer(skb) > skb->end)) | 888 | if (unlikely(skb->tail > skb->end)) |
| 876 | skb_over_panic(skb, len, current_text_addr()); | 889 | skb_over_panic(skb, len, current_text_addr()); |
| 877 | return tmp; | 890 | return tmp; |
| 878 | } | 891 | } |
| @@ -968,7 +981,7 @@ static inline int skb_headroom(const struct sk_buff *skb) | |||
| 968 | */ | 981 | */ |
| 969 | static inline int skb_tailroom(const struct sk_buff *skb) | 982 | static inline int skb_tailroom(const struct sk_buff *skb) |
| 970 | { | 983 | { |
| 971 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb_tail_pointer(skb); | 984 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; |
| 972 | } | 985 | } |
| 973 | 986 | ||
| 974 | /** | 987 | /** |
