From: Kees van Reeuwijk Date: Mon, 25 Jan 2010 18:13:48 +0000 (+0000) Subject: Removed unused symbols. X-Git-Tag: v3.1.6~38 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=a701e290f74fd5d57fcc733e11c3e43eadf046ba;p=minix.git Removed unused symbols. Made some functions PRIVATE, including ones that aren't used anywhere. --- diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 0026f4711..0f8ca0e60 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -109,12 +109,6 @@ PRIVATE struct pcitab pcitab_fxp[]= typedef int irq_hook_t; -/* Translate a pointer to a field in a structure to a pointer to the structure - * itself. So it translates '&struct_ptr->field' back to 'struct_ptr'. - */ -#define structof(type, field, ptr) \ - ((type *) (((char *) (ptr)) - offsetof(type, field))) - static timer_t *fxp_timers= NULL; static clock_t fxp_next_timeout= 0; diff --git a/kernel/arch/i386/clock.c b/kernel/arch/i386/clock.c index 9cf0e7219..377312ae7 100644 --- a/kernel/arch/i386/clock.c +++ b/kernel/arch/i386/clock.c @@ -54,7 +54,7 @@ PUBLIC void stop_8253A_timer(void) /*===========================================================================* * read_8235A_timer * *===========================================================================*/ -PUBLIC clock_t read_8253A_timer(void) +PRIVATE clock_t read_8253A_timer(void) { /* Read the counter of channel 0 of the 8253A timer. This counter * counts down at a rate of TIMER_FREQ and restarts at diff --git a/kernel/arch/i386/clock.h b/kernel/arch/i386/clock.h index 4b83158f2..61586474f 100644 --- a/kernel/arch/i386/clock.h +++ b/kernel/arch/i386/clock.h @@ -3,6 +3,5 @@ _PROTOTYPE(int init_8253A_timer, (unsigned freq)); _PROTOTYPE(void stop_8253A_timer, (void)); -_PROTOTYPE(clock_t read_8253A_timer, (void)); #endif /* __CLOCK_X86_H__ */ diff --git a/kernel/arch/i386/i8259.c b/kernel/arch/i386/i8259.c index 8508b359b..b1ccb535b 100644 --- a/kernel/arch/i386/i8259.c +++ b/kernel/arch/i386/i8259.c @@ -99,7 +99,7 @@ PUBLIC void irq_8259_mask(int irq) } /* Disable 8259 - write 0xFF in OCW1 master and slave. */ -PUBLIC void i8259_disable(void) +PRIVATE void i8259_disable(void) { outb(INT2_CTLMASK, 0xFF); outb(INT_CTLMASK, 0xFF); diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 5af134944..8f640bffa 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -35,7 +35,7 @@ u8_t *vm_pagedirs = NULL; #define NOPDE (-1) #define PDEMASK(n) (1L << (n)) -PUBLIC u32_t dirtypde; +PUBLIC u32_t dirtypde; /* Accessed from assembly code. */ #define WANT_FREEPDES (sizeof(dirtypde)*8-5) PRIVATE int nfreepdes = 0, freepdes[WANT_FREEPDES], inusepde = NOPDE; @@ -151,7 +151,7 @@ PUBLIC void vm_init(struct proc *newptproc) /*===========================================================================* * lin_lin_copy * *===========================================================================*/ -int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr, +PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr, struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes) { u32_t addr; @@ -257,7 +257,7 @@ PUBLIC void vm_set_cr3(struct proc *newptproc) if(u) { unlock; } } -char *cr0_str(u32_t e) +PRIVATE char *cr0_str(u32_t e) { static char str[80]; strcpy(str, ""); @@ -273,7 +273,7 @@ char *cr0_str(u32_t e) return str; } -char *cr4_str(u32_t e) +PRIVATE char *cr4_str(u32_t e) { static char str[80]; strcpy(str, ""); @@ -594,7 +594,7 @@ PUBLIC int vm_contiguous(struct proc *targetproc, u32_t vir_buf, size_t bytes) /*===========================================================================* * vm_suspend * *===========================================================================*/ -PUBLIC int vm_suspend(struct proc *caller, struct proc *target, +PRIVATE int vm_suspend(struct proc *caller, struct proc *target, vir_bytes linaddr, vir_bytes len, int wrflag, int type) { /* This range is not OK for this process. Set parameters @@ -668,7 +668,7 @@ int delivermsg(struct proc *rp) NOREC_RETURN(deliver, r); } -char *flagstr(u32_t e, int dir) +PRIVATE char *flagstr(u32_t e, int dir) { static char str[80]; strcpy(str, ""); @@ -685,7 +685,7 @@ char *flagstr(u32_t e, int dir) return str; } -void vm_pt_print(u32_t *pagetable, u32_t v) +PRIVATE void vm_pt_print(u32_t *pagetable, u32_t v) { int pte; int col = 0; @@ -709,7 +709,7 @@ void vm_pt_print(u32_t *pagetable, u32_t v) return; } -void vm_print(u32_t *root) +PRIVATE void vm_print(u32_t *root) { int pde; diff --git a/kernel/arch/i386/protect.c b/kernel/arch/i386/protect.c index 7e079116a..8fc96f88b 100644 --- a/kernel/arch/i386/protect.c +++ b/kernel/arch/i386/protect.c @@ -66,13 +66,13 @@ PUBLIC phys_bytes seg2phys(U16_t seg) /*===========================================================================* * phys2seg * *===========================================================================*/ -PUBLIC void phys2seg(u16_t *seg, vir_bytes *off, phys_bytes phys) +PRIVATE void phys2seg(u16_t *seg, vir_bytes *off, phys_bytes phys) { /* Return a segment selector and offset that can be used to reach a physical * address, for use by a driver doing memory I/O in the A0000 - DFFFF range. */ *seg = FLAT_DS_SELECTOR; - *off = phys; + *off = (vir_bytes) phys; } /*===========================================================================* @@ -91,7 +91,7 @@ PUBLIC void init_dataseg(register struct segdesc_s *segdp, /*===========================================================================* * init_codeseg * *===========================================================================*/ -PUBLIC void init_codeseg(register struct segdesc_s *segdp, phys_bytes base, +PRIVATE void init_codeseg(register struct segdesc_s *segdp, phys_bytes base, vir_bytes size, int privilege) { /* Build descriptor for a code segment. */ @@ -305,7 +305,7 @@ PUBLIC void alloc_segments(register struct proc *rp) /*===========================================================================* * check_segments * *===========================================================================*/ -PUBLIC void check_segments(char *File, int line) +PRIVATE void check_segments(char *File, int line) { int checked = 0; int fail = 0; diff --git a/kernel/arch/i386/proto.h b/kernel/arch/i386/proto.h index 471580c5b..f7c1b729c 100644 --- a/kernel/arch/i386/proto.h +++ b/kernel/arch/i386/proto.h @@ -126,8 +126,6 @@ struct tss_s { EXTERN struct tss_s tss; _PROTOTYPE( void idt_init, (void) ); -_PROTOTYPE( void init_codeseg, (struct segdesc_s *segdp, phys_bytes base, - vir_bytes size, int privilege) ); _PROTOTYPE( void init_dataseg, (struct segdesc_s *segdp, phys_bytes base, vir_bytes size, int privilege) ); _PROTOTYPE( void enable_iop, (struct proc *pp) ); @@ -151,11 +149,9 @@ _PROTOTYPE(void idt_copy_vectors, (struct gate_table_s * first)); _PROTOTYPE(void idt_reload,(void)); EXTERN void * k_boot_stktop; -_PROTOTYPE(void tss_init, (struct tss_s * tss, void * kernel_stack, unsigned cpu)); _PROTOTYPE( void int_gate, (unsigned vec_nr, vir_bytes offset, unsigned dpl_type) ); -_PROTOTYPE(void i8259_disable, (void)); /* functions defined in architecture-independent kernel source. */ #include "../../proto.h" diff --git a/kernel/arch/i386/system.c b/kernel/arch/i386/system.c index d9254a477..1ec68a1f0 100644 --- a/kernel/arch/i386/system.c +++ b/kernel/arch/i386/system.c @@ -119,7 +119,7 @@ PUBLIC void arch_get_aout_headers(int i, struct exec *h) phys_copy(aout + i * A_MINHDR, vir2phys(h), (phys_bytes) A_MINHDR); } -PUBLIC void tss_init(struct tss_s * tss, void * kernel_stack, unsigned cpu) +PRIVATE void tss_init(struct tss_s * tss, void * kernel_stack, unsigned cpu) { /* * make space for process pointer and cpu id and point to the first @@ -428,7 +428,7 @@ PUBLIC void arch_ack_profile_clock(void) #define COLOR_BASE 0xB8000L -PUBLIC void cons_setc(int pos, int c) +PRIVATE void cons_setc(int pos, int c) { char ch; @@ -436,7 +436,7 @@ PUBLIC void cons_setc(int pos, int c) phys_copy(vir2phys((vir_bytes)&ch), COLOR_BASE+(20*80+pos)*2, 1); } -PUBLIC void cons_seth(int pos, int n) +PRIVATE void cons_seth(int pos, int n) { n &= 0xf; if (n < 10) diff --git a/kernel/clock.c b/kernel/clock.c index 7bd28f635..44c76ffde 100644 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -217,7 +217,7 @@ PRIVATE void load_update(void) } /* - * Timer interupt handler. This is the only think executed on non boot + * Timer interupt handler. This is the only thing executed on non boot * processors. It is called by bsp_timer_int_handler() on the boot processor */ PUBLIC int ap_timer_int_handler(void) diff --git a/kernel/config.h b/kernel/config.h index f50097211..c246eff5b 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -60,7 +60,5 @@ /* How many bytes for the kernel stack. Space allocated in mpx.s. */ #define K_STACK_BYTES 1024 -#define K_PARAM_SIZE 512 - #endif /* CONFIG_H */ diff --git a/kernel/const.h b/kernel/const.h index ef05149af..aa0ec7a7d 100644 --- a/kernel/const.h +++ b/kernel/const.h @@ -8,12 +8,6 @@ #include "config.h" #include "debug.h" -/* Translate a pointer to a field in a structure to a pointer to the structure - * itself. So it translates '&struct_ptr->field' back to 'struct_ptr'. - */ -#define structof(type, field, ptr) \ - ((type *) (((char *) (ptr)) - offsetof(type, field))) - /* Translate an endpoint number to a process number, return success. */ #define isokendpt(e,p) isokendpt_d((e),(p),0) #define okendpt(e,p) isokendpt_d((e),(p),1) diff --git a/kernel/glo.h b/kernel/glo.h index 141f016c6..b16bca3fd 100644 --- a/kernel/glo.h +++ b/kernel/glo.h @@ -16,10 +16,6 @@ #include "config.h" #include "debug.h" -/* Variables relating to shutting down MINIX. */ -EXTERN char kernel_exception; /* TRUE after system exceptions */ -EXTERN char shutdown_started; /* TRUE after shutdowns / reboots */ - /* Kernel information structures. This groups vital kernel information. */ EXTERN struct kinfo kinfo; /* kernel information for users */ EXTERN struct machine machine; /* machine information for users */ diff --git a/kernel/proc.h b/kernel/proc.h index 788f7b2c4..8abca51fa 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -262,7 +262,6 @@ struct proc { #define iskerneln(n) ((n) < 0) #define isuserp(p) isusern((p) >= BEG_USER_ADDR) #define isusern(n) ((n) >= 0) -#define isrootsysp(p) isrootsysn((p)->p_nr) #define isrootsysn(n) ((n) == ROOT_SYS_PROC_NR) #ifndef __ASSEMBLY__ diff --git a/kernel/proto.h b/kernel/proto.h index 2ca58ec92..dbd979852 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -78,8 +78,6 @@ _PROTOTYPE( void put_irq_handler, (irq_hook_t *hook, int irq, _PROTOTYPE( void rm_irq_handler, (irq_hook_t *hook) ); _PROTOTYPE( void enable_irq, (irq_hook_t *hook) ); _PROTOTYPE( int disable_irq, (irq_hook_t *hook) ); -_PROTOTYPE( void cons_setc, (int pos, int c) ); -_PROTOTYPE( void cons_seth, (int pos, int n) ); /* debug.c */ #if DEBUG_SCHED_CHECK @@ -122,12 +120,8 @@ _PROTOTYPE( int data_copy, (endpoint_t from, vir_bytes from_addr, endpoint_t to, vir_bytes to_addr, size_t bytes)); _PROTOTYPE( int data_copy_vmcheck, (endpoint_t from, vir_bytes from_addr, endpoint_t to, vir_bytes to_addr, size_t bytes)); -#define data_copy_to(d, p, v, n) data_copy(SYSTEM, (d), (p), (v), (n)); -#define data_copy_from(d, p, v, n) data_copy((p), (v), SYSTEM, (d), (n)); _PROTOTYPE( void alloc_segments, (struct proc *rp) ); _PROTOTYPE( void vm_init, (struct proc *first) ); -_PROTOTYPE( int vm_copy, (vir_bytes src, struct proc *srcproc, - vir_bytes dst, struct proc *dstproc, phys_bytes bytes)); _PROTOTYPE( phys_bytes umap_local, (register struct proc *rp, int seg, vir_bytes vir_addr, vir_bytes bytes)); _PROTOTYPE( void cp_mess, (int src,phys_clicks src_clicks, @@ -164,8 +158,6 @@ _PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p)); _PROTOTYPE( int vm_contiguous, (struct proc *targetproc, u32_t vir_buf, size_t count)); _PROTOTYPE( void proc_stacktrace, (struct proc *proc) ); _PROTOTYPE( int vm_lookup, (struct proc *proc, vir_bytes virtual, vir_bytes *result, u32_t *ptent)); -_PROTOTYPE( int vm_suspend, (struct proc *caller, struct proc *target, - phys_bytes lin, phys_bytes size, int wrflag, int type)); _PROTOTYPE( int delivermsg, (struct proc *target)); _PROTOTYPE( void arch_do_syscall, (struct proc *proc) ); _PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr,