diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 40bb90ebb2d1..03684e702d13 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/lockdep.h> | 47 | #include <linux/lockdep.h> |
48 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
49 | #include <linux/skbuff.h> /* struct sk_buff */ | 49 | #include <linux/skbuff.h> /* struct sk_buff */ |
50 | #include <linux/mm.h> | ||
50 | #include <linux/security.h> | 51 | #include <linux/security.h> |
51 | 52 | ||
52 | #include <linux/filter.h> | 53 | #include <linux/filter.h> |
@@ -570,7 +571,7 @@ struct proto { | |||
570 | int *sysctl_rmem; | 571 | int *sysctl_rmem; |
571 | int max_header; | 572 | int max_header; |
572 | 573 | ||
573 | kmem_cache_t *slab; | 574 | struct kmem_cache *slab; |
574 | unsigned int obj_size; | 575 | unsigned int obj_size; |
575 | 576 | ||
576 | atomic_t *orphan_count; | 577 | atomic_t *orphan_count; |
@@ -745,7 +746,32 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size) | |||
745 | */ | 746 | */ |
746 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owner) | 747 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owner) |
747 | 748 | ||
748 | extern void FASTCALL(lock_sock(struct sock *sk)); | 749 | /* |
750 | * Macro so as to not evaluate some arguments when | ||
751 | * lockdep is not enabled. | ||
752 | * | ||
753 | * Mark both the sk_lock and the sk_lock.slock as a | ||
754 | * per-address-family lock class. | ||
755 | */ | ||
756 | #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ | ||
757 | do { \ | ||
758 | sk->sk_lock.owner = NULL; \ | ||
759 | init_waitqueue_head(&sk->sk_lock.wq); \ | ||
760 | spin_lock_init(&(sk)->sk_lock.slock); \ | ||
761 | debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ | ||
762 | sizeof((sk)->sk_lock)); \ | ||
763 | lockdep_set_class_and_name(&(sk)->sk_lock.slock, \ | ||
764 | (skey), (sname)); \ | ||
765 | lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ | ||
766 | } while (0) | ||
767 | |||
768 | extern void FASTCALL(lock_sock_nested(struct sock *sk, int subclass)); | ||
769 | |||
770 | static inline void lock_sock(struct sock *sk) | ||
771 | { | ||
772 | lock_sock_nested(sk, 0); | ||
773 | } | ||
774 | |||
749 | extern void FASTCALL(release_sock(struct sock *sk)); | 775 | extern void FASTCALL(release_sock(struct sock *sk)); |
750 | 776 | ||
751 | /* BH context may only use the following locking interface. */ | 777 | /* BH context may only use the following locking interface. */ |
@@ -883,19 +909,23 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb) | |||
883 | } | 909 | } |
884 | 910 | ||
885 | /** | 911 | /** |
886 | * sk_filter_release: Release a socket filter | 912 | * sk_filter_rcu_free: Free a socket filter |
887 | * @sk: socket | 913 | * @rcu: rcu_head that contains the sk_filter to free |
888 | * @fp: filter to remove | ||
889 | * | ||
890 | * Remove a filter from a socket and release its resources. | ||
891 | */ | 914 | */ |
892 | |||
893 | static inline void sk_filter_rcu_free(struct rcu_head *rcu) | 915 | static inline void sk_filter_rcu_free(struct rcu_head *rcu) |
894 | { | 916 | { |
895 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | 917 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); |
896 | kfree(fp); | 918 | kfree(fp); |
897 | } | 919 | } |
898 | 920 | ||
921 | /** | ||
922 | * sk_filter_release: Release a socket filter | ||
923 | * @sk: socket | ||
924 | * @fp: filter to remove | ||
925 | * | ||
926 | * Remove a filter from a socket and release its resources. | ||
927 | */ | ||
928 | |||
899 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) | 929 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) |
900 | { | 930 | { |
901 | unsigned int size = sk_filter_len(fp); | 931 | unsigned int size = sk_filter_len(fp); |
@@ -944,7 +974,8 @@ static inline void sock_put(struct sock *sk) | |||
944 | sk_free(sk); | 974 | sk_free(sk); |
945 | } | 975 | } |
946 | 976 | ||
947 | extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb); | 977 | extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, |
978 | const int nested); | ||
948 | 979 | ||
949 | /* Detach socket from process context. | 980 | /* Detach socket from process context. |
950 | * Announce socket dead, detach it from wait queue and inode. | 981 | * Announce socket dead, detach it from wait queue and inode. |
@@ -1078,7 +1109,7 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from, | |||
1078 | { | 1109 | { |
1079 | if (skb->ip_summed == CHECKSUM_NONE) { | 1110 | if (skb->ip_summed == CHECKSUM_NONE) { |
1080 | int err = 0; | 1111 | int err = 0; |
1081 | unsigned int csum = csum_and_copy_from_user(from, | 1112 | __wsum csum = csum_and_copy_from_user(from, |
1082 | page_address(page) + off, | 1113 | page_address(page) + off, |
1083 | copy, 0, &err); | 1114 | copy, 0, &err); |
1084 | if (err) | 1115 | if (err) |