From: Kees van Reeuwijk Date: Tue, 8 Jun 2010 14:09:18 +0000 (+0000) Subject: More endpoint_t correctness. X-Git-Tag: v3.1.8~487 X-Git-Url: http://zhaoyanbai.com/repos/man.dnssec-coverage.html?a=commitdiff_plain;h=826b9590f21db7bd6aff3edc34c8259007adc441;p=minix.git More endpoint_t correctness. More const correctness. Other code cleanup. --- diff --git a/include/sys/mman.h b/include/sys/mman.h index 6ed8868c8..55b9a0b09 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -29,8 +29,8 @@ _PROTOTYPE( void *mmap, (void *, size_t, int, int, int, off_t)); _PROTOTYPE( int munmap, (void *, size_t)); _PROTOTYPE( int munmap_text, (void *, size_t)); _PROTOTYPE( void *vm_remap, (int d, int s, void *da, void *sa, size_t si)); -_PROTOTYPE( int vm_unmap, (int endpt, void *addr)); -_PROTOTYPE( unsigned long vm_getphys, (int endpt, void *addr)); +_PROTOTYPE( int vm_unmap, (endpoint_t endpt, void *addr)); +_PROTOTYPE( unsigned long vm_getphys, (endpoint_t endpt, void *addr)); _PROTOTYPE( u8_t vm_getrefcount, (int endpt, void *addr)); #endif /* _MMAN_H */ diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 9af83c8ac..44b58a061 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -270,7 +270,7 @@ PRIVATE int lapic_enable_in_msr(void) return 1; } -PUBLIC int lapic_enable(void) +PRIVATE int lapic_enable(void) { u32_t val, nlvt; unsigned cpu = cpuid; diff --git a/kernel/arch/i386/apic.h b/kernel/arch/i386/apic.h index 3a3f5fef6..3810ad65c 100644 --- a/kernel/arch/i386/apic.h +++ b/kernel/arch/i386/apic.h @@ -111,8 +111,6 @@ _PROTOTYPE (void ioapic_write, (u32_t addr, u32_t offset, u32_t data)); _PROTOTYPE (void lapic_eoi, (void)); */ -_PROTOTYPE (int lapic_enable, (void)); - _PROTOTYPE(int apic_single_cpu_init, (void)); _PROTOTYPE(void lapic_set_timer_periodic, (unsigned freq)); diff --git a/kernel/system.c b/kernel/system.c index 4cb223852..f41b4e903 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -50,11 +50,9 @@ * array size will be negative and this won't compile. */ PRIVATE int (*call_vec[NR_SYS_CALLS])(struct proc * caller, message *m_ptr); -PRIVATE char *callnames[NR_SYS_CALLS]; #define map(call_nr, handler) \ {extern int dummy[NR_SYS_CALLS>(unsigned)(call_nr-KERNEL_CALL) ? 1:-1];} \ - callnames[(call_nr-KERNEL_CALL)] = #call_nr; \ call_vec[(call_nr-KERNEL_CALL)] = (handler) PRIVATE void kernel_call_finish(struct proc * caller, message *msg, int result) @@ -177,7 +175,6 @@ PUBLIC void system_init(void) */ for (i=0; i #include #if USE_EXIT diff --git a/kernel/system/do_schedctl.c b/kernel/system/do_schedctl.c index a4ae1655f..600f4ba43 100644 --- a/kernel/system/do_schedctl.c +++ b/kernel/system/do_schedctl.c @@ -1,6 +1,4 @@ #include "kernel/system.h" -#include -#include #include /*===========================================================================* diff --git a/kernel/system/do_schedule.c b/kernel/system/do_schedule.c index bf68c43da..40d50c7c1 100644 --- a/kernel/system/do_schedule.c +++ b/kernel/system/do_schedule.c @@ -1,6 +1,4 @@ #include "kernel/system.h" -#include -#include #include #include "kernel/clock.h" diff --git a/kernel/system/do_setalarm.c b/kernel/system/do_setalarm.c index 313a735a2..29dc61b94 100644 --- a/kernel/system/do_setalarm.c +++ b/kernel/system/do_setalarm.c @@ -58,14 +58,13 @@ PUBLIC int do_setalarm(struct proc * caller, message * m_ptr) /*===========================================================================* * cause_alarm * *===========================================================================*/ -PRIVATE void cause_alarm(tp) -timer_t *tp; +PRIVATE void cause_alarm(timer_t *tp) { /* Routine called if a timer goes off and the process requested a synchronous * alarm. The process number is stored in timer argument 'ta_int'. Notify that * process with a notification message from CLOCK. */ - int proc_nr_e = tmr_arg(tp)->ta_int; /* get process number */ + endpoint_t proc_nr_e = tmr_arg(tp)->ta_int; /* get process number */ mini_notify(proc_addr(CLOCK), proc_nr_e); /* notify process */ } diff --git a/kernel/system/do_times.c b/kernel/system/do_times.c index 0de86debf..572ac140a 100644 --- a/kernel/system/do_times.c +++ b/kernel/system/do_times.c @@ -21,8 +21,9 @@ PUBLIC int do_times(struct proc * caller, message * m_ptr) { /* Handle sys_times(). Retrieve the accounting information. */ - register struct proc *rp; - int proc_nr, e_proc_nr; + register const struct proc *rp; + int proc_nr; + endpoint_t e_proc_nr; /* Insert the times needed by the SYS_TIMES kernel call in the message. * The clock's interrupt handler may run to update the user or system time diff --git a/kernel/system/do_vdevio.c b/kernel/system/do_vdevio.c index 88524357b..14bec5bf9 100644 --- a/kernel/system/do_vdevio.c +++ b/kernel/system/do_vdevio.c @@ -16,9 +16,9 @@ /* Buffer for SYS_VDEVIO to copy (port,value)-pairs from/ to user. */ PRIVATE char vdevio_buf[VDEVIO_BUF_SIZE]; -PRIVATE pvb_pair_t *pvb = (pvb_pair_t *) vdevio_buf; -PRIVATE pvw_pair_t *pvw = (pvw_pair_t *) vdevio_buf; -PRIVATE pvl_pair_t *pvl = (pvl_pair_t *) vdevio_buf; +PRIVATE pvb_pair_t * const pvb = (pvb_pair_t *) vdevio_buf; +PRIVATE pvw_pair_t * const pvw = (pvw_pair_t *) vdevio_buf; +PRIVATE pvl_pair_t * const pvl = (pvl_pair_t *) vdevio_buf; /*===========================================================================* * do_vdevio * diff --git a/kernel/utility.c b/kernel/utility.c index 3bbcbb4c6..3a080a9aa 100644 --- a/kernel/utility.c +++ b/kernel/utility.c @@ -60,7 +60,8 @@ int c; /* character to append */ kmess.km_size += 1; kmess.km_next = (kmess.km_next + 1) % _KMESS_BUF_SIZE; } else { - int p, outprocs[] = OUTPUT_PROCS_ARRAY; + int p; + endpoint_t outprocs[] = OUTPUT_PROCS_ARRAY; if(!(minix_panicing || do_serial_debug)) { for(p = 0; outprocs[p] != NONE; p++) { if(isokprocn(outprocs[p]) && !isemptyn(outprocs[p])) { diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index 46eab94c4..27487a55c 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -232,7 +232,7 @@ _PROTOTYPE( unsigned conv2, (int norm, int w) ); _PROTOTYPE( long conv4, (int norm, long x) ); _PROTOTYPE( int fetch_name, (char *path, int len, int flag) ); _PROTOTYPE( int no_sys, (void) ); -_PROTOTYPE( int isokendpt_f, (char *f, int l, int e, int *p, int ft)); +_PROTOTYPE( int isokendpt_f, (char *f, int l, endpoint_t e, int *p, int ft)); #define okendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 1) #define isokendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 0) diff --git a/servers/vfs/utility.c b/servers/vfs/utility.c index ff941f95f..54ae18d86 100644 --- a/servers/vfs/utility.c +++ b/servers/vfs/utility.c @@ -86,7 +86,7 @@ PUBLIC int no_sys() /*===========================================================================* * isokendpt_f * *===========================================================================*/ -PUBLIC int isokendpt_f(char *file, int line, int endpoint, int *proc, int fatal) +PUBLIC int isokendpt_f(char *file, int line, endpoint_t endpoint, int *proc, int fatal) { int failed = 0; endpoint_t ke;