skb_cow

Name

skb_cow --  copy a buffer if need be

Synopsis

struct sk_buff * skb_cow (struct sk_buff * skb, unsigned int headroom);

Arguments

skb

buffer to copy

headroom

needed headroom

Description

If the buffer passed lacks sufficient headroom or is a clone then it is copied and the additional headroom made available. If there is no free memory NULL is returned. The new buffer is returned if a copy was made (and the old one dropped a reference). The existing buffer is returned otherwise.

This function primarily exists to avoid making two copies when making a writable copy of a buffer and then growing the headroom.