Replacing timer_t by netbsd's timer_t

* Renamed struct timer to struct minix_timer
 * Renamed timer_t to minix_timer_t
 * Ensured all the code uses the minix_timer_t typedef
 * Removed ifdef around _BSD_TIMER_T
 * Removed include/timers.h and merged it into include/minix/timers.h
 * Resolved prototype conflict by renaming kernel's (re)set_timer
   to (re)set_kernel_timer.

Change-Id: I56f0f30dfed96e1a0575d92492294cf9a06468a5
This commit is contained in:
2013-09-19 10:57:10 +02:00
parent 214c4e152b
commit 9fab85c2de
67 changed files with 256 additions and 278 deletions

View File

@@ -9,7 +9,7 @@
#include <stdio.h>
#include <string.h>
#include <lib.h>
#include <timers.h>
#include <minix/timers.h>
#include <minix/callnr.h>
#include <minix/type.h>

View File

@@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
#include <lib.h>
#include <timers.h>
#include <minix/timers.h>
#include <minix/callnr.h>
#include <minix/type.h>

View File

@@ -7,7 +7,7 @@
#include <stdio.h>
#include <string.h>
#include <lib.h>
#include <timers.h>
#include <minix/timers.h>
#include <minix/callnr.h>
#include <minix/type.h>

View File

