diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-17 22:45:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-17 22:45:23 -0400 |
commit | e521db9d790aaa60ae8920e21cb7faedc280fc36 (patch) | |
tree | c58a138e9729eb61edaf697b9e259001fb92feb2 /net/ipv4/inet_fragment.c | |
parent | 2588fe1d782f1686847493ad643157d5d10bf602 (diff) |
[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>
Diffstat (limited to 'net/ipv4/inet_fragment.c')
-rw-r--r-- | net/ipv4/inet_fragment.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 15054eb3d4b9..57e15fa307dc 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -209,3 +209,20 @@ struct inet_frag_queue *inet_frag_intern(struct inet_frag_queue *qp_in, | |||
209 | return qp; | 209 | return qp; |
210 | } | 210 | } |
211 | EXPORT_SYMBOL(inet_frag_intern); | 211 | EXPORT_SYMBOL(inet_frag_intern); |
212 | |||
213 | struct inet_frag_queue *inet_frag_alloc(struct inet_frags *f) | ||
214 | { | ||
215 | struct inet_frag_queue *q; | ||
216 | |||
217 | q = kzalloc(f->qsize, GFP_ATOMIC); | ||
218 | if (q == NULL) | ||
219 | return NULL; | ||
220 | |||
221 | atomic_add(f->qsize, &f->mem); | ||
222 | setup_timer(&q->timer, f->frag_expire, (unsigned long)q); | ||
223 | spin_lock_init(&q->lock); | ||
224 | atomic_set(&q->refcnt, 1); | ||
225 | |||
226 | return q; | ||
227 | } | ||
228 | EXPORT_SYMBOL(inet_frag_alloc); | ||