aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index d200dfbe1ef6..0bea25db5471 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -363,6 +363,27 @@ static __inline__ int sk_del_node_init(struct sock *sk)
363 return rc; 363 return rc;
364} 364}
365 365
366static __inline__ int __sk_del_node_init_rcu(struct sock *sk)
367{
368 if (sk_hashed(sk)) {
369 hlist_del_init_rcu(&sk->sk_node);
370 return 1;
371 }
372 return 0;
373}
374
375static __inline__ int sk_del_node_init_rcu(struct sock *sk)
376{
377 int rc = __sk_del_node_init_rcu(sk);
378
379 if (rc) {
380 /* paranoid for a while -acme */
381 WARN_ON(atomic_read(&sk->sk_refcnt) == 1);
382 __sock_put(sk);
383 }
384 return rc;
385}
386
366static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) 387static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list)
367{ 388{
368 hlist_add_head(&sk->sk_node, list); 389 hlist_add_head(&sk->sk_node, list);
@@ -374,6 +395,17 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
374 __sk_add_node(sk, list); 395 __sk_add_node(sk, list);
375} 396}
376 397
398static __inline__ void __sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
399{
400 hlist_add_head_rcu(&sk->sk_node, list);
401}
402
403static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
404{
405 sock_hold(sk);
406 __sk_add_node_rcu(sk, list);
407}
408
377static __inline__ void __sk_del_bind_node(struct sock *sk) 409static __inline__ void __sk_del_bind_node(struct sock *sk)
378{ 410{
379 __hlist_del(&sk->sk_bind_node); 411 __hlist_del(&sk->sk_bind_node);
@@ -387,6 +419,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
387 419
388#define sk_for_each(__sk, node, list) \ 420#define sk_for_each(__sk, node, list) \
389 hlist_for_each_entry(__sk, node, list, sk_node) 421 hlist_for_each_entry(__sk, node, list, sk_node)
422#define sk_for_each_rcu(__sk, node, list) \
423 hlist_for_each_entry_rcu(__sk, node, list, sk_node)
390#define sk_for_each_from(__sk, node) \ 424#define sk_for_each_from(__sk, node) \
391 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 425 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
392 hlist_for_each_entry_from(__sk, node, sk_node) 426 hlist_for_each_entry_from(__sk, node, sk_node)
@@ -589,8 +623,9 @@ struct proto {
589 int *sysctl_rmem; 623 int *sysctl_rmem;
590 int max_header; 624 int max_header;
591 625
592 struct kmem_cache *slab; 626 struct kmem_cache *slab;
593 unsigned int obj_size; 627 unsigned int obj_size;
628 int slab_flags;
594 629
595 atomic_t *orphan_count; 630 atomic_t *orphan_count;
596 631