diff options
author | David Miller <davem@davemloft.net> | 2015-06-25 09:19:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-28 19:55:44 -0400 |
commit | 3200392b88dd25f0d60a500a38d1ce538eb7f933 (patch) | |
tree | 4a17b0714e23ce214d97d326c7a895a9f891426b /net/ax25 | |
parent | 2e598712e4b36256c3cf3bca1c2bf0460036cc89 (diff) |
ax25: Stop using sock->sk_protinfo.
Just make a ax25_sock structure that provides the ax25_cb pointer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25')
-rw-r--r-- | net/ax25/af_ax25.c | 30 | ||||
-rw-r--r-- | net/ax25/ax25_in.c | 2 |
2 files changed, 16 insertions, 16 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 9c891d0412a2..ae3a47f9d1d5 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -57,7 +57,7 @@ static const struct proto_ops ax25_proto_ops; | |||
57 | 57 | ||
58 | static void ax25_free_sock(struct sock *sk) | 58 | static void ax25_free_sock(struct sock *sk) |
59 | { | 59 | { |
60 | ax25_cb_put(ax25_sk(sk)); | 60 | ax25_cb_put(sk_to_ax25(sk)); |
61 | } | 61 | } |
62 | 62 | ||
63 | /* | 63 | /* |
@@ -306,7 +306,7 @@ void ax25_destroy_socket(ax25_cb *ax25) | |||
306 | while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) { | 306 | while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) { |
307 | if (skb->sk != ax25->sk) { | 307 | if (skb->sk != ax25->sk) { |
308 | /* A pending connection */ | 308 | /* A pending connection */ |
309 | ax25_cb *sax25 = ax25_sk(skb->sk); | 309 | ax25_cb *sax25 = sk_to_ax25(skb->sk); |
310 | 310 | ||
311 | /* Queue the unaccepted socket for death */ | 311 | /* Queue the unaccepted socket for death */ |
312 | sock_orphan(skb->sk); | 312 | sock_orphan(skb->sk); |
@@ -551,7 +551,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, | |||
551 | return -EFAULT; | 551 | return -EFAULT; |
552 | 552 | ||
553 | lock_sock(sk); | 553 | lock_sock(sk); |
554 | ax25 = ax25_sk(sk); | 554 | ax25 = sk_to_ax25(sk); |
555 | 555 | ||
556 | switch (optname) { | 556 | switch (optname) { |
557 | case AX25_WINDOW: | 557 | case AX25_WINDOW: |
@@ -697,7 +697,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, | |||
697 | length = min_t(unsigned int, maxlen, sizeof(int)); | 697 | length = min_t(unsigned int, maxlen, sizeof(int)); |
698 | 698 | ||
699 | lock_sock(sk); | 699 | lock_sock(sk); |
700 | ax25 = ax25_sk(sk); | 700 | ax25 = sk_to_ax25(sk); |
701 | 701 | ||
702 | switch (optname) { | 702 | switch (optname) { |
703 | case AX25_WINDOW: | 703 | case AX25_WINDOW: |
@@ -796,7 +796,7 @@ out: | |||
796 | static struct proto ax25_proto = { | 796 | static struct proto ax25_proto = { |
797 | .name = "AX25", | 797 | .name = "AX25", |
798 | .owner = THIS_MODULE, | 798 | .owner = THIS_MODULE, |
799 | .obj_size = sizeof(struct sock), | 799 | .obj_size = sizeof(struct ax25_sock), |
800 | }; | 800 | }; |
801 | 801 | ||
802 | static int ax25_create(struct net *net, struct socket *sock, int protocol, | 802 | static int ax25_create(struct net *net, struct socket *sock, int protocol, |
@@ -858,7 +858,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol, | |||
858 | if (sk == NULL) | 858 | if (sk == NULL) |
859 | return -ENOMEM; | 859 | return -ENOMEM; |
860 | 860 | ||
861 | ax25 = sk->sk_protinfo = ax25_create_cb(); | 861 | ax25 = ax25_sk(sk)->cb = ax25_create_cb(); |
862 | if (!ax25) { | 862 | if (!ax25) { |
863 | sk_free(sk); | 863 | sk_free(sk); |
864 | return -ENOMEM; | 864 | return -ENOMEM; |
@@ -910,7 +910,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
910 | sk->sk_state = TCP_ESTABLISHED; | 910 | sk->sk_state = TCP_ESTABLISHED; |
911 | sock_copy_flags(sk, osk); | 911 | sock_copy_flags(sk, osk); |
912 | 912 | ||
913 | oax25 = ax25_sk(osk); | 913 | oax25 = sk_to_ax25(osk); |
914 | 914 | ||
915 | ax25->modulus = oax25->modulus; | 915 | ax25->modulus = oax25->modulus; |
916 | ax25->backoff = oax25->backoff; | 916 | ax25->backoff = oax25->backoff; |
@@ -938,7 +938,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
938 | } | 938 | } |
939 | } | 939 | } |
940 | 940 | ||
941 | sk->sk_protinfo = ax25; | 941 | ax25_sk(sk)->cb = ax25; |
942 | sk->sk_destruct = ax25_free_sock; | 942 | sk->sk_destruct = ax25_free_sock; |
943 | ax25->sk = sk; | 943 | ax25->sk = sk; |
944 | 944 | ||
@@ -956,7 +956,7 @@ static int ax25_release(struct socket *sock) | |||
956 | sock_hold(sk); | 956 | sock_hold(sk); |
957 | sock_orphan(sk); | 957 | sock_orphan(sk); |
958 | lock_sock(sk); | 958 | lock_sock(sk); |
959 | ax25 = ax25_sk(sk); | 959 | ax25 = sk_to_ax25(sk); |
960 | 960 | ||
961 | if (sk->sk_type == SOCK_SEQPACKET) { | 961 | if (sk->sk_type == SOCK_SEQPACKET) { |
962 | switch (ax25->state) { | 962 | switch (ax25->state) { |
@@ -1066,7 +1066,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1066 | 1066 | ||
1067 | lock_sock(sk); | 1067 | lock_sock(sk); |
1068 | 1068 | ||
1069 | ax25 = ax25_sk(sk); | 1069 | ax25 = sk_to_ax25(sk); |
1070 | if (!sock_flag(sk, SOCK_ZAPPED)) { | 1070 | if (!sock_flag(sk, SOCK_ZAPPED)) { |
1071 | err = -EINVAL; | 1071 | err = -EINVAL; |
1072 | goto out; | 1072 | goto out; |
@@ -1113,7 +1113,7 @@ static int __must_check ax25_connect(struct socket *sock, | |||
1113 | struct sockaddr *uaddr, int addr_len, int flags) | 1113 | struct sockaddr *uaddr, int addr_len, int flags) |
1114 | { | 1114 | { |
1115 | struct sock *sk = sock->sk; | 1115 | struct sock *sk = sock->sk; |
1116 | ax25_cb *ax25 = ax25_sk(sk), *ax25t; | 1116 | ax25_cb *ax25 = sk_to_ax25(sk), *ax25t; |
1117 | struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)uaddr; | 1117 | struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)uaddr; |
1118 | ax25_digi *digi = NULL; | 1118 | ax25_digi *digi = NULL; |
1119 | int ct = 0, err = 0; | 1119 | int ct = 0, err = 0; |
@@ -1394,7 +1394,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1394 | 1394 | ||
1395 | memset(fsa, 0, sizeof(*fsa)); | 1395 | memset(fsa, 0, sizeof(*fsa)); |
1396 | lock_sock(sk); | 1396 | lock_sock(sk); |
1397 | ax25 = ax25_sk(sk); | 1397 | ax25 = sk_to_ax25(sk); |
1398 | 1398 | ||
1399 | if (peer != 0) { | 1399 | if (peer != 0) { |
1400 | if (sk->sk_state != TCP_ESTABLISHED) { | 1400 | if (sk->sk_state != TCP_ESTABLISHED) { |
@@ -1446,7 +1446,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) | |||
1446 | return -EINVAL; | 1446 | return -EINVAL; |
1447 | 1447 | ||
1448 | lock_sock(sk); | 1448 | lock_sock(sk); |
1449 | ax25 = ax25_sk(sk); | 1449 | ax25 = sk_to_ax25(sk); |
1450 | 1450 | ||
1451 | if (sock_flag(sk, SOCK_ZAPPED)) { | 1451 | if (sock_flag(sk, SOCK_ZAPPED)) { |
1452 | err = -EADDRNOTAVAIL; | 1452 | err = -EADDRNOTAVAIL; |
@@ -1621,7 +1621,7 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, | |||
1621 | if (skb == NULL) | 1621 | if (skb == NULL) |
1622 | goto out; | 1622 | goto out; |
1623 | 1623 | ||
1624 | if (!ax25_sk(sk)->pidincl) | 1624 | if (!sk_to_ax25(sk)->pidincl) |
1625 | skb_pull(skb, 1); /* Remove PID */ | 1625 | skb_pull(skb, 1); /* Remove PID */ |
1626 | 1626 | ||
1627 | skb_reset_transport_header(skb); | 1627 | skb_reset_transport_header(skb); |
@@ -1762,7 +1762,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1762 | 1762 | ||
1763 | case SIOCAX25GETINFO: | 1763 | case SIOCAX25GETINFO: |
1764 | case SIOCAX25GETINFOOLD: { | 1764 | case SIOCAX25GETINFOOLD: { |
1765 | ax25_cb *ax25 = ax25_sk(sk); | 1765 | ax25_cb *ax25 = sk_to_ax25(sk); |
1766 | struct ax25_info_struct ax25_info; | 1766 | struct ax25_info_struct ax25_info; |
1767 | 1767 | ||
1768 | ax25_info.t1 = ax25->t1 / HZ; | 1768 | ax25_info.t1 = ax25->t1 / HZ; |
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c index 29a3687237aa..bb5a0e4e98d9 100644 --- a/net/ax25/ax25_in.c +++ b/net/ax25/ax25_in.c | |||
@@ -353,7 +353,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, | |||
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | ax25 = ax25_sk(make); | 356 | ax25 = sk_to_ax25(make); |
357 | skb_set_owner_r(skb, make); | 357 | skb_set_owner_r(skb, make); |
358 | skb_queue_head(&sk->sk_receive_queue, skb); | 358 | skb_queue_head(&sk->sk_receive_queue, skb); |
359 | 359 | ||