Merge branch 'core/topology' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[pandora-kernel.git] / include / net / sock.h
index 7e0d4a0..dc42b44 100644 (file)
@@ -47,7 +47,6 @@
 #include <linux/module.h>
 #include <linux/lockdep.h>
 #include <linux/netdevice.h>
-#include <linux/pcounter.h>
 #include <linux/skbuff.h>      /* struct sk_buff */
 #include <linux/mm.h>
 #include <linux/security.h>
@@ -562,7 +561,7 @@ struct proto {
 
        /* Keeping track of sockets in use */
 #ifdef CONFIG_PROC_FS
-       struct pcounter         inuse;
+       unsigned int            inuse_idx;
 #endif
 
        /* Memory pressure */
@@ -635,36 +634,12 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
 
 
 #ifdef CONFIG_PROC_FS
-# define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME)
-# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse)
 /* Called with local bh disabled */
-static inline void sock_prot_inuse_add(struct proto *prot, int inc)
-{
-       pcounter_add(&prot->inuse, inc);
-}
-static inline int sock_prot_inuse_init(struct proto *proto)
-{
-       return pcounter_alloc(&proto->inuse);
-}
-static inline int sock_prot_inuse_get(struct proto *proto)
-{
-       return pcounter_getval(&proto->inuse);
-}
-static inline void sock_prot_inuse_free(struct proto *proto)
-{
-       pcounter_free(&proto->inuse);
-}
+extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
+extern int sock_prot_inuse_get(struct net *net, struct proto *proto);
 #else
-# define DEFINE_PROTO_INUSE(NAME)
-# define REF_PROTO_INUSE(NAME)
-static void inline sock_prot_inuse_add(struct proto *prot, int inc)
-{
-}
-static int inline sock_prot_inuse_init(struct proto *proto)
-{
-       return 0;
-}
-static void inline sock_prot_inuse_free(struct proto *proto)
+static void inline sock_prot_inuse_add(struct net *net, struct proto *prot,
+               int inc)
 {
 }
 #endif
@@ -952,41 +927,6 @@ extern void sk_common_release(struct sock *sk);
 /* Initialise core socket variables */
 extern void sock_init_data(struct socket *sock, struct sock *sk);
 
-/**
- *     sk_filter - run a packet through a socket filter
- *     @sk: sock associated with &sk_buff
- *     @skb: buffer to filter
- *     @needlock: set to 1 if the sock is not locked by caller.
- *
- * Run the filter code and then cut skb->data to correct size returned by
- * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller
- * than pkt_len we keep whole skb->data. This is the socket level
- * wrapper to sk_run_filter. It returns 0 if the packet should
- * be accepted or -EPERM if the packet should be tossed.
- *
- */
-
-static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
-{
-       int err;
-       struct sk_filter *filter;
-       
-       err = security_sock_rcv_skb(sk, skb);
-       if (err)
-               return err;
-       
-       rcu_read_lock_bh();
-       filter = rcu_dereference(sk->sk_filter);
-       if (filter) {
-               unsigned int pkt_len = sk_run_filter(skb, filter->insns,
-                               filter->len);
-               err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
-       }
-       rcu_read_unlock_bh();
-
-       return err;
-}
-
 /**
  *     sk_filter_release: Release a socket filter
  *     @sk: socket
@@ -1358,7 +1298,7 @@ struct net *sock_net(const struct sock *sk)
 }
 
 static inline
-void sock_net_set(struct sock *sk, const struct net *net)
+void sock_net_set(struct sock *sk, struct net *net)
 {
 #ifdef CONFIG_NET_NS
        sk->sk_net = net;
@@ -1374,7 +1314,7 @@ void sock_net_set(struct sock *sk, const struct net *net)
 static inline void sk_change_net(struct sock *sk, struct net *net)
 {
        put_net(sock_net(sk));
-       sock_net_set(sk, net);
+       sock_net_set(sk, hold_net(net));
 }
 
 extern void sock_enable_timestamp(struct sock *sk);