Remove U16_t and most other similar types. Rewrite functions to ansi-style

declaration if necessary.
This commit is contained in:
Kees van Reeuwijk 2010-04-21 11:05:22 +00:00
parent 8a304627a3
commit 86a23c1fbd
45 changed files with 281 additions and 474 deletions

View file

@ -93,7 +93,7 @@ void raw_copy(u32_t dstaddr, u32_t srcaddr, u32_t count);
/* Copy bytes from anywhere to anywhere. */ /* Copy bytes from anywhere to anywhere. */
u16_t get_word(u32_t addr); u16_t get_word(u32_t addr);
/* Get a word from anywhere. */ /* Get a word from anywhere. */
void put_word(u32_t addr, U16_t word); void put_word(u32_t addr, u16_t word);
/* Put a word anywhere. */ /* Put a word anywhere. */
void relocate(void); void relocate(void);
/* Switch to a copy of this program. */ /* Switch to a copy of this program. */

View file

@ -2,7 +2,6 @@
* 23 Dec 1991 * 23 Dec 1991
* Based on readfs by Paul Polderman * Based on readfs by Paul Polderman
*/ */
#define nil 0
#define _POSIX_SOURCE 1 #define _POSIX_SOURCE 1
#define _MINIX 1 #define _MINIX 1
#include <sys/types.h> #include <sys/types.h>

View file

