From 31ae2912f71e8ade59856e7533be9819b29d896d Mon Sep 17 00:00:00 2001 From: David Ahern Date: Sat, 29 Sep 2018 09:56:57 -0700 Subject: [PATCH] libnetlink: Rename rtnl_wilddump_* to rtnl_linkdump_* Rename rtnl_wilddump_req_filter to rtnl_linkdump_req_filter, rtnl_wilddump_request to rtnl_linkdump_req 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 --- 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 85570263..09df489b 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_req(&rth, PF_BRIDGE) < 0) { perror("Cannon send dump request"); exit(1); } diff --git a/bridge/vlan.c b/bridge/vlan.c index bdce55ae..59ed1964 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 f22c92ac..410c441b 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_req(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 f29480ce..c0c1fbbe 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_req(&rth, AF_UNSPEC) < 0) { perror("Cannot send dump request"); exit(1); } diff --git a/ip/iptoken.c b/ip/iptoken.c index fb64da4e..8605e75c 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_req(&rth, af) < 0) { perror("Cannot send dump request"); return -1; } diff --git a/ip/iptuntap.c b/ip/iptuntap.c index 58996e6c..8c84e620 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 0e795f74..7d2405d7 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_req(&rth, AF_UNSPEC) < 0) { perror("Cannot send dump request"); exit(1); } diff --git a/ip/tunnel.c b/ip/tunnel.c index 79de7f24..20fe6d7d 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_req(&rth, preferred_family) < 0) { perror("Cannot send dump request\n"); return -1; } diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 2dd14ac5..73d720f4 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_req(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 0afe6897..32c8e442 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_req(rth, AF_UNSPEC) < 0) { perror("Cannot send dump request"); exit(1); } diff --git a/misc/ifstat.c b/misc/ifstat.c index 50b906e8..6e70e1eb 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_req(&rth, AF_INET) < 0) { perror("Cannot send dump request"); exit(1); } -- 2.39.5