Skip to content

Commit

Permalink
[SKB]: __skb_queue_after(prev) = __skb_insert(prev, prev->next)
Browse files Browse the repository at this point in the history
By reordering, __skb_queue_after() is expressed in terms of __skb_insert().

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gerrit Renker authored and David S. Miller committed Apr 14, 2008
1 parent f525c06 commit bf29927
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,21 @@ static inline void skb_queue_head_init_class(struct sk_buff_head *list,
}

/*
* Insert an sk_buff at the start of a list.
* Insert an sk_buff on a list.
*
* The "__skb_xxxx()" functions are the non-atomic ones that
* can only be called with interrupts disabled.
*/
extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
static inline void __skb_insert(struct sk_buff *newsk,
struct sk_buff *prev, struct sk_buff *next,
struct sk_buff_head *list)
{
newsk->next = next;
newsk->prev = prev;
next->prev = prev->next = newsk;
list->qlen++;
}

/**
* __skb_queue_after - queue a buffer at the list head
Expand All @@ -684,13 +694,7 @@ static inline void __skb_queue_after(struct sk_buff_head *list,
struct sk_buff *prev,
struct sk_buff *newsk)
{
struct sk_buff *next;
list->qlen++;

next = prev->next;
newsk->next = next;
newsk->prev = prev;
next->prev = prev->next = newsk;
__skb_insert(newsk, prev, prev->next, list);
}

/**
Expand Down Expand Up @@ -734,20 +738,6 @@ static inline void __skb_queue_tail(struct sk_buff_head *list,
next->prev = prev->next = newsk;
}

/*
* Insert a packet on a list.
*/
extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
static inline void __skb_insert(struct sk_buff *newsk,
struct sk_buff *prev, struct sk_buff *next,
struct sk_buff_head *list)
{
newsk->next = next;
newsk->prev = prev;
next->prev = prev->next = newsk;
list->qlen++;
}

/*
* Place a packet after a given packet in a list.
*/
Expand Down

0 comments on commit bf29927

Please sign in to comment.