* [PATCH] net: ping: make ping_v6_sendmsg static
@ 2016-03-23 9:59 Haishuang Yan
2016-03-23 11:53 ` Sergei Shtylyov
[not found] ` <050500078c5d445f00000004>
0 siblings, 2 replies; 3+ messages in thread
From: Haishuang Yan @ 2016-03-23 9:59 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
Cc: netdev, linux-kernel, Haishuang Yan
As ping_v6_sendmsg is used only in this file,
making it static
The body of "pingv6_prot" and "pingv6_protosw" were
moved at the middle of the file, to avoid having to
declare some static prototypes.
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
---
include/net/ping.h | 1 -
net/ipv6/ping.c | 59 +++++++++++++++++++++++++++---------------------------
2 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/include/net/ping.h b/include/net/ping.h
index 5fd7cc2..4cd90d6 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -79,7 +79,6 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
int flags, int *addr_len);
int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
void *user_icmph, size_t icmph_len);
-int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
bool ping_rcv(struct sk_buff *skb);
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 263a516..c382db7 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -26,35 +26,6 @@
#include <net/transp_v6.h>
#include <net/ping.h>
-struct proto pingv6_prot = {
- .name = "PINGv6",
- .owner = THIS_MODULE,
- .init = ping_init_sock,
- .close = ping_close,
- .connect = ip6_datagram_connect_v6_only,
- .disconnect = udp_disconnect,
- .setsockopt = ipv6_setsockopt,
- .getsockopt = ipv6_getsockopt,
- .sendmsg = ping_v6_sendmsg,
- .recvmsg = ping_recvmsg,
- .bind = ping_bind,
- .backlog_rcv = ping_queue_rcv_skb,
- .hash = ping_hash,
- .unhash = ping_unhash,
- .get_port = ping_get_port,
- .obj_size = sizeof(struct raw6_sock),
-};
-EXPORT_SYMBOL_GPL(pingv6_prot);
-
-static struct inet_protosw pingv6_protosw = {
- .type = SOCK_DGRAM,
- .protocol = IPPROTO_ICMPV6,
- .prot = &pingv6_prot,
- .ops = &inet6_dgram_ops,
- .flags = INET_PROTOSW_REUSE,
-};
-
-
/* Compatibility glue so we can support IPv6 when it's compiled as a module */
static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len,
int *addr_len)
@@ -77,7 +48,7 @@ static int dummy_ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
return 0;
}
-int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
+static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
{
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
@@ -192,6 +163,34 @@ int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
return len;
}
+struct proto pingv6_prot = {
+ .name = "PINGv6",
+ .owner = THIS_MODULE,
+ .init = ping_init_sock,
+ .close = ping_close,
+ .connect = ip6_datagram_connect_v6_only,
+ .disconnect = udp_disconnect,
+ .setsockopt = ipv6_setsockopt,
+ .getsockopt = ipv6_getsockopt,
+ .sendmsg = ping_v6_sendmsg,
+ .recvmsg = ping_recvmsg,
+ .bind = ping_bind,
+ .backlog_rcv = ping_queue_rcv_skb,
+ .hash = ping_hash,
+ .unhash = ping_unhash,
+ .get_port = ping_get_port,
+ .obj_size = sizeof(struct raw6_sock),
+};
+EXPORT_SYMBOL_GPL(pingv6_prot);
+
+static struct inet_protosw pingv6_protosw = {
+ .type = SOCK_DGRAM,
+ .protocol = IPPROTO_ICMPV6,
+ .prot = &pingv6_prot,
+ .ops = &inet6_dgram_ops,
+ .flags = INET_PROTOSW_REUSE,
+};
+
#ifdef CONFIG_PROC_FS
static void *ping_v6_seq_start(struct seq_file *seq, loff_t *pos)
{
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ping: make ping_v6_sendmsg static
2016-03-23 9:59 [PATCH] net: ping: make ping_v6_sendmsg static Haishuang Yan
@ 2016-03-23 11:53 ` Sergei Shtylyov
[not found] ` <050500078c5d445f00000004>
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2016-03-23 11:53 UTC (permalink / raw)
To: Haishuang Yan, David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
Cc: netdev, linux-kernel
On 3/23/2016 12:59 PM, Haishuang Yan wrote:
> As ping_v6_sendmsg is used only in this file,
> making it static
>
> The body of "pingv6_prot" and "pingv6_protosw" were
> moved at the middle of the file, to avoid having to
> declare some static prototypes.
>
> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
These seem as 2 independent changes, so should be in 2 separate patches.
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ping: make ping_v6_sendmsg static
[not found] ` <etPan.56f3489d.47f24d7.66d@yanhaishuangs-MacBook-Pro.local>
@ 2016-03-24 2:10 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2016-03-24 2:10 UTC (permalink / raw)
To: yanhaishuang
Cc: sergei.shtylyov, jmorris, kaber, kuznet, yoshfuji, netdev, linux-kernel
From: 严海双 <yanhaishuang@cmss.chinamobile.com>
Date: Thu, 24 Mar 2016 09:53:33 +0800
> The two changes is dependent, because "pingv6_prot" and
> “pingv6_protosw” must be moved to the behind also, to avoid having
> to declare static “ping_v6_sendmsg” prototypes first.
Agreed, and applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-24 2:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-23 9:59 [PATCH] net: ping: make ping_v6_sendmsg static Haishuang Yan
2016-03-23 11:53 ` Sergei Shtylyov
[not found] ` <050500078c5d445f00000004>
[not found] ` <etPan.56f3489d.47f24d7.66d@yanhaishuangs-MacBook-Pro.local>
2016-03-24 2:10 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.