mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[INET]: Consolidate xxx_frag_alloc()
Just perform the kzalloc() allocation and setup common fields in the inet_frag_queue(). Then return the result to the caller to initialize the rest. The inet_frag_alloc() may return NULL, so check the return value before doing the container_of(). This looks ugly, but the xxx_frag_alloc() will be removed soon. The xxx_expire() timer callbacks are patches, because the argument is now the inet_frag_queue, not the protocol specific queue. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2588fe1d78
commit
e521db9d79
5 changed files with 41 additions and 36 deletions
|
@ -209,3 +209,20 @@ struct inet_frag_queue *inet_frag_intern(struct inet_frag_queue *qp_in,
|
|||
return qp;
|
||||
}
|
||||
EXPORT_SYMBOL(inet_frag_intern);
|
||||
|
||||
struct inet_frag_queue *inet_frag_alloc(struct inet_frags *f)
|
||||
{
|
||||
struct inet_frag_queue *q;
|
||||
|
||||
q = kzalloc(f->qsize, GFP_ATOMIC);
|
||||
if (q == NULL)
|
||||
return NULL;
|
||||
|
||||
atomic_add(f->qsize, &f->mem);
|
||||
setup_timer(&q->timer, f->frag_expire, (unsigned long)q);
|
||||
spin_lock_init(&q->lock);
|
||||
atomic_set(&q->refcnt, 1);
|
||||
|
||||
return q;
|
||||
}
|
||||
EXPORT_SYMBOL(inet_frag_alloc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue