diff options
-rw-r--r-- | lib/workqueue.c | 21 | ||||
-rw-r--r-- | lib/workqueue.h | 7 | ||||
-rw-r--r-- | ospfd/ospf_zebra.c | 2 | ||||
-rw-r--r-- | ospfd/ospfd.h | 112 |
4 files changed, 75 insertions, 67 deletions
diff --git a/lib/workqueue.c b/lib/workqueue.c index 92869594d..c703de90b 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -103,8 +103,7 @@ void work_queue_free_and_null(struct work_queue **wqp) { struct work_queue *wq = *wqp; - if (wq->thread != NULL) - thread_cancel(&(wq->thread)); + THREAD_OFF(wq->thread); while (!work_queue_empty(wq)) { struct work_queue_item *item = work_queue_last_item(wq); @@ -122,16 +121,14 @@ void work_queue_free_and_null(struct work_queue **wqp) bool work_queue_is_scheduled(struct work_queue *wq) { - return (wq->thread != NULL); + return thread_is_scheduled(wq->thread); } static int work_queue_schedule(struct work_queue *wq, unsigned int delay) { /* if appropriate, schedule work queue thread */ - if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) && (wq->thread == NULL) - && !work_queue_empty(wq)) { - wq->thread = NULL; - + if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) && + !thread_is_scheduled(wq->thread) && !work_queue_empty(wq)) { /* Schedule timer if there's a delay, otherwise just schedule * as an 'event' */ @@ -144,7 +141,8 @@ static int work_queue_schedule(struct work_queue *wq, unsigned int delay) &wq->thread); /* set thread yield time, if needed */ - if (wq->thread && wq->spec.yield != THREAD_YIELD_TIME_SLOT) + if (thread_is_scheduled(wq->thread) && + wq->spec.yield != THREAD_YIELD_TIME_SLOT) thread_set_yield_time(wq->thread, wq->spec.yield); return 1; } else @@ -215,10 +213,7 @@ void workqueue_cmd_init(void) */ void work_queue_plug(struct work_queue *wq) { - if (wq->thread) - thread_cancel(&(wq->thread)); - - wq->thread = NULL; + THREAD_OFF(wq->thread); UNSET_FLAG(wq->flags, WQ_UNPLUGGED); } @@ -250,8 +245,6 @@ void work_queue_run(struct thread *thread) assert(wq); - wq->thread = NULL; - /* calculate cycle granularity: * list iteration == 1 run * listnode processing == 1 cycle diff --git a/lib/workqueue.h b/lib/workqueue.h index 39202dcda..27fb1383e 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -157,7 +157,8 @@ static inline void work_queue_item_dequeue(struct work_queue *wq, * user must fill in the spec of the returned work queue before adding * anything to it */ -extern struct work_queue *work_queue_new(struct thread_master *, const char *); +extern struct work_queue *work_queue_new(struct thread_master *m, + const char *queue_name); /* destroy work queue */ /* @@ -174,10 +175,10 @@ extern void work_queue_plug(struct work_queue *wq); /* unplug the queue, allow it to be drained again */ extern void work_queue_unplug(struct work_queue *wq); -bool work_queue_is_scheduled(struct work_queue *); +bool work_queue_is_scheduled(struct work_queue *wq); /* Helpers, exported for thread.c and command.c */ -extern void work_queue_run(struct thread *); +extern void work_queue_run(struct thread *thread); extern void workqueue_cmd_init(void); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 46eb62538..1754512b5 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -1747,7 +1747,7 @@ static void ospf_filter_update(struct access_list *access) } /* If prefix-list is updated, do some updates. */ -void ospf_prefix_list_update(struct prefix_list *plist) +static void ospf_prefix_list_update(struct prefix_list *plist) { struct ospf *ospf = NULL; int type; diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 76501dd6b..401a89fa3 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -661,7 +661,7 @@ extern struct zebra_privs_t ospfd_privs; /* Prototypes. */ extern const char *ospf_redist_string(unsigned int route_type); -extern struct ospf *ospf_lookup_instance(unsigned short); +extern struct ospf *ospf_lookup_instance(unsigned short instance); extern struct ospf *ospf_lookup(unsigned short instance, const char *name); extern struct ospf *ospf_get(unsigned short instance, const char *name, bool *created); @@ -670,68 +670,82 @@ extern struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name); extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id); extern uint32_t ospf_count_area_params(struct ospf *ospf); -extern void ospf_finish(struct ospf *); +extern void ospf_finish(struct ospf *ospf); extern void ospf_process_refresh_data(struct ospf *ospf, bool reset); extern void ospf_router_id_update(struct ospf *ospf); extern void ospf_process_reset(struct ospf *ospf); extern void ospf_neighbor_reset(struct ospf *ospf, struct in_addr nbr_id, const char *nbr_str); -extern int ospf_network_set(struct ospf *, struct prefix_ipv4 *, struct in_addr, - int); -extern int ospf_network_unset(struct ospf *, struct prefix_ipv4 *, - struct in_addr); -extern int ospf_area_display_format_set(struct ospf *, struct ospf_area *area, - int df); -extern int ospf_area_stub_set(struct ospf *, struct in_addr); -extern int ospf_area_stub_unset(struct ospf *, struct in_addr); -extern int ospf_area_no_summary_set(struct ospf *, struct in_addr); -extern int ospf_area_no_summary_unset(struct ospf *, struct in_addr); -extern int ospf_area_nssa_set(struct ospf *, struct in_addr); -extern int ospf_area_nssa_unset(struct ospf *, struct in_addr, int); +extern int ospf_network_set(struct ospf *ospf, struct prefix_ipv4 *p, + struct in_addr area_id, int df); +extern int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p, + struct in_addr aread_id); +extern int ospf_area_display_format_set(struct ospf *ospf, + struct ospf_area *area, int df); +extern int ospf_area_stub_set(struct ospf *ospf, struct in_addr area_id); +extern int ospf_area_stub_unset(struct ospf *ospf, struct in_addr area_id); +extern int ospf_area_no_summary_set(struct ospf *ospf, struct in_addr area_id); +extern int ospf_area_no_summary_unset(struct ospf *ospf, + struct in_addr area_id); +extern int ospf_area_nssa_set(struct ospf *ospf, struct in_addr area_id); +extern int ospf_area_nssa_unset(struct ospf *ospf, struct in_addr area_id, + int argc); extern int ospf_area_nssa_suppress_fa_set(struct ospf *ospf, struct in_addr area_id); extern int ospf_area_nssa_suppress_fa_unset(struct ospf *ospf, struct in_addr area_id); -extern int ospf_area_nssa_translator_role_set(struct ospf *, struct in_addr, - int); -extern int ospf_area_export_list_set(struct ospf *, struct ospf_area *, - const char *); -extern int ospf_area_export_list_unset(struct ospf *, struct ospf_area *); -extern int ospf_area_import_list_set(struct ospf *, struct ospf_area *, - const char *); -extern int ospf_area_import_list_unset(struct ospf *, struct ospf_area *); -extern int ospf_area_shortcut_set(struct ospf *, struct ospf_area *, int); -extern int ospf_area_shortcut_unset(struct ospf *, struct ospf_area *); -extern int ospf_timers_refresh_set(struct ospf *, int); -extern int ospf_timers_refresh_unset(struct ospf *); +extern int ospf_area_nssa_translator_role_set(struct ospf *ospf, + struct in_addr area_id, int role); +extern int ospf_area_export_list_set(struct ospf *ospf, + struct ospf_area *area_id, + const char *list_name); +extern int ospf_area_export_list_unset(struct ospf *ospf, + struct ospf_area *area_id); +extern int ospf_area_import_list_set(struct ospf *ospf, + struct ospf_area *area_id, + const char *name); +extern int ospf_area_import_list_unset(struct ospf *ospf, + struct ospf_area *area_id); +extern int ospf_area_shortcut_set(struct ospf *ospf, struct ospf_area *area_id, + int mode); +extern int ospf_area_shortcut_unset(struct ospf *ospf, + struct ospf_area *area_id); +extern int ospf_timers_refresh_set(struct ospf *ospf, int interval); +extern int ospf_timers_refresh_unset(struct ospf *ospf); void ospf_area_lsdb_discard_delete(struct ospf_area *area); -extern int ospf_nbr_nbma_set(struct ospf *, struct in_addr); -extern int ospf_nbr_nbma_unset(struct ospf *, struct in_addr); -extern int ospf_nbr_nbma_priority_set(struct ospf *, struct in_addr, uint8_t); -extern int ospf_nbr_nbma_priority_unset(struct ospf *, struct in_addr); -extern int ospf_nbr_nbma_poll_interval_set(struct ospf *, struct in_addr, - unsigned int); -extern int ospf_nbr_nbma_poll_interval_unset(struct ospf *, struct in_addr); -extern void ospf_prefix_list_update(struct prefix_list *); -extern void ospf_if_update(struct ospf *, struct interface *); -extern void ospf_ls_upd_queue_empty(struct ospf_interface *); +extern int ospf_nbr_nbma_set(struct ospf *ospf, struct in_addr nbr_addr); +extern int ospf_nbr_nbma_unset(struct ospf *ospf, struct in_addr nbr_addr); +extern int ospf_nbr_nbma_priority_set(struct ospf *ospf, + struct in_addr nbr_addr, + uint8_t priority); +extern int ospf_nbr_nbma_priority_unset(struct ospf *ospf, + struct in_addr nbr_addr); +extern int ospf_nbr_nbma_poll_interval_set(struct ospf *ospf, + struct in_addr nbr_addr, + unsigned int interval); +extern int ospf_nbr_nbma_poll_interval_unset(struct ospf *ospf, + struct in_addr addr); +extern void ospf_if_update(struct ospf *ospf, struct interface *ifp); +extern void ospf_ls_upd_queue_empty(struct ospf_interface *oi); extern void ospf_terminate(void); -extern void ospf_nbr_nbma_if_update(struct ospf *, struct ospf_interface *); -extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *, - struct in_addr); -extern int ospf_oi_count(struct interface *); +extern void ospf_nbr_nbma_if_update(struct ospf *ospf, + struct ospf_interface *oi); +extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *ospf, + struct in_addr nbr_addr); +extern int ospf_oi_count(struct interface *ifp); extern struct ospf_area *ospf_area_new(struct ospf *ospf, struct in_addr area_id); -extern struct ospf_area *ospf_area_get(struct ospf *, struct in_addr); -extern void ospf_area_check_free(struct ospf *, struct in_addr); -extern struct ospf_area *ospf_area_lookup_by_area_id(struct ospf *, - struct in_addr); -extern void ospf_area_add_if(struct ospf_area *, struct ospf_interface *); -extern void ospf_area_del_if(struct ospf_area *, struct ospf_interface *); +extern struct ospf_area *ospf_area_get(struct ospf *ospf, + struct in_addr area_id); +extern void ospf_area_check_free(struct ospf *ospf, struct in_addr area_id); +extern struct ospf_area *ospf_area_lookup_by_area_id(struct ospf *ospf, + struct in_addr area_id); +extern void ospf_area_add_if(struct ospf_area *oa, struct ospf_interface *oi); +extern void ospf_area_del_if(struct ospf_area *oa, struct ospf_interface *oi); -extern void ospf_interface_area_set(struct ospf *, struct interface *); -extern void ospf_interface_area_unset(struct ospf *, struct interface *); +extern void ospf_interface_area_set(struct ospf *ospf, struct interface *ifp); +extern void ospf_interface_area_unset(struct ospf *ospf, struct interface *ifp); extern void ospf_route_map_init(void); @@ -741,7 +755,7 @@ extern void ospf_vrf_terminate(void); extern void ospf_vrf_link(struct ospf *ospf, struct vrf *vrf); extern void ospf_vrf_unlink(struct ospf *ospf, struct vrf *vrf); const char *ospf_vrf_id_to_name(vrf_id_t vrf_id); -int ospf_area_nssa_no_summary_set(struct ospf *, struct in_addr); +int ospf_area_nssa_no_summary_set(struct ospf *ospf, struct in_addr area_id); const char *ospf_get_name(const struct ospf *ospf); extern struct ospf_interface *add_ospf_interface(struct connected *co, |