#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);
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);
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.
*/
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.
*/
{
char params[SECTOR_SIZE + 1];
token **acmds;
- int r, bus, processor;
+ int r, processor;
memory *mp;
static char bus_type[][4] = {
"xt", "at", "mca"
{
dev_t dev;
ino_t ino;
- int drive;
struct stat st;
char *n, *s;
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. */
*
* 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>
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;
}
}
}
-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);
}
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 {
}
/* 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);
}
}
}
-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) {
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. */
/* 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. */
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. */
}
}
-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. */
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;
*/
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);
/* 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
/* 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;
* 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;
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) {
}
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",
}
}
-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
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))
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];
size += i;
buf[size]= '\r';
- if (logical != nil) {
+ if (logical != NULL) {
if ((logfd= open(logical, O_RDONLY)) < 0
|| ioctl(logfd, DIOCGETP, &geometry) < 0
) {
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.
*/
int main(int argc, char **argv)
{
- int i;
static char buf[512];
unsigned long size, mul;
off_t offset;
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;
}
STATIC int
-unalias(char *name)
+unalias(const char *name)
{
struct alias *ap, **app;
}
struct alias *
-lookupalias(char *name, int check)
+lookupalias(const char *name, int check)
{
struct alias *ap = *hashalias(name);
int flag;
};
-struct alias *lookupalias(char *, int);
+struct alias *lookupalias(const char *, int);
int aliascmd(int, char **);
int unaliascmd(int, char **);
void rmaliases(void);
#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 *);
* 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));
}
STATIC int
-cdlogical(char *dest)
+cdlogical(const char *dest)
{
char *p;
char *q;
*/
char *
-savestr(char *s)
+savestr(const char *s)
{
char *p;
pointer ckmalloc(int);
pointer ckrealloc(pointer, int);
-char *savestr(char *);
+char *savestr(const char *);
pointer stalloc(int);
void stunalloc(pointer);
void setstackmark(struct stackmark *);
}
-int binsearch(char *w, Keyword *kp, int n)
+int binsearch(const char *w, const Keyword *kp, int n)
{
int cond, low, mid, high;
set_profile(filename)
char *filename;
{ char pfile[200];
- char psfile[200];
register int pfd, len;
chroff sbx_fdlen();
register char *profptr;
{ 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
{ register struct scr_line *s;
register int col, scrw;
char *cp;
- int ch;
col = 0;
scrw = scr_wid;
*/
tstfillp(lim)
int lim;
-{ register int i, c;
+{ register int i;
register char *cp;
chroff savdot;
fill_cur_line()
{
register int foundit, i;
- chroff lastbrkdot, boldot, eoldot;
+ chroff lastbrkdot, boldot;
boldot = e_boldot();
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];
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;
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 */
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();
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;
}
}
-int is_ignored(char *name)
+int is_ignored(const char *name)
/* Is a file in the list of ignored files? */
{
struct file *ip;
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. */
{
int main(int argc, char *argv[])
{
- int sec;
-
if(argc != 2) {
fprintf(stderr, "Usage: %s <device>\n", argv[0]);
return 1;
int fd;
struct partition entry;
unsigned long d;
- struct stat st;
if ((fd = open(device, O_RDONLY)) == -1) {
perror("sizeup open");
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;
int argc;
register char **argv;
{
- FILE *fp;
register char *s;
prog_name= argv[0];
{
char buffer[256];
register char *bp, *gp, *lp;
- int alldigits;
- int hasspace;
int len;
pers->realname = 0;
char *name;
{
char *host;
- char fname[100];
struct hostent *hp;
- struct servent *sp;
int s, result;
#if !_MINIX
char *rindex();
/* 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;
/*===========================================================================*
* 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();
/* 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) );
}
-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;
}
-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;
#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
/*============================================================================*
* w_other *
*============================================================================*/
-PRIVATE int w_other(struct driver *dr, message *m)
+PRIVATE int w_other(struct driver *UNUSED(dr), message *m)
{
int r;
_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 *); );
_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 *); );
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));
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;
** 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;
** 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;
** 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) {
** 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;
** 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;
** 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;
** 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;
** 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;
return;
}
-static void do_watchdog(void *message)
+static void do_watchdog(const void *UNUSED(message))
{
DEBUG(printf("\t no reply"));
PUBLIC int main(int argc, char **argv)
{
message m;
- dpeth_t *dep;
int rc;
/* 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;
_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) );
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
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;
#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 */
/*===========================================================================*
* 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.
* 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.
*/
/*===========================================================================*
* 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.
/*===========================================================================*
* 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.
/* 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);
/*===========================================================================*
* 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
/*===========================================================================*
* 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().
*/
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) );
* fdc_command *
*===========================================================================*/
PRIVATE int fdc_command(
- u8_t *cmd, /* command bytes */
+ const u8_t *cmd, /* command bytes */
int len /* command length */
)
{
_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) );
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
_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,
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
* 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 */
* buffer */
int sreg = bap ? HERMES_SELECT1 : HERMES_SELECT0;
int oreg = bap ? HERMES_OFFSET1 : HERMES_OFFSET0;
- int resp0;
int k;
u16_t reg;
* 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;
* 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;
}
#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));
* card *
*****************************************************************************/
static void check_int_events(void) {
- int i;
t_or *orp;
/* the interrupt message doesn't contain information about the port, try
*****************************************************************************/
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. */
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);
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) {
* 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;
* 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;
* *
* 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);
* 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
* *
* 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 };
* 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;
* 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);
* 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];
*****************************************************************************/
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 */
* 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;
* 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");
* 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);
* *
* 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 {
* *
* 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)) {
* 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;
* 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;
* 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;
time_t now, rtc;
int i, s;
unsigned char mach_id, cmos_state;
- struct sysgetenv sysgetenv;
/* SEF local startup. */
env_setargs(argc, argv);
void get_time(struct tm *t)
{
int osec, n;
- unsigned long i;
do {
osec = -1;
_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) );
/*===========================================================================*
* 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
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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
{
port_t port;
u8_t cr;
- int i;
clock_t t0,t1;
rep->re_clear_rx= FALSE;
_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) );
_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) );
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
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;
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;
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;
case TIOCUNMAPMEM: {
int r, do_map;
struct mapreqvm mapreqvm;
- void *result;
do_map= (m->REQUEST == TIOCMAPMEM); /* else unmap */
* 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;
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);
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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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. */
/*===========================================================================*
* 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) {
_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));
{
static int fd = -1;
nwio_ipconf_t ipconf;
- int flags, err, r;
+ int flags;
static struct ifaddrs ifa;
static struct sockaddr_in addr, netmask;
int r, t_errno;
size_t buflen, len;
void *buf;
- struct sockaddr_in *sinp;
udp_io_hdr_t *io_hdrp;
struct sockaddr_in sin;
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);
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);
/* seekdir() Author: Kees J. Bot
* 24 Apr 1989
*/
-#define nil 0
#include <lib.h>
#define lseek _lseek
#define readdir _readdir
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;
* 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
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;
asyn->errno= errno;
break;
}
- if (to != nil) {
+ if (to != NULL) {
alarm(0);
sigaction(SIGALRM, &old_sa, (struct sigaction *)0);
alarm(old_timer);
fts_ufslinks(FTS *sp, const FTSENT *ent)
{
struct _fts_private *priv;
- const char **cpp;
priv = (struct _fts_private *)sp;
priv->ftsp_linksreliable = 0;
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)
int iovcnt, int readwrite)
{
int i;
- struct stat statbuf;
ssize_t totallen;
/* parameter sanity checks */
PUBLIC unsigned long vm_getphys(int endpt, void *addr)
{
message m;
- unsigned long ret;
int r;
m.VMPHYS_ENDPT = endpt;
PUBLIC u8_t vm_getrefcount(int endpt, void *addr)
{
message m;
- u8_t ret;
int r;
m.VMREFCNT_ENDPT = endpt;
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.
PUBLIC int swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
{
int r;
- unsigned int *stack_guard;
if ((oucp == NULL) || (ucp == NULL)) {
errno = EFAULT;
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;
int r, proc_nr;
message mess;
- sigset_t set;
/* Init MQ library. */
mq_init();
/* Deactivate a timer and remove it from the timers queue.
*/
timer_t **atp;
- struct proc *p;
clock_t prev_time;
if(*tmrs)
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;
/* 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
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
/*===========================================================================*
* 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. */
/*===========================================================================*
* 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;
/*===========================================================================*
* 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;
/*===========================================================================*
* do_getsysinfo *
*===========================================================================*/
-PUBLIC int do_getsysinfo(message *m_ptr)
+PUBLIC int do_getsysinfo(const message *m_ptr)
{
vir_bytes src_addr;
size_t length;
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));
struct rprocpub *tmp_rpub;
endpoint_t endpoint;
int r;
- int slot_nr, priv_id;
+ int priv_id;
struct priv priv;
struct rprocpub *rpub;
PRIVATE void do_io(config_t *cpe)
{
- int irq;
unsigned base, len;
char *check;
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 */
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)
message m;
int result = EXIT_SUCCESS;
int request;
- int i;
char *progname = NULL;
struct passwd *pw;
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.
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;
endpoint_t fs_e;
ino_t inode_nr;
{
- int r;
message m;
/* Fill in request message */
* 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)