Clean up code in preparation for using gcc warnings.
This commit is contained in:
parent
0937d6c367
commit
5df6b80093
@ -17,8 +17,7 @@ _PROTOTYPE(double cabs, (struct complex p_compl ));
|
|||||||
/* $Header$ */
|
/* $Header$ */
|
||||||
|
|
||||||
double
|
double
|
||||||
hypot(x, y)
|
hypot(double x, double y)
|
||||||
double x, y;
|
|
||||||
{
|
{
|
||||||
/* Computes sqrt(x*x+y*y), avoiding overflow */
|
/* Computes sqrt(x*x+y*y), avoiding overflow */
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ int sys_umap_data_fb(endpoint_t ep, vir_bytes buf, vir_bytes len, phys_bytes *ph
|
|||||||
|
|
||||||
void *alloc_contig(size_t len, int flags, phys_bytes *phys)
|
void *alloc_contig(size_t len, int flags, phys_bytes *phys)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
vir_bytes buf;
|
vir_bytes buf;
|
||||||
int mmapflags = MAP_PREALLOC|MAP_CONTIG|MAP_ANON;
|
int mmapflags = MAP_PREALLOC|MAP_CONTIG|MAP_ANON;
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ int ds_retrieve_map(const char *ds_name, char *vaddr, size_t *length,
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* Do the safemap. */
|
/* Do the safemap. */
|
||||||
if(*length > m.DS_VAL_LEN)
|
if(*length > (size_t) m.DS_VAL_LEN)
|
||||||
*length = m.DS_VAL_LEN;
|
*length = (size_t) m.DS_VAL_LEN;
|
||||||
*length = (size_t) CLICK_FLOOR(*length);
|
*length = (size_t) CLICK_FLOOR(*length);
|
||||||
r = sys_safemap(DS_PROC_NR, m.DS_VAL, 0,
|
r = sys_safemap(DS_PROC_NR, m.DS_VAL, 0,
|
||||||
(vir_bytes)vaddr, *length, D, 0);
|
(vir_bytes)vaddr, *length, D, 0);
|
||||||
|
@ -28,7 +28,8 @@ int max_len; /* maximum length of value */
|
|||||||
message m;
|
message m;
|
||||||
static char mon_params[128*sizeof(char *)]; /* copy parameters here */
|
static char mon_params[128*sizeof(char *)]; /* copy parameters here */
|
||||||
char *key_value;
|
char *key_value;
|
||||||
int i, s, keylen;
|
int i, s;
|
||||||
|
size_t keylen;
|
||||||
|
|
||||||
if (key == NULL)
|
if (key == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@ -43,7 +44,7 @@ int max_len; /* maximum length of value */
|
|||||||
if (env_argv[i][keylen] != '=')
|
if (env_argv[i][keylen] != '=')
|
||||||
continue;
|
continue;
|
||||||
key_value= env_argv[i]+keylen+1;
|
key_value= env_argv[i]+keylen+1;
|
||||||
if (strlen(key_value)+1 > max_len)
|
if (strlen(key_value)+1 > (size_t) max_len)
|
||||||
return(E2BIG);
|
return(E2BIG);
|
||||||
strcpy(value, key_value);
|
strcpy(value, key_value);
|
||||||
return OK;
|
return OK;
|
||||||
@ -67,7 +68,7 @@ int max_len; /* maximum length of value */
|
|||||||
/* Value found, see if it fits in the client's buffer. Callers assume that
|
/* Value found, see if it fits in the client's buffer. Callers assume that
|
||||||
* their buffer is unchanged on error, so don't make a partial copy.
|
* their buffer is unchanged on error, so don't make a partial copy.
|
||||||
*/
|
*/
|
||||||
if ((strlen(key_value)+1) > max_len) return(E2BIG);
|
if ((strlen(key_value)+1) > (size_t) max_len) return(E2BIG);
|
||||||
|
|
||||||
/* Make the actual copy. */
|
/* Make the actual copy. */
|
||||||
strcpy(value, key_value);
|
strcpy(value, key_value);
|
||||||
|
@ -118,7 +118,7 @@ int maxchunks; /* how many were found */
|
|||||||
return -1;
|
return -1;
|
||||||
s = memstr;
|
s = memstr;
|
||||||
for (i = 0; i < maxchunks && !done; i++) {
|
for (i = 0; i < maxchunks && !done; i++) {
|
||||||
phys_bytes base = 0, size = 0, limit;
|
phys_bytes base = 0, size = 0;
|
||||||
memp = &mem_chunks[i]; /* next mem chunk is stored here */
|
memp = &mem_chunks[i]; /* next mem chunk is stored here */
|
||||||
if (*s != 0) { /* get fresh data, unless at end */
|
if (*s != 0) { /* get fresh data, unless at end */
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ static double make_double(u64_t d)
|
|||||||
* This whole thing should be replaced by something better eventually.
|
* This whole thing should be replaced by something better eventually.
|
||||||
*/
|
*/
|
||||||
double value;
|
double value;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
value = (double) ex64hi(d);
|
value = (double) ex64hi(d);
|
||||||
for (i = 0; i < sizeof(unsigned long); i += 2)
|
for (i = 0; i < sizeof(unsigned long); i += 2)
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
PUBLIC int _kernel_call(int syscallnr, message *msgptr)
|
PUBLIC int _kernel_call(int syscallnr, message *msgptr)
|
||||||
{
|
{
|
||||||
int status;
|
|
||||||
|
|
||||||
msgptr->m_type = syscallnr;
|
msgptr->m_type = syscallnr;
|
||||||
_do_kernel_call(msgptr);
|
_do_kernel_call(msgptr);
|
||||||
return(msgptr->m_type);
|
return(msgptr->m_type);
|
||||||
|
@ -14,12 +14,10 @@ static char print_buf[DIAG_BUFSIZE]; /* output is buffered here */
|
|||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* kputc *
|
* kputc *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
void kputc(c)
|
void kputc(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
/* Accumulate another character. If 0 or buffer full, print it. */
|
/* Accumulate another character. If 0 or buffer full, print it. */
|
||||||
static int buf_count; /* # characters in the buffer */
|
static int buf_count; /* # characters in the buffer */
|
||||||
message m;
|
|
||||||
|
|
||||||
if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
|
if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
|
||||||
sys_sysctl(SYSCTL_CODE_DIAG, print_buf, buf_count);
|
sys_sysctl(SYSCTL_CODE_DIAG, print_buf, buf_count);
|
||||||
|
@ -15,7 +15,6 @@ PUBLIC void panic(const char *fmt, ...)
|
|||||||
* inconsistency is detected, e.g., a programming error or illegal
|
* inconsistency is detected, e.g., a programming error or illegal
|
||||||
* value of a defined constant.
|
* value of a defined constant.
|
||||||
*/
|
*/
|
||||||
message m;
|
|
||||||
endpoint_t me = NONE;
|
endpoint_t me = NONE;
|
||||||
char name[20];
|
char name[20];
|
||||||
void (*suicide)(void);
|
void (*suicide)(void);
|
||||||
|
@ -29,10 +29,8 @@ int devind;
|
|||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pci_reserve_ok *
|
* pci_reserve_ok *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int pci_reserve_ok(devind)
|
PUBLIC int pci_reserve_ok(int devind)
|
||||||
int devind;
|
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
message m;
|
message m;
|
||||||
|
|
||||||
m.m1_i1= devind;
|
m.m1_i1= devind;
|
||||||
|
@ -39,20 +39,16 @@ PRIVATE int cprof_announce; /* announce on n-th execution
|
|||||||
* of procentry */
|
* of procentry */
|
||||||
PRIVATE int cprof_locked; /* for reentrancy */
|
PRIVATE int cprof_locked; /* for reentrancy */
|
||||||
|
|
||||||
_PROTOTYPE(void procentry, (char *name) );
|
|
||||||
_PROTOTYPE(void procexit, (char *name) );
|
|
||||||
|
|
||||||
FORWARD _PROTOTYPE(void cprof_init, (void) );
|
FORWARD _PROTOTYPE(void cprof_init, (void) );
|
||||||
FORWARD _PROTOTYPE(void reset, (void) );
|
FORWARD _PROTOTYPE(void reset, (void) );
|
||||||
FORWARD _PROTOTYPE(void clear_tbl, (void) );
|
FORWARD _PROTOTYPE(void clear_tbl, (void) );
|
||||||
|
|
||||||
|
|
||||||
PUBLIC void procentry (name)
|
PUBLIC void procentry (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
unsigned hash = 0, i = 0, x = 0;
|
unsigned hash = 0, x = 0;
|
||||||
unsigned long hi, lo;
|
int i = 0;
|
||||||
struct cprof_tbl_s *last;
|
struct cprof_tbl_s *last;
|
||||||
char c;
|
char c;
|
||||||
u64_t start;
|
u64_t start;
|
||||||
@ -171,8 +167,7 @@ char *name;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PUBLIC void procexit (name)
|
PUBLIC void procexit (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
u64_t stop, spent;
|
u64_t stop, spent;
|
||||||
|
|
||||||
@ -227,8 +222,8 @@ char *name;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PRIVATE void cprof_init() {
|
PRIVATE void cprof_init()
|
||||||
message m;
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cpath[0] = '\0';
|
cpath[0] = '\0';
|
||||||
|
@ -249,11 +249,8 @@ cpf_lookup(cp_grant_id_t g, endpoint_t *granter, endpoint_t *grantee)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC int
|
PUBLIC int
|
||||||
cpf_getgrants(grant_ids, n)
|
cpf_getgrants(cp_grant_id_t *grant_ids, int n)
|
||||||
cp_grant_id_t *grant_ids;
|
|
||||||
int n;
|
|
||||||
{
|
{
|
||||||
cp_grant_id_t g;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
|
@ -124,7 +124,6 @@ PRIVATE void sef_debug_refresh_params(void)
|
|||||||
{
|
{
|
||||||
/* Refresh SEF debug params. */
|
/* Refresh SEF debug params. */
|
||||||
clock_t uptime;
|
clock_t uptime;
|
||||||
endpoint_t endpoint;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* Get boottime the first time. */
|
/* Get boottime the first time. */
|
||||||
@ -174,7 +173,7 @@ PUBLIC char* sef_debug_header(void)
|
|||||||
/* Build and return a SEF debug header. */
|
/* Build and return a SEF debug header. */
|
||||||
sef_debug_refresh_params();
|
sef_debug_refresh_params();
|
||||||
sprintf(sef_debug_header_buff, "%s: time = %ds %06dus",
|
sprintf(sef_debug_header_buff, "%s: time = %ds %06dus",
|
||||||
sef_self_name, sef_debug_time_sec, sef_debug_time_us);
|
sef_self_name, (int) sef_debug_time_sec, (int) sef_debug_time_us);
|
||||||
|
|
||||||
return sef_debug_header_buff;
|
return sef_debug_header_buff;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ PUBLIC int sys_whoami(endpoint_t *who_ep, char *who_name, int len)
|
|||||||
if((r = _kernel_call(SYS_GETINFO, &m)) != OK)
|
if((r = _kernel_call(SYS_GETINFO, &m)) != OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
lenmin = MIN(len, sizeof(m.GIWHO_NAME)) - 1;
|
lenmin = MIN((size_t) len, sizeof(m.GIWHO_NAME)) - 1;
|
||||||
|
|
||||||
strncpy(who_name, m.GIWHO_NAME, lenmin);
|
strncpy(who_name, m.GIWHO_NAME, lenmin);
|
||||||
who_name[lenmin] = '\0';
|
who_name[lenmin] = '\0';
|
||||||
|
@ -12,7 +12,6 @@ int count; /* number of elements */
|
|||||||
vir_bytes offset; /* offset from grant */
|
vir_bytes offset; /* offset from grant */
|
||||||
{
|
{
|
||||||
message m_io;
|
message m_io;
|
||||||
int result;
|
|
||||||
|
|
||||||
m_io.DIO_REQUEST = req;
|
m_io.DIO_REQUEST = req;
|
||||||
m_io.DIO_PORT = port;
|
m_io.DIO_PORT = port;
|
||||||
|
@ -97,7 +97,6 @@ PUBLIC int sys_vmctl_get_mapping(int index,
|
|||||||
|
|
||||||
PUBLIC int sys_vmctl_reply_mapping(int index, vir_bytes addr)
|
PUBLIC int sys_vmctl_reply_mapping(int index, vir_bytes addr)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
message m;
|
message m;
|
||||||
|
|
||||||
m.SVMCTL_WHO = SELF;
|
m.SVMCTL_WHO = SELF;
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
|
|
||||||
void util_timer_start(util_timingdata_t *timingdata, char *name)
|
void util_timer_start(util_timingdata_t *timingdata, char *name)
|
||||||
{
|
{
|
||||||
unsigned long h, l;
|
size_t i;
|
||||||
int i;
|
|
||||||
|
|
||||||
if(timingdata->names[0] == '\0') {
|
if(timingdata->names[0] == '\0') {
|
||||||
for(i = 0; i < sizeof(timingdata->names) && *name; i++)
|
for(i = 0; i < sizeof(timingdata->names) && *name; i++)
|
||||||
@ -32,7 +31,7 @@ void util_timer_start(util_timingdata_t *timingdata, char *name)
|
|||||||
|
|
||||||
void util_timer_end(util_timingdata_t *timingdata)
|
void util_timer_end(util_timingdata_t *timingdata)
|
||||||
{
|
{
|
||||||
unsigned long h, l, d = 0, binsize;
|
unsigned long h, l, d = 0;
|
||||||
int bin;
|
int bin;
|
||||||
|
|
||||||
read_tsc(&h, &l);
|
read_tsc(&h, &l);
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
PUBLIC int vm_brk(endpoint_t ep, char *addr)
|
PUBLIC int vm_brk(endpoint_t ep, char *addr)
|
||||||
{
|
{
|
||||||
message m;
|
message m;
|
||||||
int result;
|
|
||||||
|
|
||||||
m.VMB_ENDPOINT = ep;
|
m.VMB_ENDPOINT = ep;
|
||||||
m.VMB_ADDR = (void *) addr;
|
m.VMB_ADDR = (void *) addr;
|
||||||
|
@ -26,7 +26,6 @@ PUBLIC void *vm_map_phys(endpoint_t who, void *phaddr, size_t len)
|
|||||||
PUBLIC int vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
|
PUBLIC int vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
|
||||||
{
|
{
|
||||||
message m;
|
message m;
|
||||||
int r;
|
|
||||||
|
|
||||||
m.VMUP_EP = who;
|
m.VMUP_EP = who;
|
||||||
m.VMUP_VADDR = vaddr;
|
m.VMUP_VADDR = vaddr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user