Project

General

Profile

Actions

Feature #3465

open

Loop head macros support

Added by Mikhail Mandrykin about 12 years ago. Updated about 12 years ago.

Status:
Open
Priority:
Low
Category:
-
Start date:
09/20/2012
Due date:
% Done:

0%

Estimated time:
Published in build:

Description

There are some marco definitions intended for some specific list or queue traverses. For instance,

#define skb_queue_walk_safe(queue, skb, tmp)                                    \
                for (skb = (queue)->next, tmp = skb->next;                      \
                     skb != (struct sk_buff *)(queue);                          \
                     skb = tmp, tmp = skb->next)

It's desirable sometimes to have some instructions executed at each iteration of such loops. Here, for example, this macro enables us to detect assignments to skb varaible which is useful in checking for double skb deallocations.
skb_queue_walk_safe(tx_skb_queue, skb, tmp) {
        if (...) {
                ...
                kfree_skb(skb);
        }
}

Actions

Also available in: Atom PDF