Commit e4538a34 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[NET]: Deinline sock_i_uid, sock_i_ino

The sock_i_uid and sock_i_ino functions are only called by
/proc type interfaces, so they don't need to be inlined.

Also, the inline functions writeable, rcvtimeo, sndtimeo are test
for value functions that don't change their argument.
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 1fe7d5a3
...@@ -917,25 +917,8 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) ...@@ -917,25 +917,8 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
write_unlock_bh(&sk->sk_callback_lock); write_unlock_bh(&sk->sk_callback_lock);
} }
static inline int sock_i_uid(struct sock *sk) extern int sock_i_uid(struct sock *sk);
{ extern unsigned long sock_i_ino(struct sock *sk);
int uid;
read_lock(&sk->sk_callback_lock);
uid = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : 0;
read_unlock(&sk->sk_callback_lock);
return uid;
}
static inline unsigned long sock_i_ino(struct sock *sk)
{
unsigned long ino;
read_lock(&sk->sk_callback_lock);
ino = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_ino : 0;
read_unlock(&sk->sk_callback_lock);
return ino;
}
static inline struct dst_entry * static inline struct dst_entry *
__sk_dst_get(struct sock *sk) __sk_dst_get(struct sock *sk)
...@@ -1219,7 +1202,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) ...@@ -1219,7 +1202,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
/* /*
* Default write policy as shown to user space via poll/select/SIGIO * Default write policy as shown to user space via poll/select/SIGIO
*/ */
static inline int sock_writeable(struct sock *sk) static inline int sock_writeable(const struct sock *sk)
{ {
return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2); return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2);
} }
...@@ -1229,17 +1212,17 @@ static inline int gfp_any(void) ...@@ -1229,17 +1212,17 @@ static inline int gfp_any(void)
return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
} }
static inline long sock_rcvtimeo(struct sock *sk, int noblock) static inline long sock_rcvtimeo(const struct sock *sk, int noblock)
{ {
return noblock ? 0 : sk->sk_rcvtimeo; return noblock ? 0 : sk->sk_rcvtimeo;
} }
static inline long sock_sndtimeo(struct sock *sk, int noblock) static inline long sock_sndtimeo(const struct sock *sk, int noblock)
{ {
return noblock ? 0 : sk->sk_sndtimeo; return noblock ? 0 : sk->sk_sndtimeo;
} }
static inline int sock_rcvlowat(struct sock *sk, int waitall, int len) static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len)
{ {
return (waitall ? len : min_t(int, sk->sk_rcvlowat, len)) ? : 1; return (waitall ? len : min_t(int, sk->sk_rcvlowat, len)) ? : 1;
} }
......
...@@ -711,6 +711,27 @@ void sock_rfree(struct sk_buff *skb) ...@@ -711,6 +711,27 @@ void sock_rfree(struct sk_buff *skb)
atomic_sub(skb->truesize, &sk->sk_rmem_alloc); atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
} }
int sock_i_uid(struct sock *sk)
{
int uid;
read_lock(&sk->sk_callback_lock);
uid = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : 0;
read_unlock(&sk->sk_callback_lock);
return uid;
}
unsigned long sock_i_ino(struct sock *sk)
{
unsigned long ino;
read_lock(&sk->sk_callback_lock);
ino = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_ino : 0;
read_unlock(&sk->sk_callback_lock);
return ino;
}
/* /*
* Allocate a skb from the socket's send buffer. * Allocate a skb from the socket's send buffer.
*/ */
...@@ -1379,6 +1400,8 @@ EXPORT_SYMBOL(sock_rmalloc); ...@@ -1379,6 +1400,8 @@ EXPORT_SYMBOL(sock_rmalloc);
EXPORT_SYMBOL(sock_setsockopt); EXPORT_SYMBOL(sock_setsockopt);
EXPORT_SYMBOL(sock_wfree); EXPORT_SYMBOL(sock_wfree);
EXPORT_SYMBOL(sock_wmalloc); EXPORT_SYMBOL(sock_wmalloc);
EXPORT_SYMBOL(sock_i_uid);
EXPORT_SYMBOL(sock_i_ino);
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
EXPORT_SYMBOL(sysctl_optmem_max); EXPORT_SYMBOL(sysctl_optmem_max);
EXPORT_SYMBOL(sysctl_rmem_max); EXPORT_SYMBOL(sysctl_rmem_max);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment