From 5f3d1bdf3ce8ac030831ee8c4dd6655ce5172431 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 2 Nov 2016 12:16:58 -0200 Subject: [PATCH] *: rename two vrf functions Since VRFs can be searched by vrf_id or name, make this explicit in the helper functions. s/vrf_lookup/vrf_lookup_by_id/ s/zebra_vrf_lookup/zebra_vrf_lookup_by_id/ Signed-off-by: Renato Westphal --- bgpd/bgp_main.c | 4 ++-- bgpd/bgpd.c | 2 +- bgpd/bgpd.h | 2 +- lib/vrf.c | 14 +++++++------- lib/vrf.h | 2 +- lib/zclient.c | 2 +- zebra/if_netlink.c | 4 ++-- zebra/interface.c | 4 ++-- zebra/zebra_rib.c | 4 ++-- zebra/zebra_rnh.c | 4 ++-- zebra/zebra_static.c | 2 +- zebra/zebra_vrf.c | 4 ++-- zebra/zebra_vrf.h | 2 +- zebra/zserv.c | 2 +- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 50ca7eda4c..4e31eb344c 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -332,7 +332,7 @@ bgp_vrf_enable (vrf_id_t vrf_id, const char *name, void **info) struct bgp *bgp; vrf_id_t old_vrf_id; - vrf = vrf_lookup (vrf_id); + vrf = vrf_lookup_by_id (vrf_id); if (!vrf) // unexpected return -1; @@ -365,7 +365,7 @@ bgp_vrf_disable (vrf_id_t vrf_id, const char *name, void **info) if (vrf_id == VRF_DEFAULT) return 0; - vrf = vrf_lookup (vrf_id); + vrf = vrf_lookup_by_id (vrf_id); if (!vrf) // unexpected return -1; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 53258880ab..22d4dd8917 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2971,7 +2971,7 @@ bgp_lookup_by_vrf_id (vrf_id_t vrf_id) struct vrf *vrf; /* Lookup VRF (in tree) and follow link. */ - vrf = vrf_lookup (vrf_id); + vrf = vrf_lookup_by_id (vrf_id); if (!vrf) return NULL; return (vrf->info) ? (struct bgp *)vrf->info : NULL; diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index dd6a0fdccf..510082fdc2 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1490,7 +1490,7 @@ bgp_vrf_lookup_by_instance_type (struct bgp *bgp) struct vrf *vrf; if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) - vrf = vrf_lookup (VRF_DEFAULT); + vrf = vrf_lookup_by_id (VRF_DEFAULT); else if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) vrf = vrf_lookup_by_name (bgp->name); else diff --git a/lib/vrf.c b/lib/vrf.c index 79885ff3e3..2d2c55f7a6 100644 --- a/lib/vrf.c +++ b/lib/vrf.c @@ -171,7 +171,7 @@ vrf_get (vrf_id_t vrf_id, const char *name) * We've already been told about the vrf_id * or we haven't. */ - vrf = vrf_lookup (vrf_id); + vrf = vrf_lookup_by_id (vrf_id); if (vrf) { /* @@ -221,7 +221,7 @@ vrf_get (vrf_id_t vrf_id, const char *name) */ else if (!name) { - vrf = vrf_lookup (vrf_id); + vrf = vrf_lookup_by_id (vrf_id); if (debug_vrf) zlog_debug("Vrf found: %p", vrf); @@ -272,7 +272,7 @@ vrf_delete (struct vrf *vrf) /* Look up a VRF by identifier. */ struct vrf * -vrf_lookup (vrf_id_t vrf_id) +vrf_lookup_by_id (vrf_id_t vrf_id) { struct vrf vrf; vrf.vrf_id = vrf_id; @@ -405,7 +405,7 @@ vrf_info_get (vrf_id_t vrf_id) void * vrf_info_lookup (vrf_id_t vrf_id) { - struct vrf *vrf = vrf_lookup (vrf_id); + struct vrf *vrf = vrf_lookup_by_id (vrf_id); return vrf ? vrf->info : NULL; } @@ -413,7 +413,7 @@ vrf_info_lookup (vrf_id_t vrf_id) struct list * vrf_iflist (vrf_id_t vrf_id) { - struct vrf * vrf = vrf_lookup (vrf_id); + struct vrf * vrf = vrf_lookup_by_id (vrf_id); return vrf ? vrf->iflist : NULL; } @@ -429,7 +429,7 @@ vrf_iflist_get (vrf_id_t vrf_id) void vrf_iflist_create (vrf_id_t vrf_id) { - struct vrf * vrf = vrf_lookup (vrf_id); + struct vrf * vrf = vrf_lookup_by_id (vrf_id); if (vrf && !vrf->iflist) if_init (&vrf->iflist); } @@ -438,7 +438,7 @@ vrf_iflist_create (vrf_id_t vrf_id) void vrf_iflist_terminate (vrf_id_t vrf_id) { - struct vrf * vrf = vrf_lookup (vrf_id); + struct vrf * vrf = vrf_lookup_by_id (vrf_id); if (vrf && vrf->iflist) if_terminate (&vrf->iflist); } diff --git a/lib/vrf.h b/lib/vrf.h index f093f4fbd8..4ee871b332 100644 --- a/lib/vrf.h +++ b/lib/vrf.h @@ -108,7 +108,7 @@ extern struct list *vrf_list; */ extern void vrf_add_hook (int, int (*)(vrf_id_t, const char *, void **)); -extern struct vrf *vrf_lookup (vrf_id_t); +extern struct vrf *vrf_lookup_by_id (vrf_id_t); extern struct vrf *vrf_lookup_by_name (const char *); extern struct vrf *vrf_list_lookup_by_name (const char *); extern struct vrf *vrf_get (vrf_id_t, const char *); diff --git a/lib/zclient.c b/lib/zclient.c index 84f7314baa..894e0d19ef 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1042,7 +1042,7 @@ zclient_vrf_delete (struct zclient *zclient, vrf_id_t vrf_id) struct vrf *vrf; /* Lookup vrf by vrf_id. */ - vrf = vrf_lookup (vrf_id); + vrf = vrf_lookup_by_id (vrf_id); /* * If a routing protocol doesn't know about a diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index c44219a495..abf1c781a3 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -211,7 +211,7 @@ netlink_vrf_change (struct nlmsghdr *h, struct rtattr *tb, const char *name) /* If VRF already exists, we just return; status changes are handled * against the VRF "interface". */ - vrf = vrf_lookup ((vrf_id_t)ifi->ifi_index); + vrf = vrf_lookup_by_id ((vrf_id_t)ifi->ifi_index); if (vrf && vrf->info) return; @@ -250,7 +250,7 @@ netlink_vrf_change (struct nlmsghdr *h, struct rtattr *tb, const char *name) if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug ("RTM_DELLINK for VRF %s(%u)", name, ifi->ifi_index); - vrf = vrf_lookup ((vrf_id_t)ifi->ifi_index); + vrf = vrf_lookup_by_id ((vrf_id_t)ifi->ifi_index); if (!vrf) { diff --git a/zebra/interface.c b/zebra/interface.c index 75040a87f0..d5d6ffd9f0 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1038,7 +1038,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp) zebra_ptm_show_status(vty, ifp); - vrf = vrf_lookup(ifp->vrf_id); + vrf = vrf_lookup_by_id (ifp->vrf_id); vty_out (vty, " vrf: %s%s", vrf->name, VTY_NEWLINE); if (ifp->desc) @@ -2833,7 +2833,7 @@ if_config_write (struct vty *vty) struct vrf *vrf; if_data = ifp->info; - vrf = vrf_lookup(ifp->vrf_id); + vrf = vrf_lookup_by_id (ifp->vrf_id); if (ifp->vrf_id == VRF_DEFAULT) vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index ec7d1e7fde..9d9b10457d 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2152,7 +2152,7 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn) rnode_debug (rn, rib->vrf_id, "queued rn %p into sub-queue %u", (void *)rn, qindex); - zvrf = zebra_vrf_lookup (rib->vrf_id); + zvrf = zebra_vrf_lookup_by_id (rib->vrf_id); if (zvrf) zvrf->flags |= ZEBRA_VRF_RIB_SCHEDULED; } @@ -3209,7 +3209,7 @@ vrf_id_get_next (vrf_id_t vrf_id, vrf_id_t *next_id_p) { struct vrf *vrf; - vrf = vrf_lookup (vrf_id); + vrf = vrf_lookup_by_id (vrf_id); if (vrf) { vrf = RB_NEXT (vrf_id_head, &vrfs_by_id, vrf); diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 8df9277cb3..7df759030d 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -57,7 +57,7 @@ static void copy_state(struct rnh *rnh, struct rib *rib, ({ \ struct zebra_vrf *zvrf; \ struct route_table *t = NULL; \ - zvrf = zebra_vrf_lookup(v); \ + zvrf = zebra_vrf_lookup_by_id(v); \ if (zvrf) \ t = zvrf->rnh_table[family2afi(f)]; \ t; \ @@ -77,7 +77,7 @@ static inline struct route_table *get_rnh_table(vrf_id_t vrfid, int family, struct zebra_vrf *zvrf; struct route_table *t = NULL; - zvrf = zebra_vrf_lookup(vrfid); + zvrf = zebra_vrf_lookup_by_id(vrfid); if (zvrf) switch (type) { diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index 298fc4e09d..32ba90ef9a 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -129,7 +129,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p, struct static_ro rib->metric = 0; rib->mtu = 0; rib->vrf_id = si->vrf_id; - rib->table = si->vrf_id ? (zebra_vrf_lookup(si->vrf_id))->table_id : zebrad.rtm_table_default; + rib->table = si->vrf_id ? (zebra_vrf_lookup_by_id(si->vrf_id))->table_id : zebrad.rtm_table_default; rib->nexthop_num = 0; rib->tag = si->tag; diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 4c1bbbb1a0..fbb41eb5a8 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -120,7 +120,7 @@ zebra_vrf_static_route_interface_fixup (struct interface *ifp) { afi_t afi; safi_t safi; - struct zebra_vrf *zvrf = zebra_vrf_lookup (ifp->vrf_id); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id (ifp->vrf_id); struct route_table *stable = NULL; struct route_node *rn = NULL; struct static_route *si = NULL; @@ -338,7 +338,7 @@ zebra_vrf_alloc (vrf_id_t vrf_id, const char *name) /* Lookup VRF by identifier. */ struct zebra_vrf * -zebra_vrf_lookup (vrf_id_t vrf_id) +zebra_vrf_lookup_by_id (vrf_id_t vrf_id) { return vrf_info_lookup (vrf_id); } diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h index 8dffe27dcf..c7814e6c99 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h @@ -92,7 +92,7 @@ zebra_vrf_table_with_table_id (afi_t afi, safi_t safi, extern void zebra_vrf_static_route_interface_fixup (struct interface *ifp); extern void zebra_vrf_update_all (struct zserv *client); -extern struct zebra_vrf *zebra_vrf_lookup (vrf_id_t vrf_id); +extern struct zebra_vrf *zebra_vrf_lookup_by_id (vrf_id_t vrf_id); extern struct zebra_vrf *zebra_vrf_list_lookup_by_name (const char *); extern struct zebra_vrf *zebra_vrf_alloc (vrf_id_t, const char *); extern struct route_table *zebra_vrf_table (afi_t, safi_t, vrf_id_t); diff --git a/zebra/zserv.c b/zebra/zserv.c index 76fdebb3a5..947e7324db 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1935,7 +1935,7 @@ zebra_client_read (struct thread *thread) client->last_read_time = quagga_monotime(); client->last_read_cmd = command; - zvrf = zebra_vrf_lookup (vrf_id); + zvrf = zebra_vrf_lookup_by_id (vrf_id); if (!zvrf) { if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV) -- 2.39.5