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>
#define STARTDAY 0 /* see ctime(3) */
#define LEAPDAY STARTDAY+59
#define MAXDAYNR STARTDAY+365
#define NODAY -2
#define LEAPDAY (STARTDAY+59)
#define MAXDAYNR (STARTDAY+365)
#define NODAY (-2)
char CRONPID[] = "/usr/run/cron.pid";
_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 *op = obuf;
int main(int argc, char **argv);
static void copyout(char *file, int fd);
static void output(char *buf, size_t count);
static void report(char *label);
static void fatal(char *label);
static void report(const char *label);
static void fatal(const char *label);
static char STDIN[] = "standard input";
static char STDOUT[] = "standard output";
@ -76,7 +75,7 @@ int main(int argc, char *argv[])
return(excode);
}
static void copyout(char *file, int fd)
static void copyout(const char *file, int fd)
{
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;
std_err("cat: ");
@ -131,7 +130,7 @@ static void report(char *label)
excode = 1;
}
static void fatal(char *label)
static void fatal(const char *label)
{
report(label);
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 setup_wepkey, (t_or *orp, char *wepkey0) );
_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 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));
/* 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 *
*****************************************************************************/
static int do_hard_int(void) {
static void do_hard_int(void)
{
u16_t evstat;
hermes_t *hw;
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 *
* 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;
u16_t evstat, events, fid;
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 mess_reply, (message *req, message *reply) );
_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) );
#if 0
_PROTOTYPE( static void dump_phy, (re_t *rep) );
@ -2402,7 +2402,7 @@ re_t *rep;
}
#endif
static int do_hard_int(void)
static void do_hard_int(void)
{
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);
} else { /* Get input */
if (shift > 0) {
input.left = ((mask >> (shift+1)) & 1 == 1 ? ON : OFF);
input.right = ((mask >> shift) & 1 == 1 ? ON : OFF);
input.left = (((mask >> (shift+1)) & 1) == 1 ? ON : OFF);
input.right = (((mask >> shift) & 1) == 1 ? ON : OFF);
} else {
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);
} else { /* Get input */
if (shift > 0) {
output.left = ((mask >> (shift+1)) & 1 == 1 ? ON : OFF);
output.right = ((mask >> shift) & 1 == 1 ? ON : OFF);
output.left = (((mask >> (shift+1)) & 1) == 1 ? ON : OFF);
output.right = (((mask >> shift) & 1) == 1 ? ON : OFF);
} else {
output.left = ((mask & 1) == 1 ? ON : OFF);
}

View file

@ -49,7 +49,7 @@ PUBLIC int reboot_type;
PUBLIC int ioapic_enabled;
PUBLIC u32_t ioapic_id_mask[8], lapic_id_mask[8];
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_taskpri_addr;
PUBLIC int bsp_lapic_id;

View file

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

View file

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

View file

@ -11,8 +11,7 @@
#include "../../proc.h"
#include "../../proto.h"
extern int vm_copy_in_progress, catch_pagefaults;
extern struct proc *vm_copy_from, *vm_copy_to;
extern int catch_pagefaults;
void pagefault( struct proc *pr,
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)
{
u32_t addr;
int procslot;
proc_nr_t procslot;
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_name,
caller->p_endpoint);
result = EBADREQUEST;
}
}
}

View file

@ -32,7 +32,7 @@ typedef struct irq_hook {
int (*handler)(struct irq_hook *); /* interrupt handler */
int irq; /* IRQ vector number */
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_policy_t policy; /* bit mask for policy */
} irq_hook_t;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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