From: Kees van Reeuwijk Date: Wed, 21 Apr 2010 11:05:22 +0000 (+0000) Subject: Remove U16_t and most other similar types. Rewrite functions to ansi-style X-Git-Tag: v3.1.7~134 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/expt.png?a=commitdiff_plain;h=86a23c1fbd1cf624667ca8e8c8450db37d150ce1;p=minix.git Remove U16_t and most other similar types. Rewrite functions to ansi-style declaration if necessary. --- diff --git a/boot/boot.h b/boot/boot.h index 3b9bc6528..bdda5e242 100644 --- a/boot/boot.h +++ b/boot/boot.h @@ -93,7 +93,7 @@ void raw_copy(u32_t dstaddr, u32_t srcaddr, u32_t count); /* 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. */ diff --git a/boot/rawfs.c b/boot/rawfs.c index e77ca35e9..74c6bcf2b 100644 --- a/boot/rawfs.c +++ b/boot/rawfs.c @@ -2,7 +2,6 @@ * 23 Dec 1991 * Based on readfs by Paul Polderman */ -#define nil 0 #define _POSIX_SOURCE 1 #define _MINIX 1 #include diff --git a/commands/ps/ps.c b/commands/ps/ps.c index 46dd2fe19..2fabd0631 100644 --- a/commands/ps/ps.c +++ b/commands/ps/ps.c @@ -178,17 +178,14 @@ struct pstat { /* structure filled by pstat() */ #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)); @@ -198,7 +195,7 @@ _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; @@ -212,8 +209,7 @@ char *tname(dev_t dev_nr) } /* 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; @@ -226,8 +222,7 @@ int p_nr; /* 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]; @@ -483,10 +478,7 @@ struct pstat *bufp; /* 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 */ @@ -581,12 +573,7 @@ int endpoints; } /* 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; @@ -594,15 +581,13 @@ int nbytes; 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; @@ -615,7 +600,7 @@ char *s; } /* Fill ttyinfo by fstatting character specials in /dev. */ -int gettynames() +int gettynames(void) { static char dev_path[] = "/dev/"; struct stat statbuf; diff --git a/commands/simple/du.c b/commands/simple/du.c index d0091235b..ee3e136b6 100644 --- a/commands/simple/du.c +++ b/commands/simple/du.c @@ -66,7 +66,7 @@ typedef struct already { } 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)); @@ -86,16 +86,11 @@ int alc; * 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++ = '/'; diff --git a/commands/simple/fsck1.c b/commands/simple/fsck1.c index b36dbb8c5..87c935ca5 100644 --- a/commands/simple/fsck1.c +++ b/commands/simple/fsck1.c @@ -9,7 +9,6 @@ #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 @@ -19,7 +18,6 @@ #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 */ @@ -138,22 +136,22 @@ char answer[] = "Answer questions with y or n. Then hit RETURN"; _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)); @@ -162,12 +160,12 @@ _PROTOTYPE(void lsi, (char **clist)); _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)); @@ -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 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)); @@ -212,25 +210,22 @@ void initvars() } /* 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"); @@ -248,8 +243,7 @@ char *question; } /* Convert string to integer. Representation is octal. */ -int atoo(s) -register char *s; +PRIVATE int atoo(const char *s) { 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. */ -int input(buf, size) -char *buf; -int size; +int input(char *buf, int size) { register char *p = buf; @@ -287,8 +279,7 @@ int size; } /* Allocate some memory and zero it. */ -char *alloc(nelem, elsize) -unsigned nelem, elsize; +PRIVATE char *alloc(unsigned nelem, unsigned elsize) { char *p; @@ -298,8 +289,7 @@ unsigned nelem, elsize; } /* Print the name in a directory entry. */ -void printname(s) -char *s; +PRIVATE void printname(const char *s) { register n = NAME_MAX; int c; @@ -315,8 +305,7 @@ char *s; /* 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); @@ -326,9 +315,7 @@ struct stack *sp; } /* Print the current pathname. */ -void printpath(mode, nlcr) -int mode; -int nlcr; +void printpath(int mode, int nlcr) { if (ftop->st_next == 0) putchar('/'); @@ -346,7 +333,7 @@ int nlcr; } /* Open the device. */ -void devopen() +void devopen(void) { if ((dev = open(device, repair ? O_RDWR : O_RDONLY)) < 0) { perror(device); @@ -364,9 +351,7 @@ void devclose() } /* 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; @@ -391,20 +376,14 @@ int dir; } /* 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); @@ -414,16 +393,13 @@ int size; } /* 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; @@ -435,8 +411,7 @@ register char *s; } /* 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; @@ -455,7 +430,7 @@ char ***argv, *type; /* Make a listing of the super block. If `repair' is set, ask the user * for changes. */ -void lsuper() +void lsuper(void) { char buf[80]; @@ -483,7 +458,7 @@ void lsuper() } /* 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(); @@ -499,7 +474,7 @@ void getsuper() } /* Check the super block for reasonable contents. */ -void chksuper() +void chksuper(void) { register n; register off_t maxsize; @@ -541,8 +516,7 @@ void chksuper() /* 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; @@ -571,8 +545,7 @@ char **clist; } /* Allocate `nblk' blocks worth of bitmap. */ -bitchunk_t *allocbitmap(nblk) -int nblk; +bitchunk_t *allocbitmap(int nblk) { register bitchunk_t *bitmap; @@ -582,10 +555,7 @@ int nblk; } /* 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; @@ -597,10 +567,7 @@ int nblk; } /* 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; @@ -610,10 +577,7 @@ int nblk; } /* 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; @@ -659,11 +623,8 @@ void putbitmaps() /* `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 && @@ -679,12 +640,8 @@ int *n, *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; @@ -706,7 +663,7 @@ char *type; } /* See if the inodes that aren't allocated are cleared. */ -void chkilist() +void chkilist(void) { register ino_t ino = 1; mode_t mode; @@ -732,8 +689,7 @@ void getcount() } /* 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; @@ -799,9 +755,7 @@ void printperm(mode_t mode, int shift, int special, int overlay) } /* 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; @@ -838,8 +792,7 @@ d_inode *ip; * 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")) { @@ -887,10 +840,7 @@ register int n; } /* 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]; @@ -922,9 +872,7 @@ dir_struct *dp; } /* 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; @@ -952,10 +900,7 @@ dir_struct *dp; /* 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 "); @@ -1003,11 +948,7 @@ dir_struct *dp; /* 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; @@ -1041,11 +982,7 @@ zone_nr zno; } /* 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); @@ -1062,11 +999,7 @@ off_t pos; /* 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; @@ -1089,12 +1022,7 @@ off_t pos; /* 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; @@ -1111,8 +1039,7 @@ int level; /* 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; @@ -1125,12 +1052,7 @@ int level; /* 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 && @@ -1143,13 +1065,8 @@ int level; } /* 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; @@ -1183,9 +1100,7 @@ d_inode *ip; } /* 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; @@ -1207,9 +1122,7 @@ d_inode *ip; #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; @@ -1255,9 +1168,7 @@ d_inode *ip; } /* 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: @@ -1290,9 +1201,7 @@ d_inode *ip; } /* 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 "); diff --git a/commands/talk/net.c b/commands/talk/net.c index 6dd6beb24..eee4acfc5 100644 --- a/commands/talk/net.c +++ b/commands/talk/net.c @@ -195,17 +195,15 @@ udp_io_hdr_t *udp_io_hdr; 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; diff --git a/commands/talk/net.h b/commands/talk/net.h index 56358763f..8d7d725be 100644 --- a/commands/talk/net.h +++ b/commands/talk/net.h @@ -11,5 +11,5 @@ extern int tcp_fd; _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)); diff --git a/drivers/audio/es1370/pci_helper.c b/drivers/audio/es1370/pci_helper.c index 64362ca9a..6cea93c1e 100644 --- a/drivers/audio/es1370/pci_helper.c +++ b/drivers/audio/es1370/pci_helper.c @@ -33,7 +33,7 @@ PUBLIC unsigned pci_inw(u16_t port) { 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); diff --git a/drivers/dp8390/rtl8029.c b/drivers/dp8390/rtl8029.c index e5885abc1..d2ff930ec 100644 --- a/drivers/dp8390/rtl8029.c +++ b/drivers/dp8390/rtl8029.c @@ -38,7 +38,7 @@ _PROTOTYPE( static void rtl_init, (struct dpeth *dep) ); #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 diff --git a/drivers/fxp/mii.c b/drivers/fxp/mii.c index b72765054..46a2712d0 100644 --- a/drivers/fxp/mii.c +++ b/drivers/fxp/mii.c @@ -16,9 +16,7 @@ Media Independent (Ethernet) Interface functions /*===========================================================================* * 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; @@ -119,8 +117,7 @@ u16_t extstat; /*===========================================================================* * mii_print_techab * *===========================================================================*/ -PUBLIC void mii_print_techab(techab) -u16_t techab; +PUBLIC void mii_print_techab(u16_t techab) { int fs, ft; diff --git a/drivers/fxp/mii.h b/drivers/fxp/mii.h index ebd3b5f19..24431d2d9 100644 --- a/drivers/fxp/mii.h +++ b/drivers/fxp/mii.h @@ -111,8 +111,8 @@ Definitions for the Media Independent (Ethernet) Interface #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 /* diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 9da970e26..6ae4bc4dd 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -94,25 +94,22 @@ PUBLIC re_t re_table[RE_PORT_NR]; 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); @@ -122,17 +119,17 @@ static unsigned my_inl(U16_t port) { #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); @@ -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_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) ); @@ -1918,8 +1915,7 @@ resspeed: } -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) @@ -1991,9 +1987,7 @@ u16_t techab; } } -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; @@ -2093,8 +2087,7 @@ u16_t extstat; /*===========================================================================* * 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; @@ -2726,7 +2719,7 @@ timer_t *tp; _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) @@ -2882,7 +2875,7 @@ dpeth_t *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; diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index a21298189..0676428d4 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -182,10 +182,7 @@ static re_t re_table[RE_PORT_NR]; 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; @@ -193,7 +190,7 @@ static unsigned my_inb(U16_t port) 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; @@ -201,9 +198,9 @@ static unsigned my_inw(U16_t port) 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); @@ -213,21 +210,21 @@ static unsigned my_inl(U16_t port) #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; @@ -410,7 +407,7 @@ PRIVATE void sef_cb_signal_handler(int signo) 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; @@ -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; diff --git a/include/minix/devio.h b/include/minix/devio.h index dc3d7ea7f..f654a0ae1 100644 --- a/include/minix/devio.h +++ b/include/minix/devio.h @@ -13,7 +13,6 @@ #include /* 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 , which has functions for bytes, words, diff --git a/include/minix/portio.h b/include/minix/portio.h index 852a7160e..c5aa3d68f 100644 --- a/include/minix/portio.h +++ b/include/minix/portio.h @@ -11,18 +11,18 @@ Created: Jan 15, 1992 by Philip Homburg #include #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); diff --git a/include/minix/types.h b/include/minix/types.h index e84537222..8740ae0d0 100644 --- a/include/minix/types.h +++ b/include/minix/types.h @@ -101,33 +101,6 @@ typedef long off_t; /* offset within a file */ 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) ); diff --git a/include/net/gen/ether.h b/include/net/gen/ether.h index 690e76570..0cb00dea6 100644 --- a/include/net/gen/ether.h +++ b/include/net/gen/ether.h @@ -17,7 +17,6 @@ typedef struct ether_addr } 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 diff --git a/include/net/gen/oneCsum.h b/include/net/gen/oneCsum.h index b9de8fa1d..3bfae46ec 100644 --- a/include/net/gen/oneCsum.h +++ b/include/net/gen/oneCsum.h @@ -5,6 +5,6 @@ server/ip/gen/oneCsum.h #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__ */ diff --git a/include/net/gen/resolv.h b/include/net/gen/resolv.h index bd9060346..4ad157f50 100644 --- a/include/net/gen/resolv.h +++ b/include/net/gen/resolv.h @@ -99,7 +99,7 @@ char *__hostalias _ARGS(( const char *name )); 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 )); diff --git a/include/net/gen/tcp.h b/include/net/gen/tcp.h index 11022e330..05d016ac4 100644 --- a/include/net/gen/tcp.h +++ b/include/net/gen/tcp.h @@ -14,6 +14,5 @@ server/ip/gen/tcp.h #define TCPPORT_RESERVED 1024 typedef u16_t tcpport_t; -typedef U16_t Tcpport_t; /* for use in prototypes */ #endif /* __SERVER__IP__GEN__TCP_H__ */ diff --git a/include/net/gen/udp.h b/include/net/gen/udp.h index a78dceb41..fae397a05 100644 --- a/include/net/gen/udp.h +++ b/include/net/gen/udp.h @@ -6,7 +6,6 @@ server/ip/gen/udp.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 diff --git a/kernel/arch/i386/protect.c b/kernel/arch/i386/protect.c index 802be8320..a746b1e5d 100644 --- a/kernel/arch/i386/protect.c +++ b/kernel/arch/i386/protect.c @@ -48,7 +48,7 @@ PUBLIC void enable_iop(struct proc *pp) /*===========================================================================* * 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. diff --git a/kernel/arch/i386/proto.h b/kernel/arch/i386/proto.h index 7a8ed8356..e421510ce 100644 --- a/kernel/arch/i386/proto.h +++ b/kernel/arch/i386/proto.h @@ -75,10 +75,10 @@ _PROTOTYPE( void write_cr0, (unsigned long value) ); _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)); diff --git a/kernel/proto.h b/kernel/proto.h index b8ff91a2c..da4e8c25a 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -53,8 +53,8 @@ _PROTOTYPE( int isokendpt_f, (endpoint_t e, int *p, int f) ); _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) ); @@ -142,7 +142,7 @@ _PROTOTYPE( phys_bytes umap_remote, (const struct proc* rp, int seg, 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 *, diff --git a/kernel/start.c b/kernel/start.c index 75e875ee6..d70ac8878 100644 --- a/kernel/start.c +++ b/kernel/start.c @@ -15,10 +15,13 @@ FORWARD _PROTOTYPE( char *get_value, (const char *params, const char *key)); /*===========================================================================* * 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. @@ -111,9 +114,10 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */ * 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. diff --git a/lib/libc/ip/oneC_sum.c b/lib/libc/ip/oneC_sum.c index cc3d9af09..702b9d35b 100644 --- a/lib/libc/ip/oneC_sum.c +++ b/lib/libc/ip/oneC_sum.c @@ -6,7 +6,7 @@ #include #include -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; diff --git a/lib/libc/ip/res_comp.c b/lib/libc/ip/res_comp.c index 0b4574027..66b772b7d 100644 --- a/lib/libc/ip/res_comp.c +++ b/lib/libc/ip/res_comp.c @@ -42,7 +42,7 @@ int dn_skipname _ARGS(( const u_char *comp_dn, const u_char *eom )); #include #include -static dn_find(); +static int dn_find(); #endif #ifdef __STDC__ @@ -325,9 +325,7 @@ getlong(msgp) void -putshort(s, msgp) - register U16_t s; - register u8_t *msgp; +putshort(u16_t s, u8_t *msgp) { msgp[1] = s; @@ -335,9 +333,7 @@ putshort(s, msgp) } void -putlong(l, msgp) - register u32_t l; - register u8_t *msgp; +putlong(u32_t l, u8_t *msgp) { msgp[3] = l; diff --git a/lib/libc/ip/res_send.c b/lib/libc/ip/res_send.c index 88090f3f1..5bc3101f9 100644 --- a/lib/libc/ip/res_send.c +++ b/lib/libc/ip/res_send.c @@ -81,11 +81,9 @@ static char sccsid[] = "@(#)res_send.c 6.27 (Berkeley) 2/24/91"; #include #include -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 )); @@ -718,10 +716,7 @@ _res_close() } #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; @@ -810,12 +805,13 @@ static int udp_connect() 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; @@ -843,11 +839,7 @@ udpport_t port; 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; diff --git a/lib/libc/other/getgrent.c b/lib/libc/other/getgrent.c index 54978ac99..b2095e2fb 100644 --- a/lib/libc/other/getgrent.c +++ b/lib/libc/other/getgrent.c @@ -3,7 +3,6 @@ * Author: Kees J. Bot * 31 Jan 1994 */ -#define nil 0 #define open _open #define fcntl _fcntl #define read _read @@ -45,7 +44,7 @@ int setgrent(void) { 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); @@ -87,10 +86,10 @@ static char *scan_punct(int punct) 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; @@ -103,25 +102,25 @@ struct group *getgrent(void) 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:; } @@ -133,7 +132,7 @@ struct group *getgrgid(gid_t gid) struct group *gr; endgrent(); - while ((gr= getgrent()) != nil && gr->gr_gid != gid) {} + while ((gr= getgrent()) != NULL && gr->gr_gid != gid) {} endgrent(); return gr; } @@ -144,7 +143,7 @@ struct group *getgrnam(const char *name) 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; } diff --git a/lib/libc/other/getpwent.c b/lib/libc/other/getpwent.c index 22e5dfe87..d5a7e9b2b 100644 --- a/lib/libc/other/getpwent.c +++ b/lib/libc/other/getpwent.c @@ -3,7 +3,6 @@ * Author: Kees J. Bot * 31 Jan 1994 */ -#define nil 0 #define open _open #define fcntl _fcntl #define read _read @@ -44,7 +43,7 @@ int setpwent(void) { 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); @@ -86,7 +85,7 @@ static char *scan_colon(void) for (;;) { last= lineptr; - if (*lineptr == 0) return nil; + if (*lineptr == 0) return NULL; if (*lineptr == '\n') break; if (*lineptr++ == ':') break; } @@ -100,21 +99,21 @@ struct passwd *getpwent(void) 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; } @@ -126,7 +125,7 @@ struct passwd *getpwuid(uid_t uid) struct passwd *pw; endpwent(); - while ((pw= getpwent()) != nil && pw->pw_uid != uid) {} + while ((pw= getpwent()) != NULL && pw->pw_uid != uid) {} endpwent(); return pw; } @@ -137,7 +136,7 @@ struct passwd *getpwnam(const char *name) 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; } diff --git a/lib/libc/posix/_getcwd.c b/lib/libc/posix/_getcwd.c index 6dcca5d85..17117ca56 100644 --- a/lib/libc/posix/_getcwd.c +++ b/lib/libc/posix/_getcwd.c @@ -2,7 +2,6 @@ * Author: Kees J. Bot * 30 Apr 1989 */ -#define nil 0 #define chdir _chdir #define closedir _closedir #define getcwd _getcwd @@ -65,22 +64,22 @@ char *getcwd(char *path, size_t size) 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. @@ -91,7 +90,7 @@ char *getcwd(char *path, size_t size) 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); @@ -100,7 +99,7 @@ char *getcwd(char *path, size_t size) closedir(d); errno= ENOENT; recover(p); - return nil; + return NULL; } } if (strcmp(entry->d_name, ".") == 0) continue; @@ -127,16 +126,16 @@ char *getcwd(char *path, size_t size) 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; diff --git a/lib/libc/posix/_ptrace.c b/lib/libc/posix/_ptrace.c index d4d7f52b9..c33059eef 100644 --- a/lib/libc/posix/_ptrace.c +++ b/lib/libc/posix/_ptrace.c @@ -2,11 +2,7 @@ #define ptrace _ptrace #include -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; diff --git a/servers/inet/generic/icmp.c b/servers/inet/generic/icmp.c index 855389a33..c7a10da9b 100644 --- a/servers/inet/generic/icmp.c +++ b/servers/inet/generic/icmp.c @@ -371,10 +371,11 @@ int code; 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; diff --git a/servers/inet/generic/icmp_lib.h b/servers/inet/generic/icmp_lib.h index 7501f1a7a..8601ff499 100644 --- a/servers/inet/generic/icmp_lib.h +++ b/servers/inet/generic/icmp_lib.h @@ -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_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 */ diff --git a/servers/inet/generic/ip_lib.c b/servers/inet/generic/ip_lib.c index a9f6114c8..a921686c4 100644 --- a/servers/inet/generic/ip_lib.c +++ b/servers/inet/generic/ip_lib.c @@ -15,15 +15,12 @@ Copyright 1995 Philip Homburg 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, @@ -122,8 +119,7 @@ int optlen; 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; @@ -151,16 +147,14 @@ assert (acc->acc_length >= IP_MIN_HDR_SIZE); #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; @@ -198,8 +192,7 @@ ipaddr_t ipaddr; return nettype; } -PUBLIC ipaddr_t ip_netmask(nettype) -nettype_t nettype; +PUBLIC ipaddr_t ip_netmask(nettype_t nettype) { switch(nettype) { @@ -213,8 +206,7 @@ nettype_t nettype; } #if 0 -PUBLIC char *ip_nettoa(nettype) -nettype_t nettype; +PUBLIC char *ip_nettoa(nettype_t nettype) { switch(nettype) { diff --git a/servers/inet/generic/ip_read.c b/servers/inet/generic/ip_read.c index 67fe32f22..5bb89c400 100644 --- a/servers/inet/generic/ip_read.c +++ b/servers/inet/generic/ip_read.c @@ -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 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; diff --git a/servers/inet/generic/ipr.c b/servers/inet/generic/ipr.c index 6a3013a15..5aaaaa546 100644 --- a/servers/inet/generic/ipr.c +++ b/servers/inet/generic/ipr.c @@ -651,11 +651,12 @@ time_t timeout; 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; diff --git a/servers/inet/generic/ipr.h b/servers/inet/generic/ipr.h index bece6b056..8f06cf762 100644 --- a/servers/inet/generic/ipr.h +++ b/servers/inet/generic/ipr.h @@ -81,7 +81,7 @@ void ipr_destunrch ARGS(( int port_nr, ipaddr_t dest, ipaddr_t subnetmask, 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 */ diff --git a/servers/inet/generic/tcp.c b/servers/inet/generic/tcp.c index 976bbfeca..25e686a6a 100644 --- a/servers/inet/generic/tcp.c +++ b/servers/inet/generic/tcp.c @@ -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_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 @@ -1276,8 +1276,7 @@ assert (data->acc_length == sizeof(nwio_tcpopt_t)); } -PRIVATE tcpport_t find_unused_port(fd) -int fd; +PRIVATE tcpport_t find_unused_port(int fd) { tcpport_t port, nw_port; @@ -1297,8 +1296,7 @@ int fd; 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; @@ -1426,11 +1424,12 @@ If no such connection exists NULL is returned. 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; @@ -1682,11 +1681,12 @@ tcp_fd_t *tcp_fd; /* 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; diff --git a/servers/inet/generic/tcp_int.h b/servers/inet/generic/tcp_int.h index 9c5b17c17..58cf174a2 100644 --- a/servers/inet/generic/tcp_int.h +++ b/servers/inet/generic/tcp_int.h @@ -204,7 +204,7 @@ void tcp_bytesavailable ARGS(( tcp_fd_t *tcp_fd, int *bytesp )); /* 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 )); diff --git a/servers/inet/generic/tcp_send.c b/servers/inet/generic/tcp_send.c index a10cf8aa5..e63cf368c 100644 --- a/servers/inet/generic/tcp_send.c +++ b/servers/inet/generic/tcp_send.c @@ -530,10 +530,11 @@ after_data: 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; diff --git a/servers/inet/generic/udp.c b/servers/inet/generic/udp.c index 7b511ea10..99e8f99b5 100644 --- a/servers/inet/generic/udp.c +++ b/servers/inet/generic/udp.c @@ -40,7 +40,7 @@ FORWARD void reply_thr_get ARGS(( udp_fd_t *udp_fd, int reply, 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 )); @@ -676,8 +676,7 @@ assert (data->acc_length == sizeof(nwio_udpopt_t)); 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; @@ -728,8 +727,7 @@ int for_ioctl; 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; diff --git a/servers/vfs/exec.c b/servers/vfs/exec.c index ec7995317..1739f1178 100644 --- a/servers/vfs/exec.c +++ b/servers/vfs/exec.c @@ -253,16 +253,16 @@ PRIVATE int exec_newmem( /*===========================================================================* * 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; diff --git a/servers/vfs/mount.c b/servers/vfs/mount.c index 6bf948dc5..b2089acdf 100644 --- a/servers/vfs/mount.c +++ b/servers/vfs/mount.c @@ -371,7 +371,7 @@ PRIVATE int mount_fs(endpoint_t fs_e) /*===========================================================================* * do_umount * *===========================================================================*/ -PUBLIC int do_umount() +PUBLIC int do_umount(void) { /* Perform the umount(name) system call. */ char label[LABEL_MAX]; @@ -487,8 +487,7 @@ PUBLIC int unmount( /*===========================================================================* * 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 @@ -533,7 +532,7 @@ PRIVATE int is_nonedev(dev_t dev) /*===========================================================================* * 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. */ diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 73e948c29..329c7cef4 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -135,7 +135,7 @@ PUBLIC int req_chown( /*===========================================================================* * req_create * *===========================================================================*/ -int req_create( +PUBLIC int req_create( int fs_e, ino_t inode_nr, int omode, @@ -204,10 +204,7 @@ PUBLIC int req_flush(endpoint_t fs_e, dev_t dev) /*===========================================================================* * 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; @@ -233,11 +230,7 @@ char *buf; /*===========================================================================* * 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; @@ -257,13 +250,14 @@ off_t end; /*===========================================================================* * 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; @@ -295,9 +289,7 @@ u64_t *new_pos; /*===========================================================================* * 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; @@ -313,18 +305,18 @@ ino_t inode_nr; /*===========================================================================* * 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"); @@ -526,9 +518,7 @@ PUBLIC int req_mknod( /*===========================================================================* * 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;