From 94a81c840a1b902a372e7488581d253111d94ee3 Mon Sep 17 00:00:00 2001 From: Kees van Reeuwijk Date: Wed, 7 Apr 2010 11:25:51 +0000 Subject: [PATCH] Removed unused variables, added const where possible. --- boot/boot.c | 12 +- boot/boot.h | 4 +- boot/installboot.c | 67 +++++----- boot/mkfile.c | 1 - commands/ash/alias.c | 10 +- commands/ash/alias.h | 2 +- commands/ash/cd.c | 8 +- commands/ash/memalloc.c | 2 +- commands/ash/memalloc.h | 2 +- commands/awk/lex.c | 2 +- commands/elle/eecmds.c | 1 - commands/elle/eedisp.c | 3 +- commands/elle/eefill.c | 4 +- commands/elle/eeterm.c | 3 +- commands/elle/sberr.c | 3 +- commands/simple/backup.c | 4 +- commands/simple/cleantmp.c | 4 +- commands/simple/cp.c | 2 +- commands/simple/devsize.c | 3 - commands/simple/dumpcore.c | 2 - commands/simple/finger.c | 5 - commands/simple/getty.c | 2 +- drivers/audio/common/audio_fw.c | 2 +- drivers/audio/es1371/AC97.c | 4 +- drivers/audio/es1371/sample_rate_converter.c | 2 +- drivers/audio/es1371/sample_rate_converter.h | 2 +- drivers/bios_wini/bios_wini.c | 2 +- drivers/dec21140A/dec21140A.c | 8 +- drivers/dpeth/dp.c | 21 ++-- drivers/e1000/e1000.c | 6 +- drivers/filter/crc.c | 2 +- drivers/filter/crc.h | 2 +- drivers/filter/driver.c | 9 +- drivers/filter/inc.h | 2 +- drivers/filter/sum.c | 4 +- drivers/filter/util.c | 2 +- drivers/floppy/floppy.c | 4 +- drivers/fxp/fxp.c | 6 +- drivers/lance/lance.c | 6 +- drivers/log/log.c | 2 +- drivers/orinoco/hermes.c | 7 +- drivers/orinoco/hermes.h | 5 +- drivers/orinoco/orinoco.c | 122 +++++++------------ drivers/readclock/readclock.c | 2 - drivers/rtl8139/rtl8139.c | 22 ++-- drivers/rtl8169/rtl8169.c | 14 +-- drivers/ti1225/ti1225.c | 4 +- drivers/tty/console.c | 1 - drivers/tty/keyboard.c | 1 - drivers/tty/tty.c | 2 - kernel/arch/i386/apic.c | 2 +- kernel/arch/i386/memory.c | 8 +- kernel/proto.h | 4 +- lib/libc/ip/getifaddrs.c | 2 +- lib/libc/ip/recvfrom.c | 1 - lib/libc/ip/setsockopt.c | 2 - lib/libc/other/_mount.c | 1 - lib/libc/other/_seekdir.c | 5 +- lib/libc/other/asynchio.c | 7 +- lib/libc/other/fts.c | 1 - lib/libc/other/initgroups.c | 2 +- lib/libc/other/vectorio.c | 1 - lib/libc/posix/_mmap.c | 2 - lib/libc/posix/_ucontext.c | 3 +- lib/libc/posix/getloadavg.c | 2 +- lib/libdriver/driver.c | 1 - lib/libtimers/tmrs_clr.c | 1 - lib/libutil/openpty.c | 3 +- servers/ds/proto.h | 4 +- servers/ds/store.c | 14 +-- servers/mfs/link.c | 1 - servers/rs/manager.c | 2 +- servers/rs/service/service.c | 7 +- servers/vfs/device.c | 2 - servers/vfs/request.c | 3 +- 75 files changed, 207 insertions(+), 286 deletions(-) diff --git a/boot/boot.c b/boot/boot.c index 2f30fa172..56e2bd0a4 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -773,7 +773,7 @@ static environment **searchenv(const char *name) #define b_getenv(name) (*searchenv(name)) /* Return the environment *structure* belonging to name, or nil if not found. */ -char *b_value(char *name) +char *b_value(const char *name) /* The value of a variable. */ { environment *e= b_getenv(name); @@ -781,7 +781,7 @@ char *b_value(char *name) return e == nil || !(e->flags & E_VAR) ? nil : e->value; } -static char *b_body(char *name) +static char *b_body(const char *name) /* The value of a function. */ { environment *e= b_getenv(name); @@ -789,7 +789,8 @@ static char *b_body(char *name) return e == nil || !(e->flags & E_FUNCTION) ? nil : e->value; } -static int b_setenv(int flags, char *name, char *arg, char *value) +static int b_setenv(int flags, const char *name, const char *arg, + const char *value) /* Change the value of an environment variable. Returns the flags of the * variable if you are not allowed to change it, 0 otherwise. */ @@ -838,7 +839,7 @@ int b_setvar(int flags, char *name, char *value) return r; } -void b_unset(char *name) +void b_unset(const char *name) /* Remove a variable from the environment. A special variable is reset to * its default value. */ @@ -919,7 +920,7 @@ static void get_parameters(void) { char params[SECTOR_SIZE + 1]; token **acmds; - int r, bus, processor; + int r, processor; memory *mp; static char bus_type[][4] = { "xt", "at", "mca" @@ -1116,7 +1117,6 @@ dev_t name2dev(char *name) { dev_t dev; ino_t ino; - int drive; struct stat st; char *n, *s; diff --git a/boot/boot.h b/boot/boot.h index 51ae27939..f73f19042 100644 --- a/boot/boot.h +++ b/boot/boot.h @@ -167,9 +167,9 @@ typedef struct environment { EXTERN environment *env; /* Lists the environment. */ -char *b_value(char *name); /* Get/set the value of a variable. */ +char *b_value(const char *name); /* Get/set the value of a variable. */ int b_setvar(int flags, char *name, char *value); -void b_unset(char *name); +void b_unset(const char *name); void parse_code(char *code); /* Parse boot monitor commands. */ diff --git a/boot/installboot.c b/boot/installboot.c index 29e53a3d4..5b334bf68 100644 --- a/boot/installboot.c +++ b/boot/installboot.c @@ -3,7 +3,6 @@ * * Either make a device bootable or make an image from kernel, mm, fs, etc. */ -#define nil 0 #define _POSIX_SOURCE 1 #define _MINIX 1 #include @@ -61,12 +60,12 @@ char *basename(char *name) static char base[IM_NAME_MAX]; char *p, *bp= base; - if ((p= strchr(name, ':')) != nil) { + if ((p= strchr(name, ':')) != NULL) { while (name <= p && bp < base + IM_NAME_MAX - 1) *bp++ = *name++; } for (;;) { - if ((p= strrchr(name, '/')) == nil) { p= name; break; } + if ((p= strrchr(name, '/')) == NULL) { p= name; break; } if (*++p != 0) break; *--p= 0; } @@ -85,7 +84,7 @@ static void bread(FILE *f, char *name, void *buf, size_t len) } } -static void bwrite(FILE *f, char *name, const void *buf, size_t len) +static void bwrite(FILE *f, const char *name, const void *buf, size_t len) { if (len > 0 && fwrite(buf, len, 1, f) != 1) fatal(name); } @@ -95,14 +94,14 @@ int making_image= 0; void read_header(int talk, char *proc, FILE *procf, struct image_header *ihdr) /* Read the a.out header of a program and check it. If procf happens to be - * nil then the header is already in *image_hdr and need only be checked. + * NULL then the header is already in *image_hdr and need only be checked. */ { int n, big= 0; static int banner= 0; struct exec *phdr= &ihdr->process; - if (procf == nil) { + if (procf == NULL) { /* Header already present. */ n= phdr->a_hdrlen; } else { @@ -122,7 +121,7 @@ void read_header(int talk, char *proc, FILE *procf, struct image_header *ihdr) } /* Get the rest of the exec header. */ - if (procf != nil) { + if (procf != NULL) { bread(procf, proc, ((char *) phdr) + A_MINHDR, phdr->a_hdrlen - A_MINHDR); } @@ -160,7 +159,7 @@ void read_header(int talk, char *proc, FILE *procf, struct image_header *ihdr) } } -void padimage(char *image, FILE *imagef, int n) +void padimage(const char *image, FILE *imagef, int n) /* Add n zeros to image to pad it to a sector boundary. */ { while (n > 0) { @@ -206,16 +205,16 @@ void make_image(char *image, char **procv) making_image= 1; - if ((imagef= fopen(image, "w")) == nil) fatal(image); + if ((imagef= fopen(image, "w")) == NULL) fatal(image); - for (procn= 0; (proc= *procv++) != nil; procn++) { + for (procn= 0; (proc= *procv++) != NULL; procn++) { /* Remove the label from the file name. */ - if ((file= strchr(proc, ':')) != nil) file++; else file= proc; + if ((file= strchr(proc, ':')) != NULL) file++; else file= proc; /* Real files please, may need to seek. */ if (stat(file, &st) < 0 || (errno= EISDIR, !S_ISREG(st.st_mode)) - || (procf= fopen(file, "r")) == nil + || (procf= fopen(file, "r")) == NULL ) fatal(proc); /* Read a.out header. */ @@ -296,7 +295,7 @@ void extract_image(char *image) /* Size of the image. */ len= S_ISREG(st.st_mode) ? st.st_size : -1; - if ((imagef= fopen(image, "r")) == nil) fatal(image); + if ((imagef= fopen(image, "r")) == NULL) fatal(image); while (len != 0) { /* Extract a program, first sector is an extended header. */ @@ -307,9 +306,9 @@ void extract_image(char *image) phdr= ihdr.process; /* Check header. */ - read_header(1, ihdr.name, nil, &ihdr); + read_header(1, ihdr.name, NULL, &ihdr); - if ((procf= fopen(ihdr.name, "w")) == nil) fatal(ihdr.name); + if ((procf= fopen(ihdr.name, "w")) == NULL) fatal(ihdr.name); if (phdr.a_flags & A_PAL) { /* A page aligned process contains a header in text. */ @@ -333,8 +332,8 @@ void extract_image(char *image) } } -int rawfd; /* File descriptor to open device. */ -char *rawdev; /* Name of device. */ +static int rawfd; /* File descriptor to open device. */ +static const char *rawdev; /* Name of device. */ void readblock(off_t blk, char *buf, int block_size) /* For rawfs, so that it can read blocks. */ @@ -378,7 +377,7 @@ int raw_install(char *file, off_t *start, off_t *len, int block_size) devsize= -1; if (ioctl(rawfd, DIOCGETP, &entry) == 0) devsize= cv64ul(entry.size); - if ((f= fopen(file, "r")) == nil) fatal(file); + if ((f= fopen(file, "r")) == NULL) fatal(file); /* Copy sectors from file onto the boot device. */ sec= *start; @@ -486,7 +485,7 @@ void make_bootable(enum howto how, char *device, char *bootblock, */ if (stat(bootcode, &st) < 0) fatal(bootcode); - if ((bootf= fopen(bootcode, "r")) == nil) fatal(bootcode); + if ((bootf= fopen(bootcode, "r")) == NULL) fatal(bootcode); } else { /* Boot code is present in the file system. */ r_stat(ino, &st); @@ -499,14 +498,14 @@ void make_bootable(enum howto how, char *device, char *bootblock, /* Must skip 16 bytes of 'boot' as that contains code. */ memcpy(&boothdr, buf + 16, sizeof(struct exec)); } - bootf= nil; + bootf= NULL; dummy.process= boothdr; } /* See if it is an executable (read_header does the check). */ read_header(0, bootcode, bootf, &dummy); boothdr= dummy.process; - if (bootf != nil) fclose(bootf); + if (bootf != NULL) fclose(bootf); /* Get all the sector addresses of the secondary boot code. */ max_sector= (boothdr.a_hdrlen + boothdr.a_text @@ -551,7 +550,7 @@ void make_bootable(enum howto how, char *device, char *bootblock, /* Get the boot block and patch the pieces in. */ readblock(BOOTBLOCK, buf, BOOT_BLOCK_SIZE); - if ((bootf= fopen(bootblock, "r")) == nil) fatal(bootblock); + if ((bootf= fopen(bootblock, "r")) == NULL) fatal(bootblock); read_header(0, bootblock, bootf, &dummy); boothdr= dummy.process; @@ -596,7 +595,7 @@ void make_bootable(enum howto how, char *device, char *bootblock, * necessary. */ for (parmp= buf + SECTOR_SIZE; parmp < buf + 2*SECTOR_SIZE; parmp++) { - if (*imagev != nil || (control(*parmp) && *parmp != '\n')) { + if (*imagev != NULL || (control(*parmp) && *parmp != '\n')) { /* Param sector must be initialized. */ memset(buf + SECTOR_SIZE, '\n', SECTOR_SIZE); break; @@ -629,10 +628,10 @@ void make_bootable(enum howto how, char *device, char *bootblock, parmp+= strlen(parmp); } - while ((labels= *imagev++) != nil) { + while ((labels= *imagev++) != NULL) { /* Place each kernel image on the boot device. */ - if ((image= strchr(labels, ':')) != nil) + if ((image= strchr(labels, ':')) != NULL) *image++= 0; else { if (nolabel) { @@ -642,23 +641,23 @@ void make_bootable(enum howto how, char *device, char *bootblock, } nolabel= 1; image= labels; - labels= nil; + labels= NULL; } len= 0; if (!raw_install(image, &pos, &len, block_size)) exit(1); - if (labels == nil) { + if (labels == NULL) { /* Let this image be the default. */ sprintf(parmp, "image=%ld:%ld\n", pos-len, len); parmp+= strlen(parmp); } - while (labels != nil) { + while (labels != NULL) { /* Image is prefixed by a comma separated list of * labels. Define functions to select label and image. */ label= labels; - if ((labels= strchr(labels, ',')) != nil) *labels++ = 0; + if ((labels= strchr(labels, ',')) != NULL) *labels++ = 0; sprintf(parmp, "%s(%c){label=%s;image=%ld:%ld;echo %s kernel selected;menu}\n", @@ -685,7 +684,7 @@ void make_bootable(enum howto how, char *device, char *bootblock, } } -static void install_master(char *device, char *masterboot, char **guide) +static void install_master(const char *device, char *masterboot, char **guide) /* Booting a hard disk is a two stage process: The master bootstrap in sector * 0 loads the bootstrap from sector 0 of the active partition which in turn * starts the operating system. This code installs such a master bootstrap @@ -702,7 +701,7 @@ static void install_master(char *device, char *masterboot, char **guide) if ((rawfd= open(rawdev= device, O_RDWR)) < 0) fatal(device); /* Open the master boot code. */ - if ((masf= fopen(masterboot, "r")) == nil) fatal(masterboot); + if ((masf= fopen(masterboot, "r")) == NULL) fatal(masterboot); /* See if the user is cloning a device. */ if (fstat(fileno(masf), &st) >=0 && S_ISBLK(st.st_mode)) @@ -725,7 +724,7 @@ static void install_master(char *device, char *masterboot, char **guide) memset(buf, 0, PARTPOS); (void) bread(masf, masterboot, buf, size); - if (guide[0] != nil) { + if (guide[0] != NULL) { /* Fixate partition to boot. */ const char *keys= guide[0]; const char *logical= guide[1]; @@ -755,7 +754,7 @@ static void install_master(char *device, char *masterboot, char **guide) size += i; buf[size]= '\r'; - if (logical != nil) { + if (logical != NULL) { if ((logfd= open(logical, O_RDONLY)) < 0 || ioctl(logfd, DIOCGETP, &geometry) < 0 ) { @@ -793,7 +792,7 @@ static void usage(void) exit(1); } -static int isoption(const char *option, char *test) +static int isoption(const char *option, const char *test) /* Check if the option argument is equals "test". Also accept -i as short * for -image, and the special case -x for -extract. */ diff --git a/boot/mkfile.c b/boot/mkfile.c index 60c06228f..d9a130d54 100644 --- a/boot/mkfile.c +++ b/boot/mkfile.c @@ -72,7 +72,6 @@ char *strerror(int err) int main(int argc, char **argv) { - int i; static char buf[512]; unsigned long size, mul; off_t offset; diff --git a/commands/ash/alias.c b/commands/ash/alias.c index 5a8a3c1cf..9f197ed6e 100644 --- a/commands/ash/alias.c +++ b/commands/ash/alias.c @@ -55,13 +55,13 @@ __FBSDID("$FreeBSD: src/bin/sh/alias.c,v 1.18 2004/04/06 20:06:51 markm Exp $"); STATIC struct alias *atab[ATABSIZE]; -STATIC void setalias(char *, char *); -STATIC int unalias(char *); +STATIC void setalias(const char *, const char *); +STATIC int unalias(const char *); STATIC struct alias **hashalias(const char *); STATIC void -setalias(char *name, char *val) +setalias(const char *name, const char *val) { struct alias *ap, **app; @@ -114,7 +114,7 @@ setalias(char *name, char *val) } STATIC int -unalias(char *name) +unalias(const char *name) { struct alias *ap, **app; @@ -175,7 +175,7 @@ rmaliases(void) } struct alias * -lookupalias(char *name, int check) +lookupalias(const char *name, int check) { struct alias *ap = *hashalias(name); diff --git a/commands/ash/alias.h b/commands/ash/alias.h index e541908f4..5b4fb8fae 100644 --- a/commands/ash/alias.h +++ b/commands/ash/alias.h @@ -42,7 +42,7 @@ struct alias { int flag; }; -struct alias *lookupalias(char *, int); +struct alias *lookupalias(const char *, int); int aliascmd(int, char **); int unaliascmd(int, char **); void rmaliases(void); diff --git a/commands/ash/cd.c b/commands/ash/cd.c index 055cb75a0..8513128ed 100644 --- a/commands/ash/cd.c +++ b/commands/ash/cd.c @@ -67,9 +67,9 @@ __FBSDID("$FreeBSD: src/bin/sh/cd.c,v 1.34 2004/04/06 20:06:51 markm Exp $"); #include "show.h" #include "cd.h" -STATIC int cdlogical(char *); +STATIC int cdlogical(const char *); STATIC int cdphysical(const char *); -STATIC int docd(char *, int, int); +STATIC int docd(const char *, int, int); STATIC char *getcomponent(void); STATIC int updatepwd(const char *); @@ -145,7 +145,7 @@ cdcmd(int argc, char **argv) * directory name if "print" is nonzero. */ STATIC int -docd(char *dest, int print, int phys) +docd(const char *dest, int print, int phys) { TRACE(("docd(\"%s\", %d, %d) called\n", dest, print, phys)); @@ -161,7 +161,7 @@ docd(char *dest, int print, int phys) } STATIC int -cdlogical(char *dest) +cdlogical(const char *dest) { char *p; char *q; diff --git a/commands/ash/memalloc.c b/commands/ash/memalloc.c index 8f567cce9..ab4900f46 100644 --- a/commands/ash/memalloc.c +++ b/commands/ash/memalloc.c @@ -83,7 +83,7 @@ ckrealloc(pointer p, int nbytes) */ char * -savestr(char *s) +savestr(const char *s) { char *p; diff --git a/commands/ash/memalloc.h b/commands/ash/memalloc.h index f3c9138f0..68b89a207 100644 --- a/commands/ash/memalloc.h +++ b/commands/ash/memalloc.h @@ -48,7 +48,7 @@ extern int herefd; pointer ckmalloc(int); pointer ckrealloc(pointer, int); -char *savestr(char *); +char *savestr(const char *); pointer stalloc(int); void stunalloc(pointer); void setstackmark(struct stackmark *); diff --git a/commands/awk/lex.c b/commands/awk/lex.c index 49d7c5ca7..a7e225d77 100644 --- a/commands/awk/lex.c +++ b/commands/awk/lex.c @@ -434,7 +434,7 @@ int string(void) } -int binsearch(char *w, Keyword *kp, int n) +int binsearch(const char *w, const Keyword *kp, int n) { int cond, low, mid, high; diff --git a/commands/elle/eecmds.c b/commands/elle/eecmds.c index b92183f59..757d8bebb 100644 --- a/commands/elle/eecmds.c +++ b/commands/elle/eecmds.c @@ -217,7 +217,6 @@ register int c; set_profile(filename) char *filename; { char pfile[200]; - char psfile[200]; register int pfd, len; chroff sbx_fdlen(); register char *profptr; diff --git a/commands/elle/eedisp.c b/commands/elle/eedisp.c index 3827bb71e..d1ceb3136 100644 --- a/commands/elle/eedisp.c +++ b/commands/elle/eedisp.c @@ -798,7 +798,7 @@ struct window *win; { register int i, n; register struct scr_line *s; struct window *w; - int top, bot, dspf, num, isave, noicost, nodcost, iline, dline; + int top, bot, dspf, num, noicost, nodcost, iline, dline; #if FX_SOWIND int oldso; #endif @@ -1354,7 +1354,6 @@ struct scr_line *olds; { register struct scr_line *s; register int col, scrw; char *cp; - int ch; col = 0; scrw = scr_wid; diff --git a/commands/elle/eefill.c b/commands/elle/eefill.c index f46a6506a..50d7d28d5 100644 --- a/commands/elle/eefill.c +++ b/commands/elle/eefill.c @@ -92,7 +92,7 @@ f_sfpref() */ tstfillp(lim) int lim; -{ register int i, c; +{ register int i; register char *cp; chroff savdot; @@ -260,7 +260,7 @@ int c; fill_cur_line() { register int foundit, i; - chroff lastbrkdot, boldot, eoldot; + chroff lastbrkdot, boldot; boldot = e_boldot(); diff --git a/commands/elle/eeterm.c b/commands/elle/eeterm.c index 99429c255..a409f7777 100644 --- a/commands/elle/eeterm.c +++ b/commands/elle/eeterm.c @@ -988,8 +988,7 @@ static int tstrlen(), tstrlp(); static int getcap(stype) char *stype; -{ register char *t; - register int i; +{ register int i; int buflen; char *tcbuf, *tcbptr; /* Pointers into termcap buffer */ char tmpstr[4]; diff --git a/commands/elle/sberr.c b/commands/elle/sberr.c index 168727f4e..4079a05ab 100644 --- a/commands/elle/sberr.c +++ b/commands/elle/sberr.c @@ -349,7 +349,6 @@ sbe_sdtab(pt, p, phys) register struct ptab *pt; int p, phys; { register struct sdblk *sd; - register int res; pt->pt_pflag = (p ? PTF_PRF : 0) | (phys ? PTF_SDPHYS : 0) | PTF_OVFERR; @@ -397,7 +396,7 @@ struct ptab *pt; register struct smblk *sm; struct sbfile *savfile; chroff lastaddr; - int p, res, savidx, phys; + int p, savidx, phys; phys = pt->pt_pflag&PTF_SDPHYS; /* Set up physflag */ if(phys && (sd->sdfile == 0)) /* Ignore non-phys stuff if phys */ diff --git a/commands/simple/backup.c b/commands/simple/backup.c index 4a72a1740..5d0127a5c 100644 --- a/commands/simple/backup.c +++ b/commands/simple/backup.c @@ -89,11 +89,11 @@ int main(argc, argv) int argc; char *argv[]; { - int ct, n, m, fd; + int n, m; char *dir1, *dir2, *cp, c; struct stat s; struct dirent *e; - DIR *DIR1, *DIR2; + DIR *DIR1; (void) sync(); diff --git a/commands/simple/cleantmp.c b/commands/simple/cleantmp.c index a0d403e73..3c4d5a9c6 100644 --- a/commands/simple/cleantmp.c +++ b/commands/simple/cleantmp.c @@ -181,7 +181,7 @@ unsigned ihash(const char *name) return h & (arraysize(ignore_list) - 1); } -void do_ignore(int add, char *name) +void do_ignore(int add, const char *name) /* Add or remove a file to/from the list of files to ignore. */ { struct file **ipp, *ip; @@ -208,7 +208,7 @@ void do_ignore(int add, char *name) } } -int is_ignored(char *name) +int is_ignored(const char *name) /* Is a file in the list of ignored files? */ { struct file *ip; diff --git a/commands/simple/cp.c b/commands/simple/cp.c index d4e8745d1..71e191c19 100644 --- a/commands/simple/cp.c +++ b/commands/simple/cp.c @@ -346,7 +346,7 @@ static char *link_islink(const struct stat *stp, const char *file) return nil; } -int trylink(const char *src, const char *dst, struct stat *srcst, +int trylink(const char *src, const char *dst, const struct stat *srcst, const struct stat *dstst) /* Keep the link structure intact if src has been seen before. */ { diff --git a/commands/simple/devsize.c b/commands/simple/devsize.c index 250dda055..863c95452 100644 --- a/commands/simple/devsize.c +++ b/commands/simple/devsize.c @@ -23,8 +23,6 @@ unsigned long sizeup(char *); int main(int argc, char *argv[]) { - int sec; - if(argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); return 1; @@ -41,7 +39,6 @@ char *device; int fd; struct partition entry; unsigned long d; - struct stat st; if ((fd = open(device, O_RDONLY)) == -1) { perror("sizeup open"); diff --git a/commands/simple/dumpcore.c b/commands/simple/dumpcore.c index 62e03170d..fe2078940 100644 --- a/commands/simple/dumpcore.c +++ b/commands/simple/dumpcore.c @@ -70,8 +70,6 @@ int adjust_stack(pid_t pid, struct mem_map *seg) int write_seg(int fd, pid_t pid, int seg, off_t seg_off, phys_bytes seg_bytes) { - int r; - off_t off; ssize_t w; static char buf[CLICK_SIZE]; struct ptrace_range pr; diff --git a/commands/simple/finger.c b/commands/simple/finger.c index 900b325ac..a1ce1fdd3 100644 --- a/commands/simple/finger.c +++ b/commands/simple/finger.c @@ -152,7 +152,6 @@ main(argc, argv) int argc; register char **argv; { - FILE *fp; register char *s; prog_name= argv[0]; @@ -620,8 +619,6 @@ decode(pers) { char buffer[256]; register char *bp, *gp, *lp; - int alldigits; - int hasspace; int len; pers->realname = 0; @@ -888,9 +885,7 @@ netfinger(name) char *name; { char *host; - char fname[100]; struct hostent *hp; - struct servent *sp; int s, result; #if !_MINIX char *rindex(); diff --git a/commands/simple/getty.c b/commands/simple/getty.c index d4feb4541..2275e2c4f 100644 --- a/commands/simple/getty.c +++ b/commands/simple/getty.c @@ -77,7 +77,7 @@ int readch(void) /* Handle the process of a GETTY. */ -void do_getty(char *name, size_t len, char **args, char *ttyname) +void do_getty(char *name, size_t len, char **args, const char *ttyname) { register char *np, *s, *s0; int ch; diff --git a/drivers/audio/common/audio_fw.c b/drivers/audio/common/audio_fw.c index ba2ee458a..766ef3eff 100644 --- a/drivers/audio/common/audio_fw.c +++ b/drivers/audio/common/audio_fw.c @@ -198,7 +198,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) { /* Initialize the audio driver framework. */ return init_driver(); diff --git a/drivers/audio/es1371/AC97.c b/drivers/audio/es1371/AC97.c index 276476d6f..5ca447073 100644 --- a/drivers/audio/es1371/AC97.c +++ b/drivers/audio/es1371/AC97.c @@ -7,7 +7,7 @@ /* AC97 Mixer and Mode control function prototypes */ FORWARD _PROTOTYPE( int AC97_read, - (DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) ); + (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) ); FORWARD _PROTOTYPE( int AC97_write, (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) ); FORWARD _PROTOTYPE( void set_src_sync_state, (int state) ); @@ -133,7 +133,7 @@ u16_t wBaseAddr = pCC->base; } -PRIVATE int AC97_read (DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) +PRIVATE int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) { u32_t dtemp, i; u16_t base = pCC->base; diff --git a/drivers/audio/es1371/sample_rate_converter.c b/drivers/audio/es1371/sample_rate_converter.c index 1d74df510..916d67685 100644 --- a/drivers/audio/es1371/sample_rate_converter.c +++ b/drivers/audio/es1371/sample_rate_converter.c @@ -147,7 +147,7 @@ PRIVATE int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) { } -void src_set_rate(DEV_STRUCT * DSP, char base, u16_t rate) { +void src_set_rate(const DEV_STRUCT * DSP, char base, u16_t rate) { u32_t freq, dtemp, i; u16_t N, truncM, truncStart, wtemp; diff --git a/drivers/audio/es1371/sample_rate_converter.h b/drivers/audio/es1371/sample_rate_converter.h index c093c25bf..9da3c8d29 100644 --- a/drivers/audio/es1371/sample_rate_converter.h +++ b/drivers/audio/es1371/sample_rate_converter.h @@ -6,7 +6,7 @@ #include "pci_helper.h" _PROTOTYPE( int src_init, (DEV_STRUCT * DSP) ); -_PROTOTYPE( void src_set_rate, (DEV_STRUCT * DSP, char src_base, u16_t rate) ); +_PROTOTYPE( void src_set_rate, (const DEV_STRUCT * DSP, char src_base, u16_t rate) ); #define SRC_SYNTH_BASE 0x70 #define SRC_DAC_BASE 0x74 diff --git a/drivers/bios_wini/bios_wini.c b/drivers/bios_wini/bios_wini.c index 2ac72d9be..2e1c36b49 100644 --- a/drivers/bios_wini/bios_wini.c +++ b/drivers/bios_wini/bios_wini.c @@ -514,7 +514,7 @@ struct partition *entry; /*============================================================================* * w_other * *============================================================================*/ -PRIVATE int w_other(struct driver *dr, message *m) +PRIVATE int w_other(struct driver *UNUSED(dr), message *m) { int r; diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index 183709131..797383495 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -30,7 +30,7 @@ _PROTOTYPE( PRIVATE void io_outl, (u16_t, u32_t); ); _PROTOTYPE( PRIVATE void do_conf, (const message *); ); _PROTOTYPE( PRIVATE void do_get_name, (message *); ); _PROTOTYPE( PRIVATE void do_get_stat_s, (message *); ); -_PROTOTYPE( PRIVATE void do_interrupt, (dpeth_t *); ); +_PROTOTYPE( PRIVATE void do_interrupt, (const dpeth_t *); ); _PROTOTYPE( PRIVATE void do_reply, (dpeth_t *, int, int); ); _PROTOTYPE( PRIVATE void do_vread_s, (const message *, int); ); _PROTOTYPE( PRIVATE void do_watchdog, (void *); ); @@ -42,7 +42,7 @@ _PROTOTYPE( PRIVATE void de_first_init, (dpeth_t *); ); _PROTOTYPE( PRIVATE void de_reset, (const dpeth_t *); ); _PROTOTYPE( PRIVATE void de_hw_conf, (const dpeth_t *); ); _PROTOTYPE( PRIVATE void de_start, (const dpeth_t *); ); -_PROTOTYPE( PRIVATE void de_setup_frame, (dpeth_t *); ); +_PROTOTYPE( PRIVATE void de_setup_frame, (const dpeth_t *); ); _PROTOTYPE( PRIVATE u16_t de_read_rom, (const dpeth_t *, u8_t, u8_t); ); _PROTOTYPE( PRIVATE int de_calc_iov_size, (iovec_dat_s_t *); ); _PROTOTYPE( PRIVATE void de_next_iov, (iovec_dat_s_t *); ); @@ -707,7 +707,7 @@ PRIVATE void de_first_init(dpeth_t *dep) sys_irqenable(&dep->de_hook); } -PRIVATE void do_interrupt(dpeth_t *dep){ +PRIVATE void do_interrupt(const dpeth_t *dep){ u32_t val; val = io_inl(CSR_ADDR(dep, CSR5)); @@ -763,7 +763,7 @@ PRIVATE void de_start(const dpeth_t *dep){ io_outl(CSR_ADDR(dep, CSR6), val); } -PRIVATE void de_setup_frame(dpeth_t *dep){ +PRIVATE void de_setup_frame(const dpeth_t *dep){ int i; u32_t val; diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 37511e2e8..31c008360 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -155,7 +155,7 @@ static void dp_confaddr(dpeth_t * dep) ** Function: Gets the default settings from 'dp_conf' table and ** modifies them from the environment. */ -static void update_conf(dpeth_t * dep, dp_conf_t * dcp) +static void update_conf(dpeth_t * dep, const dp_conf_t * dcp) { static char dpc_fmt[] = "x:d:x"; long val; @@ -184,7 +184,7 @@ static void update_conf(dpeth_t * dep, dp_conf_t * dcp) ** Name: void do_dump(message *mp) ** Function: Displays statistics on screen (SFx key from console) */ -static void do_dump(message *mp) +static void do_dump(const message *mp) { dpeth_t *dep; int port; @@ -244,7 +244,7 @@ static void get_userdata_s(int user_proc, cp_grant_id_t grant, ** Name: void do_first_init(dpeth_t *dep, dp_conf_t *dcp); ** Function: Init action to setup task */ -static void do_first_init(dpeth_t *dep, dp_conf_t *dcp) +static void do_first_init(dpeth_t *dep, const dp_conf_t *dcp) { if (dep->de_linmem != 0) { @@ -275,7 +275,7 @@ static void do_first_init(dpeth_t *dep, dp_conf_t *dcp) ** Function: Checks for hardware presence. ** Provides initialization of hardware and data structures */ -static void do_init(message * mp) +static void do_init(const message * mp) { int port; dpeth_t *dep; @@ -395,7 +395,7 @@ static int calc_iovec_size(iovec_dat_s_t * iovp) ** Name: void do_vwrite_s(message *mp) ** Function: */ -static void do_vwrite_s(message * mp) +static void do_vwrite_s(const message * mp) { int port, size; dpeth_t *dep; @@ -436,7 +436,7 @@ static void do_vwrite_s(message * mp) ** Name: void do_vread_s(message *mp, int vectored) ** Function: */ -static void do_vread_s(message * mp) +static void do_vread_s(const message * mp) { int port, size; dpeth_t *dep; @@ -479,7 +479,7 @@ static void do_vread_s(message * mp) ** Name: void do_getstat_s(message *mp) ** Function: Reports device statistics. */ -static void do_getstat_s(message * mp) +static void do_getstat_s(const message * mp) { int port, rc; dpeth_t *dep; @@ -517,7 +517,7 @@ message *mp; ** Name: void do_stop(message *mp) ** Function: Stops network interface. */ -static void do_stop(message * mp) +static void do_stop(const message * mp) { int port; dpeth_t *dep; @@ -537,7 +537,7 @@ static void do_stop(message * mp) return; } -static void do_watchdog(void *message) +static void do_watchdog(const void *UNUSED(message)) { DEBUG(printf("\t no reply")); @@ -574,7 +574,6 @@ EXTERN char **env_argv; PUBLIC int main(int argc, char **argv) { message m; - dpeth_t *dep; int rc; /* SEF local startup. */ @@ -659,7 +658,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the dpeth driver. */ int rc, fkeys, sfkeys, tasknr; diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index f53ea991c..d19dc0e0a 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -55,7 +55,7 @@ _PROTOTYPE( PRIVATE void e1000_reg_unset, (e1000_t *e, uint32_t reg, _PROTOTYPE( PRIVATE u16_t eeprom_eerd, (void *e, int reg) ); _PROTOTYPE( PRIVATE u16_t eeprom_ich, (void *e, int reg) ); _PROTOTYPE( PRIVATE int eeprom_ich_init, (e1000_t *e) ); -_PROTOTYPE( PRIVATE int eeprom_ich_cycle, (e1000_t *e, u32_t timeout) ); +_PROTOTYPE( PRIVATE int eeprom_ich_cycle, (const e1000_t *e, u32_t timeout) ); _PROTOTYPE( PRIVATE void reply, (e1000_t *e, int err, int may_block) ); _PROTOTYPE( PRIVATE void mess_reply, (message *req, message *reply) ); @@ -135,7 +135,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) { /* Initialize the e1000 driver. */ int r; @@ -1083,7 +1083,7 @@ out: /*===========================================================================* * eeprom_ich_cycle * *===========================================================================*/ -PRIVATE int eeprom_ich_cycle(e1000_t *e, u32_t timeout) +PRIVATE int eeprom_ich_cycle(const e1000_t *e, u32_t timeout) { union ich8_hws_flash_ctrl hsflctl; union ich8_hws_flash_status hsfsts; diff --git a/drivers/filter/crc.c b/drivers/filter/crc.c index 109407cc5..356018b7e 100644 --- a/drivers/filter/crc.c +++ b/drivers/filter/crc.c @@ -63,7 +63,7 @@ static unsigned long crctab[] = { 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; -unsigned long compute_crc( unsigned char *b, size_t n) +unsigned long compute_crc(const unsigned char *b, size_t n) { int i; unsigned long s = 0; diff --git a/drivers/filter/crc.h b/drivers/filter/crc.h index ed38d9793..a9cfa4657 100644 --- a/drivers/filter/crc.h +++ b/drivers/filter/crc.h @@ -1,6 +1,6 @@ #ifndef _CRC_H #define _CRC_H -extern unsigned long compute_crc(unsigned char *b, size_t n); +extern unsigned long compute_crc(const unsigned char *b, size_t n); #endif /* _CRC_H */ diff --git a/drivers/filter/driver.c b/drivers/filter/driver.c index c554cd330..00db8d001 100644 --- a/drivers/filter/driver.c +++ b/drivers/filter/driver.c @@ -752,7 +752,7 @@ static int do_sendrec_both(message *m1, message *m2) /*===========================================================================* * do_sendrec_one * *===========================================================================*/ -static int do_sendrec_one(message *m1, message *m2) +static int do_sendrec_one(message *m1, const message *m2) { /* Only talk to the main driver. If something goes wrong, it will * be fixed elsewhere. @@ -796,7 +796,7 @@ static int paired_sendrec(message *m1, message *m2, int both) * single_grant * *===========================================================================*/ static int single_grant(endpoint_t endpt, vir_bytes buf, int access, - cp_grant_id_t *gid, iovec_s_t vector[NR_IOREQS], size_t *sizep) + cp_grant_id_t *gid, iovec_s_t vector[NR_IOREQS], const size_t *sizep) { /* Create grants for a vectored request to a single driver. */ @@ -873,7 +873,7 @@ static int paired_grant(char *buf1, char *buf2, int request, /*===========================================================================* * single_revoke * *===========================================================================*/ -PRIVATE void single_revoke(cp_grant_id_t gid, iovec_s_t vector[NR_IOREQS], +PRIVATE void single_revoke(cp_grant_id_t gid, const iovec_s_t vector[NR_IOREQS], size_t *sizep, int count) { /* Revoke all grants associated with a request to a single driver. @@ -894,7 +894,8 @@ PRIVATE void single_revoke(cp_grant_id_t gid, iovec_s_t vector[NR_IOREQS], /*===========================================================================* * paired_revoke * *===========================================================================*/ -static void paired_revoke(cp_grant_id_t *gids, iovec_s_t vectors[2][NR_IOREQS], +static void paired_revoke(const cp_grant_id_t *gids, + iovec_s_t vectors[2][NR_IOREQS], size_t *sizes, int count, int both) { /* Revoke grants to drivers for a single request. diff --git a/drivers/filter/inc.h b/drivers/filter/inc.h index 454df114b..5a936872c 100644 --- a/drivers/filter/inc.h +++ b/drivers/filter/inc.h @@ -97,7 +97,7 @@ extern int read_write(u64_t pos, char *bufa, char *bufb, size_t *sizep, /* util.c */ extern char *flt_malloc(size_t size, char *sbuf, size_t ssize); -extern void flt_free(char *buf, size_t size, char *sbuf); +extern void flt_free(char *buf, size_t size, const char *sbuf); extern char *print64(u64_t p); extern clock_t flt_alarm(clock_t dt); extern void flt_sleep(int secs); diff --git a/drivers/filter/sum.c b/drivers/filter/sum.c index e5554fbeb..18d3b2efd 100644 --- a/drivers/filter/sum.c +++ b/drivers/filter/sum.c @@ -152,8 +152,8 @@ static void make_group_sum(char *bufp, char *sump, sector_t sector, int index, /*===========================================================================* * check_group_sum * *===========================================================================*/ -static int check_group_sum(char *bufp, char *sump, sector_t sector, int index, - int count) +static int check_group_sum(char *bufp, const char *sump, sector_t sector, + int index, int count) { /* Check checksums in a group. Parameters are the same as in * make_group_sum(). Return OK if all checksums check out, or RET_REDO diff --git a/drivers/filter/util.c b/drivers/filter/util.c index ba43eb8eb..0eda31908 100644 --- a/drivers/filter/util.c +++ b/drivers/filter/util.c @@ -29,7 +29,7 @@ char *flt_malloc(size_t size, char *sbuf, size_t ssize) /*===========================================================================* * flt_free * *===========================================================================*/ -void flt_free(char *buf, size_t size, char *sbuf) +void flt_free(char *buf, size_t size, const char *sbuf) { /* Free a buffer previously allocated with flt_malloc(). */ diff --git a/drivers/floppy/floppy.c b/drivers/floppy/floppy.c index 6457591b6..33114dd1d 100644 --- a/drivers/floppy/floppy.c +++ b/drivers/floppy/floppy.c @@ -257,7 +257,7 @@ FORWARD _PROTOTYPE( void start_motor, (void) ); FORWARD _PROTOTYPE( int seek, (void) ); FORWARD _PROTOTYPE( int fdc_transfer, (int opcode) ); FORWARD _PROTOTYPE( int fdc_results, (void) ); -FORWARD _PROTOTYPE( int fdc_command, (u8_t *cmd, int len) ); +FORWARD _PROTOTYPE( int fdc_command, (const u8_t *cmd, int len) ); FORWARD _PROTOTYPE( void fdc_out, (int val) ); FORWARD _PROTOTYPE( int recalibrate, (void) ); FORWARD _PROTOTYPE( void f_reset, (void) ); @@ -1041,7 +1041,7 @@ PRIVATE int fdc_results(void) * fdc_command * *===========================================================================*/ PRIVATE int fdc_command( - u8_t *cmd, /* command bytes */ + const u8_t *cmd, /* command bytes */ int len /* command length */ ) { diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index f031261f6..af44d779e 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -232,7 +232,7 @@ _PROTOTYPE( static void fxp_confaddr, (fxp_t *fp) ); _PROTOTYPE( static void fxp_rec_mode, (fxp_t *fp) ); _PROTOTYPE( static void fxp_writev, (message *mp, int from_int, int vectored) ); -_PROTOTYPE( static void fxp_writev_s, (message *mp, int from_int) ); +_PROTOTYPE( static void fxp_writev_s, (const message *mp, int from_int) ); _PROTOTYPE( static void fxp_readv, (message *mp, int from_int, int vectored) ); _PROTOTYPE( static void fxp_readv_s, (message *mp, int from_int) ); @@ -367,7 +367,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) { /* Initialize the fxp driver. */ int r; @@ -1295,7 +1295,7 @@ suspend: /*===========================================================================* * fxp_writev_s * *===========================================================================*/ -static void fxp_writev_s(message *mp, int from_int) +static void fxp_writev_s(const message *mp, int from_int) { cp_grant_id_t iov_grant; vir_bytes iov_offset; diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index fe4976dd5..7415adc2f 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -105,7 +105,7 @@ _PROTOTYPE( static void ec_send, (ether_card_t *ec) ); _PROTOTYPE( static void ec_recv, (ether_card_t *ec) ); _PROTOTYPE( static void do_vwrite_s, (message *mp, int from_int) ); -_PROTOTYPE( static void do_vread_s, (message *mp) ); +_PROTOTYPE( static void do_vread_s, (const message *mp) ); _PROTOTYPE( static void ec_user2nic, (ether_card_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, @@ -372,7 +372,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the lance driver. */ int r; @@ -1067,7 +1067,7 @@ ether_card_t *ec; /*===========================================================================* * do_vread_s * *===========================================================================*/ -static void do_vread_s(message *mp) +static void do_vread_s(const message *mp) { int port, count, r; ether_card_t *ec; diff --git a/drivers/log/log.c b/drivers/log/log.c index 1d553f219..79dddd303 100644 --- a/drivers/log/log.c +++ b/drivers/log/log.c @@ -99,7 +99,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the log driver. */ int i; diff --git a/drivers/orinoco/hermes.c b/drivers/orinoco/hermes.c index 39996d76e..b9ff7141c 100644 --- a/drivers/orinoco/hermes.c +++ b/drivers/orinoco/hermes.c @@ -103,7 +103,7 @@ void hermes_struct_init (hermes_t * hw, u32_t address, * write HERMES_PCI_COR_MASK to the Configuration Option Register * *****************************************************************************/ int hermes_cor_reset (hermes_t *hw) { - int k, i; + int k; u16_t reg; /* Assert the reset until the card notice */ @@ -399,7 +399,6 @@ static int hermes_bap_seek (hermes_t * hw, int bap, u16_t id, u16_t offset) { * buffer */ int sreg = bap ? HERMES_SELECT1 : HERMES_SELECT0; int oreg = bap ? HERMES_OFFSET1 : HERMES_OFFSET0; - int resp0; int k; u16_t reg; @@ -743,7 +742,7 @@ void hermes_read_words (hermes_t * hw, int off, void *buf, unsigned count) { * registers are supported, but accessing I/O spaced registers should be * * quite trivial * *****************************************************************************/ -u16_t hermes_read_reg (hermes_t * hw, u16_t off) { +u16_t hermes_read_reg (const hermes_t * hw, u16_t off) { int v = 0; v = *((int *)(hw->locmem + (off << hw->reg_spacing))); return (u16_t) v; @@ -756,7 +755,7 @@ u16_t hermes_read_reg (hermes_t * hw, u16_t off) { * registers are supported, but accessing I/O spaced registers should be * * quite trivial * *****************************************************************************/ -void hermes_write_reg (hermes_t * hw, u16_t off, u16_t val) { +void hermes_write_reg (const hermes_t * hw, u16_t off, u16_t val) { int v = (int) val; *(int *)(hw->locmem + (off << hw->reg_spacing)) = v; } diff --git a/drivers/orinoco/hermes.h b/drivers/orinoco/hermes.h index 38a79be9b..77109c116 100644 --- a/drivers/orinoco/hermes.h +++ b/drivers/orinoco/hermes.h @@ -301,8 +301,9 @@ struct hermes_idstring #define HERMES_RECLEN_TO_BYTES(n) ( ((n)-1) * 2 ) /* Function prototypes */ -_PROTOTYPE (u16_t hermes_read_reg, (hermes_t * hw, u16_t off)); -_PROTOTYPE (void hermes_write_reg, (hermes_t * hw, u16_t off, u16_t val)); +_PROTOTYPE (u16_t hermes_read_reg, (const hermes_t * hw, u16_t off)); +_PROTOTYPE (void hermes_write_reg, (const hermes_t * hw, u16_t off, + u16_t val)); _PROTOTYPE (void hermes_struct_init, (hermes_t * hw, u32_t address, int io_space, int reg_spacing)); _PROTOTYPE (int hermes_init, (hermes_t * hw)); diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index c0394df41..e91f3c204 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -384,7 +384,6 @@ PRIVATE void sef_cb_signal_handler(int signo) * card * *****************************************************************************/ static void check_int_events(void) { - int i; t_or *orp; /* the interrupt message doesn't contain information about the port, try @@ -427,10 +426,7 @@ static void or_getname(message *mp) { *****************************************************************************/ static void do_hard_int(void) { - u16_t evstat; - hermes_t *hw; int i,s; - t_or *orp; for (i=0; i < OR_PORT_NR; i ++) { /* Run interrupt handler at driver level. */ @@ -454,7 +450,6 @@ static void or_reset() { static clock_t last_reset, now; t_or *orp; int i, j, r; - u16_t irqmask; if (OK != (r = getuptime(&now))) panic("orinoco: getuptime() failed: %d", r); @@ -499,8 +494,6 @@ static void or_reset() { static void or_dump (message *m) { t_or *orp; - int err; - u16_t evstat =0, d; for (orp = or_table; orp < or_table + OR_PORT_NR; orp++) { if(orp->or_mode == OR_M_DISABLED) { @@ -527,11 +520,10 @@ static void or_dump (message *m) * The main initialization function, called when a DL_INIT message comes in. * *****************************************************************************/ static void or_init (message * mp) { - int port, err, i; + int port; t_or *orp; message reply; static int first_time = 1; - clock_t t0,t1; if (first_time) { first_time = 0; @@ -657,9 +649,10 @@ static void or_pci_conf () { * Try to find the card based on information provided by pci and get irq and * * bar * *****************************************************************************/ -static int or_probe (t_or * orp) { +static int or_probe (t_or * orp) +{ u8_t ilr; - u32_t bar, reg, cpuspace_bar; + u32_t bar; char *dname; u16_t vid, did; int i, r, devind, just_one; @@ -748,9 +741,10 @@ static int or_probe (t_or * orp) { * * * Map the memory mapped registers into user space memory * *****************************************************************************/ -static void map_hw_buffer(t_or *orp) { +static void map_hw_buffer(t_or *orp) +{ int r; - size_t o, size, reg_size; + size_t o, size; char *buf, *abuf; hermes_t *hw = &(orp->hw); @@ -789,11 +783,10 @@ static void map_hw_buffer(t_or *orp) { * whether the card is memory mapped or in I/O space. Currently, only * * memmory mapped is supported. * *****************************************************************************/ -static u32_t or_get_bar (int devind, t_or * orp) { - - u32_t bar, desired_bar; - int is_iospace, i; - u16_t check, check2; +static u32_t or_get_bar (int devind, t_or * orp) +{ + u32_t bar; + int is_iospace; hermes_t *hw = &(orp->hw); /* bit 1 off the PCI_BAR register indicates whether the cards registers @@ -850,7 +843,8 @@ static u32_t or_get_bar (int devind, t_or * orp) { * * * Set the orinoco structure to default values * *****************************************************************************/ -static void or_init_struct (t_or * orp) { +static void or_init_struct (t_or * orp) +{ int i = 0; static eth_stat_t empty_stat = { 0, 0, 0, 0, 0, 0 }; @@ -902,7 +896,8 @@ static void or_init_struct (t_or * orp) { * Initialize hardware and prepare for intercepting the interrupts. At the * * end, the card is up and running * *****************************************************************************/ -static void or_init_hw (t_or * orp) { +static void or_init_hw (t_or * orp) +{ int i, err, s; hermes_t *hw = &(orp->hw); static int first_time = TRUE; @@ -971,13 +966,10 @@ static void or_init_hw (t_or * orp) { * In our case, we are mostly interested in the MAC address for now * *****************************************************************************/ -static void or_readrids (hermes_t * hw, t_or * orp) { - int err, len, i; - struct hermes_idstring nickbuf; - u16_t reclen, d; - +static void or_readrids (hermes_t * hw, t_or * orp) +{ /* Read the MAC address */ - err = hermes_read_ltv (hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, + int err = hermes_read_ltv (hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, ETH_ALEN, NULL, &orp->or_address); if (err) { printf ("%s: failed to read MAC address!\n", orp->or_name); @@ -992,10 +984,11 @@ static void or_readrids (hermes_t * hw, t_or * orp) { * Write some default rids to the card. A rid (resource identifier) * * is a data item in the firmware, some configuration variable, e.g. WEP key * *****************************************************************************/ -static void or_writerids (hermes_t * hw, t_or * orp) { +static void or_writerids (hermes_t * hw, t_or * orp) +{ int err; struct hermes_idstring idbuf; - u16_t port_type, max_data_len, reclen; + u16_t port_type; static char essid[IW_ESSID_MAX_SIZE + 1]; static char wepkey0[LARGE_KEY_LENGTH + 1]; @@ -1111,12 +1104,9 @@ static void or_rec_mode (t_or * orp) { *****************************************************************************/ static void or_handler (t_or *orp) { - int i, err, length, nr = 0; + int length; u16_t evstat, events, fid; - hermes_t *hw; - struct hermes_tx_descriptor desc; - - hw = &(orp->hw); + hermes_t *hw = &(orp->hw); beginning: /* Retrieve which kind of event happened */ @@ -1296,7 +1286,8 @@ next: * Will be called regularly to see whether the driver has crashed. If that * * condition is detected, reset the driver and card * *****************************************************************************/ -static void or_watchdog_f(timer_t *tp) { +static void or_watchdog_f(timer_t *tp) +{ int i; t_or *orp; @@ -1334,7 +1325,8 @@ static void or_watchdog_f(timer_t *tp) { * mess_reply * *****************************************************************************/ -static void mess_reply (message * req, message * reply_mess) { +static void mess_reply (message * req, message * reply_mess) +{ if (send (req->m_source, reply_mess) != 0) panic("orinoco: unable to mess_reply"); @@ -1348,19 +1340,17 @@ static void mess_reply (message * req, message * reply_mess) { * of or_writev_s. We left out the comments. For an explanation, see * * or_writev_s * ******************************************************************************/ -static void or_writev (message * mp, int from_int, int vectored) { - int port, or_client, count, size, err, data_len, data_off, tx_head; - int o, j, n, i, s, p, cps ; +static void or_writev (message * mp, int from_int, int vectored) +{ + int port, or_client, count, size, err, data_len, data_off; + int o, j, n, i, s, p, cps; struct ethhdr *eh; t_or *orp; - clock_t timebefore, t0; - phys_bytes phys_user; hermes_t *hw; struct hermes_tx_descriptor desc; struct header_struct hdr; iovec_t *iovp; - phys_bytes phys_databuf; u16_t txfid; static u8_t databuf[IEEE802_11_DATA_LEN + ETH_HLEN + 2 + 1]; memset (databuf, 0, IEEE802_11_DATA_LEN + ETH_HLEN + 3); @@ -1757,9 +1747,10 @@ static void reply (t_or * orp, int err, int may_block) { * * * Process information which comes in from the card * *****************************************************************************/ -static void or_ev_info (t_or * orp) { +static void or_ev_info (t_or * orp) +{ u16_t infofid; - int err, len, type, i; + int err, len, type; hermes_t *hw = &orp->hw; struct { @@ -1903,10 +1894,8 @@ static void print_linkstatus (t_or * orp, u16_t status) { * * * Process events which have been postponed in the interrupt handler * *****************************************************************************/ -static void or_check_ints (t_or * orp) { - int or_flags; - hermes_t *hw = &orp->hw; - +static void or_check_ints (t_or * orp) +{ if (orp->or_need_reset) or_reset(); if ((orp->rx_first!=orp->rx_last) && (orp->or_flags & OR_F_READING)) { @@ -1965,18 +1954,10 @@ static int is_ethersnap(struct header_struct *hdr) { * or_readv_s * *****************************************************************************/ static void or_readv (message * mp, int from_int, int vectored) { - int i, j, n, o, s, s1, dl_port, or_client, count, size, err, yep, cps; - port_t port; - clock_t timebefore; - unsigned amount, totlen, packlen; - struct hermes_rx_descriptor desc; - phys_bytes dst_phys; - u16_t d_start, d_end, status; - struct header_struct hdr; - int length, offset; - u32_t l, rxstat; - struct ethhdr *eh; - struct header_struct *h; + int i, j, n, o, s, dl_port; + int or_client, count; + int size, cps; + int length; t_or *orp; iovec_t *iovp; u8_t *databuf; @@ -2082,24 +2063,12 @@ suspend_readv : * Copy the data which is stored in orp->rx_buf[orp->rx_first] in the vector * * which was given with the message *mp * *****************************************************************************/ -static void or_readv_s (message * mp, int from_int) { - int i, j, n, o, s, s1, dl_port, or_client, count, size, err, cps; - int iov_offset = 0, length, offset; - port_t port; - clock_t timebefore; - unsigned amount, totlen, packlen; - struct hermes_rx_descriptor desc; - phys_bytes dst_phys; - u16_t d_start, d_end, status; - struct header_struct hdr; - u32_t l, rxstat; - struct ethhdr *eh; - struct header_struct *h; +static void or_readv_s (message * mp, int from_int) +{ + int i, j, n, o, s, dl_port, or_client, count, size, cps; + int iov_offset = 0, length; t_or *orp; - iovec_s_t *iovp; - phys_bytes databuf_phys; - u8_t *databuf; dl_port = mp->DL_PORT; @@ -2315,7 +2284,8 @@ static int or_get_recvd_packet(t_or *orp, u16_t rxfid, u8_t *databuf) { * Return the statistics structure. The statistics aren't updated until now, * * so this won't return much interesting yet. * *****************************************************************************/ -static void or_getstat (message * mp) { +static void or_getstat (message * mp) +{ int r, port; eth_stat_t stats; t_or *orp; diff --git a/drivers/readclock/readclock.c b/drivers/readclock/readclock.c index c5c30a073..fdc37a622 100644 --- a/drivers/readclock/readclock.c +++ b/drivers/readclock/readclock.c @@ -94,7 +94,6 @@ int main(int argc, char **argv) time_t now, rtc; int i, s; unsigned char mach_id, cmos_state; - struct sysgetenv sysgetenv; /* SEF local startup. */ env_setargs(argc, argv); @@ -231,7 +230,6 @@ void errmsg(char *s) void get_time(struct tm *t) { int osec, n; - unsigned long i; do { osec = -1; diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 23c05c0f9..154d552ae 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -153,12 +153,12 @@ _PROTOTYPE( static void rl_init_hw, (re_t *rep) ); _PROTOTYPE( static void rl_reset_hw, (re_t *rep) ); _PROTOTYPE( static void rl_confaddr, (re_t *rep) ); _PROTOTYPE( static void rl_rec_mode, (re_t *rep) ); -_PROTOTYPE( static void rl_readv, (message *mp, int from_int, +_PROTOTYPE( static void rl_readv, (const message *mp, int from_int, int vectored) ); -_PROTOTYPE( static void rl_readv_s, (message *mp, int from_int) ); -_PROTOTYPE( static void rl_writev, (message *mp, int from_int, +_PROTOTYPE( static void rl_readv_s, (const message *mp, int from_int) ); +_PROTOTYPE( static void rl_writev, (const message *mp, int from_int, int vectored) ); -_PROTOTYPE( static void rl_writev_s, (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) ); @@ -298,7 +298,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the rtl8139 driver. */ #if RTL8139_FKEY @@ -696,7 +696,7 @@ re_t *rep; size_t rx_bufsize, tx_bufsize, tot_bufsize; phys_bytes buf; char *mallocbuf; - int fd, s, i, off; + int i, off; /* Allocate receive and transmit buffers */ tx_bufsize= ETH_MAX_PACK_SIZE_TAGGED; @@ -971,12 +971,11 @@ re_t *rep; /*===========================================================================* * rl_readv * *===========================================================================*/ -static void rl_readv(message *mp, int from_int, int vectored) +static void rl_readv(const message *mp, int from_int, int vectored) { int i, j, n, o, s, s1, dl_port, re_client, count, size; port_t port; unsigned amount, totlen, packlen; - phys_bytes dst_phys; u16_t d_start, d_end; u32_t l, rxstat = 0x12345678; re_t *rep; @@ -1218,7 +1217,7 @@ suspend: /*===========================================================================* * rl_readv_s * *===========================================================================*/ -static void rl_readv_s(message *mp, int from_int) +static void rl_readv_s(const message *mp, int from_int) { int i, j, n, o, s, s1, dl_port, re_client, count, size; port_t port; @@ -1444,7 +1443,7 @@ suspend: /*===========================================================================* * rl_writev * *===========================================================================*/ -static void rl_writev(message *mp, int from_int, int vectored) +static void rl_writev(const message *mp, int from_int, int vectored) { phys_bytes phys_user; int i, j, n, s, port, count, size; @@ -1585,7 +1584,7 @@ suspend: /*===========================================================================* * rl_writev_s * *===========================================================================*/ -static void rl_writev_s(message *mp, int from_int) +static void rl_writev_s(const message *mp, int from_int) { int i, j, n, s, port, count, size; int tx_head, re_client; @@ -2110,7 +2109,6 @@ re_t *rep; { port_t port; u8_t cr; - int i; clock_t t0,t1; rep->re_clear_rx= FALSE; diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 0db59fed5..786b0f0a5 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -249,8 +249,8 @@ _PROTOTYPE( static void rl_init_hw, (re_t *rep) ); _PROTOTYPE( static void rl_reset_hw, (re_t *rep) ); _PROTOTYPE( static void rl_confaddr, (re_t *rep) ); _PROTOTYPE( static void rl_rec_mode, (re_t *rep) ); -_PROTOTYPE( static void rl_readv_s, (message *mp, int from_int) ); -_PROTOTYPE( static void rl_writev_s, (message *mp, int from_int) ); +_PROTOTYPE( static void rl_readv_s, (const message *mp, int from_int) ); +_PROTOTYPE( static void rl_writev_s, (const message *mp, int from_int) ); _PROTOTYPE( static void rl_check_ints, (re_t *rep) ); _PROTOTYPE( static void rl_report_link, (re_t *rep) ); _PROTOTYPE( static void rl_do_reset, (re_t *rep) ); @@ -262,7 +262,7 @@ _PROTOTYPE( static void mess_reply, (message *req, message *reply) ); _PROTOTYPE( static void check_int_events, (void) ); _PROTOTYPE( static void do_hard_int, (void) ); _PROTOTYPE( static void rtl8169_dump, (void) ); -_PROTOTYPE( static void dump_phy, (re_t *rep) ); +_PROTOTYPE( static void dump_phy, (const re_t *rep) ); _PROTOTYPE( static void rl_handler, (re_t *rep) ); _PROTOTYPE( static void rl_watchdog_f, (timer_t *tp) ); @@ -363,7 +363,7 @@ PRIVATE void sef_local_startup() /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ -PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) +PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the rtl8169 driver. */ u32_t inet_proc_nr; @@ -1283,7 +1283,7 @@ void transmittest(re_t *rep) /*===========================================================================* * rl_readv_s * *===========================================================================*/ -static void rl_readv_s(message *mp, int from_int) +static void rl_readv_s(const message *mp, int from_int) { int i, j, n, s, dl_port, re_client, count, size, index; port_t port; @@ -1425,7 +1425,7 @@ suspend: /*===========================================================================* * rl_writev_s * *===========================================================================*/ -static void rl_writev_s(message *mp, int from_int) +static void rl_writev_s(const message *mp, int from_int) { int i, j, n, s, port, count, size; int tx_head, re_client; @@ -1790,7 +1790,7 @@ message *reply_mess; panic("unable to mess_reply"); } -static void dump_phy(re_t *rep) +static void dump_phy(const re_t *rep) { #if VERBOSE port_t port; diff --git a/drivers/ti1225/ti1225.c b/drivers/ti1225/ti1225.c index 5783497c8..8c94a925d 100644 --- a/drivers/ti1225/ti1225.c +++ b/drivers/ti1225/ti1225.c @@ -183,7 +183,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) PRIVATE void hw_init(pp) struct port *pp; { - int i, r, devind, irq, socket; + int r, devind, irq; u8_t v8; u16_t v16; u32_t v32; @@ -311,7 +311,7 @@ PRIVATE void map_regs(struct port *pp, u32_t base) PRIVATE void do_int(pp) struct port *pp; { - int i, r, devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv, + int r, devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv, socket_5v, socket_3v, socket_Xv, socket_Yv; clock_t t0, t1; u32_t csr_event, csr_present, csr_control; diff --git a/drivers/tty/console.c b/drivers/tty/console.c index 00d30adab..985f5608a 100644 --- a/drivers/tty/console.c +++ b/drivers/tty/console.c @@ -821,7 +821,6 @@ PUBLIC void do_video(message *m) case TIOCUNMAPMEM: { int r, do_map; struct mapreqvm mapreqvm; - void *result; do_map= (m->REQUEST == TIOCMAPMEM); /* else unmap */ diff --git a/drivers/tty/keyboard.c b/drivers/tty/keyboard.c index 56295cdf7..9b9e77f90 100644 --- a/drivers/tty/keyboard.c +++ b/drivers/tty/keyboard.c @@ -1182,7 +1182,6 @@ int scode; /* scan code for a function key */ * in kb_init, where NONE is set to indicate there is no interest in the key. * Returns FALSE on a key release or if the key is not observable. */ - message m; int key; int proc_nr; diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index af47414a6..324b56c82 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -161,8 +161,6 @@ PUBLIC int main(void) sef_local_startup(); while (TRUE) { - int adflag = 0; - /* Check for and handle any events on any of the ttys. */ for (tp = FIRST_TTY; tp < END_TTY; tp++) { if (tp->tty_events) handle_events(tp); diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index bc9233f01..9d39aa969 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -78,7 +78,7 @@ PRIVATE u32_t pci_config_intr_data; PRIVATE u32_t ioapic_extint_assigned = 0; PRIVATE int lapic_extint_assigned = 0; -PRIVATE int calib_clk_handler(irq_hook_t * hook) +PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook)) { u32_t tcrt; u64_t tsc; diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index c68b6bebb..8f6c4be7d 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -137,8 +137,8 @@ PRIVATE phys_bytes createpde( /*===========================================================================* * lin_lin_copy * *===========================================================================*/ -PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr, - struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes) +PRIVATE int lin_lin_copy(const struct proc *srcproc, vir_bytes srclinaddr, + const struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes) { u32_t addr; proc_nr_t procslot; @@ -476,7 +476,7 @@ PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual, /*===========================================================================* * vm_contiguous * *===========================================================================*/ -PUBLIC int vm_contiguous(struct proc *targetproc, u32_t vir_buf, size_t bytes) +PUBLIC int vm_contiguous(const struct proc *targetproc, u32_t vir_buf, size_t bytes) { int first = 1, r; u32_t prev_phys = 0; /* Keep lints happy. */ @@ -900,7 +900,7 @@ PUBLIC void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp) /*===========================================================================* * arch_umap * *===========================================================================*/ -PUBLIC int arch_umap(struct proc *pr, vir_bytes offset, vir_bytes count, +PUBLIC int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count, int seg, phys_bytes *addr) { switch(seg) { diff --git a/kernel/proto.h b/kernel/proto.h index 58fed5f6e..8be84262e 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -162,10 +162,10 @@ _PROTOTYPE( void do_ser_debug, (void) ); _PROTOTYPE( int arch_get_params, (char *parm, int max)); _PROTOTYPE( int arch_set_params, (char *parm, int max)); _PROTOTYPE( void arch_pre_exec, (struct proc *pr, u32_t, u32_t)); -_PROTOTYPE( int arch_umap, (struct proc *pr, vir_bytes, vir_bytes, +_PROTOTYPE( int arch_umap, (const struct proc *pr, vir_bytes, vir_bytes, int, phys_bytes *)); _PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p)); -_PROTOTYPE( int vm_contiguous, (struct proc *targetproc, vir_bytes vir_buf, size_t count)); +_PROTOTYPE( int vm_contiguous, (const struct proc *targetproc, vir_bytes vir_buf, size_t count)); _PROTOTYPE( void proc_stacktrace, (struct proc *proc) ); _PROTOTYPE( int vm_lookup, (const struct proc *proc, vir_bytes virtual, vir_bytes *result, u32_t *ptent)); _PROTOTYPE( int delivermsg, (struct proc *target)); diff --git a/lib/libc/ip/getifaddrs.c b/lib/libc/ip/getifaddrs.c index 748ae97eb..1872ae30b 100644 --- a/lib/libc/ip/getifaddrs.c +++ b/lib/libc/ip/getifaddrs.c @@ -18,7 +18,7 @@ getifaddrs(struct ifaddrs **ifap) { static int fd = -1; nwio_ipconf_t ipconf; - int flags, err, r; + int flags; static struct ifaddrs ifa; static struct sockaddr_in addr, netmask; diff --git a/lib/libc/ip/recvfrom.c b/lib/libc/ip/recvfrom.c index ce9656585..659535666 100644 --- a/lib/libc/ip/recvfrom.c +++ b/lib/libc/ip/recvfrom.c @@ -105,7 +105,6 @@ static ssize_t _udp_recvfrom(int socket, void *_RESTRICT buffer, size_t length, int r, t_errno; size_t buflen, len; void *buf; - struct sockaddr_in *sinp; udp_io_hdr_t *io_hdrp; struct sockaddr_in sin; diff --git a/lib/libc/ip/setsockopt.c b/lib/libc/ip/setsockopt.c index 58922b9f6..c5d362ac5 100644 --- a/lib/libc/ip/setsockopt.c +++ b/lib/libc/ip/setsockopt.c @@ -169,8 +169,6 @@ static int _tcp_setsockopt(int socket, int level, int option_name, static int _udp_setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len) { - int i; - #if DEBUG fprintf(stderr, "_udp_setsocketopt: level %d, name %d\n", level, option_name); diff --git a/lib/libc/other/_mount.c b/lib/libc/other/_mount.c index 5d930ae91..597b71256 100644 --- a/lib/libc/other/_mount.c +++ b/lib/libc/other/_mount.c @@ -18,7 +18,6 @@ PRIVATE int rs_down(char *label) { char cmd[200]; - message m; if(strlen(_PATH_SERVICE)+strlen(label)+50 >= sizeof(cmd)) return -1; sprintf(cmd, _PATH_SERVICE " down '%s'", label); diff --git a/lib/libc/other/_seekdir.c b/lib/libc/other/_seekdir.c index a341f9dc7..7c4159c30 100644 --- a/lib/libc/other/_seekdir.c +++ b/lib/libc/other/_seekdir.c @@ -1,7 +1,6 @@ /* seekdir() Author: Kees J. Bot * 24 Apr 1989 */ -#define nil 0 #include #define lseek _lseek #define readdir _readdir @@ -14,9 +13,7 @@ int seekdir(DIR *dp, off_t pos) /* Seek to position pos in a directory. */ { - int off; - - if (dp == nil) { errno= EBADF; return -1; } + if (dp == NULL) { errno= EBADF; return -1; } dp->_count= 0; diff --git a/lib/libc/other/asynchio.c b/lib/libc/other/asynchio.c index df6eb6ea5..ee7434bda 100644 --- a/lib/libc/other/asynchio.c +++ b/lib/libc/other/asynchio.c @@ -5,7 +5,6 @@ * Thise are just stub routines that are call compatible with * the asynchio(3) library of Minix-vmd. See asynchio.h. */ -#define nil 0 #define alarm _alarm #define ioctl _ioctl #define read _read @@ -98,8 +97,8 @@ int asyn_wait(asynchio_t *asyn, int flags, struct timeval *to) return 0; } - if (to != nil) { - now= time(nil); + if (to != NULL) { + now= time(NULL); if (to->tv_sec <= now) { errno= EINTR; return -1; } old_timer= alarm(0); new_sa.sa_handler= time_out; @@ -129,7 +128,7 @@ int asyn_wait(asynchio_t *asyn, int flags, struct timeval *to) asyn->errno= errno; break; } - if (to != nil) { + if (to != NULL) { alarm(0); sigaction(SIGALRM, &old_sa, (struct sigaction *)0); alarm(old_timer); diff --git a/lib/libc/other/fts.c b/lib/libc/other/fts.c index 7a4023c5e..f9dc37b15 100644 --- a/lib/libc/other/fts.c +++ b/lib/libc/other/fts.c @@ -1209,7 +1209,6 @@ static int fts_ufslinks(FTS *sp, const FTSENT *ent) { struct _fts_private *priv; - const char **cpp; priv = (struct _fts_private *)sp; priv->ftsp_linksreliable = 0; diff --git a/lib/libc/other/initgroups.c b/lib/libc/other/initgroups.c index d27554945..3f455793f 100644 --- a/lib/libc/other/initgroups.c +++ b/lib/libc/other/initgroups.c @@ -11,7 +11,7 @@ initgroups.c int initgroups(const char *name, gid_t basegid) { struct group *gr; - int r, found = 0, n = 0; + int r, n = 0; gid_t groups[NGROUPS]; if((r = setgid(basegid)) < 0) diff --git a/lib/libc/other/vectorio.c b/lib/libc/other/vectorio.c index 20d007464..1e59e6959 100644 --- a/lib/libc/other/vectorio.c +++ b/lib/libc/other/vectorio.c @@ -75,7 +75,6 @@ static ssize_t vectorio(int fildes, const struct iovec *iov, int iovcnt, int readwrite) { int i; - struct stat statbuf; ssize_t totallen; /* parameter sanity checks */ diff --git a/lib/libc/posix/_mmap.c b/lib/libc/posix/_mmap.c index a1bfd6638..a01602015 100644 --- a/lib/libc/posix/_mmap.c +++ b/lib/libc/posix/_mmap.c @@ -85,7 +85,6 @@ PUBLIC int vm_unmap(int endpt, void *addr) PUBLIC unsigned long vm_getphys(int endpt, void *addr) { message m; - unsigned long ret; int r; m.VMPHYS_ENDPT = endpt; @@ -100,7 +99,6 @@ PUBLIC unsigned long vm_getphys(int endpt, void *addr) PUBLIC u8_t vm_getrefcount(int endpt, void *addr) { message m; - u8_t ret; int r; m.VMREFCNT_ENDPT = endpt; diff --git a/lib/libc/posix/_ucontext.c b/lib/libc/posix/_ucontext.c index 110133566..d7930e6ad 100644 --- a/lib/libc/posix/_ucontext.c +++ b/lib/libc/posix/_ucontext.c @@ -70,7 +70,7 @@ PUBLIC int getuctx(ucontext_t *ucp) PUBLIC void makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) { va_list ap; - unsigned int *stack_top, *stack_guard; + unsigned int *stack_top; /* There are a number of situations that are erroneous, but we can't actually tell the caller something is wrong, because this is a void function. @@ -158,7 +158,6 @@ PUBLIC void makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) PUBLIC int swapcontext(ucontext_t *oucp, const ucontext_t *ucp) { int r; - unsigned int *stack_guard; if ((oucp == NULL) || (ucp == NULL)) { errno = EFAULT; diff --git a/lib/libc/posix/getloadavg.c b/lib/libc/posix/getloadavg.c index adca7d847..70253473b 100644 --- a/lib/libc/posix/getloadavg.c +++ b/lib/libc/posix/getloadavg.c @@ -41,7 +41,7 @@ int getloadavg(double *loadavg, int nelem) unfilled_ticks = TICKSPERSLOT - (loadinfo.last_clock % TICKSPERSLOT); for(p = 0; p < nelem; p++) { - int h, offset, slots; + int h, slots; double l = 0.0; int latest = loadinfo.proc_last_slot; slots = minutes[p] * 60 / _LOAD_UNIT_SECS; diff --git a/lib/libdriver/driver.c b/lib/libdriver/driver.c index 7a8a5c693..483c3cadc 100644 --- a/lib/libdriver/driver.c +++ b/lib/libdriver/driver.c @@ -126,7 +126,6 @@ int type; /* Driver type (DRIVER_STD or DRIVER_ASYN) */ int r, proc_nr; message mess; - sigset_t set; /* Init MQ library. */ mq_init(); diff --git a/lib/libtimers/tmrs_clr.c b/lib/libtimers/tmrs_clr.c index b8d2a732a..5b97570b3 100644 --- a/lib/libtimers/tmrs_clr.c +++ b/lib/libtimers/tmrs_clr.c @@ -11,7 +11,6 @@ clock_t *next_time; /* Deactivate a timer and remove it from the timers queue. */ timer_t **atp; - struct proc *p; clock_t prev_time; if(*tmrs) diff --git a/lib/libutil/openpty.c b/lib/libutil/openpty.c index ec6db2525..e28080076 100644 --- a/lib/libutil/openpty.c +++ b/lib/libutil/openpty.c @@ -29,9 +29,8 @@ int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) { - char buff[128], temp[128]; + char buff[128]; register int i, j; - int pty_fd = -1, gr; static char tty_name[128]; struct group *ttygroup; gid_t tty_gid = 0; diff --git a/servers/ds/proto.h b/servers/ds/proto.h index 1bd516595..c8ec34561 100644 --- a/servers/ds/proto.h +++ b/servers/ds/proto.h @@ -9,12 +9,12 @@ _PROTOTYPE(int main, (int argc, char **argv)); /* store.c */ _PROTOTYPE(int do_publish, (message *m_ptr)); _PROTOTYPE(int do_retrieve, (message *m_ptr)); -_PROTOTYPE(int do_retrieve_label, (message *m_ptr)); +_PROTOTYPE(int do_retrieve_label, (const message *m_ptr)); _PROTOTYPE(int do_subscribe, (message *m_ptr)); _PROTOTYPE(int do_check, (message *m_ptr)); _PROTOTYPE(int do_delete, (message *m_ptr)); _PROTOTYPE(int do_snapshot, (message *m_ptr)); -_PROTOTYPE(int do_getsysinfo, (message *m_ptr)); +_PROTOTYPE(int do_getsysinfo, (const message *m_ptr)); _PROTOTYPE(int sef_cb_init_fresh, (int type, sef_init_info_t *info)); #endif diff --git a/servers/ds/store.c b/servers/ds/store.c index 53e83ad2e..e37088f7b 100644 --- a/servers/ds/store.c +++ b/servers/ds/store.c @@ -126,7 +126,7 @@ PRIVATE endpoint_t ds_getprocep(const char *s) /*===========================================================================* * check_auth * *===========================================================================*/ -PRIVATE int check_auth(struct data_store *p, endpoint_t ep, int perm) +PRIVATE int check_auth(const struct data_store *p, endpoint_t ep, int perm) { /* Check authorization for a given type of permission. */ char *source; @@ -141,7 +141,7 @@ PRIVATE int check_auth(struct data_store *p, endpoint_t ep, int perm) /*===========================================================================* * get_key_name * *===========================================================================*/ -PRIVATE int get_key_name(message *m_ptr, char *key_name) +PRIVATE int get_key_name(const message *m_ptr, char *key_name) { /* Get key name given an input message. */ int r; @@ -169,7 +169,7 @@ PRIVATE int get_key_name(message *m_ptr, char *key_name) /*===========================================================================* * check_snapshot_index * *===========================================================================*/ -PRIVATE int check_snapshot_index(struct data_store *dsp, int index) +PRIVATE int check_snapshot_index(const struct data_store *dsp, int index) { /* See if the given snapshot index is valid. */ int min; @@ -184,7 +184,7 @@ PRIVATE int check_snapshot_index(struct data_store *dsp, int index) /*===========================================================================* * check_sub_match * *===========================================================================*/ -PRIVATE int check_sub_match(struct subscription *subp, +PRIVATE int check_sub_match(const struct subscription *subp, struct data_store *dsp, endpoint_t ep) { /* Check if an entry matches a subscription. Return 1 in case of match. */ @@ -227,7 +227,7 @@ PRIVATE void update_subscribers(struct data_store *dsp, int set) /*===========================================================================* * map_service * *===========================================================================*/ -PRIVATE int map_service(struct rprocpub *rpub) +PRIVATE int map_service(const struct rprocpub *rpub) { /* Map a new service by registering its label. */ struct data_store *dsp; @@ -489,7 +489,7 @@ PUBLIC int do_retrieve(message *m_ptr) /*===========================================================================* * do_retrieve_label * *===========================================================================*/ -PUBLIC int do_retrieve_label(message *m_ptr) +PUBLIC int do_retrieve_label(const message *m_ptr) { struct data_store *dsp; int r; @@ -743,7 +743,7 @@ PUBLIC int do_snapshot(message *m_ptr) /*===========================================================================* * do_getsysinfo * *===========================================================================*/ -PUBLIC int do_getsysinfo(message *m_ptr) +PUBLIC int do_getsysinfo(const message *m_ptr) { vir_bytes src_addr; size_t length; diff --git a/servers/mfs/link.c b/servers/mfs/link.c index 28939ddad..861854865 100644 --- a/servers/mfs/link.c +++ b/servers/mfs/link.c @@ -286,7 +286,6 @@ PUBLIC int fs_rename() char old_name[NAME_MAX], new_name[NAME_MAX]; ino_t numb; phys_bytes len; - int r1; /* Copy the last component of the old name */ len = MFS_MIN(fs_m_in.REQ_REN_LEN_OLD, sizeof(old_name)); diff --git a/servers/rs/manager.c b/servers/rs/manager.c index 157097a1f..37a40fd25 100644 --- a/servers/rs/manager.c +++ b/servers/rs/manager.c @@ -1631,7 +1631,7 @@ struct priv *privp; struct rprocpub *tmp_rpub; endpoint_t endpoint; int r; - int slot_nr, priv_id; + int priv_id; struct priv priv; struct rprocpub *rpub; diff --git a/servers/rs/service/service.c b/servers/rs/service/service.c index 1664f69be..baeeec82a 100644 --- a/servers/rs/service/service.c +++ b/servers/rs/service/service.c @@ -536,7 +536,6 @@ PRIVATE void do_irq(config_t *cpe) PRIVATE void do_io(config_t *cpe) { - int irq; unsigned base, len; char *check; @@ -665,9 +664,6 @@ PRIVATE void do_pci_class(config_t *cpe) PRIVATE void do_pci(config_t *cpe) { - int i, call_nr, word, bits_per_word; - unsigned long mask; - if (cpe == NULL) return; /* Empty PCI statement */ @@ -811,7 +807,7 @@ PRIVATE void do_vm(config_t *cpe) PRIVATE void do_system(config_t *cpe) { - int i, call_nr; + int i; /* Process a list of 'system' calls that are allowed */ for (; cpe; cpe= cpe->next) @@ -1017,7 +1013,6 @@ PUBLIC int main(int argc, char **argv) message m; int result = EXIT_SUCCESS; int request; - int i; char *progname = NULL; struct passwd *pw; diff --git a/servers/vfs/device.c b/servers/vfs/device.c index 8c105e555..2407a2ef3 100644 --- a/servers/vfs/device.c +++ b/servers/vfs/device.c @@ -771,7 +771,6 @@ int flags; /* mode bits and flags */ if (op == DEV_OPEN && dev_mess.REP_STATUS >= 0) { if (dev_mess.REP_STATUS != minor) { struct vnode *vp; - struct vmnt *vmp; struct node_details res; /* A new minor device number has been returned. @@ -873,7 +872,6 @@ PUBLIC void dev_up(int maj) needs_reopen= FALSE; for (fp = filp; fp < &filp[NR_FILPS]; fp++) { struct vnode *vp; - int minor; if(fp->filp_count < 1 || !(vp = fp->filp_vno)) continue; if(((vp->v_sdev >> MAJOR) & BYTE) != maj) continue; diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 9b0993e06..733bbdf1d 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -526,7 +526,6 @@ PUBLIC int req_mountpoint(fs_e, inode_nr) endpoint_t fs_e; ino_t inode_nr; { - int r; message m; /* Fill in request message */ @@ -1023,7 +1022,7 @@ PRIVATE int fs_sendrec_f(char *file, int line, endpoint_t fs_e, message *reqm) * It also handles driver recovery mechanism and reissuing the * request which failed due to a dead driver. */ - int r, old_driver_e, new_driver_e; + int r, old_driver_e; message origm, m; if(fs_e <= 0 || fs_e == NONE) -- 2.44.0