declaration if necessary.
/* Copy bytes from anywhere to anywhere. */
u16_t get_word(u32_t addr);
/* 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. */
void relocate(void);
/* Switch to a copy of this program. */
* 23 Dec 1991
* Based on readfs by Paul Polderman
*/
-#define nil 0
#define _POSIX_SOURCE 1
#define _MINIX 1
#include <sys/types.h>
#define R_STATE 'R' /* Runnable */
#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(int main, (int argc, char *argv []));
_PROTOTYPE(char *get_args, (struct pstat *bufp ));
_PROTOTYPE(int pstat, (int p_nr, struct pstat *bufp, int Eflag ));
_PROTOTYPE(int addrread, (int fd, phys_clicks base, vir_bytes addr,
char *buf, int nbytes ));
-_PROTOTYPE(void usage, (char *pname ));
-_PROTOTYPE(void err, (char *s ));
+_PROTOTYPE(void usage, (const char *pname ));
+_PROTOTYPE(void err, (const char *s ));
_PROTOTYPE(int gettynames, (void));
* 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").
*/
-char *tname(dev_t dev_nr)
+PRIVATE char *tname(dev_t dev_nr)
{
int i;
}
/* Return canonical task name of task p_nr; overwritten on each call (yucch) */
-char *taskname(p_nr)
-int p_nr;
+PRIVATE char *taskname(int p_nr)
{
int n;
n = _ENDPOINT_P(p_nr) + nr_tasks;
/* Prrecv prints the RECV field for process with pstat buffer pointer bufp.
* This is either "ANY", "taskname", or "(blockreason) taskname".
*/
-char *prrecv(bufp)
-struct pstat *bufp;
+PRIVATE char *prrecv(struct pstat *bufp)
{
char *blkstr, *task; /* reason for blocking and task */
static char recvstr[20];
/* 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.
*/
-int pstat(p_nr, bufp, endpoints)
-int p_nr;
-struct pstat *bufp;
-int endpoints;
+int pstat(int p_nr, struct pstat *bufp, int endpoints)
{
int p_ki = p_nr + nr_tasks; /* kernel proc index */
}
/* Addrread reads nbytes from offset addr to click base of fd into buf. */
-int addrread(fd, base, addr, buf, nbytes)
-int fd;
-phys_clicks base;
-vir_bytes addr;
-char *buf;
-int nbytes;
+int addrread(int fd, phys_clicks base, vir_bytes addr, char *buf, int nbytes)
{
if (lseek(fd, ((off_t) base << CLICK_SHIFT) + addr, 0) < 0)
return -1;
return read(fd, buf, nbytes);
}
-void usage(pname)
-char *pname;
+void usage(const char *pname)
{
fprintf(stderr, "Usage: %s [-][aeflx]\n", pname);
exit(1);
}
-void err(s)
-char *s;
+void err(const char *s)
{
extern int errno;
}
/* Fill ttyinfo by fstatting character specials in /dev. */
-int gettynames()
+int gettynames(void)
{
static char dev_path[] = "/dev/";
struct stat statbuf;
} ALREADY;
_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(long dodir, (char *d, int thislev, dev_t dev));
* directory entry, placing it in out. If this would overflow,
* return 0, otherwise 1.
*/
-int makedname(d, f, out, outlen)
-char *d;
-char *f;
-char *out;
-int outlen;
+PRIVATE int makedname(char *d, char *f, char *out, int outlen)
{
char *cp;
- int length;
+ int length = strlen(f);
- length = strlen(f);
if (strlen(d) + length + 2 > outlen) return(0);
for (cp = out; *d; *cp++ = *d++);
if (*(cp - 1) != '/') *cp++ = '/';
#define NR_ZONE_NUMS V1_NR_TZONES
#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
#define block_nr block_t
#define d_inode d1_inode
#define d_inum d_ino
#define i_size d1_size
#define i_zone d1_zone
#define zone_nr zone1_t
-#define Zone_nr Zone1_t
/* fsck - file system checker Author: Robbert van Renesse */
_PROTOTYPE(int main, (int argc, char **argv));
_PROTOTYPE(void initvars, (void));
-_PROTOTYPE(void fatal, (char *s));
+_PROTOTYPE(void fatal, (const char *s));
_PROTOTYPE(int eoln, (int c));
-_PROTOTYPE(int yes, (char *question));
-_PROTOTYPE(int atoo, (char *s));
+PRIVATE _PROTOTYPE(int yes, (const char *question));
+PRIVATE _PROTOTYPE(int atoo, (const char *s));
_PROTOTYPE(int input, (char *buf, int size));
-_PROTOTYPE(char *alloc, (unsigned nelem, unsigned elsize));
-_PROTOTYPE(void printname, (char *s));
+PRIVATE _PROTOTYPE(char *alloc, (unsigned nelem, unsigned elsize));
+PRIVATE _PROTOTYPE(void printname, (const char *s));
_PROTOTYPE(void printrec, (struct stack *sp));
_PROTOTYPE(void printpath, (int mode, int nlcr));
_PROTOTYPE(void devopen, (void));
_PROTOTYPE(void devclose, (void));
_PROTOTYPE(void devio, (block_nr bno, int dir));
_PROTOTYPE(void devread, (long offset, char *buf, int size));
-_PROTOTYPE(void devwrite, (long offset, char *buf, int size));
-_PROTOTYPE(void pr, (char *fmt, int cnt, char *s, char *p));
-_PROTOTYPE(bit_nr getnumber, (char *s));
+PRIVATE _PROTOTYPE(void devwrite, (long offset, const char *buf, int size));
+_PROTOTYPE(void pr, (const char *fmt, int cnt, const char *s, const char *p));
+_PROTOTYPE(bit_nr getnumber, (const char *s));
_PROTOTYPE(char **getlist, (char ***argv, char *type));
_PROTOTYPE(void lsuper, (void));
_PROTOTYPE(void getsuper, (void));
_PROTOTYPE(bitchunk_t *allocbitmap, (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 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 getbitmaps, (void));
_PROTOTYPE(void putbitmaps, (void));
-_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 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 chkilist, (void));
_PROTOTYPE(void getcount, (void));
_PROTOTYPE(void counterror, (Ino_t ino));
_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 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(void errzone, (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 chkindzone, (Ino_t ino, d_inode *ip, off_t *pos, Zone_nr zno, int level));
+_PROTOTYPE(int chkdirzone, (Ino_t ino, d_inode *ip, off_t pos, zone_nr zno));
+_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 chkindzone, (Ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, 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 chkfile, (Ino_t ino, d_inode *ip));
_PROTOTYPE(int chkdirectory, (Ino_t ino, d_inode *ip));
}
/* Print the string `s' and exit. */
-void fatal(s)
-char *s;
+void fatal(const char *s)
{
printf("%s\nfatal\n", s);
exit(-1);
}
/* Test for end of line. */
-int eoln(c)
-int c;
+int eoln(int c)
{
return(c == EOF || c == '\n' || c == '\r');
}
/* Ask a question and get the answer unless automatic is set. */
-int yes(question)
-char *question;
+PRIVATE int yes(const char *question)
{
- register c, answer;
+ int c, answer;
if (!repair) {
printf("\n");
}
/* Convert string to integer. Representation is octal. */
-int atoo(s)
-register char *s;
+PRIVATE int atoo(const char *s)
{
register int n = 0;
}
/* If repairing the file system, print a prompt and get a string from user. */
-int input(buf, size)
-char *buf;
-int size;
+int input(char *buf, int size)
{
register char *p = buf;
}
/* Allocate some memory and zero it. */
-char *alloc(nelem, elsize)
-unsigned nelem, elsize;
+PRIVATE char *alloc(unsigned nelem, unsigned elsize)
{
char *p;
}
/* Print the name in a directory entry. */
-void printname(s)
-char *s;
+PRIVATE void printname(const char *s)
{
register n = NAME_MAX;
int c;
/* Print the pathname given by a linked list pointed to by `sp'. The
* names are in reverse order.
*/
-void printrec(sp)
-struct stack *sp;
+void printrec(struct stack *sp)
{
if (sp->st_next != 0) {
printrec(sp->st_next);
}
/* Print the current pathname. */
-void printpath(mode, nlcr)
-int mode;
-int nlcr;
+void printpath(int mode, int nlcr)
{
if (ftop->st_next == 0)
putchar('/');
}
/* Open the device. */
-void devopen()
+void devopen(void)
{
if ((dev = open(device, repair ? O_RDWR : O_RDONLY)) < 0) {
perror(device);
}
/* Read or write a block. */
-void devio(bno, dir)
-block_nr bno;
-int dir;
+void devio(block_nr bno, int dir)
{
if (dir == READING && bno == thisblk) return;
thisblk = bno;
}
/* Read `size' bytes from the disk starting at byte `offset'. */
-void devread(offset, buf, size)
-long offset;
-char *buf;
-int size;
+void devread(long offset, char *buf, int size)
{
devio((block_nr) (offset / BLOCK_SIZE), READING);
memmove(buf, &rwbuf[(int) (offset % BLOCK_SIZE)], (size_t)size);
}
/* Write `size' bytes to the disk starting at byte `offset'. */
-void devwrite(offset, buf, size)
-long offset;
-char *buf;
-int size;
+static void devwrite(long offset, const char *buf, int size)
{
if (!repair) fatal("internal error (devwrite)");
if (size != BLOCK_SIZE) devio((block_nr) (offset / BLOCK_SIZE), READING);
}
/* Print a string with either a singular or a plural pronoun. */
-void pr(fmt, cnt, s, p)
-char *fmt, *s, *p;
-int cnt;
+void pr(const char *fmt, int cnt, const char *s, const char *p)
{
printf(fmt, cnt, cnt == 1 ? s : p);
}
/* Convert string to number. */
-bit_nr getnumber(s)
-register char *s;
+bit_nr getnumber(const char *s)
{
register bit_nr n = 0;
}
/* See if the list pointed to by `argv' contains numbers. */
-char **getlist(argv, type)
-char ***argv, *type;
+char **getlist(char ***argv, char *type)
{
register char **list = *argv;
register empty = 1;
/* Make a listing of the super block. If `repair' is set, ask the user
* for changes.
*/
-void lsuper()
+void lsuper(void)
{
char buf[80];
}
/* 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));
if (listsuper) lsuper();
}
/* Check the super block for reasonable contents. */
-void chksuper()
+void chksuper(void)
{
register n;
register off_t maxsize;
/* Make a listing of the inodes given by `clist'. If `repair' is set, ask
* the user for changes.
*/
-void lsi(clist)
-char **clist;
+void lsi(char **clist)
{
register bit_nr bit;
register ino_t ino;
}
/* Allocate `nblk' blocks worth of bitmap. */
-bitchunk_t *allocbitmap(nblk)
-int nblk;
+bitchunk_t *allocbitmap(int nblk)
{
register bitchunk_t *bitmap;
}
/* Load the bitmap starting at block `bno' from disk. */
-void loadbitmap(bitmap, bno, nblk)
-bitchunk_t *bitmap;
-block_nr bno;
-int nblk;
+void loadbitmap(bitchunk_t *bitmap, block_nr bno, int nblk)
{
register i;
register bitchunk_t *p;
}
/* Write the bitmap starting at block `bno' to disk. */
-void dumpbitmap(bitmap, bno, nblk)
-bitchunk_t *bitmap;
-block_nr bno;
-int nblk;
+void dumpbitmap(bitchunk_t *bitmap, block_nr bno, int nblk)
{
register i;
register bitchunk_t *p = bitmap;
}
/* Set the bits given by `list' in the bitmap. */
-void fillbitmap(bitmap, lwb, upb, list)
-bitchunk_t *bitmap;
-bit_nr lwb, upb;
-char **list;
+void fillbitmap(bitchunk_t *bitmap, bit_nr lwb, bit_nr upb, char **list)
{
register bit_nr bit;
/* `w1' and `w2' are differing words from two bitmaps that should be
* identical. Print what's the matter with them.
*/
-void chkword(w1, w2, bit, type, n, report)
-unsigned w1, w2;
-char *type;
-bit_nr bit;
-int *n, *report;
+void chkword(unsigned w1, unsigned w2, bit_nr bit, char *type,
+ int *n, int *report)
{
for (; (w1 | w2); w1 >>= 1, w2 >>= 1, bit++)
if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report &&
/* 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.
*/
-void chkmap(cmap, dmap, bit, blkno, nblk, type)
-bitchunk_t *cmap, *dmap;
-bit_nr bit;
-block_nr blkno;
-int nblk;
-char *type;
+void chkmap(bitchunk_t *cmap, bitchunk_t *dmap, bit_nr bit,
+ block_nr blkno, int nblk, char *type)
{
register bitchunk_t *p = dmap, *q = cmap;
int report = 1, nerr = 0;
}
/* See if the inodes that aren't allocated are cleared. */
-void chkilist()
+void chkilist(void)
{
register ino_t ino = 1;
mode_t mode;
}
/* The reference count for inode `ino' is wrong. Ask if it should be adjusted. */
-void counterror(ino)
-ino_t ino;
+void counterror(ino_t ino)
{
d_inode inode;
}
/* List the given inode. */
-void list(ino, ip)
-ino_t ino;
-d_inode *ip;
+void list(ino_t ino, d_inode *ip)
{
if (firstlist) {
firstlist = 0;
* Don't name the function remove() - that is owned by ANSI, and chaos results
* when it is a macro.
*/
-int Remove(dp)
-dir_struct *dp;
+int Remove(dir_struct *dp)
{
setbit(spec_imap, (bit_nr) dp->d_inum);
if (yes(". remove entry")) {
}
/* See if the `.' or `..' entry is as expected. */
-int chkdots(ino, pos, dp, exp)
-ino_t ino, exp;
-off_t pos;
-dir_struct *dp;
+int chkdots(ino_t ino, off_t pos, dir_struct *dp, ino_t exp)
{
char printable_name[4 * NAME_MAX + 1];
}
/* Check the name in a directory entry. */
-int chkname(ino, dp)
-ino_t ino;
-dir_struct *dp;
+int chkname(ino_t ino, dir_struct *dp)
{
register n = NAME_MAX + 1;
register char *p = dp->d_name;
/* Check a directory entry. Here the routine `descendtree' is called
* recursively to check the file or directory pointed to by the entry.
*/
-int chkentry(ino, pos, dp)
-ino_t ino;
-off_t pos;
-dir_struct *dp;
+int chkentry(ino_t ino, off_t pos, dir_struct *dp)
{
if (dp->d_inum < ROOT_INODE || dp->d_inum > sb.s_ninodes) {
printf("bad inode found in directory ");
/* 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.
*/
-int chkdirzone(ino, ip, pos, zno)
-ino_t ino;
-d_inode *ip;
-off_t pos;
-zone_nr zno;
+int chkdirzone(ino_t ino, d_inode *ip, off_t pos, zone_nr zno)
{
dir_struct dirblk[CDIRECT];
register dir_struct *dp;
}
/* There is something wrong with the given zone. Print some details. */
-void errzone(mess, zno, level, pos)
-char *mess;
-zone_nr zno;
-int level;
-off_t pos;
+void errzone(const char *mess, zone_nr zno, int level, off_t pos)
{
printf("%s zone in ", mess);
printpath(1, 0);
/* Found the given zone in the given inode. Check it, and if ok, mark it
* in the zone bitmap.
*/
-int markzone(ino, zno, level, pos)
-ino_t ino;
-zone_nr zno;
-int level;
-off_t pos;
+int markzone(ino_t ino, zone_nr zno, int level, off_t pos)
{
register bit_nr bit = (bit_nr) zno - FIRST + 1;
/* Check an indirect zone by checking all of its entries.
* The zone is split up into chunks to not allocate too much stack.
*/
-int chkindzone(ino, ip, pos, zno, level)
-ino_t ino;
-d_inode *ip;
-off_t *pos;
-zone_nr zno;
-int level;
+int chkindzone(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level)
{
zone_nr indirect[CINDIR];
register n = NR_INDIRECTS / CINDIR;
/* Return the size of a gap in the file, represented by a null zone number
* at some level of indirection.
*/
-off_t jump(level)
-int level;
+off_t jump(int level)
{
off_t power = ZONE_SIZE;
/* Check a zone, which may be either a normal data zone, a directory zone,
* or an indirect zone.
*/
-int zonechk(ino, ip, pos, zno, level)
-ino_t ino;
-d_inode *ip;
-off_t *pos;
-zone_nr zno;
-int level;
+int zonechk(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level)
{
if (level == 0) {
if ((ip->i_mode & I_TYPE) == I_DIRECTORY &&
}
/* Check a list of zones given by `zlist'. */
-int chkzones(ino, ip, pos, zlist, len, level)
-ino_t ino;
-d_inode *ip;
-off_t *pos;
-zone_nr *zlist;
-int len;
-int level;
+int chkzones(ino_t ino, d_inode *ip, off_t *pos, zone_nr *zlist,
+ int len, int level)
{
register ok = 1, i;
}
/* Check a directory by checking the contents. Check if . and .. are present. */
-int chkdirectory(ino, ip)
-ino_t ino;
-d_inode *ip;
+int chkdirectory(ino_t ino, d_inode *ip)
{
register ok;
#ifdef I_SYMBOLIC_LINK
/* Check the validity of a symbolic link. */
-int chklink(ino, ip)
-ino_t ino;
-d_inode *ip;
+int chklink(ino_t ino, d_inode *ip)
{
int ok;
}
/* Check the mode and contents of an inode. */
-int chkmode(ino, ip)
-ino_t ino;
-d_inode *ip;
+int chkmode(ino_t ino, d_inode *ip)
{
switch (ip->i_mode & I_TYPE) {
case I_REGULAR:
}
/* Check an inode. */
-int chkinode(ino, ip)
-ino_t ino;
-d_inode *ip;
+int chkinode(ino_t ino, d_inode *ip)
{
if (ino == ROOT_INODE && (ip->i_mode & I_TYPE) != I_DIRECTORY) {
printf("root inode is not a directory ");
return(0);
}
-void TimeOut(sig)
-int sig;
+void TimeOut(int sig)
{
}
-int NetConnect(port)
-u16_t port;
+int NetConnect(u16_t port)
{
-int s;
-nwio_tcpconf_t tcpconf;
-nwio_tcpcl_t tcpcopt;
+ int s;
+ nwio_tcpconf_t tcpconf;
+ nwio_tcpcl_t tcpcopt;
tcpconf.nwtc_flags = NWTC_NOFLAGS;
tcpconf.nwtc_flags |= NWTC_LP_SET | NWTC_SET_RA | NWTC_SET_RP;
_PROTOTYPE(int NetInit, (void));
_PROTOTYPE(int getreply, (struct talk_reply *reply, int timeout));
_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));
PUBLIC unsigned pci_inl(u16_t port) {
- U32_t value;
+ u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
printf("%s: warning, sys_inl failed: %d\n", DRIVER_NAME, s);
#if 0
_PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) );
_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) );
#endif
/*===========================================================================*
* mii_print_stat_speed *
*===========================================================================*/
-PUBLIC void mii_print_stat_speed(stat, extstat)
-u16_t stat;
-u16_t extstat;
+PUBLIC void mii_print_stat_speed(u16_t stat, u16_t extstat)
{
int fs, ft;
/*===========================================================================*
* mii_print_techab *
*===========================================================================*/
-PUBLIC void mii_print_techab(techab)
-u16_t techab;
+PUBLIC void mii_print_techab(u16_t techab)
{
int fs, ft;
#define MII_ESTAT_RES 0x0FFF /* Reserved */
/* 0x10 ... 0x1F */ /* Vendor Specific */
-_PROTOTYPE( void mii_print_stat_speed, (U16_t stat, U16_t extstat) );
-_PROTOTYPE( void mii_print_techab, (U16_t techab) );
+_PROTOTYPE( void mii_print_stat_speed, (u16_t stat, u16_t extstat) );
+_PROTOTYPE( void mii_print_techab, (u16_t techab) );
#endif
/*
static u16_t eth_ign_proto;
static tmra_ut rl_watchdog;
-FORWARD _PROTOTYPE( 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) {
+static unsigned my_inb(u16_t port) {
u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
printf("RTL8139: warning, sys_inb failed: %d\n", s);
return value;
}
-static unsigned my_inw(U16_t port) {
+static unsigned my_inw(u16_t port) {
u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
printf("RTL8139: warning, sys_inw failed: %d\n", s);
return value;
}
-static unsigned my_inl(U16_t port) {
- U32_t value;
+static unsigned my_inl(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
printf("RTL8139: warning, sys_inl failed: %d\n", s);
#define rl_inw(port, offset) (my_inw((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;
if ((s=sys_outb(port, value)) !=OK)
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;
if ((s=sys_outw(port, value)) !=OK)
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;
if ((s=sys_outl(port, value)) !=OK)
printf("RTL8139: warning, sys_outl failed: %d\n", s);
_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_report_link, (re_t *rep) );
-_PROTOTYPE( static void mii_print_techab, (U16_t techab) );
-_PROTOTYPE( static void mii_print_stat_speed, (U16_t stat,
- U16_t extstat) );
+_PROTOTYPE( static void mii_print_techab, (u16_t techab) );
+_PROTOTYPE( static void mii_print_stat_speed, (u16_t stat,
+ u16_t extstat) );
_PROTOTYPE( static void rl_clear_rx, (re_t *rep) );
_PROTOTYPE( static void rl_do_reset, (re_t *rep) );
_PROTOTYPE( static void rl_getstat, (message *mp) );
}
-static void mii_print_techab(techab)
-u16_t techab;
+static void mii_print_techab(u16_t techab)
{
int fs, ft;
if ((techab & MII_ANA_SEL_M) != MII_ANA_SEL_802_3)
}
}
-static void mii_print_stat_speed(stat, extstat)
-u16_t stat;
-u16_t extstat;
+static void mii_print_stat_speed(u16_t stat, u16_t extstat)
{
int fs, ft;
fs= 1;
/*===========================================================================*
* rl_clear_rx *
*===========================================================================*/
-static void rl_clear_rx(rep)
-re_t *rep;
+static void rl_clear_rx(re_t *rep)
{
port_t port;
u8_t cr;
_PROTOTYPE( static void rtl_init, (struct dpeth *dep) );
_PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) );
_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) );
static void rtl_init(dep)
/* 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;
int a;
u16_t w;
static u16_t eth_ign_proto;
static timer_t rl_watchdog;
-FORWARD _PROTOTYPE(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)
+static unsigned my_inb(u16_t port)
{
u32_t value;
int s;
printf("RTL8169: warning, sys_inb failed: %d\n", s);
return value;
}
-static unsigned my_inw(U16_t port)
+static unsigned my_inw(u16_t port)
{
u32_t value;
int s;
printf("RTL8169: warning, sys_inw failed: %d\n", s);
return value;
}
-static unsigned my_inl(U16_t port)
+static unsigned my_inl(u16_t port)
{
- U32_t value;
+ u32_t value;
int s;
if ((s = sys_inl(port, &value)) != OK)
printf("RTL8169: warning, sys_inl failed: %d\n", s);
#define rl_inw(port, offset) (my_inw((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;
if ((s = sys_outb(port, value)) != OK)
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;
if ((s = sys_outw(port, value)) != OK)
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;
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;
}
}
-static int mdio_read(U16_t port, int regaddr)
+static int mdio_read(u16_t port, int regaddr)
{
int i, value = -1;
#include <minix/types.h> /* u8_t, u16_t, u32_t needed */
typedef u16_t port_t;
-typedef U16_t Port_t;
/* We have different granularities of port I/O: 8, 16, 32 bits.
* Also see <ibm/portio.h>, which has functions for bytes, words,
#include <minix/types.h>
#endif
-unsigned inb(U16_t _port);
-unsigned inw(U16_t _port);
-unsigned inl(U32_t _port);
-void outb(U16_t _port, u8_t _value);
-void outw(U16_t _port, U16_t _value);
-void outl(U16_t _port, U32_t _value);
-void insb(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 outsb(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);
+unsigned inb(u16_t _port);
+unsigned inw(u16_t _port);
+unsigned inl(u32_t _port);
+void outb(u16_t _port, u8_t _value);
+void outw(u16_t _port, u16_t _value);
+void outl(u16_t _port, u32_t _value);
+void insb(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 outsb(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 intr_disable(void);
void intr_enable(void);
typedef int pid_t; /* process id (must be signed) */
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 */
typedef void _PROTOTYPE( (*sighandler_t), (int) );
} ether_addr_t;
typedef u16_t ether_type_t;
-typedef U16_t Ether_type_t;
#define ETH_ARP_PROTO 0x806
#define ETH_IP_PROTO 0x800
#ifndef __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__ */
u16_t _getshort _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 p_query _ARGS(( char *msg ));
#define TCPPORT_RESERVED 1024
typedef u16_t tcpport_t;
-typedef U16_t Tcpport_t; /* for use in prototypes */
#endif /* __SERVER__IP__GEN__TCP_H__ */
#define __SERVER__IP__GEN__UDP_H__
typedef u16_t udpport_t;
-typedef U16_t Udpport_t;
#define UDP_HDR_SIZE 8
#define UDP_IO_HDR_SIZE 16
/*===========================================================================*
* 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
* register, or a 286/386 segment selector.
_PROTOTYPE( unsigned long read_cr4, (void) );
_PROTOTYPE( void write_cr4, (unsigned long value) );
_PROTOTYPE( unsigned long read_cpu_flags, (void) );
-_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_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_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_outsb, (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( void reload_cr3, (void) );
_PROTOTYPE( void phys_memset, (phys_bytes ph, u32_t c, phys_bytes bytes));
_PROTOTYPE( void check_ticks_left, (struct proc *p));
/* start.c */
-_PROTOTYPE( void cstart, (U16_t cs, U16_t ds, U16_t mds,
- U16_t parmoff, U16_t parmsize) );
+_PROTOTYPE( void cstart, (u16_t cs, u16_t ds, u16_t mds,
+ u16_t parmoff, u16_t parmsize) );
/* system.c */
_PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) );
vir_bytes vir_addr, vir_bytes bytes) );
_PROTOTYPE( phys_bytes umap_virtual, (struct proc* rp,
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,
phys_bytes count) );
_PROTOTYPE( vir_bytes alloc_remote_segment, (u32_t *, segframe_t *,
/*===========================================================================*
* cstart *
*===========================================================================*/
-PUBLIC void cstart(cs, ds, mds, parmoff, parmsize)
-U16_t cs, ds; /* kernel code and data segment */
-U16_t mds; /* monitor data segment */
-U16_t parmoff, parmsize; /* boot parameters offset and length */
+PUBLIC void cstart(
+ u16_t cs, /* kernel code segment */
+ u16_t ds, /* kernel data segment */
+ 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
* determined with help of the environment strings passed by MINIX' loader.
* get_value *
*===========================================================================*/
-PRIVATE char *get_value(params, name)
- const char *params; /* boot monitor parameters */
- const char *name; /* key to look up */
+PRIVATE char *get_value(
+ const char *params, /* boot monitor parameters */
+ const char *name /* key to look up */
+)
{
/* Get environment value - kernel version of getenv to avoid setting up the
* usual environment array.
#include <sys/types.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;
size_t n;
#include <stdio.h>
#include <arpa/nameser.h>
-static dn_find();
+static int dn_find();
#endif
#ifdef __STDC__
void
-putshort(s, msgp)
- register U16_t s;
- register u8_t *msgp;
+putshort(u16_t s, u8_t *msgp)
{
msgp[1] = s;
}
void
-putlong(l, msgp)
- register u32_t l;
- register u8_t *msgp;
+putlong(u32_t l, u8_t *msgp)
{
msgp[3] = l;
#include <net/gen/udp_hdr.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_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,
time_t timeout ));
}
#if _MINIX
-static int tcp_connect(host, port, terrno)
-ipaddr_t host;
-tcpport_t port;
-int *terrno;
+static int tcp_connect(ipaddr_t host, tcpport_t port, int *terrno)
{
char *dev_name;
int fd;
return fd;
}
-static int udp_sendto(fd, buf, buflen, addr, port)
-int fd;
-const char *buf;
-unsigned buflen;
-ipaddr_t addr;
-udpport_t port;
+static int udp_sendto(
+ int fd,
+ const char *buf,
+ unsigned buflen,
+ ipaddr_t addr,
+ udpport_t port
+)
{
char *newbuf;
udp_io_hdr_t *udp_io_hdr;
return r;
}
-static int udp_receive(fd, buf, buflen, timeout)
-int fd;
-char *buf;
-unsigned buflen;
-time_t timeout;
+static int udp_receive(int fd, char *buf, unsigned buflen, time_t timeout)
{
char *newbuf;
udp_io_hdr_t *udp_io_hdr;
* Author: Kees J. Bot
* 31 Jan 1994
*/
-#define nil 0
#define open _open
#define fcntl _fcntl
#define read _read
{
if (grfd >= 0) endgrent();
- if (grfile == nil) grfile= GROUP;
+ if (grfile == NULL) grfile= GROUP;
if ((grfd= open(grfile, O_RDONLY)) < 0) return -1;
(void) fcntl(grfd, F_SETFD, fcntl(grfd, F_GETFD) | FD_CLOEXEC);
for (;;) {
last= lineptr;
- if (*lineptr == 0) return nil;
+ if (*lineptr == 0) return NULL;
if (*lineptr == '\n') break;
if (*lineptr++ == punct) break;
- if (lineptr[-1] == ':') return nil; /* :::,,,:,,,? */
+ if (lineptr[-1] == ':') return NULL; /* :::,,,:,,,? */
}
*last= 0;
return field;
char **mem;
/* 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. */
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_passwd= scan_punct(':')) == nil) continue;
- if ((p= scan_punct(':')) == nil) continue;
- entry.gr_gid= strtol(p, nil, 0);
+ if ((entry.gr_name= scan_punct(':')) == NULL) continue;
+ if ((entry.gr_passwd= scan_punct(':')) == NULL) continue;
+ if ((p= scan_punct(':')) == NULL) continue;
+ entry.gr_gid= strtol(p, NULL, 0);
entry.gr_mem= mem= members;
if (*lineptr != '\n') {
do {
- if ((*mem= scan_punct(',')) == nil) goto again;
+ if ((*mem= scan_punct(',')) == NULL) goto again;
if (mem < arraylimit(members) - 1) mem++;
} while (*lineptr != 0);
}
- *mem= nil;
+ *mem= NULL;
return &entry;
again:;
}
struct group *gr;
endgrent();
- while ((gr= getgrent()) != nil && gr->gr_gid != gid) {}
+ while ((gr= getgrent()) != NULL && gr->gr_gid != gid) {}
endgrent();
return gr;
}
struct group *gr;
endgrent();
- while ((gr= getgrent()) != nil && strcmp(gr->gr_name, name) != 0) {}
+ while ((gr= getgrent()) != NULL && strcmp(gr->gr_name, name) != 0) {}
endgrent();
return gr;
}
* Author: Kees J. Bot
* 31 Jan 1994
*/
-#define nil 0
#define open _open
#define fcntl _fcntl
#define read _read
{
if (pwfd >= 0) endpwent();
- if (pwfile == nil) pwfile= PASSWD;
+ if (pwfile == NULL) pwfile= PASSWD;
if ((pwfd= open(pwfile, O_RDONLY)) < 0) return -1;
(void) fcntl(pwfd, F_SETFD, fcntl(pwfd, F_GETFD) | FD_CLOEXEC);
for (;;) {
last= lineptr;
- if (*lineptr == 0) return nil;
+ if (*lineptr == 0) return NULL;
if (*lineptr == '\n') break;
if (*lineptr++ == ':') break;
}
char *p;
/* 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. */
for (;;) {
- if (!getline()) return nil; /* EOF or corrupt. */
-
- if ((entry.pw_name= scan_colon()) == nil) continue;
- if ((entry.pw_passwd= scan_colon()) == nil) continue;
- if ((p= scan_colon()) == nil) continue;
- entry.pw_uid= strtol(p, nil, 0);
- if ((p= scan_colon()) == nil) continue;
- entry.pw_gid= strtol(p, nil, 0);
- if ((entry.pw_gecos= scan_colon()) == nil) continue;
- if ((entry.pw_dir= scan_colon()) == nil) continue;
- if ((entry.pw_shell= scan_colon()) == nil) continue;
+ if (!getline()) return NULL; /* EOF or corrupt. */
+
+ if ((entry.pw_name= scan_colon()) == NULL) continue;
+ if ((entry.pw_passwd= scan_colon()) == NULL) continue;
+ if ((p= scan_colon()) == NULL) continue;
+ entry.pw_uid= strtol(p, NULL, 0);
+ if ((p= scan_colon()) == NULL) continue;
+ entry.pw_gid= strtol(p, NULL, 0);
+ if ((entry.pw_gecos= scan_colon()) == NULL) continue;
+ if ((entry.pw_dir= scan_colon()) == NULL) continue;
+ if ((entry.pw_shell= scan_colon()) == NULL) continue;
if (*lineptr == 0) return &entry;
}
struct passwd *pw;
endpwent();
- while ((pw= getpwent()) != nil && pw->pw_uid != uid) {}
+ while ((pw= getpwent()) != NULL && pw->pw_uid != uid) {}
endpwent();
return pw;
}
struct passwd *pw;
endpwent();
- while ((pw= getpwent()) != nil && strcmp(pw->pw_name, name) != 0) {}
+ while ((pw= getpwent()) != NULL && strcmp(pw->pw_name, name) != 0) {}
endpwent();
return pw;
}
* Author: Kees J. Bot
* 30 Apr 1989
*/
-#define nil 0
#define chdir _chdir
#define closedir _closedir
#define getcwd _getcwd
char *p, *up, *dotdot;
int cycle;
- if (path == nil || size <= 1) { errno= EINVAL; return nil; }
+ if (path == NULL || size <= 1) { errno= EINVAL; return NULL; }
p= path + size;
*--p = 0;
- if (stat(".", ¤t) < 0) return nil;
+ if (stat(".", ¤t) < 0) return NULL;
while (1) {
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
&& above.st_ino == current.st_ino)
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
* for inode *and* device nr.
char name[3 + NAME_MAX + 1];
tmp.st_ino= 0;
- if ((entry= readdir(d)) == nil) {
+ if ((entry= readdir(d)) == NULL) {
switch (++cycle) {
case 1:
rewinddir(d);
closedir(d);
errno= ENOENT;
recover(p);
- return nil;
+ return NULL;
}
}
if (strcmp(entry->d_name, ".") == 0) continue;
closedir(d);
errno = ERANGE;
recover(p);
- return nil;
+ return NULL;
}
closedir(d);
- if (chdir(dotdot) < 0) { recover(p); return nil; }
+ if (chdir(dotdot) < 0) { recover(p); return NULL; }
p= up;
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 > path) strcpy(path, p); /* Move string to start of path. */
return path;
#define ptrace _ptrace
#include <unistd.h>
-PUBLIC long ptrace(req, pid, addr, data)
-int req;
-pid_t pid;
-long addr;
-long data;
+PUBLIC long ptrace(int req, pid_t pid, long addr, long data)
{
message m;
enqueue_pack(icmp_port, pack);
}
-PUBLIC void icmp_snd_mtu(port_nr, pack, mtu)
-int port_nr;
-acc_t *pack;
-u16_t mtu;
+PUBLIC void icmp_snd_mtu(
+ int port_nr,
+ acc_t *pack,
+ u16_t mtu
+)
{
icmp_hdr_t *icmp_hdr;
icmp_port_t *icmp_port;
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,
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 */
THIS_FILE
-PUBLIC ipaddr_t ip_get_netmask (hostaddr)
-ipaddr_t hostaddr;
+PUBLIC ipaddr_t ip_get_netmask (ipaddr_t hostaddr)
{
return ip_netmask(ip_nettype(hostaddr));
}
-PUBLIC int ip_chk_hdropt (opt, optlen)
-u8_t *opt;
-int optlen;
+PUBLIC int ip_chk_hdropt (u8_t *opt, int optlen)
{
int i, security_present= FALSE, lose_source_present= FALSE,
strict_source_present= FALSE, record_route_present= FALSE,
return NW_OK;
}
-PUBLIC void ip_print_frags(acc)
-acc_t *acc;
+PUBLIC void ip_print_frags(acc_t *acc)
{
#if DEBUG
ip_hdr_t *ip_hdr;
#endif
}
-PUBLIC ipaddr_t ip_get_ifaddr(port_nr)
-int port_nr;
+PUBLIC ipaddr_t ip_get_ifaddr(int port_nr)
{
assert(port_nr >= 0 && port_nr < ip_conf_nr);
return ip_port_table[port_nr].ip_ipaddr;
}
-PUBLIC nettype_t ip_nettype(ipaddr)
-ipaddr_t ipaddr;
+PUBLIC nettype_t ip_nettype(ipaddr_t ipaddr)
{
u8_t highbyte;
nettype_t nettype;
return nettype;
}
-PUBLIC ipaddr_t ip_netmask(nettype)
-nettype_t nettype;
+PUBLIC ipaddr_t ip_netmask(nettype_t nettype)
{
switch(nettype)
{
}
#if 0
-PUBLIC char *ip_nettoa(nettype)
-nettype_t nettype;
+PUBLIC char *ip_nettoa(nettype_t nettype)
{
switch(nettype)
{
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 ));
-PUBLIC int ip_read (fd, count)
-int fd;
-size_t count;
+PUBLIC int ip_read(int fd, size_t count)
{
ip_fd_t *ip_fd;
acc_t *pack;
assert(result == NW_OK);
}
-PUBLIC void ipr_mtu(port_nr, dest, mtu, timeout)
-int port_nr;
-ipaddr_t dest;
-u16_t mtu;
-time_t timeout;
+PUBLIC void ipr_mtu(
+ int port_nr,
+ ipaddr_t dest,
+ u16_t mtu,
+ time_t timeout
+)
{
oroute_t *oroute;
int result;
time_t timeout ));
void ipr_ttl_exc ARGS(( int port_nr, ipaddr_t dest, ipaddr_t subnetmask,
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 */
FORWARD int tcp_listen ARGS(( tcp_fd_t *tcp_fd, int do_listenq ));
FORWARD int tcp_acceptto ARGS(( tcp_fd_t *tcp_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,
int for_ioctl ));
FORWARD void reply_thr_get ARGS(( tcp_fd_t *tcp_fd, int reply,
int for_ioctl ));
-FORWARD tcp_conn_t *find_conn_entry ARGS(( Tcpport_t locport,
- ipaddr_t locaddr, Tcpport_t remport, ipaddr_t readaddr ));
+FORWARD tcp_conn_t *find_conn_entry ARGS(( tcpport_t locport,
+ ipaddr_t locaddr, tcpport_t remport, ipaddr_t readaddr ));
FORWARD tcp_conn_t *find_empty_conn ARGS(( void ));
FORWARD tcp_conn_t *find_best_conn ARGS(( ip_hdr_t *ip_hdr,
tcp_hdr_t *tcp_hdr ));
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,
- ipaddr_t remaddr, Tcpport_t remport ));
+FORWARD int maybe_listen ARGS(( ipaddr_t locaddr, tcpport_t locport,
+ ipaddr_t remaddr, tcpport_t remport ));
FORWARD int tcp_su4connect ARGS(( tcp_fd_t *tcp_fd ));
FORWARD void tcp_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK
}
-PRIVATE tcpport_t find_unused_port(fd)
-int fd;
+PRIVATE tcpport_t find_unused_port(int fd)
{
tcpport_t port, nw_port;
return 0;
}
-PRIVATE int is_unused_port(port)
-tcpport_t port;
+PRIVATE int is_unused_port(tcpport_t port)
{
int i;
tcp_fd_t *tcp_fd;
If a connection exists without mainuser it is closed.
*/
-PRIVATE tcp_conn_t *find_conn_entry(locport, locaddr, remport, remaddr)
-tcpport_t locport;
-ipaddr_t locaddr;
-tcpport_t remport;
-ipaddr_t remaddr;
+PRIVATE tcp_conn_t *find_conn_entry(
+ tcpport_t locport,
+ ipaddr_t locaddr,
+ tcpport_t remport,
+ ipaddr_t remaddr
+)
{
tcp_conn_t *tcp_conn;
int i, state;
/*
maybe_listen
*/
-PRIVATE int maybe_listen(locaddr, locport, remaddr, remport)
-ipaddr_t locaddr;
-tcpport_t locport;
-ipaddr_t remaddr;
-tcpport_t remport;
+PRIVATE int maybe_listen(
+ ipaddr_t locaddr,
+ tcpport_t locport,
+ ipaddr_t remaddr,
+ tcpport_t remport
+)
{
int i;
tcp_conn_t *tcp_conn;
/* tcp_send.c */
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,
- U16_t new_win ));
+ u16_t new_win ));
void tcp_fast_retrans 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 ));
tcp_release_retrans
*/
-PUBLIC void tcp_release_retrans(tcp_conn, seg_ack, new_win)
-tcp_conn_t *tcp_conn;
-u32_t seg_ack;
-u16_t new_win;
+PUBLIC void tcp_release_retrans(
+ tcp_conn_t *tcp_conn,
+ u32_t seg_ack,
+ u16_t new_win
+)
{
tcp_fd_t *tcp_fd;
size_t size, offset;
int for_ioctl ));
FORWARD int udp_setopt ARGS(( udp_fd_t *udp_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 void restart_write_fd ARGS(( udp_fd_t *udp_fd ));
FORWARD u16_t pack_oneCsum ARGS(( acc_t *pack ));
return NW_OK;
}
-PRIVATE udpport_t find_unused_port(fd)
-int fd;
+PRIVATE udpport_t find_unused_port(int fd)
{
udpport_t port, nw_port;
assert (!result);
}
-PRIVATE int is_unused_port(port)
-udpport_t port;
+PRIVATE int is_unused_port(udpport_t port)
{
int i;
udp_fd_t *udp_fd;
/*===========================================================================*
* read_header *
*===========================================================================*/
-PRIVATE int read_header(vp, sep_id, text_bytes, data_bytes, bss_bytes,
- tot_bytes, pc, hdrlenp)
-struct vnode *vp; /* inode for reading exec file */
-int *sep_id; /* true iff sep I&D */
-vir_bytes *text_bytes; /* place to return text size */
-vir_bytes *data_bytes; /* place to return initialized data size */
-vir_bytes *bss_bytes; /* place to return bss size */
-phys_bytes *tot_bytes; /* place to return total size */
-vir_bytes *pc; /* program entry point (initial PC) */
-int *hdrlenp;
+PRIVATE int read_header(
+ struct vnode *vp, /* inode for reading exec file */
+ int *sep_id, /* true iff sep I&D */
+ vir_bytes *text_bytes, /* place to return text size */
+ vir_bytes *data_bytes, /* place to return initialized data size */
+ vir_bytes *bss_bytes, /* place to return bss size */
+ phys_bytes *tot_bytes, /* place to return total size */
+ 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;
/*===========================================================================*
* do_umount *
*===========================================================================*/
-PUBLIC int do_umount()
+PUBLIC int do_umount(void)
{
/* Perform the umount(name) system call. */
char label[LABEL_MAX];
/*===========================================================================*
* name_to_dev *
*===========================================================================*/
-PRIVATE dev_t name_to_dev(allow_mountpt)
-int allow_mountpt;
+PRIVATE dev_t name_to_dev(int allow_mountpt)
{
/* 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
/*===========================================================================*
* 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.
*/
/*===========================================================================*
* req_create *
*===========================================================================*/
-int req_create(
+PUBLIC int req_create(
int fs_e,
ino_t inode_nr,
int omode,
/*===========================================================================*
* req_fstatfs *
*===========================================================================*/
-PUBLIC int req_fstatfs(fs_e, who_e, buf)
-int fs_e;
-int who_e;
-char *buf;
+PUBLIC int req_fstatfs(int fs_e, int who_e, char *buf)
{
int r;
cp_grant_id_t grant_id;
/*===========================================================================*
* req_ftrunc *
*===========================================================================*/
-PUBLIC int req_ftrunc(fs_e, inode_nr, start, end)
-endpoint_t fs_e;
-ino_t inode_nr;
-off_t start;
-off_t end;
+PUBLIC int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
{
message m;
/*===========================================================================*
* req_getdents *
*===========================================================================*/
-PUBLIC int req_getdents(fs_e, inode_nr, pos, buf, size, new_pos)
-endpoint_t fs_e;
-ino_t inode_nr;
-u64_t pos;
-char *buf;
-size_t size;
-u64_t *new_pos;
+PUBLIC int req_getdents(
+ endpoint_t fs_e,
+ ino_t inode_nr,
+ u64_t pos,
+ char *buf,
+ size_t size,
+ u64_t *new_pos
+)
{
int r;
message m;
/*===========================================================================*
* req_inhibread *
*===========================================================================*/
-PUBLIC int req_inhibread(fs_e, inode_nr)
-endpoint_t fs_e;
-ino_t inode_nr;
+PUBLIC int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
{
message m;
/*===========================================================================*
* req_link *
*===========================================================================*/
-PUBLIC int req_link(fs_e, link_parent, lastc, linked_file)
-endpoint_t fs_e;
-ino_t link_parent;
-char *lastc;
-ino_t linked_file;
+PUBLIC int req_link(
+ endpoint_t fs_e,
+ ino_t link_parent,
+ char *lastc,
+ ino_t linked_file
+)
{
int r;
cp_grant_id_t grant_id;
- size_t len;
+ const size_t len = strlen(lastc) + 1;
message m;
- len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1)
panic("req_link: cpf_grant_direct failed");
/*===========================================================================*
* req_mountpoint *
*===========================================================================*/
-PUBLIC int req_mountpoint(fs_e, inode_nr)
-endpoint_t fs_e;
-ino_t inode_nr;
+PUBLIC int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
{
message m;