fix clang warnings -R in kernel/ and servers/

This commit is contained in:
Ben Gras 2011-06-09 16:09:13 +02:00
parent d34ab6de9f
commit a77c2973b3
32 changed files with 71 additions and 119 deletions

View file

@ -1,5 +1,9 @@
#include <string.h>
#include "kernel/kernel.h"
#include "acpi.h"
#include "arch_proto.h"
typedef int ((* acpi_read_t)(phys_bytes addr, void * buff, size_t size));
@ -80,7 +84,7 @@ PRIVATE int acpi_read_sdt_at(phys_bytes addr,
return tb->length;
}
PRIVATE phys_bytes acpi_get_table_base(const char * name)
PUBLIC phys_bytes acpi_get_table_base(const char * name)
{
int i;
@ -93,7 +97,7 @@ PRIVATE phys_bytes acpi_get_table_base(const char * name)
return (phys_bytes) NULL;
}
PRIVATE size_t acpi_get_table_length(const char * name)
PUBLIC size_t acpi_get_table_length(const char * name)
{
int i;
@ -130,6 +134,7 @@ PRIVATE void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
return NULL;
}
#if 0
PRIVATE void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
unsigned idx)
{
@ -147,6 +152,8 @@ PRIVATE void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
return NULL;
}
#endif
PRIVATE int acpi_rsdp_test(void * buff)
{
struct acpi_rsdp * rsdp = (struct acpi_rsdp *) buff;

View file

@ -176,7 +176,7 @@ PRIVATE u32_t lapic_bus_freq[CONFIG_MAX_CPUS];
#define IOAPIC_IOREGSEL 0x0
#define IOAPIC_IOWIN 0x10
PUBLIC u32_t ioapic_read(u32_t ioa_base, u32_t reg)
PRIVATE u32_t ioapic_read(u32_t ioa_base, u32_t reg)
{
*((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = (reg & 0xff);
return *(u32_t *)(ioa_base + IOAPIC_IOWIN);
@ -207,6 +207,7 @@ PRIVATE void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
ioapic_write(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2, lo);
}
#if 0
PRIVATE void ioapic_redirt_entry_read(void * ioapic_addr,
int entry,
u32_t *hi,
@ -216,6 +217,7 @@ PRIVATE void ioapic_redirt_entry_read(void * ioapic_addr,
*hi = ioapic_read((u32_t)ioapic_addr, (u8_t) (IOAPIC_REDIR_TABLE + entry * 2 + 1));
}
#endif
PRIVATE void ioapic_redirt_entry_write(void * ioapic_addr,
int entry,
@ -570,7 +572,7 @@ PRIVATE u32_t lapic_errstatus(void)
PRIVATE int lapic_disable_in_msr(void)
{
u32_t addr, msr_hi, msr_lo;
u32_t msr_hi, msr_lo;
ia32_msr_read(IA32_APIC_BASE, &msr_hi, &msr_lo);
@ -617,11 +619,12 @@ PUBLIC void lapic_disable(void)
PRIVATE int lapic_enable_in_msr(void)
{
u32_t addr, msr_hi, msr_lo;
u32_t msr_hi, msr_lo;
ia32_msr_read(IA32_APIC_BASE, &msr_hi, &msr_lo);
#if 0
u32_t addr;
/*FIXME this is a problem on AP */
/*
* FIXME if the location is different (unlikely) then the one we expect,

View file

@ -123,6 +123,9 @@ EXTERN u32_t lapic_addr_vaddr; /* we remember the virtual address here until we
switch to paging */
_PROTOTYPE (int lapic_enable, (unsigned cpu));
_PROTOTYPE (void ioapic_unmask_irq, (unsigned irq));
_PROTOTYPE (void ioapic_mask_irq, (unsigned irq));
_PROTOTYPE (void ioapic_reset_pic, (void));
EXTERN int ioapic_enabled;
EXTERN unsigned nioapics;

View file

@ -185,8 +185,6 @@ PUBLIC int register_local_timer_handler(const irq_handler_t handler)
PUBLIC void cycles_accounting_init(void)
{
unsigned cpu = cpuid;
read_tsc_64(get_cpu_var_ptr(cpu, tsc_ctr_switch));
make_zero64(get_cpu_var(cpu, cpu_last_tsc));
@ -195,11 +193,11 @@ PUBLIC void cycles_accounting_init(void)
PUBLIC void context_stop(struct proc * p)
{
unsigned cpu = cpuid;
u64_t tsc, tsc_delta;
u64_t * __tsc_ctr_switch = get_cpulocal_var_ptr(tsc_ctr_switch);
#ifdef CONFIG_SMP
unsigned cpu = cpuid;
/*
* This function is called only if we switch from kernel to user or idle
* or back. Therefore this is a perfect location to place the big kernel
@ -279,7 +277,9 @@ PUBLIC void context_stop(struct proc * p)
PUBLIC void context_stop_idle(void)
{
int is_idle;
#ifdef CONFIG_SMP
unsigned cpu = cpuid;
#endif
is_idle = get_cpu_var(cpu, cpu_is_idle);
get_cpu_var(cpu, cpu_is_idle) = 0;
@ -310,7 +310,9 @@ PUBLIC short cpu_load(void)
u64_t tsc_delta, idle_delta, busy;
struct proc *idle;
short load;
#ifdef CONFIG_SMP
unsigned cpu = cpuid;
#endif
u64_t *last_tsc, *last_idle;

View file

@ -634,23 +634,6 @@ PUBLIC void arch_ack_profile_clock(void)
#define COLOR_BASE 0xB8000L
PRIVATE void cons_setc(const int pos, const int c)
{
char ch;
ch= c;
phys_copy(vir2phys((vir_bytes)&ch), COLOR_BASE+(20*80+pos)*2, 1);
}
PRIVATE void cons_seth(int pos, int n)
{
n &= 0xf;
if (n < 10)
cons_setc(pos, '0'+n);
else
cons_setc(pos, 'A'+(n-10));
}
/* Saved by mpx386.s into these variables. */
u32_t params_size, params_offset, mon_ds;

View file

@ -3,7 +3,7 @@
#include "debugreg.h"
PRIVATE int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
PUBLIC int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
{
unsigned long dr7, dr7flags;

View file

@ -8,6 +8,7 @@
#include "kernel/kernel.h"
#include "kernel/proc.h"
#include "arch_proto.h"
#include "hw_intr.h"
#include <minix/portio.h>
#include <machine/cpu.h>

View file

@ -2,11 +2,13 @@
#define __HW_INTR_X86_H__
#include "kernel/kernel.h"
_PROTOTYPE(int irq_8259_unmask,(int irq));
_PROTOTYPE(int irq_8259_mask,(int irq));
_PROTOTYPE(int irq_8259_eoi, (int irq));
_PROTOTYPE(void irq_8259_unmask,(int irq));
_PROTOTYPE(void irq_8259_mask,(int irq));
_PROTOTYPE(void irq_8259_eoi, (int irq));
_PROTOTYPE(void irq_handle,(int irq));
_PROTOTYPE(void i8259_disable,(void));
_PROTOTYPE(void eoi_8259_master,(void));
_PROTOTYPE(void eoi_8259_slave,(void));
/*
* we don't use IO APIC if not configured for SMP as we cannot read any info

View file

@ -225,6 +225,7 @@ PRIVATE u32_t phys_get32(phys_bytes addr)
return v;
}
#if 0
PRIVATE char *cr0_str(u32_t e)
{
static char str[80];
@ -256,6 +257,7 @@ PRIVATE char *cr4_str(u32_t e)
if(e) { strcat(str, " (++)"); }
return str;
}
#endif
PUBLIC void vm_stop(void)
{
@ -531,7 +533,6 @@ PRIVATE void vm_suspend(struct proc *caller, const struct proc *target,
*===========================================================================*/
PUBLIC void delivermsg(struct proc *rp)
{
phys_bytes addr;
int r;
assert(rp->p_misc_flags & MF_DELIVERMSG);
@ -557,6 +558,7 @@ PUBLIC void delivermsg(struct proc *rp)
}
}
#if 0
PRIVATE char *flagstr(u32_t e, const int dir)
{
static char str[80];
@ -627,6 +629,7 @@ PRIVATE void vm_print(u32_t *root)
return;
}
#endif
/*===========================================================================*
* lin_memset *

View file

@ -42,27 +42,6 @@ phys_bytes mulitboot_modules_addr;
FORWARD _PROTOTYPE(void mb_print, (char *str));
PRIVATE void mb_phys_move(u32_t src, u32_t dest, u32_t len)
{
char data[GRAN + 1];
int i;
/* Move upward (start moving from tail), block by block
* len should be aligned to GRAN
*/
if (len % GRAN) {
mb_print("fatal: not aligned phys move");
/* Spin here */
while (1)
;
}
len /= GRAN;
for (i = len - 1; i >= 0; i--) {
mb_load_phymem(data, src + i * GRAN, GRAN);
mb_save_phymem(data, dest + i * GRAN, GRAN);
}
}
PRIVATE void mb_itoa(u32_t val, char * out)
{
char ret[ITOA_BUFFER_SIZE];
@ -244,7 +223,7 @@ PRIVATE int mb_set_param(char *name, char *value)
PRIVATE void get_parameters(multiboot_info_t *mbi)
{
char mem_value[40], temp[ITOA_BUFFER_SIZE];
int i, r, processor;
int i, processor;
int dev;
int ctrlr;
int disk, prim, sub;
@ -386,8 +365,6 @@ PRIVATE void mb_extract_image(multiboot_info_t mbi)
/* Load boot image services into memory and save memory map */
for (i = 0; module < &mb_module_info[mods_count]; ++module, ++i) {
char zero = 0;
r = read_header_elf((const char *)module->mod_start,
&text_vaddr, &text_paddr,
&text_filebytes, &text_membytes,

View file

@ -72,18 +72,6 @@ PUBLIC phys_bytes seg2phys(const u16_t seg)
return base;
}
/*===========================================================================*
* phys2seg *
*===========================================================================*/
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 = (vir_bytes) phys;
}
/*===========================================================================*
* init_dataseg *
*===========================================================================*/
@ -330,6 +318,7 @@ PUBLIC void alloc_segments(register struct proc *rp)
rp->p_reg.ds = (DS_LDT_INDEX*DESC_SIZE) | TI | privilege;
}
#if 0
/*===========================================================================*
* check_segments *
*===========================================================================*/
@ -369,6 +358,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
panic("wrong: %d", fail);
}
}
#endif
/*===========================================================================*
* printseg *

View file

@ -238,4 +238,6 @@ PUBLIC int app_cpu_init_timer(unsigned freq)
{
if (init_local_timer(freq))
return -1;
return 0;
}

View file

@ -257,7 +257,6 @@ print_sigmgr(struct proc *pp)
PUBLIC void print_proc(struct proc *pp)
{
struct proc *depproc = NULL;
endpoint_t dep;
printf("%d: %s %d prio %d time %d/%d cycles 0x%x%08x cpu %2d "

View file

@ -20,6 +20,7 @@
#include "debug.h"
#include "clock.h"
#include "hw_intr.h"
#include "arch_proto.h"
#ifdef CONFIG_SMP
#include "smp.h"
@ -126,10 +127,10 @@ PUBLIC int main(void)
struct boot_image *ip; /* boot image pointer */
register struct proc *rp; /* process pointer */
register int i, j;
phys_clicks text_base;
vir_clicks text_clicks, data_clicks, st_clicks;
size_t argsz; /* size of arguments passed to crtso on stack */
#if !defined(__ELF__)
vir_clicks text_clicks, data_clicks, st_clicks;
phys_clicks text_base;
int hdrindex; /* index to array of a.out headers */
struct exec e_hdr; /* for a copy of an a.out header */
#endif

View file

@ -845,7 +845,7 @@ PRIVATE int mini_receive(struct proc * caller_ptr,
*/
register struct proc **xpp;
sys_map_t *map;
int i, r, src_id, src_proc_nr, src_p;
int r, src_id, src_proc_nr, src_p;
assert(!(caller_ptr->p_misc_flags & MF_DELIVERMSG));
@ -1227,7 +1227,7 @@ struct proc *caller_ptr;
PRIVATE int try_one(struct proc *src_ptr, struct proc *dst_ptr)
{
/* Try to receive an asynchronous message from 'src_ptr' */
int r = EAGAIN, done, do_notify, pending_recv = FALSE;
int r = EAGAIN, done, do_notify;
unsigned int flags, i;
size_t size;
endpoint_t dst;
@ -1331,7 +1331,7 @@ PUBLIC int cancel_async(struct proc *src_ptr, struct proc *dst_ptr)
{
/* Cancel asynchronous messages from src to dst, because dst is not interested
* in them (e.g., dst has been restarted) */
int done, do_notify, pending_recv = FALSE;
int done, do_notify;
unsigned int flags, i;
size_t size;
endpoint_t dst;

View file

@ -63,7 +63,7 @@ PUBLIC void stop_profile_clock()
rm_irq_handler(&profile_clock_hook);
}
PRIVATE sprof_save_sample(struct proc * p, void * pc)
PRIVATE void sprof_save_sample(struct proc * p, void * pc)
{
struct sprof_sample *s;
@ -75,7 +75,7 @@ PRIVATE sprof_save_sample(struct proc * p, void * pc)
sprof_info.mem_used += sizeof(struct sprof_sample);
}
PRIVATE sprof_save_proc(struct proc * p)
PRIVATE void sprof_save_proc(struct proc * p)
{
struct sprof_proc * s;

View file

@ -226,6 +226,8 @@ _PROTOTYPE(void release_address_space, (struct proc *pr));
_PROTOTYPE(void enable_fpu_exception, (void));
_PROTOTYPE(void disable_fpu_exception, (void));
_PROTOTYPE(void release_fpu, (struct proc * p));
_PROTOTYPE(void arch_pause,(void));
_PROTOTYPE(short cpu_load, (void));
/* utility.c */
_PROTOTYPE( void cpu_print_freq, (unsigned cpu));

View file

@ -54,9 +54,10 @@
*/
PRIVATE int (*call_vec[NR_SYS_CALLS])(struct proc * caller, message *m_ptr);
#define map(call_nr, handler) \
{extern int dummy[NR_SYS_CALLS>(unsigned)(call_nr-KERNEL_CALL) ? 1:-1];} \
call_vec[(call_nr-KERNEL_CALL)] = (handler)
#define map(call_nr, handler) \
{ int call_index = call_nr-KERNEL_CALL; \
assert(call_index >= 0 && call_index < NR_SYS_CALLS); \
call_vec[call_index] = (handler) ; }
PRIVATE void kernel_call_finish(struct proc * caller, message *msg, int result)
{

View file

@ -44,7 +44,9 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr)
vir_bytes src_vir;
int nr_e, nr, r;
int wipe_rnd_bin = -1;
#if !defined(__ELF__)
struct exec e_hdr;
#endif
/* Set source address and length based on request type. */
switch (m_ptr->I_REQUEST) {

View file

@ -14,13 +14,14 @@
*/
#include "kernel/system.h"
#include "watchdog.h"
#if SPROFILE
/* user address to write info struct */
PRIVATE vir_bytes sprof_info_addr_vir;
PRIVATE clean_seen_flag(void)
PRIVATE void clean_seen_flag(void)
{
int i;

View file

@ -16,7 +16,6 @@
/* Declare some local functions. */
FORWARD _PROTOTYPE(void get_work, (message *m_in) );
FORWARD _PROTOTYPE(void cch_check, (void) );
FORWARD _PROTOTYPE( void reply, (endpoint_t who, message *m_out) );
/* SEF functions and variables. */
@ -83,7 +82,6 @@ PUBLIC int main(int argc, char *argv[])
error = EINVAL;
} else {
error = (*fs_call_vec[ind])();
/*cch_check();*/
}
fs_m_out.m_type = error;
@ -209,23 +207,3 @@ PRIVATE void reply(
if (OK != send(who, m_out)) /* send the message */
printf("ext2(%d) was unable to send reply\n", SELF_E);
}
/*===========================================================================*
* cch_check *
*===========================================================================*/
PRIVATE void cch_check(void)
{
int i;
for (i = 0; i < NR_INODES; ++i) {
if (inode[i].i_count != cch[i] && req_nr != REQ_GETNODE &&
req_nr != REQ_PUTNODE && req_nr != REQ_READSUPER &&
req_nr != REQ_MOUNTPOINT && req_nr != REQ_UNMOUNT &&
req_nr != REQ_SYNC && req_nr != REQ_LOOKUP) {
printf("ext2(%d) inode(%ul) cc: %d req_nr: %d\n", SELF_E,
inode[i].i_num, inode[i].i_count - cch[i], req_nr);
}
cch[i] = inode[i].i_count;
}
}

View file

@ -20,7 +20,6 @@ PUBLIC int fs_sync()
*/
struct inode *rip;
struct buf *bp;
int r;
assert(nr_bufs > 0);
assert(buf);

View file

@ -551,7 +551,6 @@ PUBLIC int fs_getdents(void)
struct buf *bp;
struct ext2_disk_dir_desc *d_desc;
struct dirent *dep;
char *cp;
ino = (ino_t) fs_m_in.REQ_INODE_NR;
gid = (gid_t) fs_m_in.REQ_GRANT;

View file

@ -43,7 +43,6 @@ sef_init_info_t *info;
{
/* Initialize this file server. Called at startup time.
*/
message m;
int i, r;
/* Defaults */

View file

@ -128,6 +128,7 @@ PRIVATE void remove_semaphore(struct sem_struct *sem)
sem_list[i] = sem_list[sem_list_nr];
}
#if 0
PRIVATE void show_semaphore(void)
{
int i, j, k;
@ -161,6 +162,7 @@ PRIVATE void show_semaphore(void)
}
printf("\n");
}
#endif
PRIVATE void remove_process(endpoint_t pt)
{

View file

@ -327,6 +327,7 @@ PUBLIC int do_shmctl(message *m)
return OK;
}
#if 0
PRIVATE void list_shm_ds(void)
{
int i;
@ -337,6 +338,7 @@ PRIVATE void list_shm_ds(void)
shm_list[i].id,
shm_list[i].page);
}
#endif
/*===========================================================================*
* is_shm_nil *

View file

@ -1,8 +1,6 @@
#include "inc.h"
#include <minix/vfsif.h>
PRIVATE int dummyproc;
FORWARD _PROTOTYPE( int safe_io_conversion, (endpoint_t, cp_grant_id_t *,
int *, cp_grant_id_t *, int,
endpoint_t *, void **, int *,

View file

@ -546,7 +546,6 @@ PRIVATE void cache_resize(unsigned int blocksize, unsigned int bufs)
{
struct buf *bp;
struct inode *rip;
int scale, r;
#define MINBUFS 10
assert(blocksize > 0);
@ -569,7 +568,7 @@ PRIVATE void cache_resize(unsigned int blocksize, unsigned int bufs)
PRIVATE int bufs_heuristic(struct super_block *sp)
{
struct vm_stats_info vsi;
int r, bufs;
int bufs;
u32_t btotal, bfree, bused, kbytes_used_fs,
kbytes_total_fs, kbcache, kb_fsmax;
u32_t kbytes_remain_mem;

View file

@ -14,7 +14,6 @@
/* Declare some local functions. */
FORWARD _PROTOTYPE(void get_work, (message *m_in) );
FORWARD _PROTOTYPE(void cch_check, (void) );
FORWARD _PROTOTYPE( void reply, (endpoint_t who, message *m_out) );
/* SEF functions and variables. */
@ -178,6 +177,7 @@ PRIVATE void reply(
}
#if 0
/*===========================================================================*
* cch_check *
*===========================================================================*/
@ -197,4 +197,5 @@ PRIVATE void cch_check(void)
cch[i] = inode[i].i_count;
}
}
#endif

View file

@ -154,13 +154,10 @@ PUBLIC int do_sysuname()
*===========================================================================*/
PUBLIC int do_getsysinfo()
{
struct mproc *proc_addr;
vir_bytes src_addr, dst_addr;
struct kinfo kinfo;
struct loadinfo loadinfo;
static struct proc proctab[NR_PROCS+NR_TASKS];
size_t len;
int s, r;
int s;
/* This call leaks important information (the contents of registers). */
if (mp->mp_effuid != 0)

View file

@ -116,7 +116,7 @@ PUBLIC int do_noquantum(message *m_ptr)
PUBLIC int do_stop_scheduling(message *m_ptr)
{
register struct schedproc *rmp;
int rv, proc_nr_n;
int proc_nr_n;
/* check who can send you requests */
if (!accept_message(m_ptr))
@ -143,7 +143,7 @@ PUBLIC int do_stop_scheduling(message *m_ptr)
PUBLIC int do_start_scheduling(message *m_ptr)
{
register struct schedproc *rmp;
int rv, proc_nr_n, parent_nr_n, nice;
int rv, proc_nr_n, parent_nr_n;
/* we can handle two kinds of messages here */
assert(m_ptr->m_type == SCHEDULING_START ||
@ -353,7 +353,6 @@ PRIVATE void balance_queues(struct timer *tp)
{
struct schedproc *rmp;
int proc_nr;
int rv;
for (proc_nr=0, rmp=schedproc; proc_nr < NR_PROCS; proc_nr++, rmp++) {
if (rmp->flags & IN_USE) {

View file

@ -200,7 +200,7 @@ PUBLIC int do_select(void)
/* Check all file descriptors in the set whether one is 'ready' now */
for (fd = 0; fd < nfds; fd++) {
int type, ops, r;
int ops, r;
struct filp *f;
/* Again, check for involuntarily selected fd's */
@ -211,7 +211,7 @@ PUBLIC int do_select(void)
* processes sharing a filp and both doing a select on that filp. */
f = se->filps[fd];
if ((f->filp_select_ops & ops) != ops) {
int wantops, type, block;
int wantops;
wantops = (f->filp_select_ops |= ops);
r = do_select_request(se, fd, &wantops);
@ -911,7 +911,7 @@ PRIVATE void select_restart_filps()
* select request to be sent again).
*/
for (fd = 0; fd < se->nfds; fd++) {
int r, type, wantops, ops, block;
int r, wantops, ops;
if ((f = se->filps[fd]) == NULL) continue;
if (f->filp_select_flags & FSF_BUSY) /* Still waiting for */
continue; /* initial reply */