Remove useless variables and the computations on them.

This commit is contained in:
Kees van Reeuwijk 2010-02-19 10:00:32 +00:00
parent cf4f92dc21
commit 1597e701a0
29 changed files with 82 additions and 182 deletions

View file

@ -1733,9 +1733,8 @@ PRIVATE void w_need_reset()
{
/* The controller needs to be reset. */
struct wini *wn;
int dr = 0;
for (wn = wini; wn < &wini[MAX_DRIVES]; wn++, dr++) {
for (wn = wini; wn < &wini[MAX_DRIVES]; wn++) {
if (wn->base_cmd == w_wn->base_cmd) {
wn->state |= DEAF;
wn->state &= ~INITIALIZED;

View file

@ -73,7 +73,7 @@ FORWARD _PROTOTYPE( void tell_dev, (vir_bytes buf, size_t size, int pci_bus,
PRIVATE char io_ctl_buf[_IOCPARM_MASK];
PRIVATE int irq_hook_id = 0; /* id of irq hook at the kernel */
PRIVATE int irq_hook_set = FALSE;
PRIVATE device_available = 0;/*todo*/
PRIVATE int device_available = 0;/*todo*/
/* SEF functions and variables. */
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
@ -85,7 +85,7 @@ PUBLIC int is_status_msg_expected = FALSE;
PUBLIC void main(void)
{
int r, caller, proc_nr;
int r, caller;
message mess, repl_mess;
/* SEF local startup. */
@ -97,7 +97,6 @@ PUBLIC void main(void)
while(1) {
sef_receive(ANY, &mess);
caller = mess.m_source;
proc_nr = mess.IO_ENDPT;
/* Now carry out the work. First check for notifications. */
if (is_notify(mess.m_type)) {
@ -772,7 +771,7 @@ PRIVATE int get_started(sub_dev_t *sub_dev_ptr) {
/* enable interrupt messages from MINIX */
if ((i=sys_irqenable(&irq_hook_id)) != OK) {
error("%s: Couldn't enable IRQs",drv.DriverName);
error("%s: Couldn't enable IRQs: error code %u",drv.DriverName, (unsigned int) i);
return EIO;
}
/* let the lower part of the driver start the device */

View file

@ -192,7 +192,6 @@ unsigned nr_req; /* length of request vector */
unsigned nbytes, count, chunk;
unsigned long block;
vir_bytes i13e_rw_off, rem_buf_size;
size_t vir_offset = 0;
unsigned secspcyl = wn->heads * wn->sectors;
struct int13ext_rw {
u8_t len;
@ -336,12 +335,10 @@ unsigned nr_req; /* length of request vector */
for (;;) {
if (nbytes < iov->iov_size) {
/* Not done with this one yet. */
vir_offset += nbytes;
iov->iov_size -= nbytes;
break;
}
nbytes -= iov->iov_size;
vir_offset = 0;
iov->iov_size = 0;
if (nbytes == 0) {
/* The rest is optional, so we return to give FS a

View file

@ -18,7 +18,6 @@
#include <minix/com.h>
#include <minix/sef.h>
#include <minix/ds.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>
#include <stdlib.h>

View file

@ -7,7 +7,6 @@
#include "../drivers.h"
#include <stdlib.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>
#include <ibm/pci.h>

View file

@ -314,7 +314,7 @@ PUBLIC int main(void)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
PRIVATE void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
@ -432,8 +432,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
/*===========================================================================*
* f_prepare *
*===========================================================================*/
PRIVATE struct device *f_prepare(device)
int device;
PRIVATE struct device *f_prepare(int device)
{
/* Prepare for I/O on a device. */
@ -460,7 +459,7 @@ int device;
/*===========================================================================*
* f_name *
*===========================================================================*/
PRIVATE char *f_name()
PRIVATE char *f_name(void)
{
/* Return a name for the current device. */
static char name[] = "fd0";
@ -472,7 +471,7 @@ PRIVATE char *f_name()
/*===========================================================================*
* f_cleanup *
*===========================================================================*/
PRIVATE void f_cleanup()
PRIVATE void f_cleanup(void)
{
/* Start a timer to turn the motor off in a few seconds. */
tmr_arg(&f_fp->fl_tmr_stop)->ta_int = f_drive;
@ -725,8 +724,9 @@ unsigned nr_req; /* length of request vector */
/*===========================================================================*
* dma_setup *
*===========================================================================*/
PRIVATE int dma_setup(opcode)
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
PRIVATE int dma_setup(
int opcode /* DEV_GATHER_S or DEV_SCATTER_S */
)
{
/* The IBM PC can perform DMA operations by using the DMA chip. To use it,
* the DMA (Direct Memory Access) chip is loaded with the 20-bit memory address
@ -770,7 +770,7 @@ int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
/*===========================================================================*
* start_motor *
*===========================================================================*/
PRIVATE void start_motor()
PRIVATE void start_motor(void)
{
/* Control of the floppy disk motors is a big pain. If a motor is off, you
* have to turn it on first, which takes 1/2 second. You can't leave it on
@ -823,8 +823,7 @@ PRIVATE void start_motor()
/*===========================================================================*
* stop_motor *
*===========================================================================*/
PRIVATE void stop_motor(tp)
timer_t *tp;
PRIVATE void stop_motor(timer_t *tp)
{
/* This routine is called from an alarm timer after several seconds have
* elapsed with no floppy disk activity. It turns the drive motor off.
@ -852,7 +851,7 @@ PRIVATE void floppy_stop(struct driver *dp, sigset_t *set)
/*===========================================================================*
* seek *
*===========================================================================*/
PRIVATE int seek()
PRIVATE int seek(void)
{
/* Issue a SEEK command on the indicated drive unless the arm is already
* positioned on the correct cylinder.
@ -915,8 +914,9 @@ PRIVATE int seek()
/*===========================================================================*
* fdc_transfer *
*===========================================================================*/
PRIVATE int fdc_transfer(opcode)
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
PRIVATE int fdc_transfer(
int opcode /* DEV_GATHER_S or DEV_SCATTER_S */
)
{
/* The drive is now on the proper cylinder. Read, write or format 1 block. */
@ -988,7 +988,7 @@ int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
/*===========================================================================*
* fdc_results *
*===========================================================================*/
PRIVATE int fdc_results()
PRIVATE int fdc_results(void)
{
/* Extract results from the controller after an operation, then allow floppy
* interrupts again.
@ -1039,9 +1039,10 @@ PRIVATE int fdc_results()
/*===========================================================================*
* fdc_command *
*===========================================================================*/
PRIVATE int fdc_command(cmd, len)
u8_t *cmd; /* command bytes */
int len; /* command length */
PRIVATE int fdc_command(
u8_t *cmd, /* command bytes */
int len /* command length */
)
{
/* Output a command to the controller. */
@ -1063,8 +1064,9 @@ int len; /* command length */
/*===========================================================================*
* fdc_out *
*===========================================================================*/
PRIVATE void fdc_out(val)
int val; /* write this byte to floppy disk controller */
PRIVATE void fdc_out(
int val /* write this byte to floppy disk controller */
)
{
/* Output a byte to the controller. This is not entirely trivial, since you
* can only write to it when it is listening, and it decides when to listen.
@ -1096,7 +1098,7 @@ int val; /* write this byte to floppy disk controller */
/*===========================================================================*
* recalibrate *
*===========================================================================*/
PRIVATE int recalibrate()
PRIVATE int recalibrate(void)
{
/* The floppy disk controller has no way of determining its absolute arm
* position (cylinder). Instead, it steps the arm a cylinder at a time and
@ -1138,7 +1140,7 @@ PRIVATE int recalibrate()
/*===========================================================================*
* f_reset *
*===========================================================================*/
PRIVATE void f_reset()
PRIVATE void f_reset(void)
{
/* Issue a reset to the controller. This is done after any catastrophe,
* like the controller refusing to respond.
@ -1210,7 +1212,7 @@ PRIVATE void f_reset()
/*===========================================================================*
* f_intr_wait *
*===========================================================================*/
PRIVATE int f_intr_wait()
PRIVATE int f_intr_wait(void)
{
/* Wait for an interrupt, but not forever. The FDC may have all the time of
* the world, but we humans do not.
@ -1248,8 +1250,7 @@ PRIVATE int f_intr_wait()
/*===========================================================================*
* f_timeout *
*===========================================================================*/
PRIVATE void f_timeout(tp)
timer_t *tp;
PRIVATE void f_timeout(timer_t *tp)
{
/* This routine is called when a timer expires. Usually to tell that a
* motor has spun up, but also to forge an interrupt when it takes too long
@ -1264,7 +1265,7 @@ timer_t *tp;
/*===========================================================================*
* read_id *
*===========================================================================*/
PRIVATE int read_id()
PRIVATE int read_id(void)
{
/* Determine current cylinder and sector. */
@ -1358,8 +1359,7 @@ message *m_ptr; /* pointer to open message */
/*===========================================================================*
* test_read *
*===========================================================================*/
PRIVATE int test_read(density)
int density;
PRIVATE int test_read(int density)
{
/* Try to read the highest numbered sector on cylinder 2. Not all floppy
* types have as many sectors per track, and trying cylinder 2 finds the
@ -1388,8 +1388,7 @@ int density;
/*===========================================================================*
* f_geometry *
*===========================================================================*/
PRIVATE void f_geometry(entry)
struct partition *entry;
PRIVATE void f_geometry(struct partition *entry)
{
entry->cylinders = f_dp->cyls;
entry->heads = NR_HEADS;

View file

@ -556,8 +556,7 @@ static void fxp_pci_conf()
/*===========================================================================*
* fxp_probe *
*===========================================================================*/
static int fxp_probe(fp)
fxp_t *fp;
static int fxp_probe(fxp_t *fp)
{
int i, r, devind, just_one;
u16_t vid, did;
@ -1025,19 +1024,15 @@ fxp_t *fp;
/*===========================================================================*
* fxp_confaddr *
*===========================================================================*/
static void fxp_confaddr(fp)
fxp_t *fp;
static void fxp_confaddr(fxp_t *fp)
{
static char eakey[]= FXP_ENVVAR "#_EA";
static char eafmt[]= "x:x:x:x:x:x";
clock_t t0,t1;
int i, r;
port_t port;
u32_t bus_addr;
long v;
port= fp->fxp_base_port;
/* User defined ethernet address? */
eakey[sizeof(FXP_ENVVAR)-1]= '0' + (fp-fxp_table);
@ -1290,9 +1285,7 @@ suspend:
/*===========================================================================*
* fxp_writev_s *
*===========================================================================*/
static void fxp_writev_s(mp, from_int)
message *mp;
int from_int;
static void fxp_writev_s(message *mp, int from_int)
{
cp_grant_id_t iov_grant;
vir_bytes iov_offset;
@ -1942,7 +1935,6 @@ message *mp;
{
clock_t t0,t1;
int r, dl_port;
port_t port;
fxp_t *fp;
u32_t *p;
eth_stat_t stats;
@ -1956,8 +1948,6 @@ message *mp;
assert(fp->fxp_mode == FM_ENABLED);
assert(fp->fxp_flags & FF_ENABLED);
port= fp->fxp_base_port;
p= &fp->fxp_stat.sc_tx_fcp;
*p= 0;
@ -2021,12 +2011,10 @@ message *mp;
/*===========================================================================*
* fxp_getstat_s *
*===========================================================================*/
static void fxp_getstat_s(mp)
message *mp;
static void fxp_getstat_s(message *mp)
{
clock_t t0,t1;
int r, dl_port;
port_t port;
fxp_t *fp;
u32_t *p;
eth_stat_t stats;
@ -2040,8 +2028,6 @@ message *mp;
assert(fp->fxp_mode == FM_ENABLED);
assert(fp->fxp_flags & FF_ENABLED);
port= fp->fxp_base_port;
p= &fp->fxp_stat.sc_tx_fcp;
*p= 0;
@ -2398,10 +2384,8 @@ fxp_t *fp;
/*===========================================================================*
* fxp_report_link *
*===========================================================================*/
static void fxp_report_link(fp)
fxp_t *fp;
static void fxp_report_link(fxp_t *fp)
{
port_t port;
u16_t mii_ctrl, mii_status, mii_id1, mii_id2,
mii_ana, mii_anlpa, mii_ane, mii_extstat,
mii_ms_ctrl, mii_ms_status, scr;
@ -2415,7 +2399,6 @@ fxp_t *fp;
ms_regs= 0; /* No master/slave registers. */
fp->fxp_report_link= FALSE;
port= fp->fxp_base_port;
scr= mii_read(fp, MII_SCR);
scr &= ~(MII_SCR_RES|MII_SCR_RES_1);

View file

@ -272,7 +272,7 @@ EXTERN char **env_argv;
void main( int argc, char **argv )
{
message m;
int i,irq,r;
int i,r;
ether_card_t *ec;
/* SEF local startup. */
@ -310,7 +310,6 @@ void main( int argc, char **argv )
if (ec->mode != EC_ENABLED)
continue;
irq=ec->ec_irq;
{
ec->ec_int_pending = 0;
ec_check_ints(ec);
@ -1074,10 +1073,9 @@ ether_card_t *ec;
/*===========================================================================*
* do_vread_s *
*===========================================================================*/
static void do_vread_s(mp)
message *mp;
static void do_vread_s(message *mp)
{
int port, count, size, r;
int port, count, r;
ether_card_t *ec;
port = mp->DL_PORT;
@ -1098,7 +1096,6 @@ message *mp;
ec->read_iovec.iod_iovec_offset = 0;
ec->tmp_iovec = ec->read_iovec;
size= calc_iovec_size(&ec->tmp_iovec);
ec->flags |= ECF_READING;
@ -1338,8 +1335,7 @@ vir_bytes count;
/*===========================================================================*
* calc_iovec_size *
*===========================================================================*/
static int calc_iovec_size(iovp)
iovec_dat_t *iovp;
static int calc_iovec_size(iovec_dat_t *iovp)
{
int size,i;

View file

@ -287,7 +287,6 @@ unsigned nr_req; /* length of request vector */
unsigned count;
vir_bytes user_vir;
struct device *dv;
unsigned long dv_size;
int accumulated_read = 0;
struct logdevice *log;
size_t vir_offset = 0;
@ -297,7 +296,6 @@ unsigned nr_req; /* length of request vector */
/* Get minor device number and check for /dev/null. */
dv = &log_geom[log_device];
dv_size = cv64ul(dv->dv_size);
log = &logdevices[log_device];
while (nr_req > 0) {

View file

@ -154,7 +154,8 @@ PRIVATE int hermes_present (hermes_t * hw) {
* *
* Initialize the card *
*****************************************************************************/
int hermes_init (hermes_t * hw) {
int hermes_init (hermes_t * hw)
{
u32_t status, reg, resp0;
int err = 0;
int k;

View file

@ -504,12 +504,13 @@ static void or_reset() {
* Dump interesting information about the card on F-key pressed. *
* Not implemented yet *
*****************************************************************************/
static void or_dump (message *m) {
static void or_dump (message *m)
{
t_or *orp;
int i, err;
int err;
u16_t evstat =0, d;
for (i = 0, orp = or_table; orp < or_table + OR_PORT_NR; i++, orp++) {
for (orp = or_table; orp < or_table + OR_PORT_NR; orp++) {
if(orp->or_mode == OR_M_DISABLED) {
printf("%s is disabled\n", orp->or_name);
}
@ -538,7 +539,6 @@ static void or_init (message * mp) {
t_or *orp;
message reply;
static int first_time = 1;
hermes_t *hw;
clock_t t0,t1;
if (first_time) {
@ -562,7 +562,6 @@ static void or_init (message * mp) {
/* the port resolves to the main orinoco structure */
orp = &or_table[port];
/* resolving to the main hardware structure */
hw = &(orp->hw);
if (orp->or_mode == OR_M_DISABLED) {
/* Initialize the orp structure */
@ -1980,14 +1979,13 @@ static void or_readv (message * mp, int from_int, int vectored) {
unsigned amount, totlen, packlen;
struct hermes_rx_descriptor desc;
phys_bytes dst_phys;
u16_t d_start, d_end, rxfid, status;
u16_t d_start, d_end, status;
struct header_struct hdr;
int length, offset;
u32_t l, rxstat;
struct ethhdr *eh;
struct header_struct *h;
t_or *orp;
hermes_t *hw;
iovec_t *iovp;
u8_t *databuf;
@ -1999,7 +1997,6 @@ static void or_readv (message * mp, int from_int, int vectored) {
orp = &or_table[dl_port];
or_client = mp->DL_PROC;
orp->or_client = or_client;
hw = &(orp->hw);
assert (orp->or_mode == OR_M_ENABLED);
assert (orp->or_flags & OR_F_ENABLED);
@ -2008,7 +2005,6 @@ static void or_readv (message * mp, int from_int, int vectored) {
goto suspend_readv;
}
rxfid = orp->rxfid[orp->rx_first];
databuf = &(orp->rx_buf[orp->rx_first][0]);
length = orp->rx_length[orp->rx_first];
@ -2102,13 +2098,12 @@ static void or_readv_s (message * mp, int from_int) {
unsigned amount, totlen, packlen;
struct hermes_rx_descriptor desc;
phys_bytes dst_phys;
u16_t d_start, d_end, rxfid, status;
u16_t d_start, d_end, status;
struct header_struct hdr;
u32_t l, rxstat;
struct ethhdr *eh;
struct header_struct *h;
t_or *orp;
hermes_t *hw;
iovec_s_t *iovp;
phys_bytes databuf_phys;
@ -2123,7 +2118,6 @@ static void or_readv_s (message * mp, int from_int) {
orp = &or_table[dl_port];
or_client = mp->DL_PROC;
orp->or_client = or_client;
hw = &(orp->hw);
assert (orp->or_mode == OR_M_ENABLED);
assert (orp->or_flags & OR_F_ENABLED);
@ -2140,8 +2134,6 @@ static void or_readv_s (message * mp, int from_int) {
/* get the buffer which contains new data */
rxfid = orp->rxfid[orp->rx_first];
/* and store the pointer to this data in databuf */
databuf = &(orp->rx_buf[orp->rx_first][0]);
length = orp->rx_length[orp->rx_first];
@ -2236,7 +2228,6 @@ static int or_get_recvd_packet(t_or *orp, u16_t rxfid, u8_t *databuf) {
hermes_t *hw;
struct header_struct hdr;
int err, length, offset;
struct ethhdr *eh;
u16_t status;
memset(databuf, 0, IEEE802_11_FRAME_LEN);
@ -2316,7 +2307,6 @@ static int or_get_recvd_packet(t_or *orp, u16_t rxfid, u8_t *databuf) {
/* Some types of firmware give us the SNAP and OUI headers. Remove these.
*/
if (is_ethersnap(&hdr)) {
eh = (struct ethhdr *) databuf;
length -= 8;

View file

@ -1,6 +1,7 @@
#define USER_SPACE 1
/*
pci.c
#define USER_SPACE 1
Configure devices on the PCI bus
@ -126,7 +127,7 @@ FORWARD _PROTOTYPE( u8_t pci_attr_r8_u, (int devind, int port) );
FORWARD _PROTOTYPE( u32_t pci_attr_r32_u, (int devind, int port) );
FORWARD _PROTOTYPE( u16_t pci_attr_rsts, (int devind) );
FORWARD _PROTOTYPE( void pci_attr_wsts, (int devind, U16_t value) );
FORWARD _PROTOTYPE( void pci_attr_wsts, (int devind, u16_t value) );
FORWARD _PROTOTYPE( u16_t pcibr_std_rsts, (int busind) );
FORWARD _PROTOTYPE( void pcibr_std_wsts, (int busind, U16_t value) );
FORWARD _PROTOTYPE( u16_t pcibr_cb_rsts, (int busind) );
@ -752,8 +753,7 @@ PRIVATE void pci_intel_init()
/*===========================================================================*
* probe_bus *
*===========================================================================*/
PRIVATE void probe_bus(busind)
int busind;
PRIVATE void probe_bus(int busind)
{
u32_t dev, func, t3;
u16_t vid, did, sts;
@ -1919,17 +1919,14 @@ int busnr;
/*===========================================================================*
* do_piix *
*===========================================================================*/
PRIVATE int do_piix(devind)
int devind;
PRIVATE int do_piix(int devind)
{
int i, s, dev, func, irqrc, irq;
int i, s, irqrc, irq;
u32_t elcr1, elcr2, elcr;
#if DEBUG
printf("in piix\n");
#endif
dev= pcidev[devind].pd_dev;
func= pcidev[devind].pd_func;
#if USER_SPACE
if (OK != (s=sys_inb(PIIX_ELCR1, &elcr1)))
printf("Warning, sys_inb failed: %d\n", s);
@ -1971,8 +1968,7 @@ int devind;
/*===========================================================================*
* do_amd_isabr *
*===========================================================================*/
PRIVATE int do_amd_isabr(devind)
int devind;
PRIVATE int do_amd_isabr(int devind)
{
int i, busnr, dev, func, xdevind, irq, edge;
u8_t levmask;
@ -2024,13 +2020,10 @@ int devind;
/*===========================================================================*
* do_sis_isabr *
*===========================================================================*/
PRIVATE int do_sis_isabr(devind)
int devind;
PRIVATE int do_sis_isabr(int devind)
{
int i, dev, func, irq;
int i, irq;
dev= pcidev[devind].pd_dev;
func= pcidev[devind].pd_func;
irq= 0; /* lint */
for (i= 0; i<4; i++)
{
@ -2054,14 +2047,11 @@ int devind;
/*===========================================================================*
* do_via_isabr *
*===========================================================================*/
PRIVATE int do_via_isabr(devind)
int devind;
PRIVATE int do_via_isabr(int devind)
{
int i, dev, func, irq, edge;
int i, irq, edge;
u8_t levmask;
dev= pcidev[devind].pd_dev;
func= pcidev[devind].pd_func;
levmask= pci_attr_r8_u(devind, VIA_ISABR_EL);
irq= 0; /* lint */
edge= 0; /* lint */
@ -2347,9 +2337,7 @@ u16_t value;
/*===========================================================================*
* pci_attr_wsts *
*===========================================================================*/
PRIVATE void pci_attr_wsts(devind, value)
int devind;
u16_t value;
PRIVATE void pci_attr_wsts(int devind, u16_t value)
{
int busnr, busind;

View file

@ -160,13 +160,11 @@ unsigned nr_req; /* length of request vector */
unsigned count, left, chunk;
vir_bytes user_vir;
struct device *dv;
unsigned long dv_size;
int r;
size_t vir_offset = 0;
/* Get minor device number and check for /dev/null. */
dv = &m_geom[m_device];
dv_size = cv64ul(dv->dv_size);
while (nr_req > 0) {
@ -245,8 +243,7 @@ PRIVATE int r_ioctl(dp, m_ptr)
struct driver *dp; /* pointer to driver structure */
message *m_ptr; /* pointer to control message */
{
struct device *dv;
if ((dv = r_prepare(m_ptr->DEVICE)) == NIL_DEV) return(ENXIO);
if (r_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO);
switch (m_ptr->REQUEST) {
@ -257,7 +254,7 @@ message *m_ptr; /* pointer to control message */
}
#define UPDATE(binnumber, bp, startitem, elems) { \
rand_t *r, *r2; \
rand_t *r; \
int n = elems, item = startitem;\
int high; \
assert(binnumber >= 0 && binnumber < RANDOM_SOURCES); \
@ -267,7 +264,6 @@ message *m_ptr; /* pointer to control message */
assert(high >= item); \
assert(high >= 0 && high < RANDOM_ELEMENTS); \
r = &bp->r_buf[item]; \
r2 = &bp->r_buf[high]; \
random_update(binnumber, r, n); \
} \
}
@ -327,8 +323,7 @@ message *m_ptr; /* pointer to alarm message */
/*============================================================================*
* r_geometry *
*============================================================================*/
PRIVATE void r_geometry(entry)
struct partition *entry;
PRIVATE void r_geometry(struct partition *entry)
{
/* Memory devices don't have a geometry, but the outside world insists. */
entry->cylinders = div64u(m_geom[m_device].dv_size, SECTOR_SIZE) / (64 * 32);

View file

@ -985,7 +985,7 @@ static void rl_readv(message *mp, int from_int, int vectored)
int i, j, n, o, s, s1, dl_port, re_client, count, size;
port_t port;
unsigned amount, totlen, packlen;
phys_bytes src_phys, dst_phys;
phys_bytes dst_phys;
u16_t d_start, d_end;
u32_t l, rxstat = 0x12345678;
re_t *rep;
@ -1083,7 +1083,6 @@ static void rl_readv(message *mp, int from_int, int vectored)
size= 0;
o= d_start+4;
src_phys= rep->re_rx_buf;
for (i= 0; i<count; i += IOVEC_NR,
iov_offset += IOVEC_NR * sizeof(rep->re_iovec[0]))
{
@ -1233,7 +1232,7 @@ static void rl_readv_s(message *mp, int from_int)
int i, j, n, o, s, s1, dl_port, re_client, count, size;
port_t port;
unsigned amount, totlen, packlen;
phys_bytes src_phys, dst_phys;
phys_bytes dst_phys;
u16_t d_start, d_end;
u32_t l, rxstat = 0x12345678;
re_t *rep;
@ -1328,7 +1327,6 @@ static void rl_readv_s(message *mp, int from_int)
size= 0;
o= d_start+4;
src_phys= rep->re_rx_buf;
for (i= 0; i<count; i += IOVEC_NR,
iov_offset += IOVEC_NR * sizeof(rep->re_iovec_s[0]))
{

View file

@ -1271,11 +1271,8 @@ re_t *rep;
void transmittest(re_t *rep)
{
int tx_head;
re_desc *desc;
tx_head = rep->re_tx_head;
desc = rep->re_tx_desc;
desc += tx_head;
if(rep->re_tx[tx_head].ret_busy) {
do {
@ -1299,7 +1296,6 @@ static void rl_readv_s(message *mp, int from_int)
int i, j, n, s, dl_port, re_client, count, size, index;
port_t port;
unsigned totlen, packlen;
phys_bytes src_phys;
re_desc *desc;
u32_t rxstat = 0x12345678;
re_t *rep;
@ -1366,7 +1362,6 @@ readvs_loop:
packlen = totlen - ETH_CRC_SIZE;
size = 0;
src_phys = rep->re_rx[index].ret_buf;
for (i = 0; i < count; i += IOVEC_NR,
iov_offset += IOVEC_NR * sizeof(rep->re_iovec_s[0]))
{

View file

@ -283,9 +283,7 @@ struct port *pp;
#endif
}
PRIVATE void map_regs(pp, base)
struct port *pp;
u32_t base;
PRIVATE void map_regs(struct port *pp, u32_t base)
{
int r;
vir_bytes buf_base;

View file

@ -72,7 +72,7 @@ acc_t *pack;
ip_hdr_t *pack_hdr;
{
ip_ass_t *ass_ent;
size_t pack_hdr_len, pack_data_len, pack_offset, tmp_offset;
size_t pack_hdr_len, pack_offset, tmp_offset;
u16_t pack_flags_fragoff;
acc_t *prev_acc, *curr_acc, *next_acc, *head_acc, *tmp_acc;
ip_hdr_t *tmp_hdr;
@ -83,7 +83,6 @@ ip_hdr_t *pack_hdr;
pack_flags_fragoff= ntohs(pack_hdr->ih_flags_fragoff);
pack_hdr_len= (pack_hdr->ih_vers_ihl & IH_IHL_MASK) * 4;
pack_data_len= ntohs(pack_hdr->ih_length)-pack_hdr_len;
pack_offset= (pack_flags_fragoff & IH_FRAGOFF_MASK)*8;
pack->acc_ext_link= NULL;

View file

@ -1185,15 +1185,11 @@ int fd;
udp_fd->uf_rdbuf_head= NULL;
}
PUBLIC int udp_write(fd, count)
int fd;
size_t count;
PUBLIC int udp_write(int fd, size_t count)
{
udp_fd_t *udp_fd;
udp_port_t *udp_port;
udp_fd= &udp_fd_table[fd];
udp_port= udp_fd->uf_port;
if (!(udp_fd->uf_flags & UFF_OPTSET))
{

View file

@ -17,13 +17,12 @@ PUBLIC int fs_readsuper() {
int r = OK;
unsigned long tasknr;
endpoint_t driver_e;
int readonly, isroot;
int readonly;
fs_dev = fs_m_in.REQ_DEV;
label_gid = fs_m_in.REQ_GRANT;
label_len = fs_m_in.REQ_PATH_LEN;
readonly = 1; /* Always mount devices read only. */
isroot = (fs_m_in.REQ_FLAGS & REQ_ISROOT) ? 1 : 0;
if (label_len > sizeof(fs_dev_label))
return(EINVAL);

View file

@ -17,12 +17,11 @@ FORWARD _PROTOTYPE( int parse_path, (ino_t dir_ino, ino_t root_ino, int flags,
PUBLIC int fs_lookup() {
cp_grant_id_t grant;
int r, r1, len, flags;
size_t offset, size;
size_t offset;
ino_t dir_ino, root_ino;
struct dir_record *dir;
grant = fs_m_in.REQ_GRANT;
size = fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */
len = fs_m_in.REQ_PATH_LEN; /* including terminating nul */
dir_ino = fs_m_in.REQ_DIR_INO;
root_ino = fs_m_in.REQ_ROOT_INO;
@ -89,7 +88,7 @@ PUBLIC int search_dir(ldir_ptr,string,numb)
{
struct dir_record *dir_tmp;
register struct buf *bp,*bp2;
int pos,r,len;
int pos,len;
char* comma_pos = NULL;
char tmp_string[NAME_MAX];
@ -103,8 +102,6 @@ PUBLIC int search_dir(ldir_ptr,string,numb)
return(ENOTDIR);
}
r = OK;
if (strcmp(string,".") == 0) {
*numb = ID_DIR_RECORD(ldir_ptr);
return OK;

View file

@ -136,7 +136,7 @@ PUBLIC int fs_getdents(void) {
struct dir_record *dir;
ino_t ino;
cp_grant_id_t gid;
size_t size_to_read, block_size;
size_t block_size;
off_t pos, block_pos, block, cur_pos, tmpbuf_offset, userbuf_off;
struct buf *bp;
struct dir_record *dir_tmp;
@ -153,7 +153,6 @@ PUBLIC int fs_getdents(void) {
/* Get input parameters */
ino = fs_m_in.REQ_INODE_NR;
gid = fs_m_in.REQ_GRANT;
size_to_read = fs_m_in.REQ_MEM_SIZE;
pos = fs_m_in.REQ_SEEK_POS_LO;
block_size = v_pri.logical_block_size_l;

View file

@ -501,9 +501,7 @@ off_t newsize; /* inode must become this size */
* O_APPEND mode, as this is different per fd and is checked when
* writing is done.
*/
zone_t zone_size;
int scale, file_type;
dev_t dev;
file_type = rip->i_mode & I_TYPE; /* check to see if file is special */
if (file_type == I_CHAR_SPECIAL || file_type == I_BLOCK_SPECIAL)
@ -511,9 +509,7 @@ off_t newsize; /* inode must become this size */
if(newsize > rip->i_sp->s_max_size) /* don't let inode grow too big */
return(EFBIG);
dev = rip->i_dev; /* device on which inode resides */
scale = rip->i_sp->s_log_zone_size;
zone_size = (zone_t) rip->i_sp->s_block_size << scale;
/* Free the actual space if truncating. */
if(newsize < rip->i_size) freesp_inode(rip, newsize, rip->i_size);
@ -549,7 +545,7 @@ off_t start, end; /* range of bytes to free (end uninclusive) */
* fcntl().
*/
off_t p, e;
int zone_size, dev;
int zone_size;
int zero_last, zero_first;
if(end > rip->i_size) /* freeing beyond end makes no sense */
@ -558,7 +554,6 @@ off_t start, end; /* range of bytes to free (end uninclusive) */
return(EINVAL);
zone_size = rip->i_sp->s_block_size << rip->i_sp->s_log_zone_size;
dev = rip->i_dev; /* device on which inode resides */
/* If freeing doesn't cross a zone boundary, then we may only zero
* a range of the zone, unless we are freeing up that entire zone.

View file

@ -307,7 +307,6 @@ vir_bytes *pc; /* program entry point (initial PC) */
int *hdrlenp;
{
/* Read the header and extract the text, data, bss and total sizes from it. */
off_t pos;
block_t b;
struct exec hdr; /* a.out header is read in here */
@ -339,8 +338,6 @@ int *hdrlenp;
*/
int r;
pos= 0; /* Read from the start of the file */
if (exec_len < sizeof(hdr)) return(ENOEXEC);
memcpy(&hdr, exec, sizeof(hdr));

View file

@ -1071,7 +1071,7 @@ PUBLIC int main(int argc, char **argv)
int result = EXIT_SUCCESS;
int request;
int i;
char *label, *progname = NULL;
char *progname = NULL;
struct passwd *pw;
/* Verify and parse the command line arguments. All arguments are checked
@ -1120,9 +1120,6 @@ PUBLIC int main(int argc, char **argv)
fatal("no passwd file entry for '%s'", SERVICE_LOGIN);
rs_start.rss_uid= pw->pw_uid;
/* The name of the system service. */
(label= strrchr(req_path, '/')) ? label++ : (label= req_path);
if (req_config) {
assert(progname);
do_config(progname, req_config);

View file

@ -341,7 +341,7 @@ int suspend_reopen; /* Just suspend the process */
message dev_mess;
cp_grant_id_t gid = GRANT_INVALID;
static cp_grant_id_t gids[NR_IOREQS];
int vec_grants = 0, orig_op, safe;
int vec_grants = 0, safe;
void *buf_used;
endpoint_t ioproc;
@ -350,7 +350,6 @@ int suspend_reopen; /* Just suspend the process */
/* Determine task dmap. */
dp = &dmap[(dev >> MAJOR) & BYTE];
orig_op = op;
/* See if driver is roughly valid. */
if (dp->dmap_driver == NONE) {
@ -655,9 +654,7 @@ message *mess_ptr; /* pointer to message for task */
* pairs. These lead to calls on the following routines via the dmap table.
*/
int r, proc_e;
proc_e = mess_ptr->IO_ENDPT;
int r;
r = asynsend(task_nr, mess_ptr);
if (r != OK) panic(__FILE__, "asyn_io: asynsend failed", r);

View file

@ -328,12 +328,11 @@ size_t size;
PUBLIC void unsuspend_by_endpt(endpoint_t proc_e)
{
struct fproc *rp;
int client = 0;
/* Revive processes waiting for drivers (SUSPENDed) that have
* disappeared with return code EAGAIN.
*/
for (rp = &fproc[0]; rp < &fproc[NR_PROCS]; rp++, client++)
for (rp = &fproc[0]; rp < &fproc[NR_PROCS]; rp++)
if(rp->fp_pid != PID_FREE &&
rp->fp_blocked_on == FP_BLOCKED_ON_OTHER && rp->fp_task == proc_e) {
revive(rp->fp_endpoint, EAGAIN);

View file

@ -194,8 +194,8 @@ struct filp *f;
char *buf;
size_t req_size;
{
int r, oflags, op, partial_pipe = 0, r2;
size_t size, size2, cum_io, cum_io_incr, cum_io_incr2;
int r, oflags, partial_pipe = 0, r2;
size_t size, cum_io, cum_io_incr, cum_io_incr2;
struct vnode *vp;
u64_t position, new_pos, new_pos2;
@ -205,7 +205,6 @@ size_t req_size;
vp->v_pipe_wr_pos);
/* fp->fp_cum_io_partial is only nonzero when doing partial writes */
cum_io = fp->fp_cum_io_partial;
op = (rw_flag == READING ? VFS_DEV_READ : VFS_DEV_WRITE);
r = pipe_check(vp, rw_flag, oflags, req_size, position, 0);
if (r <= 0) {
@ -226,7 +225,6 @@ size_t req_size;
pos32 = cv64ul(position);
assert(pos32 >= 0);
assert(pos32 <= LONG_MAX);
size2 = size;
size = vp->v_size - pos32;
}

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, fd_setsize;
int r, nfds, do_timeout = 0, nonzero_timeout = 0, fd, s;
struct timeval timeout;
struct selectentry *se;
@ -97,7 +97,6 @@ PUBLIC int do_select(void)
/* Sane amount of file descriptors? */
if (nfds < 0 || nfds > OPEN_MAX) return(EINVAL);
fd_setsize = _FDSETWORDS(nfds) * _FDSETBITSPERWORD/8;
/* Find a slot to store this select request */
for (s = 0; s < MAXSELECTS; s++)
@ -479,7 +478,7 @@ PRIVATE void select_wakeup(struct selectentry *e, int r)
*===========================================================================*/
PRIVATE int select_reevaluate(struct filp *fp)
{
int s, remain_ops = 0, fd, type = -1;
int s, remain_ops = 0, fd;
if (!fp) {
printf("fs: select: reevalute NULL fp\n");
@ -492,7 +491,6 @@ PRIVATE int select_reevaluate(struct filp *fp)
for(fd = 0; fd < selecttab[s].nfds; fd++)
if (fp == selecttab[s].filps[fd]) {
remain_ops |= tab2ops(fd, &selecttab[s]);
type = selecttab[s].type[fd];
}
}
@ -526,15 +524,13 @@ PRIVATE void select_return(struct selectentry *se, int r)
*===========================================================================*/
PUBLIC int select_callback(struct filp *fp, int ops)
{
int s, fd, want_ops, type;
int s, fd;
/* We are being notified that file pointer fp is available for
* operations 'ops'. We must re-register the select for
* operations that we are still interested in, if any.
*/
want_ops = 0;
type = -1;
for(s = 0; s < MAXSELECTS; s++) {
int wakehim = 0;
if (selecttab[s].requestor == NULL) continue;
@ -545,13 +541,11 @@ PUBLIC int select_callback(struct filp *fp, int ops)
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) {
/* this select() has been satisfied. */
ops2tab(ops, fd, &selecttab[s]);
wakehim = 1;
}
type = selecttab[s].type[fd];
}
}
if (wakehim)

View file

@ -6,7 +6,6 @@
*/
#include "fs.h"
#include <string.h>
#include "file.h"
#include "fproc.h"