aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 13:26:21 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 15:39:55 -0400
commit3b1e0a655f8eba44ab1ee2a1068d169ccfb853b9 (patch)
tree09edb35f32ebcfb1b4dad904425128a110ef16ee /net/unix/af_unix.c
parentc346dca10840a874240c78efe3f39acf4312a1f2 (diff)
[NET] NETNS: Omit sock->sk_net without CONFIG_NET_NS.
Introduce per-sock inlines: sock_net(), sock_net_set() and per-inet_timewait_sock inlines: twsk_net(), twsk_net_set(). Without CONFIG_NET_NS, no namespace other than &init_net exists. Let's explicitly define them to help compiler optimizations. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index ae584356852c..cb9d0cb5f270 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -252,7 +252,7 @@ static struct sock *__unix_find_socket_byname(struct net *net,
252 sk_for_each(s, node, &unix_socket_table[hash ^ type]) { 252 sk_for_each(s, node, &unix_socket_table[hash ^ type]) {
253 struct unix_sock *u = unix_sk(s); 253 struct unix_sock *u = unix_sk(s);
254 254
255 if (s->sk_net != net) 255 if (sock_net(s) != net)
256 continue; 256 continue;
257 257
258 if (u->addr->len == len && 258 if (u->addr->len == len &&
@@ -289,7 +289,7 @@ static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i)
289 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { 289 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) {
290 struct dentry *dentry = unix_sk(s)->dentry; 290 struct dentry *dentry = unix_sk(s)->dentry;
291 291
292 if (s->sk_net != net) 292 if (sock_net(s) != net)
293 continue; 293 continue;
294 294
295 if(dentry && dentry->d_inode == i) 295 if(dentry && dentry->d_inode == i)
@@ -654,7 +654,7 @@ static int unix_release(struct socket *sock)
654static int unix_autobind(struct socket *sock) 654static int unix_autobind(struct socket *sock)
655{ 655{
656 struct sock *sk = sock->sk; 656 struct sock *sk = sock->sk;
657 struct net *net = sk->sk_net; 657 struct net *net = sock_net(sk);
658 struct unix_sock *u = unix_sk(sk); 658 struct unix_sock *u = unix_sk(sk);
659 static u32 ordernum = 1; 659 static u32 ordernum = 1;
660 struct unix_address * addr; 660 struct unix_address * addr;
@@ -758,7 +758,7 @@ fail:
758static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 758static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
759{ 759{
760 struct sock *sk = sock->sk; 760 struct sock *sk = sock->sk;
761 struct net *net = sk->sk_net; 761 struct net *net = sock_net(sk);
762 struct unix_sock *u = unix_sk(sk); 762 struct unix_sock *u = unix_sk(sk);
763 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; 763 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
764 struct dentry * dentry = NULL; 764 struct dentry * dentry = NULL;
@@ -899,7 +899,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
899 int alen, int flags) 899 int alen, int flags)
900{ 900{
901 struct sock *sk = sock->sk; 901 struct sock *sk = sock->sk;
902 struct net *net = sk->sk_net; 902 struct net *net = sock_net(sk);
903 struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr; 903 struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr;
904 struct sock *other; 904 struct sock *other;
905 unsigned hash; 905 unsigned hash;
@@ -996,7 +996,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
996{ 996{
997 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; 997 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
998 struct sock *sk = sock->sk; 998 struct sock *sk = sock->sk;
999 struct net *net = sk->sk_net; 999 struct net *net = sock_net(sk);
1000 struct unix_sock *u = unix_sk(sk), *newu, *otheru; 1000 struct unix_sock *u = unix_sk(sk), *newu, *otheru;
1001 struct sock *newsk = NULL; 1001 struct sock *newsk = NULL;
1002 struct sock *other = NULL; 1002 struct sock *other = NULL;
@@ -1025,7 +1025,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
1025 err = -ENOMEM; 1025 err = -ENOMEM;
1026 1026
1027 /* create new sock for complete connection */ 1027 /* create new sock for complete connection */
1028 newsk = unix_create1(sk->sk_net, NULL); 1028 newsk = unix_create1(sock_net(sk), NULL);
1029 if (newsk == NULL) 1029 if (newsk == NULL)
1030 goto out; 1030 goto out;
1031 1031
@@ -1312,7 +1312,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1312{ 1312{
1313 struct sock_iocb *siocb = kiocb_to_siocb(kiocb); 1313 struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
1314 struct sock *sk = sock->sk; 1314 struct sock *sk = sock->sk;
1315 struct net *net = sk->sk_net; 1315 struct net *net = sock_net(sk);
1316 struct unix_sock *u = unix_sk(sk); 1316 struct unix_sock *u = unix_sk(sk);
1317 struct sockaddr_un *sunaddr=msg->msg_name; 1317 struct sockaddr_un *sunaddr=msg->msg_name;
1318 struct sock *other = NULL; 1318 struct sock *other = NULL;
@@ -2022,7 +2022,7 @@ static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos)
2022 struct sock *s; 2022 struct sock *s;
2023 2023
2024 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) { 2024 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
2025 if (s->sk_net != iter->p.net) 2025 if (sock_net(s) != iter->p.net)
2026 continue; 2026 continue;
2027 if (off == pos) 2027 if (off == pos)
2028 return s; 2028 return s;
@@ -2050,7 +2050,7 @@ static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2050 sk = first_unix_socket(&iter->i); 2050 sk = first_unix_socket(&iter->i);
2051 else 2051 else
2052 sk = next_unix_socket(&iter->i, sk); 2052 sk = next_unix_socket(&iter->i, sk);
2053 while (sk && (sk->sk_net != iter->p.net)) 2053 while (sk && (sock_net(sk) != iter->p.net))
2054 sk = next_unix_socket(&iter->i, sk); 2054 sk = next_unix_socket(&iter->i, sk);
2055 return sk; 2055 return sk;
2056} 2056}