@ -178,17 +178,14 @@ struct pstat { /* structure filled by pstat() */
#define R_STATE 'R' /* Runnable */ #define R_STATE 'R' /* Runnable */
#define T_STATE 'T' /* stopped (Trace) */ #define T_STATE 'T' /* stopped (Trace) */
_PROTOTYPE(char *tname, (dev_t dev_nr ));
_PROTOTYPE(char *taskname, (int p_nr ));
_PROTOTYPE(char *prrecv, (struct pstat *bufp ));
_PROTOTYPE(void disaster, (int sig )); _PROTOTYPE(void disaster, (int sig ));
_PROTOTYPE(int main, (int argc, char *argv [])); _PROTOTYPE(int main, (int argc, char *argv []));
_PROTOTYPE(char *get_args, (struct pstat *bufp )); _PROTOTYPE(char *get_args, (struct pstat *bufp ));
_PROTOTYPE(int pstat, (int p_nr, struct pstat *bufp, int Eflag )); _PROTOTYPE(int pstat, (int p_nr, struct pstat *bufp, int Eflag ));
_PROTOTYPE(int addrread, (int fd, phys_clicks base, vir_bytes addr, _PROTOTYPE(int addrread, (int fd, phys_clicks base, vir_bytes addr,
char *buf, int nbytes )); char *buf, int nbytes ));
_PROTOTYPE(void usage, (char *pname )); _PROTOTYPE(void usage, (const char *pname ));
_PROTOTYPE(void err, (char *s )); _PROTOTYPE(void err, (const char *s ));
_PROTOTYPE(int gettynames, (void)); _PROTOTYPE(int gettynames, (void));
@ -198,7 +195,7 @@ _PROTOTYPE(int gettynames, (void));
* Tname assumes that the first three letters of the tty's name can be omitted * Tname assumes that the first three letters of the tty's name can be omitted
* and returns the rest (except for the console, which yields "co"). * and returns the rest (except for the console, which yields "co").
*/ */
char *tname(dev_t dev_nr) PRIVATE char *tname(dev_t dev_nr)
{ {
int i; int i;
@ -212,8 +209,7 @@ char *tname(dev_t dev_nr)
} }
/* Return canonical task name of task p_nr; overwritten on each call (yucch) */ /* Return canonical task name of task p_nr; overwritten on each call (yucch) */
char *taskname(p_nr) PRIVATE char *taskname(int p_nr)
int p_nr;
{ {
int n; int n;
n = _ENDPOINT_P(p_nr) + nr_tasks; n = _ENDPOINT_P(p_nr) + nr_tasks;
@ -226,8 +222,7 @@ int p_nr;
/* Prrecv prints the RECV field for process with pstat buffer pointer bufp. /* Prrecv prints the RECV field for process with pstat buffer pointer bufp.
* This is either "ANY", "taskname", or "(blockreason) taskname". * This is either "ANY", "taskname", or "(blockreason) taskname".
*/ */
char *prrecv(bufp) PRIVATE char *prrecv(struct pstat *bufp)
struct pstat *bufp;
{ {
char *blkstr, *task; /* reason for blocking and task */ char *blkstr, *task; /* reason for blocking and task */
static char recvstr[20]; static char recvstr[20];
@ -483,10 +478,7 @@ struct pstat *bufp;
/* Pstat collects info on process number p_nr and returns it in buf. /* Pstat collects info on process number p_nr and returns it in buf.
* It is assumed that tasks do not have entries in fproc/mproc. * It is assumed that tasks do not have entries in fproc/mproc.
*/ */
int pstat(p_nr, bufp, endpoints) int pstat(int p_nr, struct pstat *bufp, int endpoints)
int p_nr;
struct pstat *bufp;
int endpoints;
{ {
int p_ki = p_nr + nr_tasks; /* kernel proc index */ int p_ki = p_nr + nr_tasks; /* kernel proc index */
@ -581,12 +573,7 @@ int endpoints;
} }
/* Addrread reads nbytes from offset addr to click base of fd into buf. */ /* Addrread reads nbytes from offset addr to click base of fd into buf. */
int addrread(fd, base, addr, buf, nbytes) int addrread(int fd, phys_clicks base, vir_bytes addr, char *buf, int nbytes)
int fd;
phys_clicks base;
vir_bytes addr;
char *buf;
int nbytes;
{ {
if (lseek(fd, ((off_t) base << CLICK_SHIFT) + addr, 0) < 0) if (lseek(fd, ((off_t) base << CLICK_SHIFT) + addr, 0) < 0)
return -1; return -1;
@ -594,15 +581,13 @@ int nbytes;
return read(fd, buf, nbytes); return read(fd, buf, nbytes);
} }
void usage(pname) void usage(const char *pname)
char *pname;
{ {
fprintf(stderr, "Usage: %s [-][aeflx]\n", pname); fprintf(stderr, "Usage: %s [-][aeflx]\n", pname);
exit(1); exit(1);
} }
void err(s) void err(const char *s)
char *s;
{ {
extern int errno; extern int errno;
@ -615,7 +600,7 @@ char *s;
} }
/* Fill ttyinfo by fstatting character specials in /dev. */ /* Fill ttyinfo by fstatting character specials in /dev. */
int gettynames() int gettynames(void)
{ {
static char dev_path[] = "/dev/"; static char dev_path[] = "/dev/";
struct stat statbuf; struct stat statbuf;

View file

@ -66,7 +66,7 @@ typedef struct already {
} ALREADY; } ALREADY;
_PROTOTYPE(int main, (int argc, char **argv)); _PROTOTYPE(int main, (int argc, char **argv));
_PROTOTYPE(int makedname, (char *d, char *f, char *out, int outlen)); PRIVATE _PROTOTYPE(int makedname, (char *d, char *f, char *out, int outlen));
_PROTOTYPE(int done, (dev_t dev, ino_t inum, nlink_t nlink)); _PROTOTYPE(int done, (dev_t dev, ino_t inum, nlink_t nlink));
_PROTOTYPE(long dodir, (char *d, int thislev, dev_t dev)); _PROTOTYPE(long dodir, (char *d, int thislev, dev_t dev));
@ -86,16 +86,11 @@ int alc;
* directory entry, placing it in out. If this would overflow, * directory entry, placing it in out. If this would overflow,
* return 0, otherwise 1. * return 0, otherwise 1.
*/ */
int makedname(d, f, out, outlen) PRIVATE int makedname(char *d, char *f, char *out, int outlen)
char *d;
char *f;
char *out;
int outlen;
{ {
char *cp; char *cp;
int length; int length = strlen(f);
length = strlen(f);
if (strlen(d) + length + 2 > outlen) return(0); if (strlen(d) + length + 2 > outlen) return(0);
for (cp = out; *d; *cp++ = *d++); for (cp = out; *d; *cp++ = *d++);
if (*(cp - 1) != '/') *cp++ = '/'; if (*(cp - 1) != '/') *cp++ = '/';

View file

@ -9,7 +9,6 @@
#define NR_ZONE_NUMS V1_NR_TZONES #define NR_ZONE_NUMS V1_NR_TZONES
#define ZONE_NUM_SIZE V1_ZONE_NUM_SIZE #define ZONE_NUM_SIZE V1_ZONE_NUM_SIZE
#define bit_nr u16_t /* perhaps bit_t should be used, although slower */ #define bit_nr u16_t /* perhaps bit_t should be used, although slower */
#define Bit_nr U16_t
#define block_nr block_t #define block_nr block_t
#define d_inode d1_inode #define d_inode d1_inode
#define d_inum d_ino #define d_inum d_ino
@ -19,7 +18,6 @@
#define i_size d1_size #define i_size d1_size
#define i_zone d1_zone #define i_zone d1_zone
#define zone_nr zone1_t #define zone_nr zone1_t
#define Zone_nr Zone1_t
/* fsck - file system checker Author: Robbert van Renesse */ /* fsck - file system checker Author: Robbert van Renesse */
@ -138,22 +136,22 @@ char answer[] = "Answer questions with y or n. Then hit RETURN";
_PROTOTYPE(int main, (int argc, char **argv)); _PROTOTYPE(int main, (int argc, char **argv));
_PROTOTYPE(void initvars, (void)); _PROTOTYPE(void initvars, (void));
_PROTOTYPE(void fatal, (char *s)); _PROTOTYPE(void fatal, (const char *s));
_PROTOTYPE(int eoln, (int c)); _PROTOTYPE(int eoln, (int c));
_PROTOTYPE(int yes, (char *question)); PRIVATE _PROTOTYPE(int yes, (const char *question));
_PROTOTYPE(int atoo, (char *s)); PRIVATE _PROTOTYPE(int atoo, (const char *s));
_PROTOTYPE(int input, (char *buf, int size)); _PROTOTYPE(int input, (char *buf, int size));
_PROTOTYPE(char *alloc, (unsigned nelem, unsigned elsize)); PRIVATE _PROTOTYPE(char *alloc, (unsigned nelem, unsigned elsize));
_PROTOTYPE(void printname, (char *s)); PRIVATE _PROTOTYPE(void printname, (const char *s));
_PROTOTYPE(void printrec, (struct stack *sp)); _PROTOTYPE(void printrec, (struct stack *sp));
_PROTOTYPE(void printpath, (int mode, int nlcr)); _PROTOTYPE(void printpath, (int mode, int nlcr));
_PROTOTYPE(void devopen, (void)); _PROTOTYPE(void devopen, (void));
_PROTOTYPE(void devclose, (void)); _PROTOTYPE(void devclose, (void));
_PROTOTYPE(void devio, (block_nr bno, int dir)); _PROTOTYPE(void devio, (block_nr bno, int dir));
_PROTOTYPE(void devread, (long offset, char *buf, int size)); _PROTOTYPE(void devread, (long offset, char *buf, int size));
_PROTOTYPE(void devwrite, (long offset, char *buf, int size)); PRIVATE _PROTOTYPE(void devwrite, (long offset, const char *buf, int size));
_PROTOTYPE(void pr, (char *fmt, int cnt, char *s, char *p)); _PROTOTYPE(void pr, (const char *fmt, int cnt, const char *s, const char *p));
_PROTOTYPE(bit_nr getnumber, (char *s)); _PROTOTYPE(bit_nr getnumber, (const char *s));
_PROTOTYPE(char **getlist, (char ***argv, char *type)); _PROTOTYPE(char **getlist, (char ***argv, char *type));
_PROTOTYPE(void lsuper, (void)); _PROTOTYPE(void lsuper, (void));
_PROTOTYPE(void getsuper, (void)); _PROTOTYPE(void getsuper, (void));
@ -162,12 +160,12 @@ _PROTOTYPE(void lsi, (char **clist));
_PROTOTYPE(bitchunk_t *allocbitmap, (int nblk)); _PROTOTYPE(bitchunk_t *allocbitmap, (int nblk));
_PROTOTYPE(void loadbitmap, (bitchunk_t *bitmap, block_nr bno, int nblk)); _PROTOTYPE(void loadbitmap, (bitchunk_t *bitmap, block_nr bno, int nblk));
_PROTOTYPE(void dumpbitmap, (bitchunk_t *bitmap, block_nr bno, int nblk)); _PROTOTYPE(void dumpbitmap, (bitchunk_t *bitmap, block_nr bno, int nblk));
_PROTOTYPE(void fillbitmap, (bitchunk_t *bitmap, Bit_nr lwb, Bit_nr upb, char **list)); _PROTOTYPE(void fillbitmap, (bitchunk_t *bitmap, bit_nr lwb, bit_nr upb, char **list));
_PROTOTYPE(void freebitmap, (bitchunk_t *p)); _PROTOTYPE(void freebitmap, (bitchunk_t *p));
_PROTOTYPE(void getbitmaps, (void)); _PROTOTYPE(void getbitmaps, (void));
_PROTOTYPE(void putbitmaps, (void)); _PROTOTYPE(void putbitmaps, (void));
_PROTOTYPE(void chkword, (unsigned w1, unsigned w2, Bit_nr bit, char *type, int *n, int *report)); _PROTOTYPE(void chkword, (unsigned w1, unsigned w2, bit_nr bit, char *type, int *n, int *report));
_PROTOTYPE(void chkmap, (bitchunk_t *cmap, bitchunk_t *dmap, Bit_nr bit, block_nr blkno, int nblk, char *type)); _PROTOTYPE(void chkmap, (bitchunk_t *cmap, bitchunk_t *dmap, bit_nr bit, block_nr blkno, int nblk, char *type));
_PROTOTYPE(void chkilist, (void)); _PROTOTYPE(void chkilist, (void));
_PROTOTYPE(void getcount, (void)); _PROTOTYPE(void getcount, (void));
_PROTOTYPE(void counterror, (Ino_t ino)); _PROTOTYPE(void counterror, (Ino_t ino));
@ -180,12 +178,12 @@ _PROTOTYPE(void make_printable_name, (char *dst, char *src, int n));
_PROTOTYPE(int chkdots, (Ino_t ino, off_t pos, dir_struct *dp, Ino_t exp)); _PROTOTYPE(int chkdots, (Ino_t ino, off_t pos, dir_struct *dp, Ino_t exp));
_PROTOTYPE(int chkname, (Ino_t ino, dir_struct *dp)); _PROTOTYPE(int chkname, (Ino_t ino, dir_struct *dp));
_PROTOTYPE(int chkentry, (Ino_t ino, off_t pos, dir_struct *dp)); _PROTOTYPE(int chkentry, (Ino_t ino, off_t pos, dir_struct *dp));
_PROTOTYPE(int chkdirzone, (Ino_t ino, d_inode *ip, off_t pos, Zone_nr zno)); _PROTOTYPE(int chkdirzone, (Ino_t ino, d_inode *ip, off_t pos, zone_nr zno));
_PROTOTYPE(void errzone, (char *mess, Zone_nr zno, int level, off_t pos)); _PROTOTYPE(void errzone, (const char *mess, zone_nr zno, int level, off_t pos));
_PROTOTYPE(int markzone, (Ino_t ino, Zone_nr zno, int level, off_t pos)); _PROTOTYPE(int markzone, (Ino_t ino, zone_nr zno, int level, off_t pos));
_PROTOTYPE(int chkindzone, (Ino_t ino, d_inode *ip, off_t *pos, Zone_nr zno, int level)); _PROTOTYPE(int chkindzone, (Ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level));
_PROTOTYPE(off_t jump, (int level)); _PROTOTYPE(off_t jump, (int level));
_PROTOTYPE(int zonechk, (Ino_t ino, d_inode *ip, off_t *pos, Zone_nr zno, int level)); _PROTOTYPE(int zonechk, (Ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level));
_PROTOTYPE(int chkzones, (Ino_t ino, d_inode *ip, off_t *pos, zone_nr *zlist, int len, int level)); _PROTOTYPE(int chkzones, (Ino_t ino, d_inode *ip, off_t *pos, zone_nr *zlist, int len, int level));
_PROTOTYPE(int chkfile, (Ino_t ino, d_inode *ip)); _PROTOTYPE(int chkfile, (Ino_t ino, d_inode *ip));
_PROTOTYPE(int chkdirectory, (Ino_t ino, d_inode *ip)); _PROTOTYPE(int chkdirectory, (Ino_t ino, d_inode *ip));
@ -212,25 +210,22 @@ void initvars()
} }
/* Print the string `s' and exit. */ /* Print the string `s' and exit. */
void fatal(s) void fatal(const char *s)
char *s;
{ {
printf("%s\nfatal\n", s); printf("%s\nfatal\n", s);
exit(-1); exit(-1);
} }
/* Test for end of line. */ /* Test for end of line. */
int eoln(c) int eoln(int c)
int c;
{ {
return(c == EOF || c == '\n' || c == '\r'); return(c == EOF || c == '\n' || c == '\r');
} }
/* Ask a question and get the answer unless automatic is set. */ /* Ask a question and get the answer unless automatic is set. */
int yes(question) PRIVATE int yes(const char *question)
char *question;
{ {
register c, answer; int c, answer;
if (!repair) { if (!repair) {
printf("\n"); printf("\n");
@ -248,8 +243,7 @@ char *question;
} }
/* Convert string to integer. Representation is octal. */ /* Convert string to integer. Representation is octal. */
int atoo(s) PRIVATE int atoo(const char *s)
register char *s;
{ {
register int n = 0; register int n = 0;
@ -261,9 +255,7 @@ register char *s;
} }
/* If repairing the file system, print a prompt and get a string from user. */ /* If repairing the file system, print a prompt and get a string from user. */
int input(buf, size) int input(char *buf, int size)
char *buf;
int size;
{ {
register char *p = buf; register char *p = buf;
@ -287,8 +279,7 @@ int size;
} }
/* Allocate some memory and zero it. */ /* Allocate some memory and zero it. */
char *alloc(nelem, elsize) PRIVATE char *alloc(unsigned nelem, unsigned elsize)
unsigned nelem, elsize;
{ {
char *p; char *p;
@ -298,8 +289,7 @@ unsigned nelem, elsize;
} }
/* Print the name in a directory entry. */ /* Print the name in a directory entry. */
void printname(s) PRIVATE void printname(const char *s)
char *s;
{ {
register n = NAME_MAX; register n = NAME_MAX;
int c; int c;
@ -315,8 +305,7 @@ char *s;
/* Print the pathname given by a linked list pointed to by `sp'. The /* Print the pathname given by a linked list pointed to by `sp'. The
* names are in reverse order. * names are in reverse order.
*/ */
void printrec(sp) void printrec(struct stack *sp)
struct stack *sp;
{ {
if (sp->st_next != 0) { if (sp->st_next != 0) {
printrec(sp->st_next); printrec(sp->st_next);
@ -326,9 +315,7 @@ struct stack *sp;
} }
/* Print the current pathname. */ /* Print the current pathname. */
void printpath(mode, nlcr) void printpath(int mode, int nlcr)
int mode;
int nlcr;
{ {
if (ftop->st_next == 0) if (ftop->st_next == 0)
putchar('/'); putchar('/');
@ -346,7 +333,7 @@ int nlcr;
} }
/* Open the device. */ /* Open the device. */
void devopen() void devopen(void)
{ {
if ((dev = open(device, repair ? O_RDWR : O_RDONLY)) < 0) { if ((dev = open(device, repair ? O_RDWR : O_RDONLY)) < 0) {
perror(device); perror(device);
@ -364,9 +351,7 @@ void devclose()
} }
/* Read or write a block. */ /* Read or write a block. */
void devio(bno, dir) void devio(block_nr bno, int dir)
block_nr bno;
int dir;
{ {
if (dir == READING && bno == thisblk) return; if (dir == READING && bno == thisblk) return;
thisblk = bno; thisblk = bno;
@ -391,20 +376,14 @@ int dir;
} }
/* Read `size' bytes from the disk starting at byte `offset'. */ /* Read `size' bytes from the disk starting at byte `offset'. */
void devread(offset, buf, size) void devread(long offset, char *buf, int size)
long offset;
char *buf;
int size;
{ {
devio((block_nr) (offset / BLOCK_SIZE), READING); devio((block_nr) (offset / BLOCK_SIZE), READING);
memmove(buf, &rwbuf[(int) (offset % BLOCK_SIZE)], (size_t)size); memmove(buf, &rwbuf[(int) (offset % BLOCK_SIZE)], (size_t)size);
} }
/* Write `size' bytes to the disk starting at byte `offset'. */ /* Write `size' bytes to the disk starting at byte `offset'. */
void devwrite(offset, buf, size) static void devwrite(long offset, const char *buf, int size)
long offset;
char *buf;
int size;
{ {
if (!repair) fatal("internal error (devwrite)"); if (!repair) fatal("internal error (devwrite)");
if (size != BLOCK_SIZE) devio((block_nr) (offset / BLOCK_SIZE), READING); if (size != BLOCK_SIZE) devio((block_nr) (offset / BLOCK_SIZE), READING);
@ -414,16 +393,13 @@ int size;
} }
/* Print a string with either a singular or a plural pronoun. */ /* Print a string with either a singular or a plural pronoun. */
void pr(fmt, cnt, s, p) void pr(const char *fmt, int cnt, const char *s, const char *p)
char *fmt, *s, *p;
int cnt;
{ {
printf(fmt, cnt, cnt == 1 ? s : p); printf(fmt, cnt, cnt == 1 ? s : p);
} }
/* Convert string to number. */ /* Convert string to number. */
bit_nr getnumber(s) bit_nr getnumber(const char *s)
register char *s;
{ {
register bit_nr n = 0; register bit_nr n = 0;
@ -435,8 +411,7 @@ register char *s;
} }
/* See if the list pointed to by `argv' contains numbers. */ /* See if the list pointed to by `argv' contains numbers. */
char **getlist(argv, type) char **getlist(char ***argv, char *type)
char ***argv, *type;
{ {
register char **list = *argv; register char **list = *argv;
register empty = 1; register empty = 1;
@ -455,7 +430,7 @@ char ***argv, *type;
/* Make a listing of the super block. If `repair' is set, ask the user /* Make a listing of the super block. If `repair' is set, ask the user
* for changes. * for changes.
*/ */
void lsuper() void lsuper(void)
{ {
char buf[80]; char buf[80];
@ -483,7 +458,7 @@ void lsuper()
} }
/* Get the super block from either disk or user. Do some initial checks. */ /* Get the super block from either disk or user. Do some initial checks. */
void getsuper() void getsuper(void)
{ {
devread(btoa(BLK_SUPER), (char *) &sb, sizeof(sb)); devread(btoa(BLK_SUPER), (char *) &sb, sizeof(sb));
if (listsuper) lsuper(); if (listsuper) lsuper();
@ -499,7 +474,7 @@ void getsuper()
} }
/* Check the super block for reasonable contents. */ /* Check the super block for reasonable contents. */
void chksuper() void chksuper(void)
{ {
register n; register n;
register off_t maxsize; register off_t maxsize;
@ -541,8 +516,7 @@ void chksuper()
/* Make a listing of the inodes given by `clist'. If `repair' is set, ask /* Make a listing of the inodes given by `clist'. If `repair' is set, ask
* the user for changes. * the user for changes.
*/ */
void lsi(clist) void lsi(char **clist)
char **clist;
{ {
register bit_nr bit; register bit_nr bit;
register ino_t ino; register ino_t ino;
@ -571,8 +545,7 @@ char **clist;
} }
/* Allocate `nblk' blocks worth of bitmap. */ /* Allocate `nblk' blocks worth of bitmap. */
bitchunk_t *allocbitmap(nblk) bitchunk_t *allocbitmap(int nblk)
int nblk;
{ {
register bitchunk_t *bitmap; register bitchunk_t *bitmap;
@ -582,10 +555,7 @@ int nblk;
} }
/* Load the bitmap starting at block `bno' from disk. */ /* Load the bitmap starting at block `bno' from disk. */
void loadbitmap(bitmap, bno, nblk) void loadbitmap(bitchunk_t *bitmap, block_nr bno, int nblk)
bitchunk_t *bitmap;
block_nr bno;
int nblk;
{ {
register i; register i;
register bitchunk_t *p; register bitchunk_t *p;
@ -597,10 +567,7 @@ int nblk;
} }
/* Write the bitmap starting at block `bno' to disk. */ /* Write the bitmap starting at block `bno' to disk. */
void dumpbitmap(bitmap, bno, nblk) void dumpbitmap(bitchunk_t *bitmap, block_nr bno, int nblk)
bitchunk_t *bitmap;
block_nr bno;
int nblk;
{ {
register i; register i;
register bitchunk_t *p = bitmap; register bitchunk_t *p = bitmap;
@ -610,10 +577,7 @@ int nblk;
} }
/* Set the bits given by `list' in the bitmap. */ /* Set the bits given by `list' in the bitmap. */
void fillbitmap(bitmap, lwb, upb, list) void fillbitmap(bitchunk_t *bitmap, bit_nr lwb, bit_nr upb, char **list)
bitchunk_t *bitmap;
bit_nr lwb, upb;
char **list;
{ {
register bit_nr bit; register bit_nr bit;
@ -659,11 +623,8 @@ void putbitmaps()
/* `w1' and `w2' are differing words from two bitmaps that should be /* `w1' and `w2' are differing words from two bitmaps that should be
* identical. Print what's the matter with them. * identical. Print what's the matter with them.
*/ */
void chkword(w1, w2, bit, type, n, report) void chkword(unsigned w1, unsigned w2, bit_nr bit, char *type,
unsigned w1, w2; int *n, int *report)
char *type;
bit_nr bit;
int *n, *report;
{ {
for (; (w1 | w2); w1 >>= 1, w2 >>= 1, bit++) for (; (w1 | w2); w1 >>= 1, w2 >>= 1, bit++)
if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report && if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report &&
@ -679,12 +640,8 @@ int *n, *report;
/* Check if the given (correct) bitmap is identical with the one that is /* Check if the given (correct) bitmap is identical with the one that is
* on the disk. If not, ask if the disk should be repaired. * on the disk. If not, ask if the disk should be repaired.
*/ */
void chkmap(cmap, dmap, bit, blkno, nblk, type) void chkmap(bitchunk_t *cmap, bitchunk_t *dmap, bit_nr bit,
bitchunk_t *cmap, *dmap; block_nr blkno, int nblk, char *type)
bit_nr bit;
block_nr blkno;
int nblk;
char *type;
{ {
register bitchunk_t *p = dmap, *q = cmap; register bitchunk_t *p = dmap, *q = cmap;
int report = 1, nerr = 0; int report = 1, nerr = 0;
@ -706,7 +663,7 @@ char *type;
} }
/* See if the inodes that aren't allocated are cleared. */ /* See if the inodes that aren't allocated are cleared. */
void chkilist() void chkilist(void)
{ {
register ino_t ino = 1; register ino_t ino = 1;
mode_t mode; mode_t mode;
@ -732,8 +689,7 @@ void getcount()
} }
/* The reference count for inode `ino' is wrong. Ask if it should be adjusted. */ /* The reference count for inode `ino' is wrong. Ask if it should be adjusted. */
void counterror(ino) void counterror(ino_t ino)
ino_t ino;
{ {
d_inode inode; d_inode inode;
@ -799,9 +755,7 @@ void printperm(mode_t mode, int shift, int special, int overlay)
} }
/* List the given inode. */ /* List the given inode. */
void list(ino, ip) void list(ino_t ino, d_inode *ip)
ino_t ino;
d_inode *ip;
{ {
if (firstlist) { if (firstlist) {
firstlist = 0; firstlist = 0;
@ -838,8 +792,7 @@ d_inode *ip;
* Don't name the function remove() - that is owned by ANSI, and chaos results * Don't name the function remove() - that is owned by ANSI, and chaos results
* when it is a macro. * when it is a macro.
*/ */
int Remove(dp) int Remove(dir_struct *dp)
dir_struct *dp;
{ {
setbit(spec_imap, (bit_nr) dp->d_inum); setbit(spec_imap, (bit_nr) dp->d_inum);
if (yes(". remove entry")) { if (yes(". remove entry")) {
@ -887,10 +840,7 @@ register int n;
} }
/* See if the `.' or `..' entry is as expected. */ /* See if the `.' or `..' entry is as expected. */
int chkdots(ino, pos, dp, exp) int chkdots(ino_t ino, off_t pos, dir_struct *dp, ino_t exp)
ino_t ino, exp;
off_t pos;
dir_struct *dp;
{ {
char printable_name[4 * NAME_MAX + 1]; char printable_name[4 * NAME_MAX + 1];
@ -922,9 +872,7 @@ dir_struct *dp;
} }
/* Check the name in a directory entry. */ /* Check the name in a directory entry. */
int chkname(ino, dp) int chkname(ino_t ino, dir_struct *dp)
ino_t ino;
dir_struct *dp;
{ {
register n = NAME_MAX + 1; register n = NAME_MAX + 1;
register char *p = dp->d_name; register char *p = dp->d_name;
@ -952,10 +900,7 @@ dir_struct *dp;
/* Check a directory entry. Here the routine `descendtree' is called /* Check a directory entry. Here the routine `descendtree' is called
* recursively to check the file or directory pointed to by the entry. * recursively to check the file or directory pointed to by the entry.
*/ */
int chkentry(ino, pos, dp) int chkentry(ino_t ino, off_t pos, dir_struct *dp)
ino_t ino;
off_t pos;
dir_struct *dp;
{ {
if (dp->d_inum < ROOT_INODE || dp->d_inum > sb.s_ninodes) { if (dp->d_inum < ROOT_INODE || dp->d_inum > sb.s_ninodes) {
printf("bad inode found in directory "); printf("bad inode found in directory ");
@ -1003,11 +948,7 @@ dir_struct *dp;
/* Check a zone of a directory by checking all the entries in the zone. /* Check a zone of a directory by checking all the entries in the zone.
* The zone is split up into chunks to not allocate too much stack. * The zone is split up into chunks to not allocate too much stack.
*/ */
int chkdirzone(ino, ip, pos, zno) int chkdirzone(ino_t ino, d_inode *ip, off_t pos, zone_nr zno)
ino_t ino;
d_inode *ip;
off_t pos;
zone_nr zno;
{ {
dir_struct dirblk[CDIRECT]; dir_struct dirblk[CDIRECT];
register dir_struct *dp; register dir_struct *dp;
@ -1041,11 +982,7 @@ zone_nr zno;
} }
/* There is something wrong with the given zone. Print some details. */ /* There is something wrong with the given zone. Print some details. */
void errzone(mess, zno, level, pos) void errzone(const char *mess, zone_nr zno, int level, off_t pos)
char *mess;
zone_nr zno;
int level;
off_t pos;
{ {
printf("%s zone in ", mess); printf("%s zone in ", mess);
printpath(1, 0); printpath(1, 0);
@ -1062,11 +999,7 @@ off_t pos;
/* Found the given zone in the given inode. Check it, and if ok, mark it /* Found the given zone in the given inode. Check it, and if ok, mark it
* in the zone bitmap. * in the zone bitmap.
*/ */
int markzone(ino, zno, level, pos) int markzone(ino_t ino, zone_nr zno, int level, off_t pos)
ino_t ino;
zone_nr zno;
int level;
off_t pos;
{ {
register bit_nr bit = (bit_nr) zno - FIRST + 1; register bit_nr bit = (bit_nr) zno - FIRST + 1;
@ -1089,12 +1022,7 @@ off_t pos;
/* Check an indirect zone by checking all of its entries. /* Check an indirect zone by checking all of its entries.
* The zone is split up into chunks to not allocate too much stack. * The zone is split up into chunks to not allocate too much stack.
*/ */
int chkindzone(ino, ip, pos, zno, level) int chkindzone(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level)
ino_t ino;
d_inode *ip;
off_t *pos;
zone_nr zno;
int level;
{ {
zone_nr indirect[CINDIR]; zone_nr indirect[CINDIR];
register n = NR_INDIRECTS / CINDIR; register n = NR_INDIRECTS / CINDIR;
@ -1111,8 +1039,7 @@ int level;
/* Return the size of a gap in the file, represented by a null zone number /* Return the size of a gap in the file, represented by a null zone number
* at some level of indirection. * at some level of indirection.
*/ */
off_t jump(level) off_t jump(int level)
int level;
{ {
off_t power = ZONE_SIZE; off_t power = ZONE_SIZE;
@ -1125,12 +1052,7 @@ int level;
/* Check a zone, which may be either a normal data zone, a directory zone, /* Check a zone, which may be either a normal data zone, a directory zone,
* or an indirect zone. * or an indirect zone.
*/ */
int zonechk(ino, ip, pos, zno, level) int zonechk(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level)
ino_t ino;
d_inode *ip;
off_t *pos;
zone_nr zno;
int level;
{ {
if (level == 0) { if (level == 0) {
if ((ip->i_mode & I_TYPE) == I_DIRECTORY && if ((ip->i_mode & I_TYPE) == I_DIRECTORY &&
@ -1143,13 +1065,8 @@ int level;
} }
/* Check a list of zones given by `zlist'. */ /* Check a list of zones given by `zlist'. */
int chkzones(ino, ip, pos, zlist, len, level) int chkzones(ino_t ino, d_inode *ip, off_t *pos, zone_nr *zlist,
ino_t ino; int len, int level)
d_inode *ip;
off_t *pos;
zone_nr *zlist;
int len;
int level;
{ {
register ok = 1, i; register ok = 1, i;
@ -1183,9 +1100,7 @@ d_inode *ip;
} }
/* Check a directory by checking the contents. Check if . and .. are present. */ /* Check a directory by checking the contents. Check if . and .. are present. */
int chkdirectory(ino, ip) int chkdirectory(ino_t ino, d_inode *ip)
ino_t ino;
d_inode *ip;
{ {
register ok; register ok;
@ -1207,9 +1122,7 @@ d_inode *ip;
#ifdef I_SYMBOLIC_LINK #ifdef I_SYMBOLIC_LINK
/* Check the validity of a symbolic link. */ /* Check the validity of a symbolic link. */
int chklink(ino, ip) int chklink(ino_t ino, d_inode *ip)
ino_t ino;
d_inode *ip;
{ {
int ok; int ok;
@ -1255,9 +1168,7 @@ d_inode *ip;
} }
/* Check the mode and contents of an inode. */ /* Check the mode and contents of an inode. */
int chkmode(ino, ip) int chkmode(ino_t ino, d_inode *ip)
ino_t ino;
d_inode *ip;
{ {
switch (ip->i_mode & I_TYPE) { switch (ip->i_mode & I_TYPE) {
case I_REGULAR: case I_REGULAR:
@ -1290,9 +1201,7 @@ d_inode *ip;
} }
/* Check an inode. */ /* Check an inode. */
int chkinode(ino, ip) int chkinode(ino_t ino, d_inode *ip)
ino_t ino;
d_inode *ip;
{ {
if (ino == ROOT_INODE && (ip->i_mode & I_TYPE) != I_DIRECTORY) { if (ino == ROOT_INODE && (ip->i_mode & I_TYPE) != I_DIRECTORY) {
printf("root inode is not a directory "); printf("root inode is not a directory ");

View file

@ -195,17 +195,15 @@ udp_io_hdr_t *udp_io_hdr;
return(0); return(0);
} }
void TimeOut(sig) void TimeOut(int sig)
int sig;
{ {
} }
int NetConnect(port) int NetConnect(u16_t port)
u16_t port;
{ {
int s; int s;
nwio_tcpconf_t tcpconf; nwio_tcpconf_t tcpconf;
nwio_tcpcl_t tcpcopt; nwio_tcpcl_t tcpcopt;
tcpconf.nwtc_flags = NWTC_NOFLAGS; tcpconf.nwtc_flags = NWTC_NOFLAGS;
tcpconf.nwtc_flags |= NWTC_LP_SET | NWTC_SET_RA | NWTC_SET_RP; tcpconf.nwtc_flags |= NWTC_LP_SET | NWTC_SET_RA | NWTC_SET_RP;

View file

@ -11,5 +11,5 @@ extern int tcp_fd;
_PROTOTYPE(int NetInit, (void)); _PROTOTYPE(int NetInit, (void));
_PROTOTYPE(int getreply, (struct talk_reply *reply, int timeout)); _PROTOTYPE(int getreply, (struct talk_reply *reply, int timeout));
_PROTOTYPE(int sendrequest, (struct talk_request *request, int here)); _PROTOTYPE(int sendrequest, (struct talk_request *request, int here));
_PROTOTYPE(int NetConnect, (U16_t port)); _PROTOTYPE(int NetConnect, (u16_t port));
_PROTOTYPE(int NetListen, (int timeout)); _PROTOTYPE(int NetListen, (int timeout));

View file

@ -33,7 +33,7 @@ PUBLIC unsigned pci_inw(u16_t port) {
PUBLIC unsigned pci_inl(u16_t port) { PUBLIC unsigned pci_inl(u16_t port) {
U32_t value; u32_t value;
int s; int s;
if ((s=sys_inl(port, &value)) !=OK) if ((s=sys_inl(port, &value)) !=OK)
printf("%s: warning, sys_inl failed: %d\n", DRIVER_NAME, s); printf("%s: warning, sys_inl failed: %d\n", DRIVER_NAME, s);

View file

@ -38,7 +38,7 @@ _PROTOTYPE( static void rtl_init, (struct dpeth *dep) );
#if 0 #if 0
_PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) ); _PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) );
_PROTOTYPE( static void ee_wen, (dpeth_t *dep) ); _PROTOTYPE( static void ee_wen, (dpeth_t *dep) );
_PROTOTYPE( static void set_ee_word, (dpeth_t *dep, int a, U16_t w) ); _PROTOTYPE( static void set_ee_word, (dpeth_t *dep, int a, u16_t w) );
_PROTOTYPE( static void ee_wds, (dpeth_t *dep) ); _PROTOTYPE( static void ee_wds, (dpeth_t *dep) );
#endif #endif

View file

@ -16,9 +16,7 @@ Media Independent (Ethernet) Interface functions
/*===========================================================================* /*===========================================================================*
* mii_print_stat_speed * * mii_print_stat_speed *
*===========================================================================*/ *===========================================================================*/
PUBLIC void mii_print_stat_speed(stat, extstat) PUBLIC void mii_print_stat_speed(u16_t stat, u16_t extstat)
u16_t stat;
u16_t extstat;
{ {
int fs, ft; int fs, ft;
@ -119,8 +117,7 @@ u16_t extstat;
/*===========================================================================* /*===========================================================================*
* mii_print_techab * * mii_print_techab *
*===========================================================================*/ *===========================================================================*/
PUBLIC void mii_print_techab(techab) PUBLIC void mii_print_techab(u16_t techab)
u16_t techab;
{ {
int fs, ft; int fs, ft;

View file

@ -111,8 +111,8 @@ Definitions for the Media Independent (Ethernet) Interface
#define MII_ESTAT_RES 0x0FFF /* Reserved */ #define MII_ESTAT_RES 0x0FFF /* Reserved */
/* 0x10 ... 0x1F */ /* Vendor Specific */ /* 0x10 ... 0x1F */ /* Vendor Specific */
_PROTOTYPE( void mii_print_stat_speed, (U16_t stat, U16_t extstat) ); _PROTOTYPE( void mii_print_stat_speed, (u16_t stat, u16_t extstat) );
_PROTOTYPE( void mii_print_techab, (U16_t techab) ); _PROTOTYPE( void mii_print_techab, (u16_t techab) );
#endif #endif
/* /*

View file

@ -94,25 +94,22 @@ PUBLIC re_t re_table[RE_PORT_NR];
static u16_t eth_ign_proto; static u16_t eth_ign_proto;
static tmra_ut rl_watchdog; static tmra_ut rl_watchdog;
FORWARD _PROTOTYPE( unsigned my_inb, (U16_t port) ); static unsigned my_inb(u16_t port) {
FORWARD _PROTOTYPE( unsigned my_inw, (U16_t port) );
FORWARD _PROTOTYPE( unsigned my_inl, (U16_t port) );
static unsigned my_inb(U16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inb(port, &value)) !=OK) if ((s=sys_inb(port, &value)) !=OK)
printf("RTL8139: warning, sys_inb failed: %d\n", s); printf("RTL8139: warning, sys_inb failed: %d\n", s);
return value; return value;
} }
static unsigned my_inw(U16_t port) { static unsigned my_inw(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inw(port, &value)) !=OK) if ((s=sys_inw(port, &value)) !=OK)
printf("RTL8139: warning, sys_inw failed: %d\n", s); printf("RTL8139: warning, sys_inw failed: %d\n", s);
return value; return value;
} }
static unsigned my_inl(U16_t port) { static unsigned my_inl(u16_t port) {
U32_t value; u32_t value;
int s; int s;
if ((s=sys_inl(port, &value)) !=OK) if ((s=sys_inl(port, &value)) !=OK)
printf("RTL8139: warning, sys_inl failed: %d\n", s); printf("RTL8139: warning, sys_inl failed: %d\n", s);
@ -122,17 +119,17 @@ static unsigned my_inl(U16_t port) {
#define rl_inw(port, offset) (my_inw((port) + (offset))) #define rl_inw(port, offset) (my_inw((port) + (offset)))
#define rl_inl(port, offset) (my_inl((port) + (offset))) #define rl_inl(port, offset) (my_inl((port) + (offset)))
static void my_outb(U16_t port, u8_t value) { static void my_outb(u16_t port, u8_t value) {
int s; int s;
if ((s=sys_outb(port, value)) !=OK) if ((s=sys_outb(port, value)) !=OK)
printf("RTL8139: warning, sys_outb failed: %d\n", s); printf("RTL8139: warning, sys_outb failed: %d\n", s);
} }
static void my_outw(U16_t port, U16_t value) { static void my_outw(u16_t port, u16_t value) {
int s; int s;
if ((s=sys_outw(port, value)) !=OK) if ((s=sys_outw(port, value)) !=OK)
printf("RTL8139: warning, sys_outw failed: %d\n", s); printf("RTL8139: warning, sys_outw failed: %d\n", s);
} }
static void my_outl(U16_t port, U32_t value) { static void my_outl(u16_t port, u32_t value) {
int s; int s;
if ((s=sys_outl(port, value)) !=OK) if ((s=sys_outl(port, value)) !=OK)
printf("RTL8139: warning, sys_outl failed: %d\n", s); printf("RTL8139: warning, sys_outl failed: %d\n", s);
@ -158,9 +155,9 @@ _PROTOTYPE( static void rl_writev, (const message *mp, int from_int,
_PROTOTYPE( static void rl_writev_s, (const message *mp, int from_int) ); _PROTOTYPE( static void rl_writev_s, (const message *mp, int from_int) );
_PROTOTYPE( static void rl_check_ints, (re_t *rep) ); _PROTOTYPE( static void rl_check_ints, (re_t *rep) );
_PROTOTYPE( static void rl_report_link, (re_t *rep) ); _PROTOTYPE( static void rl_report_link, (re_t *rep) );
_PROTOTYPE( static void mii_print_techab, (U16_t techab) ); _PROTOTYPE( static void mii_print_techab, (u16_t techab) );
_PROTOTYPE( static void mii_print_stat_speed, (U16_t stat, _PROTOTYPE( static void mii_print_stat_speed, (u16_t stat,
U16_t extstat) ); u16_t extstat) );
_PROTOTYPE( static void rl_clear_rx, (re_t *rep) ); _PROTOTYPE( static void rl_clear_rx, (re_t *rep) );
_PROTOTYPE( static void rl_do_reset, (re_t *rep) ); _PROTOTYPE( static void rl_do_reset, (re_t *rep) );
_PROTOTYPE( static void rl_getstat, (message *mp) ); _PROTOTYPE( static void rl_getstat, (message *mp) );
@ -1918,8 +1915,7 @@ resspeed:
} }
static void mii_print_techab(techab) static void mii_print_techab(u16_t techab)
u16_t techab;
{ {
int fs, ft; int fs, ft;
if ((techab & MII_ANA_SEL_M) != MII_ANA_SEL_802_3) if ((techab & MII_ANA_SEL_M) != MII_ANA_SEL_802_3)
@ -1991,9 +1987,7 @@ u16_t techab;
} }
} }
static void mii_print_stat_speed(stat, extstat) static void mii_print_stat_speed(u16_t stat, u16_t extstat)
u16_t stat;
u16_t extstat;
{ {
int fs, ft; int fs, ft;
fs= 1; fs= 1;
@ -2093,8 +2087,7 @@ u16_t extstat;
/*===========================================================================* /*===========================================================================*
* rl_clear_rx * * rl_clear_rx *
*===========================================================================*/ *===========================================================================*/
static void rl_clear_rx(rep) static void rl_clear_rx(re_t *rep)
re_t *rep;
{ {
port_t port; port_t port;
u8_t cr; u8_t cr;
@ -2726,7 +2719,7 @@ timer_t *tp;
_PROTOTYPE( static void rtl_init, (struct dpeth *dep) ); _PROTOTYPE( static void rtl_init, (struct dpeth *dep) );
_PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) ); _PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) );
_PROTOTYPE( static void ee_wen, (dpeth_t *dep) ); _PROTOTYPE( static void ee_wen, (dpeth_t *dep) );
_PROTOTYPE( static void set_ee_word, (dpeth_t *dep, int a, U16_t w) ); _PROTOTYPE( static void set_ee_word, (dpeth_t *dep, int a, u16_t w) );
_PROTOTYPE( static void ee_wds, (dpeth_t *dep) ); _PROTOTYPE( static void ee_wds, (dpeth_t *dep) );
static void rtl_init(dep) static void rtl_init(dep)
@ -2882,7 +2875,7 @@ dpeth_t *dep;
/* micro_delay(1); */ /* Is this required? */ /* micro_delay(1); */ /* Is this required? */
} }
static void set_ee_word(dep, a, w) static void set_ee_word(dpeth_t *dep, int a, u16_t w)
dpeth_t *dep; dpeth_t *dep;
int a; int a;
u16_t w; u16_t w;

View file

@ -182,10 +182,7 @@ static re_t re_table[RE_PORT_NR];
static u16_t eth_ign_proto; static u16_t eth_ign_proto;
static timer_t rl_watchdog; static timer_t rl_watchdog;
FORWARD _PROTOTYPE(unsigned my_inb, (U16_t port)); static unsigned my_inb(u16_t port)
FORWARD _PROTOTYPE(unsigned my_inw, (U16_t port));
FORWARD _PROTOTYPE(unsigned my_inl, (U16_t port));
static unsigned my_inb(U16_t port)
{ {
u32_t value; u32_t value;
int s; int s;
@ -193,7 +190,7 @@ static unsigned my_inb(U16_t port)
printf("RTL8169: warning, sys_inb failed: %d\n", s); printf("RTL8169: warning, sys_inb failed: %d\n", s);
return value; return value;
} }
static unsigned my_inw(U16_t port) static unsigned my_inw(u16_t port)
{ {
u32_t value; u32_t value;
int s; int s;
@ -201,9 +198,9 @@ static unsigned my_inw(U16_t port)
printf("RTL8169: warning, sys_inw failed: %d\n", s); printf("RTL8169: warning, sys_inw failed: %d\n", s);
return value; return value;
} }
static unsigned my_inl(U16_t port) static unsigned my_inl(u16_t port)
{ {
U32_t value; u32_t value;
int s; int s;
if ((s = sys_inl(port, &value)) != OK) if ((s = sys_inl(port, &value)) != OK)
printf("RTL8169: warning, sys_inl failed: %d\n", s); printf("RTL8169: warning, sys_inl failed: %d\n", s);
@ -213,21 +210,21 @@ static unsigned my_inl(U16_t port)
#define rl_inw(port, offset) (my_inw((port) + (offset))) #define rl_inw(port, offset) (my_inw((port) + (offset)))
#define rl_inl(port, offset) (my_inl((port) + (offset))) #define rl_inl(port, offset) (my_inl((port) + (offset)))
static void my_outb(U16_t port, u8_t value) static void my_outb(u16_t port, u8_t value)
{ {
int s; int s;
if ((s = sys_outb(port, value)) != OK) if ((s = sys_outb(port, value)) != OK)
printf("RTL8169: warning, sys_outb failed: %d\n", s); printf("RTL8169: warning, sys_outb failed: %d\n", s);
} }
static void my_outw(U16_t port, U16_t value) static void my_outw(u16_t port, u16_t value)
{ {
int s; int s;
if ((s = sys_outw(port, value)) != OK) if ((s = sys_outw(port, value)) != OK)
printf("RTL8169: warning, sys_outw failed: %d\n", s); printf("RTL8169: warning, sys_outw failed: %d\n", s);
} }
static void my_outl(U16_t port, U32_t value) static void my_outl(u16_t port, u32_t value)
{ {
int s; int s;
@ -410,7 +407,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
exit(0); exit(0);
} }
static void mdio_write(U16_t port, int regaddr, int value) static void mdio_write(u16_t port, int regaddr, int value)
{ {
int i; int i;
@ -428,7 +425,7 @@ static void mdio_write(U16_t port, int regaddr, int value)
} }
} }
static int mdio_read(U16_t port, int regaddr) static int mdio_read(u16_t port, int regaddr)
{ {
int i, value = -1; int i, value = -1;

View file

@ -13,7 +13,6 @@
#include <minix/types.h> /* u8_t, u16_t, u32_t needed */ #include <minix/types.h> /* u8_t, u16_t, u32_t needed */
typedef u16_t port_t; typedef u16_t port_t;
typedef U16_t Port_t;
/* We have different granularities of port I/O: 8, 16, 32 bits. /* We have different granularities of port I/O: 8, 16, 32 bits.
* Also see <ibm/portio.h>, which has functions for bytes, words, * Also see <ibm/portio.h>, which has functions for bytes, words,

View file

@ -11,18 +11,18 @@ Created: Jan 15, 1992 by Philip Homburg
#include <minix/types.h> #include <minix/types.h>
#endif #endif
unsigned inb(U16_t _port); unsigned inb(u16_t _port);
unsigned inw(U16_t _port); unsigned inw(u16_t _port);
unsigned inl(U32_t _port); unsigned inl(u32_t _port);
void outb(U16_t _port, u8_t _value); void outb(u16_t _port, u8_t _value);
void outw(U16_t _port, U16_t _value); void outw(u16_t _port, u16_t _value);
void outl(U16_t _port, U32_t _value); void outl(u16_t _port, u32_t _value);
void insb(U16_t _port, void *_buf, size_t _count); void insb(u16_t _port, void *_buf, size_t _count);
void insw(U16_t _port, void *_buf, size_t _count); void insw(u16_t _port, void *_buf, size_t _count);
void insl(U16_t _port, void *_buf, size_t _count); void insl(u16_t _port, void *_buf, size_t _count);
void outsb(U16_t _port, void *_buf, size_t _count); void outsb(u16_t _port, void *_buf, size_t _count);
void outsw(U16_t _port, void *_buf, size_t _count); void outsw(u16_t _port, void *_buf, size_t _count);
void outsl(U16_t _port, void *_buf, size_t _count); void outsl(u16_t _port, void *_buf, size_t _count);
void intr_disable(void); void intr_disable(void);
void intr_enable(void); void intr_enable(void);

View file

@ -101,33 +101,6 @@ typedef long off_t; /* offset within a file */
typedef int pid_t; /* process id (must be signed) */ typedef int pid_t; /* process id (must be signed) */
typedef short uid_t; /* user id */ typedef short uid_t; /* user id */
/* The following types are needed because MINIX uses K&R style function
* definitions (for maximum portability). When a short, such as dev_t, is
* passed to a function with a K&R definition, the compiler automatically
* promotes it to an int. The prototype must contain an int as the parameter,
* not a short, because an int is what an old-style function definition
* expects. Thus using dev_t in a prototype would be incorrect. It would be
* sufficient to just use int instead of dev_t in the prototypes, but Dev_t
* is clearer.
*/
typedef unsigned long U32_t;
typedef int I16_t;
typedef long I32_t;
#if _EM_WSIZE == 2
/*typedef unsigned int Ino_t; Ino_t is now 32 bits */
typedef unsigned int Zone1_t;
typedef unsigned int Bitchunk_t;
typedef unsigned int U16_t;
#else /* _EM_WSIZE == 4, or _EM_WSIZE undefined */
/*typedef int Ino_t; Ino_t is now 32 bits */
typedef int Zone1_t;
typedef int Bitchunk_t;
typedef int U16_t;
#endif /* _EM_WSIZE == 2, etc */
/* Signal handler type, e.g. SIG_IGN */ /* Signal handler type, e.g. SIG_IGN */
typedef void _PROTOTYPE( (*sighandler_t), (int) ); typedef void _PROTOTYPE( (*sighandler_t), (int) );

View file

@ -17,7 +17,6 @@ typedef struct ether_addr
} ether_addr_t; } ether_addr_t;
typedef u16_t ether_type_t; typedef u16_t ether_type_t;
typedef U16_t Ether_type_t;
#define ETH_ARP_PROTO 0x806 #define ETH_ARP_PROTO 0x806
#define ETH_IP_PROTO 0x800 #define ETH_IP_PROTO 0x800

View file

@ -5,6 +5,6 @@ server/ip/gen/oneCsum.h
#ifndef __SERVER__IP__GEN__ONECSUM_H__ #ifndef __SERVER__IP__GEN__ONECSUM_H__
#define __SERVER__IP__GEN__ONECSUM_H__ #define __SERVER__IP__GEN__ONECSUM_H__
u16_t oneC_sum _ARGS(( U16_t prev, void *data, size_t data_len )); u16_t oneC_sum _ARGS(( u16_t prev, void *data, size_t data_len ));
#endif /* __SERVER__IP__GEN__ONECSUM_H__ */ #endif /* __SERVER__IP__GEN__ONECSUM_H__ */

View file

@ -99,7 +99,7 @@ char *__hostalias _ARGS(( const char *name ));
u16_t _getshort _ARGS(( const u8_t *msgp )); u16_t _getshort _ARGS(( const u8_t *msgp ));
u32_t _getlong _ARGS(( const u8_t *msgp )); u32_t _getlong _ARGS(( const u8_t *msgp ));
void __putshort _ARGS(( U16_t s, u8_t *msgp )); void __putshort _ARGS(( u16_t s, u8_t *msgp ));
void __putlong _ARGS(( u32_t l, u8_t *msgp )); void __putlong _ARGS(( u32_t l, u8_t *msgp ));
void p_query _ARGS(( char *msg )); void p_query _ARGS(( char *msg ));

View file

@ -14,6 +14,5 @@ server/ip/gen/tcp.h
#define TCPPORT_RESERVED 1024 #define TCPPORT_RESERVED 1024
typedef u16_t tcpport_t; typedef u16_t tcpport_t;
typedef U16_t Tcpport_t; /* for use in prototypes */
#endif /* __SERVER__IP__GEN__TCP_H__ */ #endif /* __SERVER__IP__GEN__TCP_H__ */

View file

@ -6,7 +6,6 @@ server/ip/gen/udp.h
#define __SERVER__IP__GEN__UDP_H__ #define __SERVER__IP__GEN__UDP_H__
typedef u16_t udpport_t; typedef u16_t udpport_t;
typedef U16_t Udpport_t;
#define UDP_HDR_SIZE 8 #define UDP_HDR_SIZE 8
#define UDP_IO_HDR_SIZE 16 #define UDP_IO_HDR_SIZE 16

View file

@ -48,7 +48,7 @@ PUBLIC void enable_iop(struct proc *pp)
/*===========================================================================* /*===========================================================================*
* seg2phys * * seg2phys *
*===========================================================================*/ *===========================================================================*/
PUBLIC phys_bytes seg2phys(const U16_t seg) PUBLIC phys_bytes seg2phys(const u16_t seg)
{ {
/* Return the base address of a segment, with seg being a /* Return the base address of a segment, with seg being a
* register, or a 286/386 segment selector. * register, or a 286/386 segment selector.

View file

@ -75,10 +75,10 @@ _PROTOTYPE( void write_cr0, (unsigned long value) );
_PROTOTYPE( unsigned long read_cr4, (void) ); _PROTOTYPE( unsigned long read_cr4, (void) );
_PROTOTYPE( void write_cr4, (unsigned long value) ); _PROTOTYPE( void write_cr4, (unsigned long value) );
_PROTOTYPE( unsigned long read_cpu_flags, (void) ); _PROTOTYPE( unsigned long read_cpu_flags, (void) );
_PROTOTYPE( void phys_insb, (U16_t port, phys_bytes buf, size_t count) ); _PROTOTYPE( void phys_insb, (u16_t port, phys_bytes buf, size_t count) );
_PROTOTYPE( void phys_insw, (U16_t port, phys_bytes buf, size_t count) ); _PROTOTYPE( void phys_insw, (u16_t port, phys_bytes buf, size_t count) );
_PROTOTYPE( void phys_outsb, (U16_t port, phys_bytes buf, size_t count) ); _PROTOTYPE( void phys_outsb, (u16_t port, phys_bytes buf, size_t count) );
_PROTOTYPE( void phys_outsw, (U16_t port, phys_bytes buf, size_t count) ); _PROTOTYPE( void phys_outsw, (u16_t port, phys_bytes buf, size_t count) );
_PROTOTYPE( u32_t read_cr3, (void) ); _PROTOTYPE( u32_t read_cr3, (void) );
_PROTOTYPE( void reload_cr3, (void) ); _PROTOTYPE( void reload_cr3, (void) );
_PROTOTYPE( void phys_memset, (phys_bytes ph, u32_t c, phys_bytes bytes)); _PROTOTYPE( void phys_memset, (phys_bytes ph, u32_t c, phys_bytes bytes));

View file

@ -53,8 +53,8 @@ _PROTOTYPE( int isokendpt_f, (endpoint_t e, int *p, int f) );
_PROTOTYPE( void check_ticks_left, (struct proc *p)); _PROTOTYPE( void check_ticks_left, (struct proc *p));
/* start.c */ /* start.c */
_PROTOTYPE( void cstart, (U16_t cs, U16_t ds, U16_t mds, _PROTOTYPE( void cstart, (u16_t cs, u16_t ds, u16_t mds,
U16_t parmoff, U16_t parmsize) ); u16_t parmoff, u16_t parmsize) );
/* system.c */ /* system.c */
_PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) ); _PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) );
@ -142,7 +142,7 @@ _PROTOTYPE( phys_bytes umap_remote, (const struct proc* rp, int seg,
vir_bytes vir_addr, vir_bytes bytes) ); vir_bytes vir_addr, vir_bytes bytes) );
_PROTOTYPE( phys_bytes umap_virtual, (struct proc* rp, _PROTOTYPE( phys_bytes umap_virtual, (struct proc* rp,
int seg, vir_bytes vir_addr, vir_bytes bytes) ); int seg, vir_bytes vir_addr, vir_bytes bytes) );
_PROTOTYPE( phys_bytes seg2phys, (U16_t) ); _PROTOTYPE( phys_bytes seg2phys, (u16_t) );
_PROTOTYPE( int vm_phys_memset, (phys_bytes source, u8_t pattern, _PROTOTYPE( int vm_phys_memset, (phys_bytes source, u8_t pattern,
phys_bytes count) ); phys_bytes count) );
_PROTOTYPE( vir_bytes alloc_remote_segment, (u32_t *, segframe_t *, _PROTOTYPE( vir_bytes alloc_remote_segment, (u32_t *, segframe_t *,

View file

@ -15,10 +15,13 @@ FORWARD _PROTOTYPE( char *get_value, (const char *params, const char *key));
/*===========================================================================* /*===========================================================================*
* cstart * * cstart *
*===========================================================================*/ *===========================================================================*/
PUBLIC void cstart(cs, ds, mds, parmoff, parmsize) PUBLIC void cstart(
U16_t cs, ds; /* kernel code and data segment */ u16_t cs, /* kernel code segment */
U16_t mds; /* monitor data segment */ u16_t ds, /* kernel data segment */
U16_t parmoff, parmsize; /* boot parameters offset and length */ u16_t mds, /* monitor data segment */
u16_t parmoff, /* boot parameters offset */
u16_t parmsize /* boot parameters length */
)
{ {
/* Perform system initializations prior to calling main(). Most settings are /* Perform system initializations prior to calling main(). Most settings are
* determined with help of the environment strings passed by MINIX' loader. * determined with help of the environment strings passed by MINIX' loader.
@ -111,9 +114,10 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */
* get_value * * get_value *
*===========================================================================*/ *===========================================================================*/
PRIVATE char *get_value(params, name) PRIVATE char *get_value(
const char *params; /* boot monitor parameters */ const char *params, /* boot monitor parameters */
const char *name; /* key to look up */ const char *name /* key to look up */
)
{ {
/* Get environment value - kernel version of getenv to avoid setting up the /* Get environment value - kernel version of getenv to avoid setting up the
* usual environment array. * usual environment array.

View file

@ -6,7 +6,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <net/gen/oneCsum.h> #include <net/gen/oneCsum.h>
u16_t oneC_sum(U16_t prev, void *data, size_t size) u16_t oneC_sum(u16_t prev, void *data, size_t size)
{ {
u8_t *dptr; u8_t *dptr;
size_t n; size_t n;

View file

@ -42,7 +42,7 @@ int dn_skipname _ARGS(( const u_char *comp_dn, const u_char *eom ));
#include <stdio.h> #include <stdio.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
static dn_find(); static int dn_find();
#endif #endif
#ifdef __STDC__ #ifdef __STDC__
@ -325,9 +325,7 @@ getlong(msgp)
void void
putshort(s, msgp) putshort(u16_t s, u8_t *msgp)
register U16_t s;
register u8_t *msgp;
{ {
msgp[1] = s; msgp[1] = s;
@ -335,9 +333,7 @@ putshort(s, msgp)
} }
void void
putlong(l, msgp) putlong(u32_t l, u8_t *msgp)
register u32_t l;
register u8_t *msgp;
{ {
msgp[3] = l; msgp[3] = l;

View file

@ -81,11 +81,9 @@ static char sccsid[] = "@(#)res_send.c 6.27 (Berkeley) 2/24/91";
#include <net/gen/udp_hdr.h> #include <net/gen/udp_hdr.h>
#include <net/gen/udp_io.h> #include <net/gen/udp_io.h>
static int tcp_connect _ARGS(( ipaddr_t host, Tcpport_t port, int *terrno ));
static int tcpip_writeall _ARGS(( int fd, const char *buf, size_t siz ));
static int udp_connect _ARGS(( void )); static int udp_connect _ARGS(( void ));
static int udp_sendto _ARGS(( int fd, const char *buf, unsigned buflen, static int udp_sendto _ARGS(( int fd, const char *buf, unsigned buflen,
ipaddr_t addr, Udpport_t port )); ipaddr_t addr, udpport_t port ));
static int udp_receive _ARGS(( int fd, char *buf, unsigned buflen, static int udp_receive _ARGS(( int fd, char *buf, unsigned buflen,
time_t timeout )); time_t timeout ));
@ -718,10 +716,7 @@ _res_close()
} }
#if _MINIX #if _MINIX
static int tcp_connect(host, port, terrno) static int tcp_connect(ipaddr_t host, tcpport_t port, int *terrno)
ipaddr_t host;
tcpport_t port;
int *terrno;
{ {
char *dev_name; char *dev_name;
int fd; int fd;
@ -810,12 +805,13 @@ static int udp_connect()
return fd; return fd;
} }
static int udp_sendto(fd, buf, buflen, addr, port) static int udp_sendto(
int fd; int fd,
const char *buf; const char *buf,
unsigned buflen; unsigned buflen,
ipaddr_t addr; ipaddr_t addr,
udpport_t port; udpport_t port
)
{ {
char *newbuf; char *newbuf;
udp_io_hdr_t *udp_io_hdr; udp_io_hdr_t *udp_io_hdr;
@ -843,11 +839,7 @@ udpport_t port;
return r; return r;
} }
static int udp_receive(fd, buf, buflen, timeout) static int udp_receive(int fd, char *buf, unsigned buflen, time_t timeout)
int fd;
char *buf;
unsigned buflen;
time_t timeout;
{ {
char *newbuf; char *newbuf;
udp_io_hdr_t *udp_io_hdr; udp_io_hdr_t *udp_io_hdr;

View file

@ -3,7 +3,6 @@
* Author: Kees J. Bot * Author: Kees J. Bot
* 31 Jan 1994 * 31 Jan 1994
*/ */
#define nil 0
#define open _open #define open _open
#define fcntl _fcntl #define fcntl _fcntl
#define read _read #define read _read
@ -45,7 +44,7 @@ int setgrent(void)
{ {
if (grfd >= 0) endgrent(); if (grfd >= 0) endgrent();
if (grfile == nil) grfile= GROUP; if (grfile == NULL) grfile= GROUP;
if ((grfd= open(grfile, O_RDONLY)) < 0) return -1; if ((grfd= open(grfile, O_RDONLY)) < 0) return -1;
(void) fcntl(grfd, F_SETFD, fcntl(grfd, F_GETFD) | FD_CLOEXEC); (void) fcntl(grfd, F_SETFD, fcntl(grfd, F_GETFD) | FD_CLOEXEC);
@ -87,10 +86,10 @@ static char *scan_punct(int punct)
for (;;) { for (;;) {
last= lineptr; last= lineptr;
if (*lineptr == 0) return nil; if (*lineptr == 0) return NULL;
if (*lineptr == '\n') break; if (*lineptr == '\n') break;
if (*lineptr++ == punct) break; if (*lineptr++ == punct) break;
if (lineptr[-1] == ':') return nil; /* :::,,,:,,,? */ if (lineptr[-1] == ':') return NULL; /* :::,,,:,,,? */
} }
*last= 0; *last= 0;
return field; return field;
@ -103,25 +102,25 @@ struct group *getgrent(void)
char **mem; char **mem;
/* Open the file if not yet open. */ /* Open the file if not yet open. */
if (grfd < 0 && setgrent() < 0) return nil; if (grfd < 0 && setgrent() < 0) return NULL;
/* Until a good line is read. */ /* Until a good line is read. */
for (;;) { for (;;) {
if (!getline()) return nil; /* EOF or corrupt. */ if (!getline()) return NULL; /* EOF or corrupt. */
if ((entry.gr_name= scan_punct(':')) == nil) continue; if ((entry.gr_name= scan_punct(':')) == NULL) continue;
if ((entry.gr_passwd= scan_punct(':')) == nil) continue; if ((entry.gr_passwd= scan_punct(':')) == NULL) continue;
if ((p= scan_punct(':')) == nil) continue; if ((p= scan_punct(':')) == NULL) continue;
entry.gr_gid= strtol(p, nil, 0); entry.gr_gid= strtol(p, NULL, 0);
entry.gr_mem= mem= members; entry.gr_mem= mem= members;
if (*lineptr != '\n') { if (*lineptr != '\n') {
do { do {
if ((*mem= scan_punct(',')) == nil) goto again; if ((*mem= scan_punct(',')) == NULL) goto again;
if (mem < arraylimit(members) - 1) mem++; if (mem < arraylimit(members) - 1) mem++;
} while (*lineptr != 0); } while (*lineptr != 0);
} }
*mem= nil; *mem= NULL;
return &entry; return &entry;
again:; again:;
} }
@ -133,7 +132,7 @@ struct group *getgrgid(gid_t gid)
struct group *gr; struct group *gr;
endgrent(); endgrent();
while ((gr= getgrent()) != nil && gr->gr_gid != gid) {} while ((gr= getgrent()) != NULL && gr->gr_gid != gid) {}
endgrent(); endgrent();
return gr; return gr;
} }
@ -144,7 +143,7 @@ struct group *getgrnam(const char *name)
struct group *gr; struct group *gr;
endgrent(); endgrent();
while ((gr= getgrent()) != nil && strcmp(gr->gr_name, name) != 0) {} while ((gr= getgrent()) != NULL && strcmp(gr->gr_name, name) != 0) {}
endgrent(); endgrent();
return gr; return gr;
} }

View file

@ -3,7 +3,6 @@
* Author: Kees J. Bot * Author: Kees J. Bot
* 31 Jan 1994 * 31 Jan 1994
*/ */
#define nil 0
#define open _open #define open _open
#define fcntl _fcntl #define fcntl _fcntl
#define read _read #define read _read
@ -44,7 +43,7 @@ int setpwent(void)
{ {
if (pwfd >= 0) endpwent(); if (pwfd >= 0) endpwent();
if (pwfile == nil) pwfile= PASSWD; if (pwfile == NULL) pwfile= PASSWD;
if ((pwfd= open(pwfile, O_RDONLY)) < 0) return -1; if ((pwfd= open(pwfile, O_RDONLY)) < 0) return -1;
(void) fcntl(pwfd, F_SETFD, fcntl(pwfd, F_GETFD) | FD_CLOEXEC); (void) fcntl(pwfd, F_SETFD, fcntl(pwfd, F_GETFD) | FD_CLOEXEC);
@ -86,7 +85,7 @@ static char *scan_colon(void)
for (;;) { for (;;) {
last= lineptr; last= lineptr;
if (*lineptr == 0) return nil; if (*lineptr == 0) return NULL;
if (*lineptr == '\n') break; if (*lineptr == '\n') break;
if (*lineptr++ == ':') break; if (*lineptr++ == ':') break;
} }
@ -100,21 +99,21 @@ struct passwd *getpwent(void)
char *p; char *p;
/* Open the file if not yet open. */ /* Open the file if not yet open. */
if (pwfd < 0 && setpwent() < 0) return nil; if (pwfd < 0 && setpwent() < 0) return NULL;
/* Until a good line is read. */ /* Until a good line is read. */
for (;;) { for (;;) {
if (!getline()) return nil; /* EOF or corrupt. */ if (!getline()) return NULL; /* EOF or corrupt. */
if ((entry.pw_name= scan_colon()) == nil) continue; if ((entry.pw_name= scan_colon()) == NULL) continue;
if ((entry.pw_passwd= scan_colon()) == nil) continue; if ((entry.pw_passwd= scan_colon()) == NULL) continue;
if ((p= scan_colon()) == nil) continue; if ((p= scan_colon()) == NULL) continue;
entry.pw_uid= strtol(p, nil, 0); entry.pw_uid= strtol(p, NULL, 0);
if ((p= scan_colon()) == nil) continue; if ((p= scan_colon()) == NULL) continue;
entry.pw_gid= strtol(p, nil, 0); entry.pw_gid= strtol(p, NULL, 0);
if ((entry.pw_gecos= scan_colon()) == nil) continue; if ((entry.pw_gecos= scan_colon()) == NULL) continue;
if ((entry.pw_dir= scan_colon()) == nil) continue; if ((entry.pw_dir= scan_colon()) == NULL) continue;
if ((entry.pw_shell= scan_colon()) == nil) continue; if ((entry.pw_shell= scan_colon()) == NULL) continue;
if (*lineptr == 0) return &entry; if (*lineptr == 0) return &entry;
} }
@ -126,7 +125,7 @@ struct passwd *getpwuid(uid_t uid)
struct passwd *pw; struct passwd *pw;
endpwent(); endpwent();
while ((pw= getpwent()) != nil && pw->pw_uid != uid) {} while ((pw= getpwent()) != NULL && pw->pw_uid != uid) {}
endpwent(); endpwent();
return pw; return pw;
} }
@ -137,7 +136,7 @@ struct passwd *getpwnam(const char *name)
struct passwd *pw; struct passwd *pw;
endpwent(); endpwent();
while ((pw= getpwent()) != nil && strcmp(pw->pw_name, name) != 0) {} while ((pw= getpwent()) != NULL && strcmp(pw->pw_name, name) != 0) {}
endpwent(); endpwent();
return pw; return pw;
} }

View file

@ -2,7 +2,6 @@
* Author: Kees J. Bot * Author: Kees J. Bot
* 30 Apr 1989 * 30 Apr 1989
*/ */
#define nil 0
#define chdir _chdir #define chdir _chdir
#define closedir _closedir #define closedir _closedir
#define getcwd _getcwd #define getcwd _getcwd
@ -65,22 +64,22 @@ char *getcwd(char *path, size_t size)
char *p, *up, *dotdot; char *p, *up, *dotdot;
int cycle; int cycle;
if (path == nil || size <= 1) { errno= EINVAL; return nil; } if (path == NULL || size <= 1) { errno= EINVAL; return NULL; }
p= path + size; p= path + size;
*--p = 0; *--p = 0;
if (stat(".", &current) < 0) return nil; if (stat(".", &current) < 0) return NULL;
while (1) { while (1) {
dotdot= ".."; dotdot= "..";
if (stat(dotdot, &above) < 0) { recover(p); return nil; } if (stat(dotdot, &above) < 0) { recover(p); return NULL; }
if (above.st_dev == current.st_dev if (above.st_dev == current.st_dev
&& above.st_ino == current.st_ino) && above.st_ino == current.st_ino)
break; /* Root dir found */ break; /* Root dir found */
if ((d= opendir(dotdot)) == nil) { recover(p); return nil; } if ((d= opendir(dotdot)) == NULL) { recover(p); return NULL; }
/* Cycle is 0 for a simple inode nr search, or 1 for a search /* Cycle is 0 for a simple inode nr search, or 1 for a search
* for inode *and* device nr. * for inode *and* device nr.
@ -91,7 +90,7 @@ char *getcwd(char *path, size_t size)
char name[3 + NAME_MAX + 1]; char name[3 + NAME_MAX + 1];
tmp.st_ino= 0; tmp.st_ino= 0;
if ((entry= readdir(d)) == nil) { if ((entry= readdir(d)) == NULL) {
switch (++cycle) { switch (++cycle) {
case 1: case 1:
rewinddir(d); rewinddir(d);
@ -100,7 +99,7 @@ char *getcwd(char *path, size_t size)
closedir(d); closedir(d);
errno= ENOENT; errno= ENOENT;
recover(p); recover(p);
return nil; return NULL;
} }
} }
if (strcmp(entry->d_name, ".") == 0) continue; if (strcmp(entry->d_name, ".") == 0) continue;
@ -127,16 +126,16 @@ char *getcwd(char *path, size_t size)
closedir(d); closedir(d);
errno = ERANGE; errno = ERANGE;
recover(p); recover(p);
return nil; return NULL;
} }
closedir(d); closedir(d);
if (chdir(dotdot) < 0) { recover(p); return nil; } if (chdir(dotdot) < 0) { recover(p); return NULL; }
p= up; p= up;
current= above; current= above;
} }
if (recover(p) < 0) return nil; /* Undo all those chdir("..")'s. */ if (recover(p) < 0) return NULL; /* Undo all those chdir("..")'s. */
if (*p == 0) *--p = '/'; /* Cwd is "/" if nothing added */ if (*p == 0) *--p = '/'; /* Cwd is "/" if nothing added */
if (p > path) strcpy(path, p); /* Move string to start of path. */ if (p > path) strcpy(path, p); /* Move string to start of path. */
return path; return path;

View file

@ -2,11 +2,7 @@
#define ptrace _ptrace #define ptrace _ptrace
#include <unistd.h> #include <unistd.h>
PUBLIC long ptrace(req, pid, addr, data) PUBLIC long ptrace(int req, pid_t pid, long addr, long data)
int req;
pid_t pid;
long addr;
long data;
{ {
message m; message m;

View file

@ -371,10 +371,11 @@ int code;
enqueue_pack(icmp_port, pack); enqueue_pack(icmp_port, pack);
} }
PUBLIC void icmp_snd_mtu(port_nr, pack, mtu) PUBLIC void icmp_snd_mtu(
int port_nr; int port_nr,
acc_t *pack; acc_t *pack,
u16_t mtu; u16_t mtu
)
{ {
icmp_hdr_t *icmp_hdr; icmp_hdr_t *icmp_hdr;
icmp_port_t *icmp_port; icmp_port_t *icmp_port;

View file

@ -16,7 +16,7 @@ void icmp_snd_time_exceeded ARGS(( int port_nr, acc_t *pack, int code ));
void icmp_snd_unreachable ARGS(( int port_nr, acc_t *pack, int code )); void icmp_snd_unreachable ARGS(( int port_nr, acc_t *pack, int code ));
void icmp_snd_redirect ARGS(( int port_nr, acc_t *pack, int code, void icmp_snd_redirect ARGS(( int port_nr, acc_t *pack, int code,
ipaddr_t gw )); ipaddr_t gw ));
void icmp_snd_mtu ARGS(( int port_nr, acc_t *pack, U16_t mtu )); void icmp_snd_mtu ARGS(( int port_nr, acc_t *pack, u16_t mtu ));
#endif /* ICMP_LIB_H */ #endif /* ICMP_LIB_H */

View file

@ -15,15 +15,12 @@ Copyright 1995 Philip Homburg
THIS_FILE THIS_FILE
PUBLIC ipaddr_t ip_get_netmask (hostaddr) PUBLIC ipaddr_t ip_get_netmask (ipaddr_t hostaddr)
ipaddr_t hostaddr;
{ {
return ip_netmask(ip_nettype(hostaddr)); return ip_netmask(ip_nettype(hostaddr));
} }
PUBLIC int ip_chk_hdropt (opt, optlen) PUBLIC int ip_chk_hdropt (u8_t *opt, int optlen)
u8_t *opt;
int optlen;
{ {
int i, security_present= FALSE, lose_source_present= FALSE, int i, security_present= FALSE, lose_source_present= FALSE,
strict_source_present= FALSE, record_route_present= FALSE, strict_source_present= FALSE, record_route_present= FALSE,
@ -122,8 +119,7 @@ int optlen;
return NW_OK; return NW_OK;
} }
PUBLIC void ip_print_frags(acc) PUBLIC void ip_print_frags(acc_t *acc)
acc_t *acc;
{ {
#if DEBUG #if DEBUG
ip_hdr_t *ip_hdr; ip_hdr_t *ip_hdr;
@ -151,16 +147,14 @@ assert (acc->acc_length >= IP_MIN_HDR_SIZE);
#endif #endif
} }
PUBLIC ipaddr_t ip_get_ifaddr(port_nr) PUBLIC ipaddr_t ip_get_ifaddr(int port_nr)
int port_nr;
{ {
assert(port_nr >= 0 && port_nr < ip_conf_nr); assert(port_nr >= 0 && port_nr < ip_conf_nr);
return ip_port_table[port_nr].ip_ipaddr; return ip_port_table[port_nr].ip_ipaddr;
} }
PUBLIC nettype_t ip_nettype(ipaddr) PUBLIC nettype_t ip_nettype(ipaddr_t ipaddr)
ipaddr_t ipaddr;
{ {
u8_t highbyte; u8_t highbyte;
nettype_t nettype; nettype_t nettype;
@ -198,8 +192,7 @@ ipaddr_t ipaddr;
return nettype; return nettype;
} }
PUBLIC ipaddr_t ip_netmask(nettype) PUBLIC ipaddr_t ip_netmask(nettype_t nettype)
nettype_t nettype;
{ {
switch(nettype) switch(nettype)
{ {
@ -213,8 +206,7 @@ nettype_t nettype;
} }
#if 0 #if 0
PUBLIC char *ip_nettoa(nettype) PUBLIC char *ip_nettoa(nettype_t nettype)
nettype_t nettype;
{ {
switch(nettype) switch(nettype)
{ {

View file

@ -28,9 +28,7 @@ FORWARD acc_t *reassemble ARGS(( ip_port_t *ip_port, acc_t *pack,
FORWARD void route_packets ARGS(( event_t *ev, ev_arg_t ev_arg )); FORWARD void route_packets ARGS(( event_t *ev, ev_arg_t ev_arg ));
FORWARD int broadcast_dst ARGS(( ip_port_t *ip_port, ipaddr_t dest )); FORWARD int broadcast_dst ARGS(( ip_port_t *ip_port, ipaddr_t dest ));
PUBLIC int ip_read (fd, count) PUBLIC int ip_read(int fd, size_t count)
int fd;
size_t count;
{ {
ip_fd_t *ip_fd; ip_fd_t *ip_fd;
acc_t *pack; acc_t *pack;

View file

@ -651,11 +651,12 @@ time_t timeout;
assert(result == NW_OK); assert(result == NW_OK);
} }
PUBLIC void ipr_mtu(port_nr, dest, mtu, timeout) PUBLIC void ipr_mtu(
int port_nr; int port_nr,
ipaddr_t dest; ipaddr_t dest,
u16_t mtu; u16_t mtu,
time_t timeout; time_t timeout
)
{ {
oroute_t *oroute; oroute_t *oroute;
int result; int result;

View file

@ -81,7 +81,7 @@ void ipr_destunrch ARGS(( int port_nr, ipaddr_t dest, ipaddr_t subnetmask,
time_t timeout )); time_t timeout ));
void ipr_ttl_exc ARGS(( int port_nr, ipaddr_t dest, ipaddr_t subnetmask, void ipr_ttl_exc ARGS(( int port_nr, ipaddr_t dest, ipaddr_t subnetmask,
time_t timeout )); time_t timeout ));
void ipr_mtu ARGS(( int port_nr, ipaddr_t dest, U16_t mtu, time_t timeout )); void ipr_mtu ARGS(( int port_nr, ipaddr_t dest, u16_t mtu, time_t timeout ));
#endif /* IPR_H */ #endif /* IPR_H */

View file

@ -39,19 +39,19 @@ FORWARD int tcp_connect ARGS(( tcp_fd_t *tcp_fd ));
FORWARD int tcp_listen ARGS(( tcp_fd_t *tcp_fd, int do_listenq )); FORWARD int tcp_listen ARGS(( tcp_fd_t *tcp_fd, int do_listenq ));
FORWARD int tcp_acceptto ARGS(( tcp_fd_t *tcp_fd )); FORWARD int tcp_acceptto ARGS(( tcp_fd_t *tcp_fd ));
FORWARD tcpport_t find_unused_port ARGS(( int fd )); FORWARD tcpport_t find_unused_port ARGS(( int fd ));
FORWARD int is_unused_port ARGS(( Tcpport_t port )); FORWARD int is_unused_port ARGS(( tcpport_t port ));
FORWARD int reply_thr_put ARGS(( tcp_fd_t *tcp_fd, int reply, FORWARD int reply_thr_put ARGS(( tcp_fd_t *tcp_fd, int reply,
int for_ioctl )); int for_ioctl ));
FORWARD void reply_thr_get ARGS(( tcp_fd_t *tcp_fd, int reply, FORWARD void reply_thr_get ARGS(( tcp_fd_t *tcp_fd, int reply,
int for_ioctl )); int for_ioctl ));
FORWARD tcp_conn_t *find_conn_entry ARGS(( Tcpport_t locport, FORWARD tcp_conn_t *find_conn_entry ARGS(( tcpport_t locport,
ipaddr_t locaddr, Tcpport_t remport, ipaddr_t readaddr )); ipaddr_t locaddr, tcpport_t remport, ipaddr_t readaddr ));
FORWARD tcp_conn_t *find_empty_conn ARGS(( void )); FORWARD tcp_conn_t *find_empty_conn ARGS(( void ));
FORWARD tcp_conn_t *find_best_conn ARGS(( ip_hdr_t *ip_hdr, FORWARD tcp_conn_t *find_best_conn ARGS(( ip_hdr_t *ip_hdr,
tcp_hdr_t *tcp_hdr )); tcp_hdr_t *tcp_hdr ));
FORWARD tcp_conn_t *new_conn_for_queue ARGS(( tcp_fd_t *tcp_fd )); FORWARD tcp_conn_t *new_conn_for_queue ARGS(( tcp_fd_t *tcp_fd ));
FORWARD int maybe_listen ARGS(( ipaddr_t locaddr, Tcpport_t locport, FORWARD int maybe_listen ARGS(( ipaddr_t locaddr, tcpport_t locport,
ipaddr_t remaddr, Tcpport_t remport )); ipaddr_t remaddr, tcpport_t remport ));
FORWARD int tcp_su4connect ARGS(( tcp_fd_t *tcp_fd )); FORWARD int tcp_su4connect ARGS(( tcp_fd_t *tcp_fd ));
FORWARD void tcp_buffree ARGS(( int priority )); FORWARD void tcp_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK #ifdef BUF_CONSISTENCY_CHECK
@ -1276,8 +1276,7 @@ assert (data->acc_length == sizeof(nwio_tcpopt_t));
} }
PRIVATE tcpport_t find_unused_port(fd) PRIVATE tcpport_t find_unused_port(int fd)
int fd;
{ {
tcpport_t port, nw_port; tcpport_t port, nw_port;
@ -1297,8 +1296,7 @@ int fd;
return 0; return 0;
} }
PRIVATE int is_unused_port(port) PRIVATE int is_unused_port(tcpport_t port)
tcpport_t port;
{ {
int i; int i;
tcp_fd_t *tcp_fd; tcp_fd_t *tcp_fd;
@ -1426,11 +1424,12 @@ If no such connection exists NULL is returned.
If a connection exists without mainuser it is closed. If a connection exists without mainuser it is closed.
*/ */
PRIVATE tcp_conn_t *find_conn_entry(locport, locaddr, remport, remaddr) PRIVATE tcp_conn_t *find_conn_entry(
tcpport_t locport; tcpport_t locport,
ipaddr_t locaddr; ipaddr_t locaddr,
tcpport_t remport; tcpport_t remport,
ipaddr_t remaddr; ipaddr_t remaddr
)
{ {
tcp_conn_t *tcp_conn; tcp_conn_t *tcp_conn;
int i, state; int i, state;
@ -1682,11 +1681,12 @@ tcp_fd_t *tcp_fd;
/* /*
maybe_listen maybe_listen
*/ */
PRIVATE int maybe_listen(locaddr, locport, remaddr, remport) PRIVATE int maybe_listen(
ipaddr_t locaddr; ipaddr_t locaddr,
tcpport_t locport; tcpport_t locport,
ipaddr_t remaddr; ipaddr_t remaddr,
tcpport_t remport; tcpport_t remport
)
{ {
int i; int i;
tcp_conn_t *tcp_conn; tcp_conn_t *tcp_conn;

View file

@ -204,7 +204,7 @@ void tcp_bytesavailable ARGS(( tcp_fd_t *tcp_fd, int *bytesp ));
/* tcp_send.c */ /* tcp_send.c */
void tcp_conn_write ARGS(( tcp_conn_t *tcp_conn, int enq )); void tcp_conn_write ARGS(( tcp_conn_t *tcp_conn, int enq ));
void tcp_release_retrans ARGS(( tcp_conn_t *tcp_conn, u32_t seg_ack, void tcp_release_retrans ARGS(( tcp_conn_t *tcp_conn, u32_t seg_ack,
U16_t new_win )); u16_t new_win ));
void tcp_fast_retrans ARGS(( tcp_conn_t *tcp_conn )); void tcp_fast_retrans ARGS(( tcp_conn_t *tcp_conn ));
void tcp_set_send_timer ARGS(( tcp_conn_t *tcp_conn )); void tcp_set_send_timer ARGS(( tcp_conn_t *tcp_conn ));
void tcp_fd_write ARGS(( tcp_conn_t *tcp_conn )); void tcp_fd_write ARGS(( tcp_conn_t *tcp_conn ));

View file

@ -530,10 +530,11 @@ after_data:
tcp_release_retrans tcp_release_retrans
*/ */
PUBLIC void tcp_release_retrans(tcp_conn, seg_ack, new_win) PUBLIC void tcp_release_retrans(
tcp_conn_t *tcp_conn; tcp_conn_t *tcp_conn,
u32_t seg_ack; u32_t seg_ack,
u16_t new_win; u16_t new_win
)
{ {
tcp_fd_t *tcp_fd; tcp_fd_t *tcp_fd;
size_t size, offset; size_t size, offset;

View file

@ -40,7 +40,7 @@ FORWARD void reply_thr_get ARGS(( udp_fd_t *udp_fd, int reply,
int for_ioctl )); int for_ioctl ));
FORWARD int udp_setopt ARGS(( udp_fd_t *udp_fd )); FORWARD int udp_setopt ARGS(( udp_fd_t *udp_fd ));
FORWARD udpport_t find_unused_port ARGS(( int fd )); FORWARD udpport_t find_unused_port ARGS(( int fd ));
FORWARD int is_unused_port ARGS(( Udpport_t port )); FORWARD int is_unused_port ARGS(( udpport_t port ));
FORWARD int udp_packet2user ARGS(( udp_fd_t *udp_fd )); FORWARD int udp_packet2user ARGS(( udp_fd_t *udp_fd ));
FORWARD void restart_write_fd ARGS(( udp_fd_t *udp_fd )); FORWARD void restart_write_fd ARGS(( udp_fd_t *udp_fd ));
FORWARD u16_t pack_oneCsum ARGS(( acc_t *pack )); FORWARD u16_t pack_oneCsum ARGS(( acc_t *pack ));
@ -676,8 +676,7 @@ assert (data->acc_length == sizeof(nwio_udpopt_t));
return NW_OK; return NW_OK;
} }
PRIVATE udpport_t find_unused_port(fd) PRIVATE udpport_t find_unused_port(int fd)
int fd;
{ {
udpport_t port, nw_port; udpport_t port, nw_port;
@ -728,8 +727,7 @@ int for_ioctl;
assert (!result); assert (!result);
} }
PRIVATE int is_unused_port(port) PRIVATE int is_unused_port(udpport_t port)
udpport_t port;
{ {
int i; int i;
udp_fd_t *udp_fd; udp_fd_t *udp_fd;

View file

@ -253,16 +253,16 @@ PRIVATE int exec_newmem(
/*===========================================================================* /*===========================================================================*
* read_header * * read_header *
*===========================================================================*/ *===========================================================================*/
PRIVATE int read_header(vp, sep_id, text_bytes, data_bytes, bss_bytes, PRIVATE int read_header(
tot_bytes, pc, hdrlenp) struct vnode *vp, /* inode for reading exec file */
struct vnode *vp; /* inode for reading exec file */ int *sep_id, /* true iff sep I&D */
int *sep_id; /* true iff sep I&D */ vir_bytes *text_bytes, /* place to return text size */
vir_bytes *text_bytes; /* place to return text size */ vir_bytes *data_bytes, /* place to return initialized data size */
vir_bytes *data_bytes; /* place to return initialized data size */ vir_bytes *bss_bytes, /* place to return bss size */
vir_bytes *bss_bytes; /* place to return bss size */ phys_bytes *tot_bytes, /* place to return total size */
phys_bytes *tot_bytes; /* place to return total size */ vir_bytes *pc, /* program entry point (initial PC) */
vir_bytes *pc; /* program entry point (initial PC) */ int *hdrlenp
int *hdrlenp; )
{ {
/* Read the header and extract the text, data, bss and total sizes from it. */ /* Read the header and extract the text, data, bss and total sizes from it. */
off_t pos; off_t pos;

View file

@ -371,7 +371,7 @@ PRIVATE int mount_fs(endpoint_t fs_e)
/*===========================================================================* /*===========================================================================*
* do_umount * * do_umount *
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_umount() PUBLIC int do_umount(void)
{ {
/* Perform the umount(name) system call. */ /* Perform the umount(name) system call. */
char label[LABEL_MAX]; char label[LABEL_MAX];
@ -487,8 +487,7 @@ PUBLIC int unmount(
/*===========================================================================* /*===========================================================================*
* name_to_dev * * name_to_dev *
*===========================================================================*/ *===========================================================================*/
PRIVATE dev_t name_to_dev(allow_mountpt) PRIVATE dev_t name_to_dev(int allow_mountpt)
int allow_mountpt;
{ {
/* Convert the block special file in 'user_fullpath' to a device number. /* Convert the block special file in 'user_fullpath' to a device number.
* If the given path is not a block special file, but 'allow_mountpt' is set * If the given path is not a block special file, but 'allow_mountpt' is set
@ -533,7 +532,7 @@ PRIVATE int is_nonedev(dev_t dev)
/*===========================================================================* /*===========================================================================*
* find_free_nonedev * * find_free_nonedev *
*===========================================================================*/ *===========================================================================*/
PRIVATE dev_t find_free_nonedev() PRIVATE dev_t find_free_nonedev(void)
{ {
/* Find a free "none" pseudo device. Do not allocate it yet. /* Find a free "none" pseudo device. Do not allocate it yet.
*/ */

View file

@ -135,7 +135,7 @@ PUBLIC int req_chown(
/*===========================================================================* /*===========================================================================*
* req_create * * req_create *
*===========================================================================*/ *===========================================================================*/
int req_create( PUBLIC int req_create(
int fs_e, int fs_e,
ino_t inode_nr, ino_t inode_nr,
int omode, int omode,
@ -204,10 +204,7 @@ PUBLIC int req_flush(endpoint_t fs_e, dev_t dev)
/*===========================================================================* /*===========================================================================*
* req_fstatfs * * req_fstatfs *
*===========================================================================*/ *===========================================================================*/
PUBLIC int req_fstatfs(fs_e, who_e, buf) PUBLIC int req_fstatfs(int fs_e, int who_e, char *buf)
int fs_e;
int who_e;
char *buf;
{ {
int r; int r;
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
@ -233,11 +230,7 @@ char *buf;
/*===========================================================================* /*===========================================================================*
* req_ftrunc * * req_ftrunc *
*===========================================================================*/ *===========================================================================*/
PUBLIC int req_ftrunc(fs_e, inode_nr, start, end) PUBLIC int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
endpoint_t fs_e;
ino_t inode_nr;
off_t start;
off_t end;
{ {
message m; message m;
@ -257,13 +250,14 @@ off_t end;
/*===========================================================================* /*===========================================================================*
* req_getdents * * req_getdents *
*===========================================================================*/ *===========================================================================*/
PUBLIC int req_getdents(fs_e, inode_nr, pos, buf, size, new_pos) PUBLIC int req_getdents(
endpoint_t fs_e; endpoint_t fs_e,
ino_t inode_nr; ino_t inode_nr,
u64_t pos; u64_t pos,
char *buf; char *buf,
size_t size; size_t size,
u64_t *new_pos; u64_t *new_pos
)
{ {
int r; int r;
message m; message m;
@ -295,9 +289,7 @@ u64_t *new_pos;
/*===========================================================================* /*===========================================================================*
* req_inhibread * * req_inhibread *
*===========================================================================*/ *===========================================================================*/
PUBLIC int req_inhibread(fs_e, inode_nr) PUBLIC int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
endpoint_t fs_e;
ino_t inode_nr;
{ {
message m; message m;
@ -313,18 +305,18 @@ ino_t inode_nr;
/*===========================================================================* /*===========================================================================*
* req_link * * req_link *
*===========================================================================*/ *===========================================================================*/
PUBLIC int req_link(fs_e, link_parent, lastc, linked_file) PUBLIC int req_link(
endpoint_t fs_e; endpoint_t fs_e,
ino_t link_parent; ino_t link_parent,
char *lastc; char *lastc,
ino_t linked_file; ino_t linked_file
)
{ {
int r; int r;
cp_grant_id_t grant_id; cp_grant_id_t grant_id;
size_t len; const size_t len = strlen(lastc) + 1;
message m; message m;
len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1) if(grant_id == -1)
panic("req_link: cpf_grant_direct failed"); panic("req_link: cpf_grant_direct failed");
@ -526,9 +518,7 @@ PUBLIC int req_mknod(
/*===========================================================================* /*===========================================================================*
* req_mountpoint * * req_mountpoint *
*===========================================================================*/ *===========================================================================*/
PUBLIC int req_mountpoint(fs_e, inode_nr) PUBLIC int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
endpoint_t fs_e;
ino_t inode_nr;
{ {
message m; message m;