linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] rtnetlink: remove rtnetlink_send() in rtnetlink
@ 2021-07-19 12:24 Yajun Deng
  0 siblings, 0 replies; 2+ messages in thread
From: Yajun Deng @ 2021-07-19 12:24 UTC (permalink / raw)
  To: davem, kuba, roopa, nikolay, yoshfuji, dsahern, courmisch, jhs,
	xiyou.wangcong, jiri, johannes
  Cc: netdev, linux-kernel, linux-decnet-user, Yajun Deng

rtnetlink_send() is similar to rtnl_notify(), so remove rtnetlink_send().
Modify the fifth parameter from 'struct nlmsghdr *nlh' to 'int report'
in rtnl_notify(). This will do well for the caller havn't nlh variable.
And modify the return value to integer, Some caller may be need the
return value.

Rename pid to portid to avoid confusion in rtnl_{unicast, notify}.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 include/linux/rtnetlink.h |  7 +++----
 net/core/rtnetlink.c      | 21 +++++----------------
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index bb9cb84114c1..409c334746a6 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -9,10 +9,9 @@
 #include <linux/refcount.h>
 #include <uapi/linux/rtnetlink.h>
 
-extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
-extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
-extern void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid,
-			u32 group, struct nlmsghdr *nlh, gfp_t flags);
+extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 portid);
+extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 portid,
+		       u32 group, int report, gfp_t flags);
 extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
 extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
 extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 670d74ab91ae..48bb9dc6f06f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -707,31 +707,20 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
 	return err;
 }
 
-int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, int echo)
+int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 portid)
 {
 	struct sock *rtnl = net->rtnl;
 
-	return nlmsg_notify(rtnl, skb, pid, group, echo, GFP_KERNEL);
-}
-
-int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid)
-{
-	struct sock *rtnl = net->rtnl;
-
-	return nlmsg_unicast(rtnl, skb, pid);
+	return nlmsg_unicast(rtnl, skb, portid);
 }
 EXPORT_SYMBOL(rtnl_unicast);
 
-void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
-		 struct nlmsghdr *nlh, gfp_t flags)
+int rtnl_notify(struct sk_buff *skb, struct net *net, u32 portid,
+		u32 group, int report, gfp_t flags)
 {
 	struct sock *rtnl = net->rtnl;
-	int report = 0;
-
-	if (nlh)
-		report = nlmsg_report(nlh);
 
-	nlmsg_notify(rtnl, skb, pid, group, report, flags);
+	return nlmsg_notify(rtnl, skb, portid, group, report, flags);
 }
 EXPORT_SYMBOL(rtnl_notify);
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 1/4] rtnetlink: remove rtnetlink_send() in rtnetlink
@ 2021-07-20  3:22 Yajun Deng
  0 siblings, 0 replies; 2+ messages in thread
From: Yajun Deng @ 2021-07-20  3:22 UTC (permalink / raw)
  To: courmisch, remi; +Cc: linux-kernel, Yajun Deng

rtnetlink_send() is similar to rtnl_notify(), so remove rtnetlink_send().
Modify the fifth parameter from 'struct nlmsghdr *nlh' to 'int report'
in rtnl_notify(). This will do well for the caller havn't nlh variable.
And modify the return value to integer, Some caller may be need the
return value.

Rename pid to portid to avoid confusion in rtnl_{unicast, notify}.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 include/linux/rtnetlink.h |  7 +++----
 net/core/rtnetlink.c      | 21 +++++----------------
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index bb9cb84114c1..409c334746a6 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -9,10 +9,9 @@
 #include <linux/refcount.h>
 #include <uapi/linux/rtnetlink.h>
 
-extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
-extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
-extern void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid,
-			u32 group, struct nlmsghdr *nlh, gfp_t flags);
+extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 portid);
+extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 portid,
+		       u32 group, int report, gfp_t flags);
 extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
 extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
 extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 670d74ab91ae..48bb9dc6f06f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -707,31 +707,20 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
 	return err;
 }
 
-int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, int echo)
+int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 portid)
 {
 	struct sock *rtnl = net->rtnl;
 
-	return nlmsg_notify(rtnl, skb, pid, group, echo, GFP_KERNEL);
-}
-
-int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid)
-{
-	struct sock *rtnl = net->rtnl;
-
-	return nlmsg_unicast(rtnl, skb, pid);
+	return nlmsg_unicast(rtnl, skb, portid);
 }
 EXPORT_SYMBOL(rtnl_unicast);
 
-void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
-		 struct nlmsghdr *nlh, gfp_t flags)
+int rtnl_notify(struct sk_buff *skb, struct net *net, u32 portid,
+		u32 group, int report, gfp_t flags)
 {
 	struct sock *rtnl = net->rtnl;
-	int report = 0;
-
-	if (nlh)
-		report = nlmsg_report(nlh);
 
-	nlmsg_notify(rtnl, skb, pid, group, report, flags);
+	return nlmsg_notify(rtnl, skb, portid, group, report, flags);
 }
 EXPORT_SYMBOL(rtnl_notify);
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-20  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 12:24 [PATCH 1/4] rtnetlink: remove rtnetlink_send() in rtnetlink Yajun Deng
2021-07-20  3:22 Yajun Deng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).