@@ -16,10 +16,10 @@ int clck_call_expire;
static clock_t curr_time;
static clock_t prev_time;
static timer_t *timer_chain;
static minix_timer_t *timer_chain;
static time_t next_timeout;
static void clck_fast_release(timer_t *timer);
static void clck_fast_release(minix_timer_t *timer);
static void set_timer(void);
void clck_init()
@@ -66,12 +66,12 @@ void reset_time()
}
void clck_timer(timer, timeout, func, fd)
timer_t *timer;
minix_timer_t *timer;
time_t timeout;
timer_func_t func;
int fd;
{
timer_t *timer_index;
minix_timer_t *timer_index;
if (timer->tim_active)
clck_fast_release(timer);
@@ -111,9 +111,9 @@ message *mess;
}
static void clck_fast_release (timer)
timer_t *timer;
minix_timer_t *timer;
{
timer_t *timer_index;
minix_timer_t *timer_index;
if (!timer->tim_active)
return;
@@ -158,7 +158,7 @@ static void set_timer()
}
void clck_untimer (timer)
timer_t *timer;
minix_timer_t *timer;
{
clck_fast_release (timer);
set_timer();
@@ -167,7 +167,7 @@ timer_t *timer;
void clck_expire_timers()
{
time_t now;
timer_t *timer_index;
minix_timer_t *timer_index;
clck_call_expire= 0;

View File

@@ -77,7 +77,7 @@ typedef struct arp_port
struct arp_req
{
timer_t ar_timer;
minix_timer_t ar_timer;
int ar_entry;
int ar_req_count;
} ap_req[AP_REQ_NR];
@@ -139,7 +139,7 @@ static acc_t *arp_getdata ARGS(( int fd, size_t offset,
static int arp_putdata ARGS(( int fd, size_t offset,
acc_t *data, int for_ioctl ));
static void arp_main ARGS(( arp_port_t *arp_port ));
static void arp_timeout ARGS(( int ref, timer_t *timer ));
static void arp_timeout ARGS(( int ref, minix_timer_t *timer ));
static void setup_write ARGS(( arp_port_t *arp_port ));
static void setup_read ARGS(( arp_port_t *arp_port ));
static void do_reclist ARGS(( event_t *ev, ev_arg_t ev_arg ));
@@ -1193,7 +1193,7 @@ put_userdata_t put_userdata;
static void arp_timeout (ref, timer)
int ref;
timer_t *timer;
minix_timer_t *timer;
{
int i, port, reqind, acind;
arp_port_t *arp_port;

View File

@@ -7,18 +7,18 @@ Copyright 1995 Philip Homburg
#ifndef CLOCK_H
#define CLOCK_H
struct timer;
struct minix_timer;
typedef void (*timer_func_t) ARGS(( int fd, struct timer *timer ));
typedef void (*timer_func_t) ARGS(( int fd, struct minix_timer *timer ));
typedef struct timer
typedef struct minix_timer
{
struct timer *tim_next;
struct minix_timer *tim_next;
timer_func_t tim_func;
int tim_ref;
time_t tim_time;
int tim_active;
} timer_t;
} minix_timer_t;
extern int clck_call_expire; /* Call clck_expire_timer from the mainloop */
@@ -27,9 +27,9 @@ void set_time ARGS(( clock_t time ));
time_t get_time ARGS(( void ));
void reset_time ARGS(( void ));
/* set a timer to go off at the time specified by timeout */
void clck_timer ARGS(( struct timer *timer, time_t timeout, timer_func_t func,
void clck_timer ARGS(( minix_timer_t *timer, time_t timeout, timer_func_t func,
int fd ));
void clck_untimer ARGS(( struct timer *timer ));
void clck_untimer ARGS(( minix_timer_t *timer ));
void clck_expire_timers ARGS(( void ));
#endif /* CLOCK_H */

View File

@@ -160,7 +160,7 @@ typedef struct tcp_conn
u16_t tc_mtu; /* discovered PMTU */
clock_t tc_mtutim; /* Last time MTU/TCF_PMTU flag was changed */
struct timer tc_transmit_timer;
minix_timer_t tc_transmit_timer;
u32_t tc_transmit_seq;
clock_t tc_0wnd_to;
clock_t tc_stt; /* time of first send after last ack */

View File

@@ -20,7 +20,7 @@ Copyright 1995 Philip Homburg
THIS_FILE
static acc_t *make_pack ARGS(( tcp_conn_t *tcp_conn ));
static void tcp_send_timeout ARGS(( int conn, struct timer *timer ));
static void tcp_send_timeout ARGS(( int conn, minix_timer_t *timer ));
static void do_snd_event ARGS(( event_t *ev, ev_arg_t arg ));
void tcp_conn_write (tcp_conn, enq)
@@ -812,7 +812,7 @@ tcp_send_timeout
static void tcp_send_timeout(conn, timer)
int conn;
struct timer *timer;
minix_timer_t *timer;
{
tcp_conn_t *tcp_conn;
u16_t mss, mss2;

View File

@@ -1,7 +1,7 @@
/* Debugging dump procedures for the kernel. */
#include "inc.h"
#include <timers.h>
#include <minix/timers.h>
#include <assert.h>
#include <machine/interrupt.h>
#include <minix/endpoint.h>

View File

@@ -9,7 +9,7 @@
#include "inc.h"
#include "../pm/mproc.h"
#include <timers.h>
#include <minix/timers.h>
#include <minix/config.h>
#include <minix/type.h>

View File

@@ -8,7 +8,7 @@
*/
#include "inc.h"
#include <timers.h>
#include <minix/timers.h>
#include <minix/rs.h>
#include "kernel/priv.h"
#include "../rs/const.h"

View File

@@ -3,7 +3,7 @@
#include "inc.h"
#include <sys/mman.h>
#include <minix/vm.h>
#include <timers.h>
#include <minix/timers.h>
#include "kernel/proc.h"
#define LINES 24

View File

@@ -1,5 +1,5 @@
#include <unistd.h>
#include <timers.h>
#include <minix/timers.h>
#include <sys/svrctl.h>
#include <minix/ds.h>
#include <minix/endpoint.h>
@@ -25,7 +25,7 @@
endpoint_t lwip_ep;
static timer_t tcp_ftmr, tcp_stmr, arp_tmr;
static minix_timer_t tcp_ftmr, tcp_stmr, arp_tmr;
static int arp_ticks, tcp_fticks, tcp_sticks;
static struct netif * netif_lo;
@@ -38,19 +38,19 @@ static void sys_init(void)
{
}
static void arp_watchdog(__unused timer_t *tp)
static void arp_watchdog(__unused minix_timer_t *tp)
{
etharp_tmr();
set_timer(&arp_tmr, arp_ticks, arp_watchdog, 0);
}
static void tcp_fwatchdog(__unused timer_t *tp)
static void tcp_fwatchdog(__unused minix_timer_t *tp)
{
tcp_fasttmr();
set_timer(&tcp_ftmr, tcp_fticks, tcp_fwatchdog, 0);
}
static void tcp_swatchdog(__unused timer_t *tp)
static void tcp_swatchdog(__unused minix_timer_t *tp)
{
tcp_slowtmr();
set_timer(&tcp_ftmr, tcp_sticks, tcp_swatchdog, 0);

View File

@@ -26,7 +26,7 @@ static void getset_vtimer(struct mproc *mp, int nwhich, struct
itimerval *value, struct itimerval *ovalue);
static void get_realtimer(struct mproc *mp, struct itimerval *value);
static void set_realtimer(struct mproc *mp, struct itimerval *value);
static void cause_sigalrm(struct timer *tp);
static void cause_sigalrm(minix_timer_t *tp);
/*===========================================================================*
* ticks_from_timeval *
@@ -345,7 +345,7 @@ clock_t ticks; /* how many ticks delay before the signal */
* cause_sigalrm *
*===========================================================================*/
static void cause_sigalrm(tp)
struct timer *tp;
minix_timer_t *tp;
{
int proc_nr_n;
register struct mproc *rmp;

View File

@@ -5,7 +5,7 @@
* of corresponding slots referring to the same process in all three.
*/
#include <limits.h>
#include <timers.h>
#include <minix/timers.h>
#include <signal.h>
#include <sys/cdefs.h>
@@ -50,7 +50,7 @@ EXTERN struct mproc {
char mp_padding[60]; /* align structure with new libc */
#endif
vir_bytes mp_sigreturn; /* address of C library __sigreturn function */
struct timer mp_timer; /* watchdog timer for alarm(2), setitimer(2) */
minix_timer_t mp_timer; /* watchdog timer for alarm(2), setitimer(2) */
clock_t mp_interval[NR_ITIMERS]; /* setitimer(2) repetition intervals */
unsigned mp_flags; /* flag bits */

View File

@@ -5,7 +5,7 @@ struct stat;
struct mem_map;
struct memory;
#include <timers.h>
#include <minix/timers.h>
/* alarm.c */
int do_alarm(void);

View File

@@ -11,7 +11,7 @@
#include "mproc.h"
#include <machine/archtypes.h>
#include <timers.h>
#include <minix/timers.h>
#include "kernel/proc.h"
/*===========================================================================*

View File

@@ -22,7 +22,7 @@
#include "param.h"
#include <minix/config.h>
#include <timers.h>
#include <minix/timers.h>
#include <string.h>
#include <machine/archtypes.h>
#include "kernel/const.h"

View File

@@ -14,7 +14,7 @@
#include <assert.h>
#include <fcntl.h>
#include <lib.h>
#include <timers.h>
#include <minix/timers.h>
#include <dirent.h>
#include <minix/callnr.h>

View File

@@ -38,7 +38,7 @@
#include <minix/priv.h>
#include <machine/archtypes.h>
#include <timers.h> /* For priv.h */
#include <minix/timers.h> /* For priv.h */
#include "kernel/priv.h"
#include "kernel/ipc.h"

View File

@@ -1,7 +1,7 @@
/* Function prototypes. */
struct schedproc;
#include <timers.h>
#include <minix/timers.h>
/* main.c */
int main(void);

View File

@@ -14,13 +14,13 @@
#include <machine/archtypes.h>
#include "kernel/proc.h" /* for queue constants */
static timer_t sched_timer;
static minix_timer_t sched_timer;
static unsigned balance_timeout;
#define BALANCE_TIMEOUT 5 /* how often to balance queues in seconds */
static int schedule_process(struct schedproc * rmp, unsigned flags);
static void balance_queues(struct timer *tp);
static void balance_queues(minix_timer_t *tp);
#define SCHEDULE_CHANGE_PRIO 0x1
#define SCHEDULE_CHANGE_QUANTUM 0x2
@@ -348,7 +348,7 @@ void init_scheduling(void)
* quantum. This function will find all proccesses that have been bumped down,
* and pulls them back up. This default policy will soon be changed.
*/
static void balance_queues(struct timer *tp)
static void balance_queues(minix_timer_t *tp)
{
struct schedproc *rmp;
int proc_nr;

View File

@@ -3,11 +3,12 @@
/* Function prototypes. */
#include "timers.h"
#include "request.h"
#include "tll.h"
#include "threads.h"
#include <minix/rs.h>
#include <minix/timers.h>
#include "request.h"
#include "threads.h"
#include "tll.h"
/* Structs used in prototypes must be declared as such first. */
struct filp;
@@ -357,7 +358,7 @@ void select_callback(struct filp *, int ops);
void select_forget(void);
void select_reply1(endpoint_t driver_e, int minor, int status);
void select_reply2(endpoint_t driver_e, int minor, int status);
void select_timeout_check(timer_t *);
void select_timeout_check(minix_timer_t *);
void select_unsuspend_by_endpt(endpoint_t proc);
/* worker.c */

View File

@@ -45,7 +45,7 @@ static struct selectentry {
char block;
char starting;
clock_t expiry;
timer_t timer; /* if expiry > 0 */
minix_timer_t timer; /* if expiry > 0 */
} selecttab[MAXSELECTS];
static int copy_fdsets(struct selectentry *se, int nfds, int direction);
@@ -704,7 +704,7 @@ void select_forget(void)
/*===========================================================================*
* select_timeout_check *
*===========================================================================*/
void select_timeout_check(timer_t *timer)
void select_timeout_check(minix_timer_t *timer)
{
/* An alarm has gone off for one of the select queries. This function MUST NOT
* block its calling thread.

View File

@@ -10,7 +10,7 @@ struct phys_region;
#include <minix/endpoint.h>
#include <minix/safecopies.h>
#include <minix/vm.h>
#include <timers.h>
#include <minix/timers.h>
#include <stdio.h>
#include "pt.h"