Subject: [PATCH iproute2-next 10/11] libnetlink: Rename rtnl_wilddump_* to rtnl_linkdump_*

From: David Ahern <[email-masked]>
Date: Sat, 29 Sep 2018 10:59:30 -0700

From: David Ahern <[email-masked]>

Rename rtnl_wilddump_req_filter to rtnl_linkdump_req_filter,
rtnl_wilddump_request to rtnl_linkdump_request and
rtnl_wilddump_req_filter_fn to rtnl_linkdump_req_filter_fn.

In all cases drop the type argument which at this point is only
RTM_GETLINK and hardcode in the functions.

Signed-off-by: David Ahern <[email-masked]>
---
 bridge/link.c        |  4 ++--
 bridge/vlan.c        |  2 +-
 include/libnetlink.h |  7 +++----
 ip/ipaddress.c       |  4 ++--
 ip/iptoken.c         |  2 +-
 ip/iptuntap.c        |  2 +-
 ip/rtmon.c           |  2 +-
 ip/tunnel.c          |  2 +-
 lib/libnetlink.c     | 12 ++++++------
 lib/ll_map.c         |  2 +-
 misc/ifstat.c        |  2 +-
 11 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/bridge/link.c b/bridge/link.c
index 8557026387d2..5d4f9b525cad 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -502,7 +502,7 @@ static int brlink_show(int argc, char **argv)
 	}
 
 	if (show_details) {
-		if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
+		if (rtnl_linkdump_req_filter(&rth, PF_BRIDGE,
 					     (compress_vlans ?
 					      RTEXT_FILTER_BRVLAN_COMPRESSED :
 					      RTEXT_FILTER_BRVLAN)) < 0) {
@@ -510,7 +510,7 @@ static int brlink_show(int argc, char **argv)
 			exit(1);
 		}
 	} else {
-		if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETLINK) < 0) {
+		if (rtnl_linkdump_request(&rth, PF_BRIDGE) < 0) {
 			perror("Cannon send dump request");
 			exit(1);
 		}
diff --git a/bridge/vlan.c b/bridge/vlan.c
index bdce55ae4e14..59ed1964bcd2 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -575,7 +575,7 @@ static int vlan_show(int argc, char **argv)
 	new_json_obj(json);
 
 	if (!show_stats) {
-		if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
+		if (rtnl_linkdump_req_filter(&rth, PF_BRIDGE,
 					     (compress_vlans ?
 					      RTEXT_FILTER_BRVLAN_COMPRESSED :
 					      RTEXT_FILTER_BRVLAN)) < 0) {
diff --git a/include/libnetlink.h b/include/libnetlink.h
index f22c92ac03dc..29eb906ec9eb 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -66,15 +66,14 @@ int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
 int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 
-int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
+int rtnl_linkdump_request(struct rtnl_handle *rth, int fam)
 	__attribute__((warn_unused_result));
-int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
-				    __u32 filt_mask)
+int rtnl_linkdump_req_filter(struct rtnl_handle *rth, int fam, __u32 filt_mask)
 	__attribute__((warn_unused_result));
 
 typedef int (*req_filter_fn_t)(struct nlmsghdr *nlh, int reqlen);
 
-int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int fam, int type,
+int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int fam,
 				req_filter_fn_t fn)
 	__attribute__((warn_unused_result));
 int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index f29480ce51d4..ffe1e1617cba 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1778,7 +1778,7 @@ static int iplink_filter_req(struct nlmsghdr *nlh, int reqlen)
 int ip_linkaddr_list(int family, req_filter_fn_t filter_fn,
 		     struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo)
 {
-	if (rtnl_wilddump_req_filter_fn(&rth, preferred_family, RTM_GETLINK,
+	if (rtnl_linkdump_req_filter_fn(&rth, preferred_family,
 					filter_fn) < 0) {
 		perror("Cannot send dump request");
 		return 1;
@@ -2031,7 +2031,7 @@ void ipaddr_get_vf_rate(int vfnum, int *min, int *max, const char *dev)
 		exit(1);
 	}
 
-	if (rtnl_wilddump_request(&rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, AF_UNSPEC) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/ip/iptoken.c b/ip/iptoken.c
index fb64da4ec262..ce0051dfdf8a 100644
--- a/ip/iptoken.c
+++ b/ip/iptoken.c
@@ -109,7 +109,7 @@ static int iptoken_list(int argc, char **argv)
 		argc--; argv++;
 	}
 
-	if (rtnl_wilddump_request(&rth, af, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, af) < 0) {
 		perror("Cannot send dump request");
 		return -1;
 	}
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 58996e6c5733..8c84e6206fa9 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -459,7 +459,7 @@ static int print_tuntap(const struct sockaddr_nl *who,
 
 static int do_show(int argc, char **argv)
 {
-	if (rtnl_wilddump_req_filter_fn(&rth, AF_UNSPEC, RTM_GETLINK,
+	if (rtnl_linkdump_req_filter_fn(&rth, AF_UNSPEC,
 					tuntap_filter_req) < 0) {
 		perror("Cannot send dump request\n");
 		return -1;
diff --git a/ip/rtmon.c b/ip/rtmon.c
index 0e795f740e62..86b4fe2e448d 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -163,7 +163,7 @@ main(int argc, char **argv)
 	if (rtnl_open(&rth, groups) < 0)
 		exit(1);
 
-	if (rtnl_wilddump_request(&rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, AF_UNSPEC) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/ip/tunnel.c b/ip/tunnel.c
index 79de7f2406f0..41ff1a686a9f 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -392,7 +392,7 @@ static int print_nlmsg_tunnel(const struct sockaddr_nl *who,
 
 int do_tunnels_list(struct tnl_print_nlmsg_info *info)
 {
-	if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, preferred_family) < 0) {
 		perror("Cannot send dump request\n");
 		return -1;
 	}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 2dd14ac5ea58..bc72272be9c4 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -346,12 +346,12 @@ int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
-int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
+int rtnl_linkdump_request(struct rtnl_handle *rth, int family)
 {
-	return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
+	return rtnl_linkdump_req_filter(rth, family, RTEXT_FILTER_VF);
 }
 
-int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
+int rtnl_linkdump_req_filter(struct rtnl_handle *rth, int family,
 			    __u32 filt_mask)
 {
 	struct {
@@ -362,7 +362,7 @@ int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
 		__u32 ext_filter_mask;
 	} req = {
 		.nlh.nlmsg_len = sizeof(req),
-		.nlh.nlmsg_type = type,
+		.nlh.nlmsg_type = RTM_GETLINK,
 		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
 		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
 		.ifm.ifi_family = family,
@@ -374,7 +374,7 @@ int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
-int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
+int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int family,
 				req_filter_fn_t filter_fn)
 {
 	struct {
@@ -383,7 +383,7 @@ int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
 		char buf[1024];
 	} req = {
 		.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
-		.nlh.nlmsg_type = type,
+		.nlh.nlmsg_type = RTM_GETLINK,
 		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
 		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
 		.ifm.ifi_family = family,
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 0afe68979283..4c3ed0d71913 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -218,7 +218,7 @@ void ll_init_map(struct rtnl_handle *rth)
 	if (initialized)
 		return;
 
-	if (rtnl_wilddump_request(rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(rth, AF_UNSPEC) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 50b906e86d5d..36eba605d5ba 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -214,7 +214,7 @@ static void load_info(void)
 			exit(1);
 		}
 	} else {
-		if (rtnl_wilddump_request(&rth, AF_INET, RTM_GETLINK) < 0) {
+		if (rtnl_linkdump_request(&rth, AF_INET) < 0) {
 			perror("Cannot send dump request");
 			exit(1);
 		}
-- 
2.11.0