Andy's formatting changes.
This commit is contained in:
parent
5ae6f98dea
commit
42fbd9aced
25 changed files with 218 additions and 218 deletions
|
@ -300,9 +300,9 @@ dev_t device; /* device whose blocks are to be purged */
|
|||
#endif
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* flushall *
|
||||
*==========================================================================*/
|
||||
/*===========================================================================*
|
||||
* flushall *
|
||||
*===========================================================================*/
|
||||
PUBLIC void flushall(dev)
|
||||
dev_t dev; /* device to flush */
|
||||
{
|
||||
|
@ -404,7 +404,7 @@ int rw_flag; /* READING or WRITING */
|
|||
bufqsize--;
|
||||
}
|
||||
}
|
||||
if(rw_flag == WRITING && i == 0) {
|
||||
if (rw_flag == WRITING && i == 0) {
|
||||
/* We're not making progress, this means we might keep
|
||||
* looping. Buffers remain dirty if un-written. Buffers are
|
||||
* lost if invalidate()d or LRU-removed while dirty. This
|
||||
|
|
|
@ -36,11 +36,11 @@ PUBLIC int cdprobe(void)
|
|||
/* Open device readonly. (This fails if the device
|
||||
* is also writable, which a CD isn't.)
|
||||
*/
|
||||
if((r = dev_open(dev, FS_PROC_NR, RO_BIT)) != OK) {
|
||||
if ((r = dev_open(dev, FS_PROC_NR, RO_BIT)) != OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if((r = dev_io(DEV_READ, dev, FS_PROC_NR, pvd,
|
||||
if ((r = dev_io(DEV_READ, dev, FS_PROC_NR, pvd,
|
||||
16*CD_SECTOR, sizeof(pvd), 0)) != sizeof(pvd)) {
|
||||
dev_close(dev);
|
||||
continue;
|
||||
|
@ -48,7 +48,7 @@ PUBLIC int cdprobe(void)
|
|||
dev_close(dev);
|
||||
|
||||
/* Check PVD ID. */
|
||||
if(pvd[0] != 1 || pvd[1] != 'C' || pvd[2] != 'D' ||
|
||||
if (pvd[0] != 1 || pvd[1] != 'C' || pvd[2] != 'D' ||
|
||||
pvd[3] != '0' || pvd[4] != '0' || pvd[5] != '1' || pvd[6] != 1 ||
|
||||
strncmp(pvd + 40, "MINIX", 5)) {
|
||||
continue;
|
||||
|
@ -57,18 +57,18 @@ PUBLIC int cdprobe(void)
|
|||
/* 3. Both c0dXp1 and p2 should have a superblock. */
|
||||
for(minor = minors[i]+2; minor <= minors[i]+3; minor++) {
|
||||
dev = (AT_MAJOR << MAJOR) | minor;
|
||||
if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
|
||||
if ((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
|
||||
break;
|
||||
}
|
||||
probe_super.s_dev = dev;
|
||||
r = read_super(&probe_super);
|
||||
dev_close(dev);
|
||||
if(r != OK) {
|
||||
if (r != OK) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(minor > minors[i]+3) {
|
||||
if (minor > minors[i]+3) {
|
||||
/* Success? Then set dev to p1. */
|
||||
dev = (AT_MAJOR << MAJOR) | (minors[i]+2);
|
||||
found = 1;
|
||||
|
@ -76,7 +76,7 @@ PUBLIC int cdprobe(void)
|
|||
}
|
||||
}
|
||||
|
||||
if(!found) return NO_DEV;
|
||||
if (!found) return NO_DEV;
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
|
|
@ -70,16 +70,16 @@ PUBLIC void dev_status(message *m)
|
|||
int d, get_more = 1;
|
||||
|
||||
for(d = 0; d < NR_DEVICES; d++)
|
||||
if(dmap[d].dmap_driver == m->m_source)
|
||||
if (dmap[d].dmap_driver == m->m_source)
|
||||
break;
|
||||
|
||||
if(d >= NR_DEVICES)
|
||||
if (d >= NR_DEVICES)
|
||||
return;
|
||||
|
||||
do {
|
||||
int r;
|
||||
st.m_type = DEV_STATUS;
|
||||
if((r=sendrec(m->m_source, &st)) != OK)
|
||||
if ((r=sendrec(m->m_source, &st)) != OK)
|
||||
panic(__FILE__,"couldn't sendrec for DEV_STATUS", r);
|
||||
|
||||
switch(st.m_type) {
|
||||
|
@ -354,7 +354,7 @@ message *mess_ptr; /* pointer to message for task */
|
|||
/* Did the process we did the sendrec() for get a result? */
|
||||
if (mess_ptr->REP_PROC_NR == proc_nr) {
|
||||
break;
|
||||
} else if(mess_ptr->m_type == REVIVE) {
|
||||
} else if (mess_ptr->m_type == REVIVE) {
|
||||
/* Otherwise it should be a REVIVE. */
|
||||
revive(mess_ptr->REP_PROC_NR, mess_ptr->REP_STATUS);
|
||||
} else {
|
||||
|
|
|
@ -41,17 +41,17 @@ PRIVATE struct dmap init_dmap[] = {
|
|||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /* 6 = /dev/lp */
|
||||
|
||||
#if (MACHINE == IBM_PC)
|
||||
DT(1, no_dev, 0, 0, DMAP_MUTABLE) /* 7 = /dev/ip */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /* 8 = /dev/c1 */
|
||||
DT(0, 0, 0, 0, DMAP_MUTABLE) /* 9 = not used */
|
||||
DT(0, no_dev, 0, 0, DMAP_MUTABLE) /*10 = /dev/c2 */
|
||||
DT(0, 0, 0, 0, DMAP_MUTABLE) /*11 = not used */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*12 = /dev/c3 */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*13 = /dev/audio */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */
|
||||
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*16 = /dev/random */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*17 = /dev/cmos */
|
||||
DT(1, no_dev, 0, 0, DMAP_MUTABLE) /* 7 = /dev/ip */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /* 8 = /dev/c1 */
|
||||
DT(0, 0, 0, 0, DMAP_MUTABLE) /* 9 = not used */
|
||||
DT(0, no_dev, 0, 0, DMAP_MUTABLE) /*10 = /dev/c2 */
|
||||
DT(0, 0, 0, 0, DMAP_MUTABLE) /*11 = not used */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*12 = /dev/c3 */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*13 = /dev/audio */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */
|
||||
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*16 = /dev/random*/
|
||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*17 = /dev/cmos */
|
||||
#endif /* IBM_PC */
|
||||
};
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ int optional;
|
|||
int i;
|
||||
|
||||
if ((i = env_get_param(key, value, sizeof(value))) != OK) {
|
||||
if(!optional)
|
||||
if (!optional)
|
||||
printf("FS: Warning, couldn't get monitor param: %d\n", i);
|
||||
return 0;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ PRIVATE void load_ram(void)
|
|||
u32_t fsmax, probedev;
|
||||
|
||||
/* If we are running from CD, see if we can find it. */
|
||||
if(igetenv("cdproberoot", 1) && (probedev=cdprobe()) != NO_DEV) {
|
||||
if (igetenv("cdproberoot", 1) && (probedev=cdprobe()) != NO_DEV) {
|
||||
char devnum[10];
|
||||
struct sysgetenv env;
|
||||
|
||||
|
@ -371,7 +371,7 @@ PRIVATE void load_ram(void)
|
|||
/* RAM block size has to be a multiple of the root image block
|
||||
* size to make copying easier.
|
||||
*/
|
||||
if(block_size_image % block_size_ram) {
|
||||
if (block_size_image % block_size_ram) {
|
||||
printf("\nram block size: %d image block size: %d\n",
|
||||
block_size_ram, block_size_image);
|
||||
panic(__FILE__, "ram disk block size must be a multiple of "
|
||||
|
@ -407,12 +407,12 @@ PRIVATE void load_ram(void)
|
|||
dev_close(image_dev);
|
||||
|
||||
/* Resize the RAM disk root file system. */
|
||||
if(dev_io(DEV_READ, root_dev, FS_PROC_NR,
|
||||
if (dev_io(DEV_READ, root_dev, FS_PROC_NR,
|
||||
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) {
|
||||
printf("WARNING: ramdisk read for resizing failed\n");
|
||||
}
|
||||
dsp = (struct super_block *) sbbuf;
|
||||
if(dsp->s_magic == SUPER_V3)
|
||||
if (dsp->s_magic == SUPER_V3)
|
||||
ramfs_block_size = dsp->s_block_size;
|
||||
else
|
||||
ramfs_block_size = STATIC_BLOCK_SIZE;
|
||||
|
@ -420,7 +420,7 @@ PRIVATE void load_ram(void)
|
|||
|
||||
dsp->s_nzones = conv2(sp->s_native, (u16_t) zones);
|
||||
dsp->s_zones = conv4(sp->s_native, zones);
|
||||
if(dev_io(DEV_WRITE, root_dev, FS_PROC_NR,
|
||||
if (dev_io(DEV_WRITE, root_dev, FS_PROC_NR,
|
||||
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) {
|
||||
printf("WARNING: ramdisk write for resizing failed\n");
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "super.h"
|
||||
|
||||
/*===========================================================================*
|
||||
* do_getsysinfo *
|
||||
* do_getsysinfo *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_getsysinfo()
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ PUBLIC int do_sync()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_fsync *
|
||||
* do_fsync *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_fsync()
|
||||
{
|
||||
|
|
|
@ -234,10 +234,10 @@ char string[NAME_MAX]; /* component name to look for */
|
|||
* search_dir *
|
||||
*===========================================================================*/
|
||||
PUBLIC int search_dir(ldir_ptr, string, numb, flag)
|
||||
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
||||
char string[NAME_MAX]; /* component to search for */
|
||||
ino_t *numb; /* pointer to inode number */
|
||||
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
||||
char string[NAME_MAX]; /* component to search for */
|
||||
ino_t *numb; /* pointer to inode number */
|
||||
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||
{
|
||||
/* This function searches the directory whose inode is pointed to by 'ldip':
|
||||
* if (flag == ENTER) enter 'string' in the directory with inode # '*numb';
|
||||
|
@ -286,7 +286,7 @@ int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
|||
/* Since directories don't have holes, 'b' cannot be NO_BLOCK. */
|
||||
bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */
|
||||
|
||||
if(bp == NO_BLOCK)
|
||||
if (bp == NO_BLOCK)
|
||||
panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM);
|
||||
|
||||
/* Search a directory block. */
|
||||
|
|
|
@ -109,7 +109,7 @@ int notouch; /* check only */
|
|||
if (oflags & O_NONBLOCK) {
|
||||
r = EAGAIN;
|
||||
} else {
|
||||
if(!notouch)
|
||||
if (!notouch)
|
||||
suspend(XPIPE); /* block reader */
|
||||
r = SUSPEND;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ int notouch; /* check only */
|
|||
/* Process is writing to a pipe. */
|
||||
if (find_filp(rip, R_BIT) == NIL_FILP) {
|
||||
/* Tell kernel to generate a SIGPIPE signal. */
|
||||
if(!notouch)
|
||||
if (!notouch)
|
||||
sys_kill((int)(fp - fproc), SIGPIPE);
|
||||
return(EPIPE);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ int notouch; /* check only */
|
|||
if ( (*canwrite = (PIPE_SIZE(rip->i_sp->s_block_size)
|
||||
- position)) > 0) {
|
||||
/* Do a partial write. Need to wakeup reader */
|
||||
if(!notouch)
|
||||
if (!notouch)
|
||||
release(rip, READ, susp_count);
|
||||
return(1);
|
||||
} else {
|
||||
|
@ -154,7 +154,7 @@ int notouch; /* check only */
|
|||
return(1);
|
||||
}
|
||||
}
|
||||
if(!notouch)
|
||||
if (!notouch)
|
||||
suspend(XPIPE); /* stop writer -- pipe full */
|
||||
return(SUSPEND);
|
||||
}
|
||||
|
@ -213,14 +213,14 @@ int count; /* max number of processes to release */
|
|||
/* Trying to perform the call also includes SELECTing on it with that
|
||||
* operation.
|
||||
*/
|
||||
if(call_nr == READ || call_nr == WRITE) {
|
||||
if (call_nr == READ || call_nr == WRITE) {
|
||||
int op;
|
||||
if(call_nr == READ)
|
||||
if (call_nr == READ)
|
||||
op = SEL_RD;
|
||||
else
|
||||
op = SEL_WR;
|
||||
for(f = &filp[0]; f < &filp[NR_FILPS]; f++) {
|
||||
if(f->filp_count < 1 || !(f->filp_pipe_select_ops & op) ||
|
||||
if (f->filp_count < 1 || !(f->filp_pipe_select_ops & op) ||
|
||||
f->filp_ino != ip)
|
||||
continue;
|
||||
select_callback(f, op);
|
||||
|
@ -274,7 +274,7 @@ int returned; /* if hanging on task, how many bytes read */
|
|||
rfp->fp_suspended = NOT_SUSPENDED;
|
||||
if (task == XPOPEN) /* process blocked in open or create */
|
||||
reply(proc_nr, rfp->fp_fd>>8);
|
||||
else if(task == XSELECT) {
|
||||
else if (task == XSELECT) {
|
||||
reply(proc_nr, returned);
|
||||
} else {
|
||||
/* Revive a process suspended on TTY or other device. */
|
||||
|
@ -349,24 +349,24 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block)
|
|||
{
|
||||
int orig_ops, r = 0, err, canwrite;
|
||||
orig_ops = *ops;
|
||||
if((*ops & SEL_RD)) {
|
||||
if((err = pipe_check(f->filp_ino, READING, 0,
|
||||
if ((*ops & SEL_RD)) {
|
||||
if ((err = pipe_check(f->filp_ino, READING, 0,
|
||||
1, f->filp_pos, &canwrite, 1)) != SUSPEND)
|
||||
r |= SEL_RD;
|
||||
if(err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
||||
if (err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
||||
r |= SEL_ERR;
|
||||
}
|
||||
if((*ops & SEL_WR)) {
|
||||
if((err = pipe_check(f->filp_ino, WRITING, 0,
|
||||
if ((*ops & SEL_WR)) {
|
||||
if ((err = pipe_check(f->filp_ino, WRITING, 0,
|
||||
1, f->filp_pos, &canwrite, 1)) != SUSPEND)
|
||||
r |= SEL_WR;
|
||||
if(err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
||||
if (err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
||||
r |= SEL_ERR;
|
||||
}
|
||||
|
||||
*ops = r;
|
||||
|
||||
if(!r && block) {
|
||||
if (!r && block) {
|
||||
f->filp_pipe_select_ops |= orig_ops;
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block)
|
|||
PUBLIC int select_match_pipe(struct filp *f)
|
||||
{
|
||||
/* recognize either pipe or named pipe (FIFO) */
|
||||
if(f && f->filp_ino && (f->filp_ino->i_mode & I_NAMED_PIPE))
|
||||
if (f && f->filp_ino && (f->filp_ino->i_mode & I_NAMED_PIPE))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ _PROTOTYPE( int do_exec, (void) );
|
|||
_PROTOTYPE( int do_revive, (void) );
|
||||
_PROTOTYPE( int do_set, (void) );
|
||||
_PROTOTYPE( int do_sync, (void) );
|
||||
_PROTOTYPE( int do_fsync, (void) );
|
||||
_PROTOTYPE( int do_fsync, (void) );
|
||||
_PROTOTYPE( int do_reboot, (void) );
|
||||
_PROTOTYPE( int do_svrctl, (void) );
|
||||
_PROTOTYPE( int do_getsysinfo, (void) );
|
||||
|
@ -122,7 +122,7 @@ _PROTOTYPE( int pipe_check, (struct inode *rip, int rw_flag,
|
|||
_PROTOTYPE( void release, (struct inode *ip, int call_nr, int count) );
|
||||
_PROTOTYPE( void revive, (int proc_nr, int bytes) );
|
||||
_PROTOTYPE( void suspend, (int task) );
|
||||
_PROTOTYPE( int select_request_pipe, (struct filp *f, int *ops, int bl) );
|
||||
_PROTOTYPE( int select_request_pipe, (struct filp *f, int *ops, int bl) );
|
||||
_PROTOTYPE( int select_cancel_pipe, (struct filp *f) );
|
||||
_PROTOTYPE( int select_match_pipe, (struct filp *f) );
|
||||
|
||||
|
@ -184,7 +184,7 @@ _PROTOTYPE( int select_callback, (struct filp *, int ops) );
|
|||
_PROTOTYPE( void select_forget, (int fproc) );
|
||||
_PROTOTYPE( void select_timeout_check, (timer_t *) );
|
||||
_PROTOTYPE( void init_select, (void) );
|
||||
_PROTOTYPE( int select_notified, (int major, int minor, int ops) );
|
||||
_PROTOTYPE( int select_notified, (int major, int minor, int ops) );
|
||||
|
||||
/* timers.c */
|
||||
_PROTOTYPE( void fs_set_timer, (timer_t *tp, int delta, tmr_func_t watchdog, int arg));
|
||||
|
|
|
@ -56,7 +56,7 @@ int rw_flag; /* READING or WRITING */
|
|||
/* left unfinished rw_chunk()s from previous call! this can't happen.
|
||||
* it means something has gone wrong we can't repair now.
|
||||
*/
|
||||
if(bufs_in_use < 0) {
|
||||
if (bufs_in_use < 0) {
|
||||
panic(__FILE__,"start - bufs_in_use negative", bufs_in_use);
|
||||
}
|
||||
|
||||
|
@ -100,21 +100,21 @@ int rw_flag; /* READING or WRITING */
|
|||
mode_word = rip->i_mode & I_TYPE;
|
||||
regular = mode_word == I_REGULAR || mode_word == I_NAMED_PIPE;
|
||||
|
||||
if((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
|
||||
if(rip->i_zone[0] == NO_DEV)
|
||||
if ((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
|
||||
if (rip->i_zone[0] == NO_DEV)
|
||||
panic(__FILE__,"read_write tries to read from "
|
||||
"character device NO_DEV", NO_NUM);
|
||||
block_size = get_block_size(rip->i_zone[0]);
|
||||
}
|
||||
if((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
|
||||
if ((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
|
||||
f_size = ULONG_MAX;
|
||||
if(rip->i_zone[0] == NO_DEV)
|
||||
if (rip->i_zone[0] == NO_DEV)
|
||||
panic(__FILE__,"read_write tries to read from "
|
||||
" block device NO_DEV", NO_NUM);
|
||||
block_size = get_block_size(rip->i_zone[0]);
|
||||
}
|
||||
|
||||
if(!char_spec && !block_spec)
|
||||
if (!char_spec && !block_spec)
|
||||
block_size = rip->i_sp->s_block_size;
|
||||
|
||||
rdwt_err = OK; /* set to EIO if disk error occurs */
|
||||
|
@ -197,7 +197,7 @@ int rw_flag; /* READING or WRITING */
|
|||
}
|
||||
} else {
|
||||
if (rip->i_pipe == I_PIPE) {
|
||||
if( position >= rip->i_size) {
|
||||
if ( position >= rip->i_size) {
|
||||
/* Reset pipe pointers. */
|
||||
rip->i_size = 0; /* no data left */
|
||||
position = 0; /* reset reader(s) */
|
||||
|
@ -240,7 +240,7 @@ int rw_flag; /* READING or WRITING */
|
|||
fp->fp_cum_io_partial = 0;
|
||||
return(cum_io);
|
||||
}
|
||||
if(bufs_in_use < 0) {
|
||||
if (bufs_in_use < 0) {
|
||||
panic(__FILE__,"end - bufs_in_use negative", bufs_in_use);
|
||||
}
|
||||
return(r);
|
||||
|
@ -305,7 +305,7 @@ int *completed; /* number of bytes copied */
|
|||
}
|
||||
|
||||
/* In all cases, bp now points to a valid buffer. */
|
||||
if(bp == NIL_BUF) {
|
||||
if (bp == NIL_BUF) {
|
||||
panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM);
|
||||
}
|
||||
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
|
||||
|
|
|
@ -100,7 +100,7 @@ PRIVATE int select_request_file(struct filp *f, int *ops, int block)
|
|||
*===========================================================================*/
|
||||
PRIVATE int select_match_file(struct filp *file)
|
||||
{
|
||||
if(file && file->filp_ino && (file->filp_ino->i_mode & I_REGULAR))
|
||||
if (file && file->filp_ino && (file->filp_ino->i_mode & I_REGULAR))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -111,9 +111,9 @@ PRIVATE int select_match_file(struct filp *file)
|
|||
PRIVATE int select_request_general(struct filp *f, int *ops, int block)
|
||||
{
|
||||
int rops = *ops;
|
||||
if(block) rops |= SEL_NOTIFY;
|
||||
if (block) rops |= SEL_NOTIFY;
|
||||
*ops = dev_io(DEV_SELECT, f->filp_ino->i_zone[0], rops, NULL, 0, 0, 0);
|
||||
if(*ops < 0)
|
||||
if (*ops < 0)
|
||||
return SEL_ERR;
|
||||
return SEL_OK;
|
||||
}
|
||||
|
@ -124,11 +124,11 @@ PRIVATE int select_request_general(struct filp *f, int *ops, int block)
|
|||
PRIVATE int select_major_match(int match_major, struct filp *file)
|
||||
{
|
||||
int major;
|
||||
if(!(file && file->filp_ino &&
|
||||
if (!(file && file->filp_ino &&
|
||||
(file->filp_ino->i_mode & I_TYPE) == I_CHAR_SPECIAL))
|
||||
return 0;
|
||||
major = (file->filp_ino->i_zone[0] >> MAJOR) & BYTE;
|
||||
if(major == match_major)
|
||||
if (major == match_major)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -142,17 +142,17 @@ PRIVATE int tab2ops(int fd, struct selectentry *e)
|
|||
|
||||
PRIVATE void ops2tab(int ops, int fd, struct selectentry *e)
|
||||
{
|
||||
if((ops & SEL_RD) && e->vir_readfds && FD_ISSET(fd, &e->readfds)
|
||||
if ((ops & SEL_RD) && e->vir_readfds && FD_ISSET(fd, &e->readfds)
|
||||
&& !FD_ISSET(fd, &e->ready_readfds)) {
|
||||
FD_SET(fd, &e->ready_readfds);
|
||||
e->nreadyfds++;
|
||||
}
|
||||
if((ops & SEL_WR) && e->vir_writefds && FD_ISSET(fd, &e->writefds)
|
||||
if ((ops & SEL_WR) && e->vir_writefds && FD_ISSET(fd, &e->writefds)
|
||||
&& !FD_ISSET(fd, &e->ready_writefds)) {
|
||||
FD_SET(fd, &e->ready_writefds);
|
||||
e->nreadyfds++;
|
||||
}
|
||||
if((ops & SEL_ERR) && e->vir_errorfds && FD_ISSET(fd, &e->errorfds)
|
||||
if ((ops & SEL_ERR) && e->vir_errorfds && FD_ISSET(fd, &e->errorfds)
|
||||
&& !FD_ISSET(fd, &e->ready_errorfds)) {
|
||||
FD_SET(fd, &e->ready_errorfds);
|
||||
e->nreadyfds++;
|
||||
|
@ -163,13 +163,13 @@ PRIVATE void ops2tab(int ops, int fd, struct selectentry *e)
|
|||
|
||||
PRIVATE void copy_fdsets(struct selectentry *e)
|
||||
{
|
||||
if(e->vir_readfds)
|
||||
if (e->vir_readfds)
|
||||
sys_vircopy(SELF, D, (vir_bytes) &e->ready_readfds,
|
||||
e->req_procnr, D, (vir_bytes) e->vir_readfds, sizeof(fd_set));
|
||||
if(e->vir_writefds)
|
||||
if (e->vir_writefds)
|
||||
sys_vircopy(SELF, D, (vir_bytes) &e->ready_writefds,
|
||||
e->req_procnr, D, (vir_bytes) e->vir_writefds, sizeof(fd_set));
|
||||
if(e->vir_errorfds)
|
||||
if (e->vir_errorfds)
|
||||
sys_vircopy(SELF, D, (vir_bytes) &e->ready_errorfds,
|
||||
e->req_procnr, D, (vir_bytes) e->vir_errorfds, sizeof(fd_set));
|
||||
|
||||
|
@ -177,7 +177,7 @@ PRIVATE void copy_fdsets(struct selectentry *e)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_select *
|
||||
* do_select *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_select(void)
|
||||
{
|
||||
|
@ -186,14 +186,14 @@ PUBLIC int do_select(void)
|
|||
struct timeval timeout;
|
||||
nfds = m_in.SEL_NFDS;
|
||||
|
||||
if(nfds < 0 || nfds > FD_SETSIZE)
|
||||
if (nfds < 0 || nfds > FD_SETSIZE)
|
||||
return EINVAL;
|
||||
|
||||
for(s = 0; s < MAXSELECTS; s++)
|
||||
if(!selecttab[s].requestor)
|
||||
if (!selecttab[s].requestor)
|
||||
break;
|
||||
|
||||
if(s >= MAXSELECTS)
|
||||
if (s >= MAXSELECTS)
|
||||
return ENOSPC;
|
||||
|
||||
selecttab[s].req_procnr = who;
|
||||
|
@ -214,40 +214,40 @@ PUBLIC int do_select(void)
|
|||
selecttab[s].vir_errorfds = (fd_set *) m_in.SEL_ERRORFDS;
|
||||
|
||||
/* copy args */
|
||||
if(selecttab[s].vir_readfds
|
||||
if (selecttab[s].vir_readfds
|
||||
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_READFDS,
|
||||
SELF, D, (vir_bytes) &selecttab[s].readfds, sizeof(fd_set))) != OK)
|
||||
return r;
|
||||
|
||||
if(selecttab[s].vir_writefds
|
||||
if (selecttab[s].vir_writefds
|
||||
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_WRITEFDS,
|
||||
SELF, D, (vir_bytes) &selecttab[s].writefds, sizeof(fd_set))) != OK)
|
||||
return r;
|
||||
|
||||
if(selecttab[s].vir_errorfds
|
||||
if (selecttab[s].vir_errorfds
|
||||
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_ERRORFDS,
|
||||
SELF, D, (vir_bytes) &selecttab[s].errorfds, sizeof(fd_set))) != OK)
|
||||
return r;
|
||||
|
||||
if(!m_in.SEL_TIMEOUT)
|
||||
if (!m_in.SEL_TIMEOUT)
|
||||
is_timeout = nonzero_timeout = 0;
|
||||
else
|
||||
if((r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_TIMEOUT,
|
||||
if ((r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_TIMEOUT,
|
||||
SELF, D, (vir_bytes) &timeout, sizeof(timeout))) != OK)
|
||||
return r;
|
||||
|
||||
/* No nonsense in the timeval please. */
|
||||
if(is_timeout && (timeout.tv_sec < 0 || timeout.tv_usec < 0))
|
||||
if (is_timeout && (timeout.tv_sec < 0 || timeout.tv_usec < 0))
|
||||
return EINVAL;
|
||||
|
||||
/* if is_timeout if 0, we block forever. otherwise, if nonzero_timeout
|
||||
* is 0, we do a poll (don't block). otherwise, we block up to the
|
||||
* specified time interval.
|
||||
*/
|
||||
if(is_timeout && (timeout.tv_sec > 0 || timeout.tv_usec > 0))
|
||||
if (is_timeout && (timeout.tv_sec > 0 || timeout.tv_usec > 0))
|
||||
nonzero_timeout = 1;
|
||||
|
||||
if(nonzero_timeout || !is_timeout)
|
||||
if (nonzero_timeout || !is_timeout)
|
||||
block = 1;
|
||||
else
|
||||
block = 0; /* timeout set as (0,0) - this effects a poll */
|
||||
|
@ -259,24 +259,24 @@ PUBLIC int do_select(void)
|
|||
int orig_ops, ops, t, type = -1, r;
|
||||
struct filp *filp;
|
||||
|
||||
if(!(orig_ops = ops = tab2ops(fd, &selecttab[s])))
|
||||
if (!(orig_ops = ops = tab2ops(fd, &selecttab[s])))
|
||||
continue;
|
||||
if(!(filp = selecttab[s].filps[fd] = get_filp(fd))) {
|
||||
if (!(filp = selecttab[s].filps[fd] = get_filp(fd))) {
|
||||
select_cancel_all(&selecttab[s]);
|
||||
return EBADF;
|
||||
}
|
||||
|
||||
for(t = 0; t < SEL_FDS; t++) {
|
||||
if(fdtypes[t].select_match) {
|
||||
if(fdtypes[t].select_match(filp)) {
|
||||
if (fdtypes[t].select_match) {
|
||||
if (fdtypes[t].select_match(filp)) {
|
||||
#if DEBUG_SELECT
|
||||
printf("select: fd %d is type %d ", fd, t);
|
||||
#endif
|
||||
if(type != -1)
|
||||
if (type != -1)
|
||||
printf("select: double match\n");
|
||||
type = t;
|
||||
}
|
||||
} else if(select_major_match(fdtypes[t].select_major, filp)) {
|
||||
} else if (select_major_match(fdtypes[t].select_major, filp)) {
|
||||
type = t;
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ PUBLIC int do_select(void)
|
|||
* If all types are implemented, then this is another
|
||||
* type of file and we get to do whatever we want.
|
||||
*/
|
||||
if(type == -1)
|
||||
if (type == -1)
|
||||
{
|
||||
#if DEBUG_SELECT
|
||||
printf("do_select: bad type\n");
|
||||
|
@ -301,7 +301,7 @@ PUBLIC int do_select(void)
|
|||
|
||||
selecttab[s].type[fd] = type;
|
||||
|
||||
if((selecttab[s].filps[fd]->filp_select_ops & ops) != ops) {
|
||||
if ((selecttab[s].filps[fd]->filp_select_ops & ops) != ops) {
|
||||
int wantops;
|
||||
/* Request the select on this fd. */
|
||||
#if DEBUG_SELECT
|
||||
|
@ -313,15 +313,15 @@ PUBLIC int do_select(void)
|
|||
#if DEBUG_SELECT
|
||||
printf("%d\n", selecttab[s].filps[fd]->filp_select_ops);
|
||||
#endif
|
||||
if((r = fdtypes[type].select_request(filp,
|
||||
if ((r = fdtypes[type].select_request(filp,
|
||||
&wantops, block)) != SEL_OK) {
|
||||
/* error or bogus return code.. backpaddle */
|
||||
select_cancel_all(&selecttab[s]);
|
||||
printf("select: select_request returned error\n");
|
||||
return EINVAL;
|
||||
}
|
||||
if(wantops) {
|
||||
if(wantops & ops) {
|
||||
if (wantops) {
|
||||
if (wantops & ops) {
|
||||
/* operations that were just requested
|
||||
* are ready to go right away
|
||||
*/
|
||||
|
@ -350,7 +350,7 @@ PUBLIC int do_select(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
if(selecttab[s].nreadyfds > 0 || !block) {
|
||||
if (selecttab[s].nreadyfds > 0 || !block) {
|
||||
/* fd's were found that were ready to go right away, and/or
|
||||
* we were instructed not to block at all. Must return
|
||||
* immediately.
|
||||
|
@ -377,7 +377,7 @@ PUBLIC int do_select(void)
|
|||
/* Convert timeval to ticks and set the timer. If it fails, undo
|
||||
* all, return error.
|
||||
*/
|
||||
if(is_timeout) {
|
||||
if (is_timeout) {
|
||||
int ticks;
|
||||
/* Open Group:
|
||||
* "If the requested timeout interval requires a finer
|
||||
|
@ -415,13 +415,13 @@ PRIVATE void select_cancel_all(struct selectentry *e)
|
|||
for(fd = 0; fd < e->nfds; fd++) {
|
||||
struct filp *fp;
|
||||
fp = e->filps[fd];
|
||||
if(!fp) {
|
||||
if (!fp) {
|
||||
#if DEBUG_SELECT
|
||||
printf("[ fd %d/%d NULL ] ", fd, e->nfds);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if(fp->filp_selectors < 1) {
|
||||
if (fp->filp_selectors < 1) {
|
||||
#if DEBUG_SELECT
|
||||
printf("select: %d selectors?!\n", fp->filp_selectors);
|
||||
#endif
|
||||
|
@ -432,7 +432,7 @@ PRIVATE void select_cancel_all(struct selectentry *e)
|
|||
select_reevaluate(fp);
|
||||
}
|
||||
|
||||
if(e->expiry > 0) {
|
||||
if (e->expiry > 0) {
|
||||
#if DEBUG_SELECT
|
||||
printf("cancelling timer %d\n", e - selecttab);
|
||||
#endif
|
||||
|
@ -457,16 +457,16 @@ PRIVATE int select_reevaluate(struct filp *fp)
|
|||
{
|
||||
int s, remain_ops = 0, fd, type = -1;
|
||||
|
||||
if(!fp) {
|
||||
if (!fp) {
|
||||
printf("fs: select: reevalute NULL fp\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(s = 0; s < MAXSELECTS; s++) {
|
||||
if(!selecttab[s].requestor)
|
||||
if (!selecttab[s].requestor)
|
||||
continue;
|
||||
for(fd = 0; fd < selecttab[s].nfds; fd++)
|
||||
if(fp == selecttab[s].filps[fd]) {
|
||||
if (fp == selecttab[s].filps[fd]) {
|
||||
remain_ops |= tab2ops(fd, &selecttab[s]);
|
||||
type = selecttab[s].type[fd];
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ PRIVATE int select_reevaluate(struct filp *fp)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* int select_callback *
|
||||
* select_callback *
|
||||
*===========================================================================*/
|
||||
PUBLIC int select_callback(struct filp *fp, int ops)
|
||||
{
|
||||
|
@ -500,16 +500,16 @@ PUBLIC int select_callback(struct filp *fp, int ops)
|
|||
type = -1;
|
||||
for(s = 0; s < MAXSELECTS; s++) {
|
||||
int wakehim = 0;
|
||||
if(!selecttab[s].requestor)
|
||||
if (!selecttab[s].requestor)
|
||||
continue;
|
||||
for(fd = 0; fd < selecttab[s].nfds; fd++) {
|
||||
if(!selecttab[s].filps[fd])
|
||||
if (!selecttab[s].filps[fd])
|
||||
continue;
|
||||
if(selecttab[s].filps[fd] == fp) {
|
||||
if (selecttab[s].filps[fd] == fp) {
|
||||
int this_want_ops;
|
||||
this_want_ops = tab2ops(fd, &selecttab[s]);
|
||||
want_ops |= this_want_ops;
|
||||
if(this_want_ops & ops) {
|
||||
if (this_want_ops & ops) {
|
||||
/* this select() has been satisfied. */
|
||||
ops2tab(ops, fd, &selecttab[s]);
|
||||
wakehim = 1;
|
||||
|
@ -517,7 +517,7 @@ PUBLIC int select_callback(struct filp *fp, int ops)
|
|||
type = selecttab[s].type[fd];
|
||||
}
|
||||
}
|
||||
if(wakehim) {
|
||||
if (wakehim) {
|
||||
select_cancel_all(&selecttab[s]);
|
||||
copy_fdsets(&selecttab[s]);
|
||||
selecttab[s].requestor = NULL;
|
||||
|
@ -529,7 +529,7 @@ PUBLIC int select_callback(struct filp *fp, int ops)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* int select_notified *
|
||||
* select_notified *
|
||||
*===========================================================================*/
|
||||
PUBLIC int select_notified(int major, int minor, int selected_ops)
|
||||
{
|
||||
|
@ -540,10 +540,10 @@ PUBLIC int select_notified(int major, int minor, int selected_ops)
|
|||
#endif
|
||||
|
||||
for(t = 0; t < SEL_FDS; t++)
|
||||
if(!fdtypes[t].select_match && fdtypes[t].select_major == major)
|
||||
if (!fdtypes[t].select_match && fdtypes[t].select_major == major)
|
||||
break;
|
||||
|
||||
if(t >= SEL_FDS) {
|
||||
if (t >= SEL_FDS) {
|
||||
#if DEBUG_SELECT
|
||||
printf("select callback: no fdtype found for device %d\n", major);
|
||||
#endif
|
||||
|
@ -556,15 +556,15 @@ PUBLIC int select_notified(int major, int minor, int selected_ops)
|
|||
|
||||
for(s = 0; s < MAXSELECTS; s++) {
|
||||
int s_minor, ops;
|
||||
if(!selecttab[s].requestor)
|
||||
if (!selecttab[s].requestor)
|
||||
continue;
|
||||
for(f = 0; f < selecttab[s].nfds; f++) {
|
||||
if(!selecttab[s].filps[f] ||
|
||||
if (!selecttab[s].filps[f] ||
|
||||
!select_major_match(major, selecttab[s].filps[f]))
|
||||
continue;
|
||||
ops = tab2ops(f, &selecttab[s]);
|
||||
s_minor = selecttab[s].filps[f]->filp_ino->i_zone[0] & BYTE;
|
||||
if((s_minor == minor) &&
|
||||
if ((s_minor == minor) &&
|
||||
(selected_ops & ops)) {
|
||||
select_callback(selecttab[s].filps[f], (selected_ops & ops));
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ PUBLIC void init_select(void)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* int select_forget *
|
||||
* select_forget *
|
||||
*===========================================================================*/
|
||||
PUBLIC void select_forget(int proc)
|
||||
{
|
||||
|
@ -596,14 +596,14 @@ PUBLIC void select_forget(int proc)
|
|||
int s;
|
||||
|
||||
for(s = 0; s < MAXSELECTS; s++) {
|
||||
if(selecttab[s].requestor &&
|
||||
if (selecttab[s].requestor &&
|
||||
selecttab[s].req_procnr == proc) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(s >= MAXSELECTS) {
|
||||
if (s >= MAXSELECTS) {
|
||||
#if DEBUG_SELECT
|
||||
printf("select: cancelled select() not found");
|
||||
#endif
|
||||
|
@ -617,7 +617,7 @@ PUBLIC void select_forget(int proc)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* int select_timeout_check *
|
||||
* select_timeout_check *
|
||||
*===========================================================================*/
|
||||
PUBLIC void select_timeout_check(timer_t *timer)
|
||||
{
|
||||
|
@ -625,21 +625,21 @@ PUBLIC void select_timeout_check(timer_t *timer)
|
|||
|
||||
s = tmr_arg(timer)->ta_int;
|
||||
|
||||
if(s < 0 || s >= MAXSELECTS) {
|
||||
if (s < 0 || s >= MAXSELECTS) {
|
||||
#if DEBUG_SELECT
|
||||
printf("select: bogus slot arg to watchdog %d\n", s);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if(!selecttab[s].requestor) {
|
||||
if (!selecttab[s].requestor) {
|
||||
#if DEBUG_SELECT
|
||||
printf("select: no requestor in watchdog\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if(selecttab[s].expiry <= 0) {
|
||||
if (selecttab[s].expiry <= 0) {
|
||||
#if DEBUG_SELECT
|
||||
printf("select: strange expiry value in watchdog\n", s);
|
||||
#endif
|
||||
|
|
|
@ -107,7 +107,7 @@ int len; /* length of the directory name string */
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* change_into *
|
||||
* change_into *
|
||||
*===========================================================================*/
|
||||
PRIVATE int change_into(iip, rip)
|
||||
struct inode **iip; /* pointer to the inode pointer for the dir */
|
||||
|
|
|
@ -150,7 +150,7 @@ dev_t dev; /* device number whose super_block is sought */
|
|||
|
||||
register struct super_block *sp;
|
||||
|
||||
if(dev == NO_DEV)
|
||||
if (dev == NO_DEV)
|
||||
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
||||
|
||||
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
|
||||
|
@ -171,7 +171,7 @@ PUBLIC int get_block_size(dev_t dev)
|
|||
|
||||
register struct super_block *sp;
|
||||
|
||||
if(dev == NO_DEV)
|
||||
if (dev == NO_DEV)
|
||||
panic(__FILE__,"request for block size of NO_DEV", NO_NUM);
|
||||
|
||||
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++) {
|
||||
|
@ -217,11 +217,11 @@ register struct super_block *sp; /* pointer to a superblock */
|
|||
static char sbbuf[MIN_BLOCK_SIZE];
|
||||
|
||||
dev = sp->s_dev; /* save device (will be overwritten by copy) */
|
||||
if(dev == NO_DEV)
|
||||
if (dev == NO_DEV)
|
||||
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
||||
r = dev_io(DEV_READ, dev, FS_PROC_NR,
|
||||
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0);
|
||||
if(r != MIN_BLOCK_SIZE) {
|
||||
if (r != MIN_BLOCK_SIZE) {
|
||||
return EINVAL;
|
||||
}
|
||||
memcpy(sp, sbbuf, sizeof(*sp));
|
||||
|
@ -271,31 +271,31 @@ register struct super_block *sp; /* pointer to a superblock */
|
|||
sp->s_ndzones = V1_NR_DZONES;
|
||||
sp->s_nindirs = V1_INDIRECTS;
|
||||
} else {
|
||||
if(version == V2)
|
||||
if (version == V2)
|
||||
sp->s_block_size = STATIC_BLOCK_SIZE;
|
||||
if(sp->s_block_size < MIN_BLOCK_SIZE)
|
||||
if (sp->s_block_size < MIN_BLOCK_SIZE)
|
||||
return EINVAL;
|
||||
sp->s_inodes_per_block = V2_INODES_PER_BLOCK(sp->s_block_size);
|
||||
sp->s_ndzones = V2_NR_DZONES;
|
||||
sp->s_nindirs = V2_INDIRECTS(sp->s_block_size);
|
||||
}
|
||||
|
||||
if(sp->s_block_size < MIN_BLOCK_SIZE) {
|
||||
if (sp->s_block_size < MIN_BLOCK_SIZE) {
|
||||
return EINVAL;
|
||||
}
|
||||
if(sp->s_block_size > MAX_BLOCK_SIZE) {
|
||||
if (sp->s_block_size > MAX_BLOCK_SIZE) {
|
||||
printf("Filesystem block size is %d kB; maximum filesystem\n"
|
||||
"block size is %d kB. This limit can be increased by recompiling.\n",
|
||||
sp->s_block_size/1024, MAX_BLOCK_SIZE/1024);
|
||||
return EINVAL;
|
||||
}
|
||||
if((sp->s_block_size % 512) != 0) {
|
||||
if ((sp->s_block_size % 512) != 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
if(SUPER_SIZE > sp->s_block_size) {
|
||||
if (SUPER_SIZE > sp->s_block_size) {
|
||||
return EINVAL;
|
||||
}
|
||||
if((sp->s_block_size % V2_INODE_SIZE) != 0 ||
|
||||
if ((sp->s_block_size % V2_INODE_SIZE) != 0 ||
|
||||
(sp->s_block_size % V1_INODE_SIZE) != 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|||
int r;
|
||||
clock_t now, old_head = 0, new_head;
|
||||
|
||||
if((r = getuptime(&now)) != OK)
|
||||
if ((r = getuptime(&now)) != OK)
|
||||
panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM);
|
||||
|
||||
tmr_arg(tp)->ta_int = arg;
|
||||
|
@ -22,8 +22,8 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|||
old_head = tmrs_settimer(&fs_timers, tp, now+ticks, watchdog, &new_head);
|
||||
|
||||
/* reschedule our synchronous alarm if necessary */
|
||||
if(!old_head || old_head > new_head) {
|
||||
if(sys_setalarm(new_head, 1) != OK)
|
||||
if (!old_head || old_head > new_head) {
|
||||
if (sys_setalarm(new_head, 1) != OK)
|
||||
panic(__FILE__, "FS set timer "
|
||||
"couldn't set synchronous alarm.", NO_NUM);
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ PUBLIC void fs_expire_timers(clock_t now)
|
|||
{
|
||||
clock_t new_head;
|
||||
tmrs_exptimers(&fs_timers, now, &new_head);
|
||||
if(new_head > 0) {
|
||||
if(sys_setalarm(new_head, 1) != OK)
|
||||
if (new_head > 0) {
|
||||
if (sys_setalarm(new_head, 1) != OK)
|
||||
panic(__FILE__, "FS expire timer couldn't set "
|
||||
"synchronous alarm.", NO_NUM);
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ PUBLIC void fs_cancel_timer(timer_t *tp)
|
|||
* altogether if th last time has been cancelled (new_head
|
||||
* will be 0 then).
|
||||
*/
|
||||
if(old_head < new_head || !new_head) {
|
||||
if(sys_setalarm(new_head, 1) != OK)
|
||||
if (old_head < new_head || !new_head) {
|
||||
if (sys_setalarm(new_head, 1) != OK)
|
||||
panic(__FILE__,
|
||||
"FS expire timer couldn't set synchronous alarm.",
|
||||
NO_NUM);
|
||||
|
|
|
@ -46,7 +46,7 @@ PUBLIC void timing_dmp()
|
|||
|
||||
for(c = 0; c < TIMING_CATEGORIES; c++) {
|
||||
int b;
|
||||
if(!timingdata[c].lock_timings_range[0] || !timingdata[c].binsize)
|
||||
if (!timingdata[c].lock_timings_range[0] || !timingdata[c].binsize)
|
||||
continue;
|
||||
x = printf("%-*s: misses %lu, resets %lu, measurements %lu: ",
|
||||
TIMING_NAME, timingdata[c].names,
|
||||
|
@ -55,14 +55,14 @@ PUBLIC void timing_dmp()
|
|||
timingdata[c].measurements);
|
||||
for(b = 0; b < TIMING_POINTS; b++) {
|
||||
int w;
|
||||
if(!timingdata[c].lock_timings[b])
|
||||
if (!timingdata[c].lock_timings[b])
|
||||
continue;
|
||||
x += (w = printf(" %5d: %5d", timingdata[c].lock_timings_range[0] +
|
||||
b*timingdata[c].binsize,
|
||||
timingdata[c].lock_timings[b]));
|
||||
if(x + w >= 80) { printf("\n"); x = 0; }
|
||||
if (x + w >= 80) { printf("\n"); x = 0; }
|
||||
}
|
||||
if(x > 0) printf("\n");
|
||||
if (x > 0) printf("\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ PUBLIC void sched_dmp()
|
|||
|
||||
for (r=0;r<NR_SCHED_QUEUES; r++) {
|
||||
rp = rdy_head[r];
|
||||
if(!rp) continue;
|
||||
if (!rp) continue;
|
||||
printf("%2d: ", r);
|
||||
while (rp != NIL_PROC) {
|
||||
printf("%3d ", rp->p_nr);
|
||||
|
|
|
@ -28,7 +28,7 @@ FORWARD _PROTOTYPE(void get_work, (void) );
|
|||
FORWARD _PROTOTYPE(void reply, (int whom, int result) );
|
||||
|
||||
/*===========================================================================*
|
||||
* main *
|
||||
* main *
|
||||
*===========================================================================*/
|
||||
PUBLIC int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ PRIVATE void init_server(int argc, char **argv)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* exit_server *
|
||||
* exit_server *
|
||||
*===========================================================================*/
|
||||
PRIVATE void exit_server()
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ PRIVATE void exit_server()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* get_work *
|
||||
* get_work *
|
||||
*===========================================================================*/
|
||||
PRIVATE void get_work()
|
||||
{
|
||||
|
|
|
@ -389,7 +389,7 @@ phys_bytes tot_bytes; /* total memory to allocate, including gap */
|
|||
* patch_ptr *
|
||||
*===========================================================================*/
|
||||
PRIVATE void patch_ptr(stack, base)
|
||||
char stack[ARG_MAX]; /* pointer to stack image within PM */
|
||||
char stack[ARG_MAX]; /* pointer to stack image within PM */
|
||||
vir_bytes base; /* virtual address of stack base inside user */
|
||||
{
|
||||
/* When doing an exec(name, argv, envp) call, the user builds up a stack
|
||||
|
@ -441,7 +441,7 @@ int replace;
|
|||
a0 = (int) ((char **) stack)[1]; /* argv[0] */
|
||||
if (a0 < 4 * PTRSIZE || a0 >= old_bytes) return(FALSE);
|
||||
|
||||
a1 = a0; /* a1 will point to the strings to be moved */
|
||||
a1 = a0; /* a1 will point to the strings to be moved */
|
||||
if (replace) {
|
||||
/* Move a1 to the end of argv[0][] (argv[1] if nargs > 1). */
|
||||
do {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
FORWARD _PROTOTYPE( void get_work, (void) );
|
||||
FORWARD _PROTOTYPE( void pm_init, (void) );
|
||||
FORWARD _PROTOTYPE( int get_nice_value, (int queue) );
|
||||
FORWARD _PROTOTYPE( int get_nice_value, (int queue) );
|
||||
FORWARD _PROTOTYPE( void get_mem_chunks, (struct memory *mem_chunks) );
|
||||
FORWARD _PROTOTYPE( void patch_mem_chunks, (struct memory *mem_chunks,
|
||||
struct mem_map *map_ptr) );
|
||||
|
@ -268,9 +268,9 @@ PRIVATE void pm_init()
|
|||
printf(" free %u KB.\n", click_to_round_k(free_clicks));
|
||||
}
|
||||
|
||||
/*=========================================================================*
|
||||
* get_nice_value *
|
||||
*=========================================================================*/
|
||||
/*===========================================================================*
|
||||
* get_nice_value *
|
||||
*===========================================================================*/
|
||||
PRIVATE int get_nice_value(queue)
|
||||
int queue; /* store mem chunks here */
|
||||
{
|
||||
|
@ -295,9 +295,9 @@ int queue; /* store mem chunks here */
|
|||
#define MAX_16BIT (0xFFF0L << CLICK_SHIFT)
|
||||
#endif
|
||||
|
||||
/*=========================================================================*
|
||||
* get_mem_chunks *
|
||||
*=========================================================================*/
|
||||
/*===========================================================================*
|
||||
* get_mem_chunks *
|
||||
*===========================================================================*/
|
||||
PRIVATE void get_mem_chunks(mem_chunks)
|
||||
struct memory *mem_chunks; /* store mem chunks here */
|
||||
{
|
||||
|
@ -358,9 +358,9 @@ struct memory *mem_chunks; /* store mem chunks here */
|
|||
}
|
||||
}
|
||||
|
||||
/*=========================================================================*
|
||||
* patch_mem_chunks *
|
||||
*=========================================================================*/
|
||||
/*===========================================================================*
|
||||
* patch_mem_chunks *
|
||||
*===========================================================================*/
|
||||
PRIVATE void patch_mem_chunks(mem_chunks, map_ptr)
|
||||
struct memory *mem_chunks; /* store mem chunks here */
|
||||
struct mem_map *map_ptr; /* memory to remove */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "param.h"
|
||||
|
||||
/*===========================================================================*
|
||||
* do_allocmem *
|
||||
* do_allocmem *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_allocmem()
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ PUBLIC int do_allocmem()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_freemem *
|
||||
* do_freemem *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_freemem()
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ PUBLIC int do_freemem()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_getsysinfo *
|
||||
* do_getsysinfo *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_getsysinfo()
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ PUBLIC int do_getsysinfo()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_getprocnr *
|
||||
* do_getprocnr *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_getprocnr()
|
||||
{
|
||||
|
@ -123,9 +123,9 @@ PUBLIC int do_getprocnr()
|
|||
return(OK);
|
||||
}
|
||||
|
||||
/*=====================================================================*
|
||||
* do_reboot *
|
||||
*=====================================================================*/
|
||||
/*===========================================================================*
|
||||
* do_reboot *
|
||||
*===========================================================================*/
|
||||
#define REBOOT_CODE "delay; boot"
|
||||
PUBLIC int do_reboot()
|
||||
{
|
||||
|
@ -169,9 +169,9 @@ PUBLIC int do_reboot()
|
|||
return(SUSPEND); /* don't reply to killed process */
|
||||
}
|
||||
|
||||
/*=====================================================================*
|
||||
* do_getsetpriority *
|
||||
*=====================================================================*/
|
||||
/*===========================================================================*
|
||||
* do_getsetpriority *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_getsetpriority()
|
||||
{
|
||||
int arg_which, arg_who, arg_pri;
|
||||
|
@ -185,28 +185,28 @@ PUBLIC int do_getsetpriority()
|
|||
/* Code common to GETPRIORITY and SETPRIORITY. */
|
||||
|
||||
/* Only support PRIO_PROCESS for now. */
|
||||
if(arg_which != PRIO_PROCESS)
|
||||
if (arg_which != PRIO_PROCESS)
|
||||
return(EINVAL);
|
||||
|
||||
if(arg_who == 0)
|
||||
if (arg_who == 0)
|
||||
rmp_nr = who;
|
||||
else
|
||||
if((rmp_nr = proc_from_pid(arg_who)) < 0)
|
||||
if ((rmp_nr = proc_from_pid(arg_who)) < 0)
|
||||
return(ESRCH);
|
||||
|
||||
rmp = &mproc[rmp_nr];
|
||||
|
||||
if(mp->mp_effuid != SUPER_USER &&
|
||||
if (mp->mp_effuid != SUPER_USER &&
|
||||
mp->mp_effuid != rmp->mp_effuid && mp->mp_effuid != rmp->mp_realuid)
|
||||
return EPERM;
|
||||
|
||||
/* If GET, that's it. */
|
||||
if(call_nr == GETPRIORITY) {
|
||||
if (call_nr == GETPRIORITY) {
|
||||
return(rmp->mp_nice - PRIO_MIN);
|
||||
}
|
||||
|
||||
/* Only root is allowed to reduce the nice level. */
|
||||
if(rmp->mp_nice > arg_pri && mp->mp_effuid != SUPER_USER)
|
||||
if (rmp->mp_nice > arg_pri && mp->mp_effuid != SUPER_USER)
|
||||
return(EACCES);
|
||||
|
||||
/* We're SET, and it's allowed. Do it and tell kernel. */
|
||||
|
@ -214,9 +214,9 @@ PUBLIC int do_getsetpriority()
|
|||
return sys_nice(rmp_nr, arg_pri);
|
||||
}
|
||||
|
||||
/*=====================================================================*
|
||||
* do_svrctl *
|
||||
*=====================================================================*/
|
||||
/*===========================================================================*
|
||||
* do_svrctl *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_svrctl()
|
||||
{
|
||||
int s, req;
|
||||
|
@ -249,9 +249,9 @@ PUBLIC int do_svrctl()
|
|||
sizeof(sysgetenv)) != OK) return(EFAULT);
|
||||
|
||||
/* Set a param override? */
|
||||
if(req == MMSETPARAM) {
|
||||
if(local_params >= MAX_LOCAL_PARAMS) return ENOSPC;
|
||||
if(sysgetenv.keylen <= 0
|
||||
if (req == MMSETPARAM) {
|
||||
if (local_params >= MAX_LOCAL_PARAMS) return ENOSPC;
|
||||
if (sysgetenv.keylen <= 0
|
||||
|| sysgetenv.keylen >=
|
||||
sizeof(local_param_overrides[local_params].name)
|
||||
|| sysgetenv.vallen <= 0
|
||||
|
@ -292,12 +292,12 @@ PUBLIC int do_svrctl()
|
|||
*/
|
||||
search_key[sysgetenv.keylen-1]= '\0';
|
||||
for(p = 0; p < local_params; p++) {
|
||||
if(!strcmp(search_key, local_param_overrides[p].name)) {
|
||||
if (!strcmp(search_key, local_param_overrides[p].name)) {
|
||||
val_start = local_param_overrides[p].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(p >= local_params && (val_start = find_param(search_key)) == NULL)
|
||||
if (p >= local_params && (val_start = find_param(search_key)) == NULL)
|
||||
return(ESRCH);
|
||||
val_len = strlen(val_start) + 1;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ FORWARD _PROTOTYPE( void handle_sig, (int proc_nr, sigset_t sig_map) );
|
|||
FORWARD _PROTOTYPE( void cause_sigalrm, (struct timer *tp) );
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigaction *
|
||||
* do_sigaction *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigaction()
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ PUBLIC int do_sigaction()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigpending *
|
||||
* do_sigpending *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigpending()
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ PUBLIC int do_sigpending()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigprocmask *
|
||||
* do_sigprocmask *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigprocmask()
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ PUBLIC int do_sigprocmask()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigsuspend *
|
||||
* do_sigsuspend *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigsuspend()
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ PUBLIC int do_sigsuspend()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigreturn *
|
||||
* do_sigreturn *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigreturn()
|
||||
{
|
||||
|
@ -554,7 +554,7 @@ int signo; /* signal to send to process (0 to _NSIG) */
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* check_pending *
|
||||
* check_pending *
|
||||
*===========================================================================*/
|
||||
PUBLIC void check_pending(rmp)
|
||||
register struct mproc *rmp;
|
||||
|
|
|
@ -62,7 +62,7 @@ PUBLIC int do_stime()
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_times *
|
||||
* do_times *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_times()
|
||||
{
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
PRIVATE timer_t *pm_timers = NULL;
|
||||
|
||||
/*===========================================================================*
|
||||
* pm_set_timer *
|
||||
* pm_set_timer *
|
||||
*===========================================================================*/
|
||||
PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
||||
{
|
||||
int r;
|
||||
clock_t now, prev_time = 0, next_time;
|
||||
|
||||
if((r = getuptime(&now)) != OK)
|
||||
if ((r = getuptime(&now)) != OK)
|
||||
panic(__FILE__, "PM couldn't get uptime", NO_NUM);
|
||||
|
||||
/* Set timer argument and add timer to the list. */
|
||||
|
@ -37,8 +37,8 @@ PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|||
prev_time = tmrs_settimer(&pm_timers,tp,now+ticks,watchdog,&next_time);
|
||||
|
||||
/* Reschedule our synchronous alarm if necessary. */
|
||||
if(! prev_time || prev_time > next_time) {
|
||||
if(sys_setalarm(next_time, 1) != OK)
|
||||
if (! prev_time || prev_time > next_time) {
|
||||
if (sys_setalarm(next_time, 1) != OK)
|
||||
panic(__FILE__, "PM set timer couldn't set alarm.", NO_NUM);
|
||||
}
|
||||
|
||||
|
@ -54,14 +54,14 @@ PUBLIC void pm_expire_timers(clock_t now)
|
|||
|
||||
/* Check for expired timers and possibly reschedule an alarm. */
|
||||
tmrs_exptimers(&pm_timers, now, &next_time);
|
||||
if(next_time > 0) {
|
||||
if(sys_setalarm(next_time, 1) != OK)
|
||||
if (next_time > 0) {
|
||||
if (sys_setalarm(next_time, 1) != OK)
|
||||
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* pm_cancel_timer *
|
||||
* pm_cancel_timer *
|
||||
*===========================================================================*/
|
||||
PUBLIC void pm_cancel_timer(timer_t *tp)
|
||||
{
|
||||
|
@ -72,8 +72,8 @@ PUBLIC void pm_cancel_timer(timer_t *tp)
|
|||
* the next timer, or cancel the alarm altogether if the last timer has
|
||||
* been cancelled (next_time will be 0 then).
|
||||
*/
|
||||
if(prev_time < next_time || ! next_time) {
|
||||
if(sys_setalarm(next_time, 1) != OK)
|
||||
if (prev_time < next_time || ! next_time) {
|
||||
if (sys_setalarm(next_time, 1) != OK)
|
||||
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,9 +144,9 @@ int what, p1, p2, p3;
|
|||
_taskcall(FS_PROC_NR, what, &m);
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* find_param *
|
||||
*==========================================================================*/
|
||||
/*===========================================================================*
|
||||
* find_param *
|
||||
*===========================================================================*/
|
||||
PUBLIC char *find_param(name)
|
||||
const char *name;
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ const char *name;
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* get_mem_map *
|
||||
* get_mem_map *
|
||||
*===========================================================================*/
|
||||
PUBLIC int get_mem_map(proc_nr, mem_map)
|
||||
int proc_nr; /* process to get map of */
|
||||
|
@ -181,7 +181,7 @@ struct mem_map *mem_map; /* put memory map here */
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* get_stack_ptr *
|
||||
* get_stack_ptr *
|
||||
*===========================================================================*/
|
||||
PUBLIC int get_stack_ptr(proc_nr, sp)
|
||||
int proc_nr; /* process to get sp of */
|
||||
|
|
|
@ -26,7 +26,7 @@ PRIVATE char command[MAX_PATH_LEN+1];
|
|||
PRIVATE char arg_buf[MAX_ARGS_LEN+1];
|
||||
|
||||
/*===========================================================================*
|
||||
* do_start *
|
||||
* do_start *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_start(message *m_ptr)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ PUBLIC int do_start(message *m_ptr)
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* do_stop *
|
||||
* do_stop *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_stop(message *m_ptr)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ PUBLIC int do_stop(message *m_ptr)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_exit *
|
||||
* do_exit *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_exit(message *m_ptr)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ FORWARD _PROTOTYPE(void get_work, (void) );
|
|||
FORWARD _PROTOTYPE(void reply, (int whom, int result) );
|
||||
|
||||
/*===========================================================================*
|
||||
* main *
|
||||
* main *
|
||||
*===========================================================================*/
|
||||
PUBLIC int main(void)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ PUBLIC int main(void)
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* init_server *
|
||||
* init_server *
|
||||
*===========================================================================*/
|
||||
PRIVATE void init_server(void)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ PRIVATE void init_server(void)
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* get_work *
|
||||
* get_work *
|
||||
*===========================================================================*/
|
||||
PRIVATE void get_work()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue