Removed unused variables, added const where possible.
This commit is contained in:
parent
c39eb33b74
commit
94a81c840a
75 changed files with 207 additions and 286 deletions
12
boot/boot.c
12
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;
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -83,7 +83,7 @@ ckrealloc(pointer p, int nbytes)
|
|||
*/
|
||||
|
||||
char *
|
||||
savestr(char *s)
|
||||
savestr(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. */
|
||||
{
|
||||
|
|
|
@ -23,8 +23,6 @@ unsigned long sizeup(char *);
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int sec;
|
||||
|
||||
if(argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <device>\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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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().
|
||||
*/
|
||||
|
|
|
@ -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 */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* seekdir() Author: Kees J. Bot
|
||||
* 24 Apr 1989
|
||||
*/
|
||||
#define nil 0
|
||||
#include <lib.h>
|
||||
#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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue