Miscellaneous code cleanup.

This commit is contained in:
Kees van Reeuwijk 2010-03-22 20:43:06 +00:00
parent 4b2310a7ee
commit c33102ea6b
20 changed files with 38 additions and 44 deletions

View File

@ -13,9 +13,9 @@
#include <errno.h> #include <errno.h>
#define STARTDAY 0 /* see ctime(3) */ #define STARTDAY 0 /* see ctime(3) */
#define LEAPDAY STARTDAY+59 #define LEAPDAY (STARTDAY+59)
#define MAXDAYNR STARTDAY+365 #define MAXDAYNR (STARTDAY+365)
#define NODAY -2 #define NODAY (-2)
char CRONPID[] = "/usr/run/cron.pid"; char CRONPID[] = "/usr/run/cron.pid";
_PROTOTYPE(int main, (int argc, char **argv, char **envp)); _PROTOTYPE(int main, (int argc, char **argv, char **envp));

View File

@ -20,11 +20,10 @@ static char ibuf[CHUNK_SIZE];
static char obuf[CHUNK_SIZE]; static char obuf[CHUNK_SIZE];
static char *op = obuf; static char *op = obuf;
int main(int argc, char **argv);
static void copyout(char *file, int fd); static void copyout(char *file, int fd);
static void output(char *buf, size_t count); static void output(char *buf, size_t count);
static void report(char *label); static void report(const char *label);
static void fatal(char *label); static void fatal(const char *label);
static char STDIN[] = "standard input"; static char STDIN[] = "standard input";
static char STDOUT[] = "standard output"; static char STDOUT[] = "standard output";
@ -76,7 +75,7 @@ int main(int argc, char *argv[])
return(excode); return(excode);
} }
static void copyout(char *file, int fd) static void copyout(const char *file, int fd)
{ {
int n; int n;
@ -120,7 +119,7 @@ static void output(char *buf, size_t count)
} }
} }
static void report(char *label) static void report(const char *label)
{ {
int e = errno; int e = errno;
std_err("cat: "); std_err("cat: ");
@ -131,7 +130,7 @@ static void report(char *label)
excode = 1; excode = 1;
} }
static void fatal(char *label) static void fatal(const char *label)
{ {
report(label); report(label);
exit(1); exit(1);

View File

@ -211,10 +211,10 @@ _PROTOTYPE (static void or_reset, (void));
_PROTOTYPE (static void or_watchdog_f, (timer_t *tp) ); _PROTOTYPE (static void or_watchdog_f, (timer_t *tp) );
_PROTOTYPE (static void setup_wepkey, (t_or *orp, char *wepkey0) ); _PROTOTYPE (static void setup_wepkey, (t_or *orp, char *wepkey0) );
_PROTOTYPE (static void or_getstat, (message *m)); _PROTOTYPE (static void or_getstat, (message *m));
_PROTOTYPE (static int do_hard_int, (void)); _PROTOTYPE (static void do_hard_int, (void));
_PROTOTYPE (static void check_int_events, (void)); _PROTOTYPE (static void check_int_events, (void));
_PROTOTYPE (static void or_getname, (message *m)); _PROTOTYPE (static void or_getname, (message *m));
_PROTOTYPE (static int or_handler, (t_or *orp)); _PROTOTYPE (static void or_handler, (t_or *orp));
_PROTOTYPE (static void or_dump, (message *m)); _PROTOTYPE (static void or_dump, (message *m));
/* The message used in the main loop is made global, so that rl_watchdog_f() /* The message used in the main loop is made global, so that rl_watchdog_f()
@ -425,7 +425,8 @@ static void or_getname(message *mp) {
* * * *
* Process the interrupts which the card generated * * Process the interrupts which the card generated *
*****************************************************************************/ *****************************************************************************/
static int do_hard_int(void) { static void do_hard_int(void)
{
u16_t evstat; u16_t evstat;
hermes_t *hw; hermes_t *hw;
int i,s; int i,s;
@ -1108,7 +1109,8 @@ static void or_rec_mode (t_or * orp) {
* like EV_INFO and EV_RX have to be handled before an acknowledgement for * * like EV_INFO and EV_RX have to be handled before an acknowledgement for *
* the event is returned to the card. See also the documentation * * the event is returned to the card. See also the documentation *
*****************************************************************************/ *****************************************************************************/
static int or_handler (t_or *orp) { static void or_handler (t_or *orp)
{
int i, err, length, nr = 0; int i, err, length, nr = 0;
u16_t evstat, events, fid; u16_t evstat, events, fid;
hermes_t *hw; hermes_t *hw;

View File

@ -172,7 +172,7 @@ _PROTOTYPE( static void rl_getname, (message *mp) );
_PROTOTYPE( static void reply, (re_t *rep, int err, int may_block) ); _PROTOTYPE( static void reply, (re_t *rep, int err, int may_block) );
_PROTOTYPE( static void mess_reply, (message *req, message *reply) ); _PROTOTYPE( static void mess_reply, (message *req, message *reply) );
_PROTOTYPE( static void check_int_events, (void) ); _PROTOTYPE( static void check_int_events, (void) );
_PROTOTYPE( static int do_hard_int, (void) ); _PROTOTYPE( static void do_hard_int, (void) );
_PROTOTYPE( static void rtl8139_dump, (message *m) ); _PROTOTYPE( static void rtl8139_dump, (message *m) );
#if 0 #if 0
_PROTOTYPE( static void dump_phy, (re_t *rep) ); _PROTOTYPE( static void dump_phy, (re_t *rep) );
@ -2402,7 +2402,7 @@ re_t *rep;
} }
#endif #endif
static int do_hard_int(void) static void do_hard_int(void)
{ {
int i,s; int i,s;

View File

@ -330,8 +330,8 @@ PRIVATE int get_set_input(message *m_ptr, int flag, int channel)
mixer_set(input_cmd, mask); mixer_set(input_cmd, mask);
} else { /* Get input */ } else { /* Get input */
if (shift > 0) { if (shift > 0) {
input.left = ((mask >> (shift+1)) & 1 == 1 ? ON : OFF); input.left = (((mask >> (shift+1)) & 1) == 1 ? ON : OFF);
input.right = ((mask >> shift) & 1 == 1 ? ON : OFF); input.right = (((mask >> shift) & 1) == 1 ? ON : OFF);
} else { } else {
input.left = ((mask & 1) == 1 ? ON : OFF); input.left = ((mask & 1) == 1 ? ON : OFF);
} }
@ -387,8 +387,8 @@ PRIVATE int get_set_output(message *m_ptr, int flag)
mixer_set(MIXER_OUTPUT_CTRL, mask); mixer_set(MIXER_OUTPUT_CTRL, mask);
} else { /* Get input */ } else { /* Get input */
if (shift > 0) { if (shift > 0) {
output.left = ((mask >> (shift+1)) & 1 == 1 ? ON : OFF); output.left = (((mask >> (shift+1)) & 1) == 1 ? ON : OFF);
output.right = ((mask >> shift) & 1 == 1 ? ON : OFF); output.right = (((mask >> shift) & 1) == 1 ? ON : OFF);
} else { } else {
output.left = ((mask & 1) == 1 ? ON : OFF); output.left = ((mask & 1) == 1 ? ON : OFF);
} }

View File

@ -49,7 +49,7 @@ PUBLIC int reboot_type;
PUBLIC int ioapic_enabled; PUBLIC int ioapic_enabled;
PUBLIC u32_t ioapic_id_mask[8], lapic_id_mask[8]; PUBLIC u32_t ioapic_id_mask[8], lapic_id_mask[8];
PUBLIC u32_t lapic_addr_vaddr; PUBLIC u32_t lapic_addr_vaddr;
PUBLIC u32_t lapic_addr; PUBLIC vir_bytes lapic_addr;
PUBLIC u32_t lapic_eoi_addr; PUBLIC u32_t lapic_eoi_addr;
PUBLIC u32_t lapic_taskpri_addr; PUBLIC u32_t lapic_taskpri_addr;
PUBLIC int bsp_lapic_id; PUBLIC int bsp_lapic_id;

View File

@ -93,7 +93,7 @@
#include "../../kernel.h" #include "../../kernel.h"
EXTERN int ioapic_enabled; EXTERN int ioapic_enabled;
EXTERN u32_t lapic_addr; EXTERN vir_bytes lapic_addr;
EXTERN u32_t lapic_eoi_addr; EXTERN u32_t lapic_eoi_addr;
EXTERN u32_t lapic_taskpri_addr; EXTERN u32_t lapic_taskpri_addr;
EXTERN int bsp_lapic_id; EXTERN int bsp_lapic_id;

View File

@ -25,8 +25,9 @@ PUBLIC int do_sdevio(struct proc * caller, message *m_ptr)
{ {
vir_bytes newoffset; vir_bytes newoffset;
endpoint_t newep; endpoint_t newep;
int proc_nr, proc_nr_e = m_ptr->DIO_VEC_ENDPT; int proc_nr;
int count = m_ptr->DIO_VEC_SIZE; endpoint_t proc_nr_e = m_ptr->DIO_VEC_ENDPT;
vir_bytes count = m_ptr->DIO_VEC_SIZE;
long port = m_ptr->DIO_PORT; long port = m_ptr->DIO_PORT;
phys_bytes phys_buf; phys_bytes phys_buf;
int i, req_type, req_dir, size, nr_io_range; int i, req_type, req_dir, size, nr_io_range;

View File

@ -11,8 +11,7 @@
#include "../../proc.h" #include "../../proc.h"
#include "../../proto.h" #include "../../proto.h"
extern int vm_copy_in_progress, catch_pagefaults; extern int catch_pagefaults;
extern struct proc *vm_copy_from, *vm_copy_to;
void pagefault( struct proc *pr, void pagefault( struct proc *pr,
struct exception_frame * frame, struct exception_frame * frame,

View File

@ -142,7 +142,7 @@ PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes) struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes)
{ {
u32_t addr; u32_t addr;
int procslot; proc_nr_t procslot;
NOREC_ENTER(linlincopy); NOREC_ENTER(linlincopy);

View File

@ -85,7 +85,6 @@ PRIVATE void kernel_call_finish(struct proc * caller, message *msg, int result)
caller->p_delivermsg_vir, caller->p_delivermsg_vir,
caller->p_name, caller->p_name,
caller->p_endpoint); caller->p_endpoint);
result = EBADREQUEST;
} }
} }
} }

View File

@ -32,7 +32,7 @@ typedef struct irq_hook {
int (*handler)(struct irq_hook *); /* interrupt handler */ int (*handler)(struct irq_hook *); /* interrupt handler */
int irq; /* IRQ vector number */ int irq; /* IRQ vector number */
int id; /* id of this hook */ int id; /* id of this hook */
int proc_nr_e; /* (endpoint) NONE if not in use */ endpoint_t proc_nr_e; /* (endpoint) NONE if not in use */
irq_id_t notify_id; /* id to return on interrupt */ irq_id_t notify_id; /* id to return on interrupt */
irq_policy_t policy; /* bit mask for policy */ irq_policy_t policy; /* bit mask for policy */
} irq_hook_t; } irq_hook_t;

View File

@ -806,11 +806,9 @@ udp_fd_t *udp_fd;
return NW_SUSPEND; return NW_SUSPEND;
} }
PRIVATE int udp_sel_read (udp_fd) PRIVATE int udp_sel_read (udp_fd_t *udp_fd)
udp_fd_t *udp_fd;
{ {
acc_t *pack, *tmp_acc, *next_acc; acc_t *tmp_acc, *next_acc;
int result;
if (!(udp_fd->uf_flags & UFF_OPTSET)) if (!(udp_fd->uf_flags & UFF_OPTSET))
return 1; /* Read will not block */ return 1; /* Read will not block */

View File

@ -287,7 +287,6 @@ PUBLIC int do_semctl(message *m)
unsigned short *buf; unsigned short *buf;
struct semid_ds *ds, tmp_ds; struct semid_ds *ds, tmp_ds;
struct sem_struct *sem; struct sem_struct *sem;
struct semaphore *semaphore;
id = m->SEMCTL_ID; id = m->SEMCTL_ID;
num = m->SEMCTL_NUM; num = m->SEMCTL_NUM;

View File

@ -184,10 +184,9 @@ PUBLIC void update_refcount_and_destroy(void)
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_shmdt(message *m) PUBLIC int do_shmdt(message *m)
{ {
struct shm_struct *shm;
vir_bytes addr; vir_bytes addr;
phys_bytes paddr; phys_bytes paddr;
int n, i; int i;
addr = m->SHMDT_ADDR; addr = m->SHMDT_ADDR;

View File

@ -26,7 +26,7 @@ PUBLIC void rproc_dmp()
{ {
struct rproc *rp; struct rproc *rp;
struct rprocpub *rpub; struct rprocpub *rpub;
int i,j, n=0; int i, n=0;
static int prev_i=0; static int prev_i=0;
getsysinfo(RS_PROC_NR, SI_PROCPUB_TAB, rprocpub); getsysinfo(RS_PROC_NR, SI_PROCPUB_TAB, rprocpub);

View File

@ -13,8 +13,8 @@
* maximum number of ids the filesystem can * maximum number of ids the filesystem can
* handle */ * handle */
#define NO_ADDRESS -1 /* Error constants */ #define NO_ADDRESS (-1) /* Error constants */
#define NO_FREE_INODES -1 #define NO_FREE_INODES (-1)
#define PATH_PENULTIMATE 001 /* parse_path stops at last but one name */ #define PATH_PENULTIMATE 001 /* parse_path stops at last but one name */
#define PATH_NONSYMBOLIC 004 /* parse_path scans final name if symbolic */ #define PATH_NONSYMBOLIC 004 /* parse_path scans final name if symbolic */

View File

@ -41,7 +41,7 @@ void **buf;
int *vec_grants; int *vec_grants;
vir_bytes bytes; vir_bytes bytes;
{ {
int access = 0, size; int size;
int j; int j;
iovec_t *v; iovec_t *v;
static iovec_t new_iovec[NR_IOREQS]; static iovec_t new_iovec[NR_IOREQS];

View File

@ -1,6 +1,4 @@
#include "inc.h" #include "inc.h"
#include <string.h>
#include <minix/com.h>
#include <minix/vfsif.h> #include <minix/vfsif.h>
#include <minix/ds.h> #include <minix/ds.h>
#include "const.h" #include "const.h"
@ -71,14 +69,14 @@ PUBLIC int fs_readsuper() {
/*===========================================================================* /*===========================================================================*
* fs_mountpoint * * fs_mountpoint *
*===========================================================================*/ *===========================================================================*/
PUBLIC int fs_mountpoint() { PUBLIC int fs_mountpoint()
{
/* This function looks up the mount point, it checks the condition whether /* This function looks up the mount point, it checks the condition whether
* the partition can be mounted on the inode or not. * the partition can be mounted on the inode or not.
*/ */
register struct dir_record *rip; register struct dir_record *rip;
int r = OK; int r = OK;
mode_t bits;
/* Temporarily open the file. */ /* Temporarily open the file. */
if ((rip = get_dir_record(fs_m_in.REQ_INODE_NR)) == NULL) if ((rip = get_dir_record(fs_m_in.REQ_INODE_NR)) == NULL)

View File

@ -89,7 +89,7 @@ PUBLIC int do_select(void)
* timeout and wait for either the file descriptors to become ready or the * timeout and wait for either the file descriptors to become ready or the
* timer to go off. If no timeout value was provided, we wait indefinitely. */ * timer to go off. If no timeout value was provided, we wait indefinitely. */
int r, nfds, do_timeout = 0, nonzero_timeout = 0, fd, s; int r, nfds, do_timeout = 0, fd, s;
struct timeval timeout; struct timeval timeout;
struct selectentry *se; struct selectentry *se;