diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-11-28 17:43:20 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 13:54:59 +0100 |
commit | a6f79ca57f0b4b296f67c2d063fd85a627b611b8 (patch) | |
tree | e8164505077da6b3039d598b6b22b6a893dfccd6 /sysdep/unix | |
parent | 574b2324275d3292e98a8e329f791eb5c799f7f2 (diff) |
Timers: Revert temporary names and remove old timer.h
Diffstat (limited to 'sysdep/unix')
-rw-r--r-- | sysdep/unix/io.c | 5 | ||||
-rw-r--r-- | sysdep/unix/krt.c | 30 | ||||
-rw-r--r-- | sysdep/unix/timer.h | 51 |
3 files changed, 17 insertions, 69 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index a196bbe2..7492e031 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -34,7 +34,6 @@ #include "nest/bird.h" #include "lib/lists.h" #include "lib/resource.h" -#include "sysdep/unix/timer.h" #include "lib/socket.h" #include "lib/event.h" #include "lib/timer.h" @@ -2143,7 +2142,7 @@ io_loop(void) { int poll_tout, timeout; int nfds, events, pout; - timer2 *t; + timer *t; sock *s; node *n; int fdmax = 256; @@ -2162,7 +2161,7 @@ io_loop(void) if (t = timers_first(&main_timeloop)) { times_update(&main_timeloop); - timeout = (tm2_remains(t) TO_MS) + 1; + timeout = (tm_remains(t) TO_MS) + 1; poll_tout = MIN(poll_tout, timeout); } diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 5b1c40f0..052f210a 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -56,9 +56,9 @@ #include "nest/route.h" #include "nest/protocol.h" #include "filter/filter.h" -#include "sysdep/unix/timer.h" #include "conf/conf.h" #include "lib/string.h" +#include "lib/timer.h" #include "unix.h" #include "krt.h" @@ -115,7 +115,7 @@ kif_force_scan(void) if (kif_proto && ((kif_last_shot + 2 S) < current_time())) { kif_scan(kif_scan_timer); - tm2_start(kif_scan_timer, ((struct kif_config *) kif_proto->p.cf)->scan_time); + tm_start(kif_scan_timer, ((struct kif_config *) kif_proto->p.cf)->scan_time); } } @@ -123,7 +123,7 @@ void kif_request_scan(void) { if (kif_proto && (kif_scan_timer->expires > (current_time() + 1 S))) - tm2_start(kif_scan_timer, 1 S); + tm_start(kif_scan_timer, 1 S); } static struct proto * @@ -144,9 +144,9 @@ kif_start(struct proto *P) kif_sys_start(p); /* Start periodic interface scanning */ - kif_scan_timer = tm2_new_init(P->pool, kif_scan, p, KIF_CF->scan_time, 0); + kif_scan_timer = tm_new_init(P->pool, kif_scan, p, KIF_CF->scan_time, 0); kif_scan(kif_scan_timer); - tm2_start(kif_scan_timer, KIF_CF->scan_time); + tm_start(kif_scan_timer, KIF_CF->scan_time); return PS_UP; } @@ -156,7 +156,7 @@ kif_shutdown(struct proto *P) { struct kif_proto *p = (struct kif_proto *) P; - tm2_stop(kif_scan_timer); + tm_stop(kif_scan_timer); kif_sys_shutdown(p); kif_proto = NULL; @@ -174,10 +174,10 @@ kif_reconfigure(struct proto *p, struct proto_config *new) if (o->scan_time != n->scan_time) { - tm2_stop(kif_scan_timer); + tm_stop(kif_scan_timer); kif_scan_timer->recurrent = n->scan_time; kif_scan(kif_scan_timer); - tm2_start(kif_scan_timer, n->scan_time); + tm_start(kif_scan_timer, n->scan_time); } if (!EMPTY_LIST(o->iface_list) || !EMPTY_LIST(n->iface_list)) @@ -840,11 +840,11 @@ static void krt_scan_timer_start(struct krt_proto *p) { if (!krt_scan_count) - krt_scan_timer = tm2_new_init(krt_pool, krt_scan, NULL, KRT_CF->scan_time, 0); + krt_scan_timer = tm_new_init(krt_pool, krt_scan, NULL, KRT_CF->scan_time, 0); krt_scan_count++; - tm2_start(krt_scan_timer, 1 S); + tm_start(krt_scan_timer, 1 S); } static void @@ -862,7 +862,7 @@ krt_scan_timer_stop(struct krt_proto *p UNUSED) static void krt_scan_timer_kick(struct krt_proto *p UNUSED) { - tm2_start(krt_scan_timer, 0); + tm_start(krt_scan_timer, 0); } #else @@ -882,20 +882,20 @@ krt_scan(timer *t) static void krt_scan_timer_start(struct krt_proto *p) { - p->scan_timer = tm2_new_init(p->p.pool, krt_scan, p, KRT_CF->scan_time, 0); - tm2_start(p->scan_timer, 1 S); + p->scan_timer = tm_new_init(p->p.pool, krt_scan, p, KRT_CF->scan_time, 0); + tm_start(p->scan_timer, 1 S); } static void krt_scan_timer_stop(struct krt_proto *p) { - tm2_stop(p->scan_timer); + tm_stop(p->scan_timer); } static void krt_scan_timer_kick(struct krt_proto *p) { - tm2_start(p->scan_timer, 0); + tm_start(p->scan_timer, 0); } #endif diff --git a/sysdep/unix/timer.h b/sysdep/unix/timer.h deleted file mode 100644 index 989574bf..00000000 --- a/sysdep/unix/timer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * BIRD -- Unix Timers - * - * (c) 1998 Martin Mares <mj@ucw.cz> - * - * Can be freely distributed and used under the terms of the GNU GPL. - */ - -#ifndef _BIRD_TIMER_H_ -#define _BIRD_TIMER_H_ - -#include <time.h> - -#include "lib/birdlib.h" -#include "lib/timer.h" - - -typedef struct timer2 timer; -#if 0 -static inline timer *tm_new(pool *p) -{ return (void *) tm2_new(p); } - -static inline void tm_start(timer *t, bird_clock_t after) -{ tm2_start(t, after S_); } - -static inline void tm_stop(timer *t) -{ tm2_stop(t); } - -// void tm_dump_all(void); - -//extern bird_clock_t now; /* Relative, monotonic time in seconds */ -//extern bird_clock_t now_real; /* Time in seconds since fixed known epoch */ -//extern bird_clock_t boot_time; - -static inline int tm_active(timer *t) -{ return tm2_active(t); } - -static inline bird_clock_t tm_remains(timer *t) -{ return tm2_remains(t) TO_S; } - -static inline void tm_start_max(timer *t, bird_clock_t after) -{ tm2_start_max(t, after S_); } - -static inline timer * tm_new_set(pool *p, void (*hook)(timer *), void *data, uint rand, uint rec) -{ return tm2_new_init(p, hook, data, rec S_, rand S_); } - -#endif - - - -#endif |