aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-02 10:55:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-02 10:55:08 -0500
commit6d6b89bd2e316b78d668f761d380837b81fa71ef (patch)
tree7e63c58611fc6181153526abbdafdd846ed1a19d /include/net/sock.h
parent13dda80e48439b446d0bc9bab34b91484bc8f533 (diff)
parent2507c05ff55fbf38326b08ed27eaed233bc75042 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1341 commits) virtio_net: remove forgotten assignment be2net: fix tx completion polling sis190: fix cable detect via link status poll net: fix protocol sk_buff field bridge: Fix build error when IGMP_SNOOPING is not enabled bnx2x: Tx barriers and locks scm: Only support SCM_RIGHTS on unix domain sockets. vhost-net: restart tx poll on sk_sndbuf full vhost: fix get_user_pages_fast error handling vhost: initialize log eventfd context pointer vhost: logging thinko fix wireless: convert to use netdev_for_each_mc_addr ethtool: do not set some flags, if others failed ipoib: returned back addrlen check for mc addresses netlink: Adding inode field to /proc/net/netlink axnet_cs: add new id bridge: Make IGMP snooping depend upon BRIDGE. bridge: Add multicast count/interval sysfs entries bridge: Add hash elasticity/max sysfs entries bridge: Add multicast_snooping sysfs toggle ... Trivial conflicts in Documentation/feature-removal-schedule.txt
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 3f1a4804bb3f..6cb1676e409a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -317,6 +317,11 @@ struct sock {
317/* 317/*
318 * Hashed lists helper routines 318 * Hashed lists helper routines
319 */ 319 */
320static inline struct sock *sk_entry(const struct hlist_node *node)
321{
322 return hlist_entry(node, struct sock, sk_node);
323}
324
320static inline struct sock *__sk_head(const struct hlist_head *head) 325static inline struct sock *__sk_head(const struct hlist_head *head)
321{ 326{
322 return hlist_entry(head->first, struct sock, sk_node); 327 return hlist_entry(head->first, struct sock, sk_node);
@@ -376,6 +381,7 @@ static __inline__ void __sk_del_node(struct sock *sk)
376 __hlist_del(&sk->sk_node); 381 __hlist_del(&sk->sk_node);
377} 382}
378 383
384/* NB: equivalent to hlist_del_init_rcu */
379static __inline__ int __sk_del_node_init(struct sock *sk) 385static __inline__ int __sk_del_node_init(struct sock *sk)
380{ 386{
381 if (sk_hashed(sk)) { 387 if (sk_hashed(sk)) {
@@ -416,6 +422,7 @@ static __inline__ int sk_del_node_init(struct sock *sk)
416 } 422 }
417 return rc; 423 return rc;
418} 424}
425#define sk_del_node_init_rcu(sk) sk_del_node_init(sk)
419 426
420static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) 427static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk)
421{ 428{
@@ -449,6 +456,12 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
449 __sk_add_node(sk, list); 456 __sk_add_node(sk, list);
450} 457}
451 458
459static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
460{
461 sock_hold(sk);
462 hlist_add_head_rcu(&sk->sk_node, list);
463}
464
452static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 465static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
453{ 466{
454 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); 467 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
@@ -473,6 +486,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
473 486
474#define sk_for_each(__sk, node, list) \ 487#define sk_for_each(__sk, node, list) \
475 hlist_for_each_entry(__sk, node, list, sk_node) 488 hlist_for_each_entry(__sk, node, list, sk_node)
489#define sk_for_each_rcu(__sk, node, list) \
490 hlist_for_each_entry_rcu(__sk, node, list, sk_node)
476#define sk_nulls_for_each(__sk, node, list) \ 491#define sk_nulls_for_each(__sk, node, list) \
477 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) 492 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
478#define sk_nulls_for_each_rcu(__sk, node, list) \ 493#define sk_nulls_for_each_rcu(__sk, node, list) \
@@ -1044,7 +1059,7 @@ extern void sk_common_release(struct sock *sk);
1044extern void sock_init_data(struct socket *sock, struct sock *sk); 1059extern void sock_init_data(struct socket *sock, struct sock *sk);
1045 1060
1046/** 1061/**
1047 * sk_filter_release: Release a socket filter 1062 * sk_filter_release - release a socket filter
1048 * @fp: filter to remove 1063 * @fp: filter to remove
1049 * 1064 *
1050 * Remove a filter from a socket and release its resources. 1065 * Remove a filter from a socket and release its resources.