#define BSIZE 512
#define LOGBS 9
-PRIVATE struct file {
+static struct file {
int fid;
char *name;
long cblock;
#define e3 smap[1]
#define f3 smap[2]
-PRIVATE long cnt[3]; /* Sizes of segments */
-PRIVATE int h_size; /* Size of core header */
-PRIVATE char def_name[] = "core"; /* Default core name */
+static long cnt[3]; /* Sizes of segments */
+static int h_size; /* Size of core header */
+static char def_name[] = "core"; /* Default core name */
#define SIZE_MP_SEG (sizeof(struct mem_map) * NR_LOCAL_SEGS)
#define SIZE_KINFO sizeof(struct proc)
#define SIZE_HEADER SIZE_MP_SEG
-FORWARD int kernel_info(int fd );
-FORWARD void setmap(struct file *fp );
-FORWARD void read_info(struct file *fp );
-FORWARD void ill_addr(long d , int segment );
-FORWARD long map_addr(long d , int segment );
-FORWARD unsigned long c_status(void);
-FORWARD long getn(long d, int s);
+static int kernel_info(int fd );
+static void setmap(struct file *fp );
+static void read_info(struct file *fp );
+static void ill_addr(long d , int segment );
+static long map_addr(long d , int segment );
+static unsigned long c_status(void);
+static long getn(long d, int s);
/*
* set and display mapping for core file
*/
-PRIVATE void setmap(fp)
+static void setmap(fp)
struct file *fp;
{
long h = (long) h_size;
}
/* Print mapping */
-PUBLIC void prtmap()
+void prtmap()
{
Printf("%s I & D space\t", (is_separate) ? "Separate " : "Combined ");
if (corepid > 0) {
}
/* Illegal address */
-PRIVATE void ill_addr(d, segment)
+static void ill_addr(d, segment)
long d;
int segment;
{
/* Map virtual address -> core file addresses
* depends on current segment if Separate I & D
*/
-PRIVATE long map_addr(d, segment)
+static long map_addr(d, segment)
long d;
int segment;
{
/* Get value with address d and segment s */
-PRIVATE long getn(d, s)
+static long getn(d, s)
long d;
int s;
{
}
/* Read kernel info from core file into lbuf[] */
-PRIVATE int kernel_info(fd)
+static int kernel_info(fd)
int fd;
{
int r;
/*
* Print status info from core - returns PC
*/
-PRIVATE unsigned long c_status()
+static unsigned long c_status()
{
fprintf(stderr, "WARNING: don't know pid from core; using proc nr for pid.\n");
}
/* Read memory maps and kernel info from core file */
-PRIVATE void read_info(fp)
+static void read_info(fp)
struct file *fp;
{
struct mem_map seg[NR_LOCAL_SEGS];
/* initialization for core files
* returns PC address from core file
*/
-PUBLIC unsigned long core_init(filename)
+unsigned long core_init(filename)
char *filename;
{
core_file = &Core_File;
* always returns 0
* Similar to core files.
*/
-PUBLIC unsigned long file_init(filename)
+unsigned long file_init(filename)
char *filename;
{
core_file = &Core_File;
* Read from core file
* Called by mdbtrace()
*/
-PUBLIC long read_core(req, addr, data)
+long read_core(req, addr, data)
int req;
long addr, data;
{
#include <minix/callnr.h>
#include "proto.h"
-FORWARD void get_message(message *m, unsigned bx);
-FORWARD void get_data(char *s, unsigned bx, int cnt);
+static void get_message(message *m, unsigned bx);
+static void get_data(char *s, unsigned bx, int cnt);
-PRIVATE message sent;
-PRIVATE message recv;
-PRIVATE unsigned saved_addr;
-PRIVATE int last_call;
+static message sent;
+static message recv;
+static unsigned saved_addr;
+static int last_call;
#define NOSYS 0
#define NOP 1
REBOOT, M1_I1, NOP, "REBOOT"
};
-PRIVATE void get_message(m,bx)
+static void get_message(m,bx)
message *m;
unsigned bx;
{
}
-PRIVATE void get_data(s, bx, cnt)
+static void get_data(s, bx, cnt)
char *s;
unsigned bx;
int cnt;
}
-PUBLIC void decode_result()
+void decode_result()
{
/* Update message */
unsigned int nsym;
};
-PRIVATE struct symtab_s symtab;
+static struct symtab_s symtab;
-FORWARD void gnu_sort(struct newnlist *array , struct newnlist *top );
-FORWARD int gnu_symeq(char *t , struct newnlist *sp );
-FORWARD int gnu_symprefix(char *t , struct newnlist *sp );
-FORWARD struct newnlist *gnu_sname(char *name, int is_text, int
+static void gnu_sort(struct newnlist *array , struct newnlist *top );
+static int gnu_symeq(char *t , struct newnlist *sp );
+static int gnu_symprefix(char *t , struct newnlist *sp );
+static struct newnlist *gnu_sname(char *name, int is_text, int
allflag);
-FORWARD struct newnlist *gnu_sval(off_t value, int where);
-FORWARD void gnu_sym(struct newnlist *sp, off_t off);
+static struct newnlist *gnu_sval(off_t value, int where);
+static void gnu_sym(struct newnlist *sp, off_t off);
-PUBLIC void gnu_init( filename )
+void gnu_init( filename )
char *filename;
{
struct exec header;
}
-PUBLIC long gnu_symbolvalue( name, is_text )
+long gnu_symbolvalue( name, is_text )
char *name;
int is_text;
{
}
-PRIVATE struct newnlist *gnu_sname( name, is_text, allflag )
+static struct newnlist *gnu_sname( name, is_text, allflag )
char *name;
int is_text;
int allflag;
return NULL;
}
-PRIVATE struct newnlist *gnu_sval( value, where )
+static struct newnlist *gnu_sval( value, where )
off_t value;
int where;
{
}
-PRIVATE void gnu_sym( sp, off )
+static void gnu_sym( sp, off )
struct newnlist *sp;
off_t off;
{
/* shell sort symbols on value */
-PRIVATE void gnu_sort( array, top )
+static void gnu_sort( array, top )
struct newnlist *array;
struct newnlist *top;
{
while ( (gap /= 3) != 0 );
}
-PUBLIC void gnu_symbolic( value, separator )
+void gnu_symbolic( value, separator )
off_t value;
int separator;
{
}
-PRIVATE int gnu_symeq( t, sp )
+static int gnu_symeq( t, sp )
register char *t;
struct newnlist *sp;
{
return strncmp( t, sp->n_un.n_name, strlen(t) ) == 0;
}
-PRIVATE int gnu_symprefix( t, sp )
+static int gnu_symprefix( t, sp )
register char *t;
struct newnlist *sp;
{
/* list all symbols - test for selection criteria */
-PUBLIC void gnu_listsym( tchar )
+void gnu_listsym( tchar )
char tchar;
{
register struct symtab_s *tp;
}
}
-PUBLIC int gnu_text_symbol(value)
+int gnu_text_symbol(value)
off_t value;
{
struct newnlist *sp;
return FALSE;
}
-PUBLIC int gnu_finds_data(off,data_seg)
+int gnu_finds_data(off,data_seg)
off_t off;
int data_seg;
{
return FALSE;
}
-PUBLIC int gnu_finds_pc(pc)
+int gnu_finds_pc(pc)
off_t pc;
{
struct newnlist *sp;
#define OUTBUFSIZE 512
#define PAGESIZE 24
-PRIVATE int forceupper = FALSE;
-PRIVATE int someupper = FALSE;
-PRIVATE int stringcount = 0;
-PRIVATE char *string_ptr = NULL; /* stringptr ambiguous at 8th char */
-PRIVATE char *stringstart = NULL;
-
-PRIVATE char outbuf[OUTBUFSIZE];
-PRIVATE FILE *cmdfile = stdin;
-PRIVATE FILE *outfile = stdout;
-PRIVATE FILE *logfile;
-PRIVATE int lineno;
+static int forceupper = FALSE;
+static int someupper = FALSE;
+static int stringcount = 0;
+static char *string_ptr = NULL; /* stringptr ambiguous at 8th char */
+static char *stringstart = NULL;
+
+static char outbuf[OUTBUFSIZE];
+static FILE *cmdfile = stdin;
+static FILE *outfile = stdout;
+static FILE *logfile;
+static int lineno;
int _doprnt(const char *format, va_list ap, FILE *stream );
-PUBLIC char *get_cmd(cbuf, csize)
+char *get_cmd(cbuf, csize)
char *cbuf;
int csize;
{
return r;
}
-PUBLIC void openin(s)
+void openin(s)
char *s;
{
char *t;
* from MINIX library
* followed by outstr()
*/
-PUBLIC int Printf(const char *format, ...)
+int Printf(const char *format, ...)
{
va_list ap;
int retval;
/*
* Set logging options
*/
-PUBLIC void logging( c, name )
+void logging( c, name )
int c;
char *name;
{
}
/* Output system error string */
-PUBLIC void do_error(m)
+void do_error(m)
char *m;
{
outstr(m);
outstr("\n");
}
-PUBLIC void closestring()
+void closestring()
{
/* close string device */
stringstart = string_ptr = NULL;
}
-PUBLIC int mytolower(ch)
+int mytolower(ch)
int ch;
{
/* convert char to lower case */
}
-PUBLIC void openstring(string)
+void openstring(string)
char *string;
{
/* open string device */
stringstart = string_ptr = string;
}
-PUBLIC void outbyte(byte)
+void outbyte(byte)
int byte;
{
/* print char to currently open output devices */
}
-PUBLIC void outcomma()
+void outcomma()
{
/* print comma */
outbyte(',');
}
-PRIVATE char hexdigits[] = "0123456789ABCDEF";
-PUBLIC void outh4(num)
+static char hexdigits[] = "0123456789ABCDEF";
+void outh4(num)
unsigned num;
{
/* print 4 bits hex */
outbyte(hexdigits[num % 16]);
}
-PUBLIC void outh8(num)
+void outh8(num)
unsigned num;
{
/* print 8 bits hex */
outh4(num);
}
-PUBLIC void outh16(num)
+void outh16(num)
unsigned num;
{
/* print 16 bits hex */
outh8(num);
}
-PUBLIC void outh32(num)
+void outh32(num)
unsigned num;
{
/* print 32 bits hex */
outh16((u16_t) num);
}
-PUBLIC void outspace()
+void outspace()
{
/* print space */
outbyte(' ');
}
-PUBLIC void outstr(s)
+void outstr(s)
register char *s;
{
/* print string */
outbyte(*s++);
}
-PUBLIC void outtab()
+void outtab()
{
/* print tab */
outbyte('\t');
}
-PUBLIC void outustr(s)
+void outustr(s)
register char *s;
{
/* print string, perhaps converting case to upper */
}
-PUBLIC int stringpos()
+int stringpos()
{
/* return current offset of string device */
return string_ptr - stringstart;
}
-PUBLIC int stringtab()
+int stringtab()
{
/* return current "tab" spot of string device */
#include <sgtty.h>
#include "proto.h"
-PRIVATE int get_request;
+static int get_request;
/*
* decode ioctl call
struct proc *prc;
long lbuf[SIZ];
-PRIVATE char segment_name[] = "TDS";
+static char segment_name[] = "TDS";
/*
* Display memory maps
*/
-PUBLIC void disp_maps()
+void disp_maps()
{
int i;
long int vir, phy, len;
}
}
-PUBLIC void update()
+void update()
{
int i;
}
-PUBLIC int disp_regs()
+int disp_regs()
{
int i;
#ifdef MINIX_PC
#ifdef __i386
-PRIVATE char regs[] = "fs gs ds es di si bp bx dx cx ax ip cs ps sp ss";
+static char regs[] = "fs gs ds es di si bp bx dx cx ax ip cs ps sp ss";
#else
-PRIVATE char regs[] = "es ds di si bp bx dx cx ax ip cs ps sp ss";
+static char regs[] = "es ds di si bp bx dx cx ax ip cs ps sp ss";
#endif
/* Get register for pid at offset k */
-PUBLIC long get_reg(pid, k)
+long get_reg(pid, k)
int pid;
long k;
{
/* Set register for pid at offset k */
-PUBLIC void set_reg(pid, k, value)
+void set_reg(pid, k, value)
int pid;
long k;
long value;
}
-PUBLIC long reg_addr(s)
+long reg_addr(s)
char *s;
{
long val;
}
-PUBLIC int outsegreg(num)
+int outsegreg(num)
off_t num;
{
/* print segment register */
#ifdef MINIX_ST
/* Get register for pid at offset k */
-PUBLIC long get_reg(pid, k)
+long get_reg(pid, k)
int pid;
long k;
{
return ptrace(T_GETUSER, pid, k, 0L);
}
-PUBLIC long reg_addr(s)
+long reg_addr(s)
char *s;
{
long val;
#define MAXLINE 128
#define MAXARG 20
-PRIVATE unsigned long lastexp = 0L; /* last expression and segment */
-PRIVATE int lastseg = NOSEG;
-PRIVATE char *prog; /* prog name */
-PRIVATE char sbuf[MAXLINE];
-PRIVATE char cbuf[MAXLINE];
-PRIVATE char *cmd; /* current command */
-PRIVATE char *cmdstart; /* start of command */
-PRIVATE jmp_buf mainlp;
+static unsigned long lastexp = 0L; /* last expression and segment */
+static int lastseg = NOSEG;
+static char *prog; /* prog name */
+static char sbuf[MAXLINE];
+static char cbuf[MAXLINE];
+static char *cmd; /* current command */
+static char *cmdstart; /* start of command */
+static jmp_buf mainlp;
struct b_pnt {
int main(int argc, char *argv[]);
-FORWARD void cleanup(void);
-FORWARD void freepnt(struct b_pnt *pnt );
-FORWARD void findbpnt(int verbose );
-FORWARD int exebpnt(int restart );
-FORWARD void catch(int sig );
-FORWARD int run(char *name , char *argstr , int tflg );
-FORWARD int dowait(void);
-FORWARD void backtrace(int all );
-FORWARD void modify(long addr , int cnt , int verbose , int size );
-FORWARD void display(long addr , int req );
-FORWARD void fill(long addr , int req );
-FORWARD void dorun(char *cmd );
-FORWARD void not_for_core(void);
-FORWARD void command(void);
-
-
-PRIVATE void cleanup()
+static void cleanup(void);
+static void freepnt(struct b_pnt *pnt );
+static void findbpnt(int verbose );
+static int exebpnt(int restart );
+static void catch(int sig );
+static int run(char *name , char *argstr , int tflg );
+static int dowait(void);
+static void backtrace(int all );
+static void modify(long addr , int cnt , int verbose , int size );
+static void display(long addr , int req );
+static void fill(long addr , int req );
+static void dorun(char *cmd );
+static void not_for_core(void);
+static void command(void);
+
+
+static void cleanup()
{
curpid = 0;
curpnt = NULL;
while (b_head) freepnt(b_head);
}
-PRIVATE void findbpnt(verbose)
+static void findbpnt(verbose)
int verbose;
{
for (curpnt = b_head; curpnt; curpnt = curpnt->nxt) {
if (verbose) Printf("Unknown breakpoint hit.\n");
}
-PRIVATE int exebpnt(restart)
+static int exebpnt(restart)
int restart;
{
ptrace(T_STEP, curpid, 0L, (long) restart);
}
-PRIVATE void freepnt(pnt)
+static void freepnt(pnt)
struct b_pnt *pnt;
{
if (pnt->prv)
}
-PUBLIC long breakpt(addr, cmd)
+long breakpt(addr, cmd)
long addr;
char *cmd;
{
return new->oldval;
}
-PRIVATE void catch(sig)
+static void catch(sig)
int sig;
{
signal(sig, catch);
}
-PRIVATE int dowait()
+static int dowait()
{
int stat;
-PUBLIC void tstart(req, verbose, val, cnt)
+void tstart(req, verbose, val, cnt)
int req, verbose, val, cnt;
{
if (curpid == 0) {
if ( verbose ) dasm((long) PC_MEMBER(prc), 1, 1);
}
-PRIVATE int run(name, argstr, tflg)
+static int run(name, argstr, tflg)
char *name, *argstr;
int tflg;
{
}
-PRIVATE void dorun(cmd)
+static void dorun(cmd)
char *cmd;
{
if (curpid = run(prog, cmd, 1)) {
/*
* backtrace - inspect the stack
*/
-PRIVATE void backtrace(all)
+static void backtrace(all)
int all;
{
unsigned long pc, bp, off, val, obp;
while (all && (reg_t) bp);
}
-PRIVATE void modify(addr, cnt, verbose, size)
+static void modify(addr, cnt, verbose, size)
long addr;
int cnt, verbose, size;
{
return;
}
-PRIVATE void display(addr, req)
+static void display(addr, req)
long addr;
int req;
{
Printf("\n");
}
-PRIVATE void fill(addr, req)
+static void fill(addr, req)
long addr;
int req;
{
while (--count > 0);
}
-PRIVATE void not_for_core()
+static void not_for_core()
{
if (corepid > 0)
mdb_error("Illegal command for 'core' file\n");
}
-PRIVATE void command()
+static void command()
{
char c, *p;
int i;
if (*cmd == ';') cmd = skip(cmd + 1);
}
-PUBLIC void mdb_error(s)
+void mdb_error(s)
char *s;
{
Printf("%s",s);
longjmp(mainlp, 0);
}
-PUBLIC int main(argc, argv)
+int main(argc, argv)
int argc;
char *argv[];
{
off_t base;
};
-PRIVATE int bits32;
-PRIVATE struct address_s uptr;
-
-FORWARD u8_t get8(void);
-FORWARD u16_t get16(void);
-FORWARD u32_t get32(void);
-FORWARD u8_t peek_byte(off_t addr);
-FORWARD u16_t peek_word(off_t addr);
-FORWARD int puti(void);
-FORWARD int outsegaddr(struct address_s *addr);
-FORWARD int outssegaddr(struct address_s *addr);
-FORWARD int show1instruction(void);
+static int bits32;
+static struct address_s uptr;
+
+static u8_t get8(void);
+static u16_t get16(void);
+static u32_t get32(void);
+static u8_t peek_byte(off_t addr);
+static u16_t peek_word(off_t addr);
+static int puti(void);
+static int outsegaddr(struct address_s *addr);
+static int outssegaddr(struct address_s *addr);
+static int show1instruction(void);
/************************* UNASM ******************************/
typedef int su16_t;
typedef int su8_pt;
-FORWARD su8_pt get8s(void);
-FORWARD void getmodregrm(void);
-FORWARD void i_00_to_3f(opcode_pt opc );
-FORWARD void i_40_to_5f(opcode_pt opc );
-FORWARD void i_60_to_6f(opcode_pt opc );
-FORWARD void i_70_to_7f(opcode_pt opc );
-FORWARD void i_80(opcode_pt opc );
-FORWARD void i_88(opcode_pt opc );
-FORWARD void i_90(opcode_pt opc );
-FORWARD void i_98(opcode_pt opc );
-FORWARD void i_a0(opcode_pt opc );
-FORWARD void i_a8(opcode_pt opc );
-FORWARD void i_b0(opcode_pt opc );
-FORWARD void i_b8(opcode_pt opc );
-FORWARD void i_c0(opcode_pt opc );
-FORWARD void i_c8(opcode_pt opc );
-FORWARD void i_d0(opcode_pt opc );
-FORWARD void i_d8(opcode_pt opc );
-FORWARD void i_e0(opcode_pt opc );
-FORWARD void i_e8(opcode_pt opc );
-FORWARD void i_f0(opcode_pt opc );
-FORWARD void i_f8(opcode_pt opc );
-FORWARD void outad(opcode_pt opc );
-FORWARD void outad1(opcode_pt opc );
-FORWARD void outalorx(opcode_pt opc );
-FORWARD void outax(void);
-FORWARD void outbptr(void);
-FORWARD void outbwptr(opcode_pt opc );
-FORWARD void outea(opcode_pt wordflags );
-FORWARD void outf1(void);
-FORWARD void out32offset(void);
-FORWARD void outfishy(void);
-FORWARD void outgetaddr(void);
-FORWARD void outimmed(opcode_pt signwordflag );
-FORWARD void outpc(off_t pc );
-FORWARD void outsegpc(void);
-FORWARD void oututstr(char *s );
-FORWARD void outword(void);
-FORWARD void outwptr(void);
-FORWARD void outwsize(void);
-FORWARD void pagef(void);
-FORWARD void shift(opcode_pt opc );
-FORWARD void checkmemory(void);
-FORWARD void CL(void);
-FORWARD void Eb(void);
-FORWARD void Ev(void);
-FORWARD void EvGv(void);
-FORWARD void EvIb(void);
-FORWARD void Ew(void);
-FORWARD void EwRw(void);
-FORWARD void Gv(void);
-FORWARD void Gv1(void);
-FORWARD void GvEv(void);
-FORWARD void GvEw(void);
-FORWARD void GvM(void);
-FORWARD void GvMa(void);
-FORWARD void GvMp(void);
-FORWARD void Ib(void);
-FORWARD void Iw(void);
-FORWARD void Iv(void);
-FORWARD void Jb(void);
-FORWARD void Jv(void);
-FORWARD void Ms(void);
+static su8_pt get8s(void);
+static void getmodregrm(void);
+static void i_00_to_3f(opcode_pt opc );
+static void i_40_to_5f(opcode_pt opc );
+static void i_60_to_6f(opcode_pt opc );
+static void i_70_to_7f(opcode_pt opc );
+static void i_80(opcode_pt opc );
+static void i_88(opcode_pt opc );
+static void i_90(opcode_pt opc );
+static void i_98(opcode_pt opc );
+static void i_a0(opcode_pt opc );
+static void i_a8(opcode_pt opc );
+static void i_b0(opcode_pt opc );
+static void i_b8(opcode_pt opc );
+static void i_c0(opcode_pt opc );
+static void i_c8(opcode_pt opc );
+static void i_d0(opcode_pt opc );
+static void i_d8(opcode_pt opc );
+static void i_e0(opcode_pt opc );
+static void i_e8(opcode_pt opc );
+static void i_f0(opcode_pt opc );
+static void i_f8(opcode_pt opc );
+static void outad(opcode_pt opc );
+static void outad1(opcode_pt opc );
+static void outalorx(opcode_pt opc );
+static void outax(void);
+static void outbptr(void);
+static void outbwptr(opcode_pt opc );
+static void outea(opcode_pt wordflags );
+static void outf1(void);
+static void out32offset(void);
+static void outfishy(void);
+static void outgetaddr(void);
+static void outimmed(opcode_pt signwordflag );
+static void outpc(off_t pc );
+static void outsegpc(void);
+static void oututstr(char *s );
+static void outword(void);
+static void outwptr(void);
+static void outwsize(void);
+static void pagef(void);
+static void shift(opcode_pt opc );
+static void checkmemory(void);
+static void CL(void);
+static void Eb(void);
+static void Ev(void);
+static void EvGv(void);
+static void EvIb(void);
+static void Ew(void);
+static void EwRw(void);
+static void Gv(void);
+static void Gv1(void);
+static void GvEv(void);
+static void GvEw(void);
+static void GvM(void);
+static void GvMa(void);
+static void GvMp(void);
+static void Ib(void);
+static void Iw(void);
+static void Iv(void);
+static void Jb(void);
+static void Jv(void);
+static void Ms(void);
typedef void(*pfv_t) (opcode_pt opc );
-PRIVATE pfv_t optable[] =
+static pfv_t optable[] =
{
i_00_to_3f,
i_00_to_3f,
i_f8,
};
-PRIVATE char fishy[] = "???";
-PRIVATE char movtab[] = "mov\t";
+static char fishy[] = "???";
+static char movtab[] = "mov\t";
-PRIVATE char *genreg[] =
+static char *genreg[] =
{
"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
"ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
};
-PRIVATE char *segreg[] =
+static char *segreg[] =
{
"es", "cs", "ss", "ds", "fs", "gs", "?s", "?s",
};
-PRIVATE char *indreg[] =
+static char *indreg[] =
{
"bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx",
};
-PRIVATE char *str_00_to_3f[] =
+static char *str_00_to_3f[] =
{
/* index by (opcode >> 3) & 7 */
"add", "or", "adc", "sbb", "and", "sub", "xor", "cmp",
};
-PRIVATE char *sstr_00_to_3f[] =
+static char *sstr_00_to_3f[] =
{
/* index ((opc>>2) & 0x0E) + (opc & 7) - 6 */
"push\tes", "pop\tes", "push\tcs", "pop\tcs",
"es:", "daa", "cs:", "das", "ss:", "aaa", "ds:", "aas",
};
-PRIVATE char *sstr_0f[] =
+static char *sstr_0f[] =
{
"push\tfs", "pop\tfs", fishy, "bt\t", "shld\t", "shld\t", fishy, fishy,
"push\tgs", "pop\tgs", fishy, "bts\t", "shrd\t", "shrd\t", fishy, "imul\t",
fishy, fishy, "", "btc\t", "bsf\t", "bsr\t", "movsx\t", "movsx\t",
};
-PRIVATE char *ssstr_0f[] =
+static char *ssstr_0f[] =
{
"sldt\t", "str\t", "lldt\t", "ltr\t", "verr\t", "verw\t", fishy, fishy,
"sgdt\t", "sidt\t", "lgdt\t", "lidt\t", "smsw\t", fishy, "lmsw\t", fishy,
fishy, fishy, fishy, fishy, "bt\t", "bts\t", "btr\t", "btc\t",
};
-PRIVATE char *str_40_to_5f[] =
+static char *str_40_to_5f[] =
{
/* index by (opcode >> 3) & 3 */
"inc\t", "dec\t", "push\t", "pop\t",
};
-PRIVATE char *str_60_to_6f[] =
+static char *str_60_to_6f[] =
{
"pusha", "popa", "bound\t", "arpl\t", "fs:", "gs:", "os:", "as:",
"push\t", "imul\t", "push\t", "imul\t", "insb", "ins", "outsb", "outs",
};
-PRIVATE char *str_flags[] =
+static char *str_flags[] =
{
/* opcodes 0x70 to 0x7F, and 0x0F80 to 0x0F9F */
"o", "no", "b", "nb", "z", "nz", "be", "a",
"s", "ns", "pe", "po", "l", "ge", "le", "g",
};
-PRIVATE char *str_98[] =
+static char *str_98[] =
{
"cbw", "cwd", "call\t", "wait", "pushf", "popf", "sahf", "lahf",
"cwde", "cdq", "call\t", "wait", "pushfd", "popfd", "sahf", "lahf",
};
-PRIVATE char *str_a0[] =
+static char *str_a0[] =
{
movtab, movtab, movtab, movtab, "movsb", "movs", "cmpsb", "cmps",
};
-PRIVATE char *str_a8[] =
+static char *str_a8[] =
{
"test\t", "test\t", "stosb", "stos", "lodsb", "lods", "scasb", "scas",
};
-PRIVATE char *str_c0[] =
+static char *str_c0[] =
{
"", "", "ret\t", "ret", "les\t", "lds\t", movtab, movtab,
};
-PRIVATE char *str_c8[] =
+static char *str_c8[] =
{
"enter\t", "leave", "retf\t", "retf", "int\t3", "int\t", "into", "iret",
};
-PRIVATE char *str_d0[] =
+static char *str_d0[] =
{
"aam", "aad", "db\td6", "xlat",
};
-PRIVATE char *sstr_d0[] =
+static char *sstr_d0[] =
{
"rol", "ror", "rcl", "rcr", "shl", "shr", fishy, "sar",
};
-PRIVATE char *str_d8[] =
+static char *str_d8[] =
{
"fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
"fld", NULL, "fst", "fstp", "fldenv", "fldcw", "fstenv", "fstcw",
"fild", NULL, "fist", "fistp", "fbld", "fild", "fbstp", "fistp",
};
-PRIVATE char *str1_d8[] =
+static char *str1_d8[] =
{
"fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
"fld", "fxch", "\0\0", NULL, "\0\10", "\0\20", "\0\30", "\0\40",
NULL, NULL, NULL, NULL, "\0\100", NULL, NULL, NULL,
};
-PRIVATE unsigned char size_d8[] =
+static unsigned char size_d8[] =
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 14-28, 2, 14-28, 2,
4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 0, 10, 0, 10,
2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 10, 8, 10, 8,
};
-PRIVATE char *sstr_d8[] =
+static char *sstr_d8[] =
{
"fnop", NULL, NULL, NULL, /* D9D0 */
NULL, NULL, NULL, NULL,
"fstsw\tax", NULL, NULL, NULL,
};
-PRIVATE char *str_e0[] =
+static char *str_e0[] =
{
"loopnz\t", "loopz\t", "loop\t", "jcxz\t",
"in\t", "in\t", "out\t", "out\t",
};
-PRIVATE char *str_e8[] =
+static char *str_e8[] =
{
"call\t", "jmp\t", "jmp\t", "jmp\t",
"in\t", "in\t", "out\t", "out\t",
};
-PRIVATE char *str_f0[] =
+static char *str_f0[] =
{
"lock\t", "db\tf1", "repnz\t", "repz\t",
"hlt", "cmc",
/* other 2 from sstr_f0 */
};
-PRIVATE char *sstr_f0[] =
+static char *sstr_f0[] =
{
"test\t", fishy, "not\t", "neg\t",
"mul\t", "imul\t", "div\t", "idiv\t",
};
-PRIVATE char *str_f8[] =
+static char *str_f8[] =
{
"clc", "stc", "cli", "sti",
"cld", "std",
/* other 2 from sstr_f8 */
};
-PRIVATE char *sstr_f8[] =
+static char *sstr_f8[] =
{
"inc\t", "dec\t", "call\t", "call\tfar ",
"jmp\t", "jmp\tfar ", "push\t", "???\t",
};
-PRIVATE int data_seg; /* data segment (munged name for asld) */
-PRIVATE unsigned hasize; /* half address size in bits */
-PRIVATE unsigned hdefsize;
-PRIVATE unsigned hosize; /* half operand size in bits */
+static int data_seg; /* data segment (munged name for asld) */
+static unsigned hasize; /* half address size in bits */
+static unsigned hdefsize;
+static unsigned hosize; /* half operand size in bits */
/* for easy index into reg tables */
-PRIVATE opcode_pt mod;
-PRIVATE off_t offtable[2];
-PRIVATE off_t *offptr;
-PRIVATE off_t *off1ptr;
-PRIVATE opcode_pt reg;
-PRIVATE opcode_pt rm;
+static opcode_pt mod;
+static off_t offtable[2];
+static off_t *offptr;
+static off_t *off1ptr;
+static opcode_pt reg;
+static opcode_pt rm;
-PRIVATE su8_pt get8s()
+static su8_pt get8s()
{
su8_pt got;
return got;
}
-PRIVATE void getmodregrm()
+static void getmodregrm()
{
opcode_pt modregrm;
rm = (modregrm & RM_MASK) >> RM_SHIFT;
}
-PRIVATE void i_00_to_3f(opc)
+static void i_00_to_3f(opc)
opcode_pt opc;
{
opcode_pt sub;
}
}
-PRIVATE void i_40_to_5f(opc)
+static void i_40_to_5f(opc)
opcode_pt opc;
{
outustr(str_40_to_5f[(opc >> 3) & 3]);
outustr(genreg[hosize + (opc & 7)]);
}
-PRIVATE void i_60_to_6f(opc)
+static void i_60_to_6f(opc)
opcode_pt opc;
{
/* most for 386, some for 286 */
}
}
-PRIVATE void i_70_to_7f(opc)
+static void i_70_to_7f(opc)
opcode_pt opc;
{
outustr("j");
Jb();
}
-PRIVATE void i_80(opc)
+static void i_80(opc)
opcode_pt opc;
{
if (opc >= 4)
}
}
-PRIVATE void i_88(opc)
+static void i_88(opc)
opcode_pt opc;
{
if (opc < 4)
}
}
-PRIVATE void i_90(opc)
+static void i_90(opc)
opcode_pt opc;
{
if (opc == 0)
}
}
-PRIVATE void i_98(opc)
+static void i_98(opc)
opcode_pt opc;
{
outustr((str_98 - 8)[opc + hosize]);
outsegpc();
}
-PRIVATE void i_a0(opc)
+static void i_a0(opc)
opcode_pt opc;
{
outustr(str_a0[opc]);
outwsize();
}
-PRIVATE void i_a8(opc)
+static void i_a8(opc)
opcode_pt opc;
{
outustr(str_a8[opc]);
outwsize();
}
-PRIVATE void i_b0(opc)
+static void i_b0(opc)
opcode_pt opc;
{
outustr(movtab);
Ib();
}
-PRIVATE void i_b8(opc)
+static void i_b8(opc)
opcode_pt opc;
{
outustr(movtab);
Iv();
}
-PRIVATE void i_c0(opc)
+static void i_c0(opc)
opcode_pt opc;
{
outustr(str_c0[opc]);
shift(opc);
}
-PRIVATE void i_c8(opc)
+static void i_c8(opc)
opcode_pt opc;
{
outustr(str_c8[opc]);
outwsize();
}
-PRIVATE void i_d0(opc)
+static void i_d0(opc)
opcode_pt opc;
{
opcode_pt aabyte;
}
}
-PRIVATE void i_d8(opc)
+static void i_d8(opc)
opcode_pt opc;
{
opcode_pt esc;
outea(opc);
}
-PRIVATE void i_e0(opc)
+static void i_e0(opc)
opcode_pt opc;
{
outustr(str_e0[opc]);
}
}
-PRIVATE void i_e8(opc)
+static void i_e8(opc)
opcode_pt opc;
{
outustr(str_e8[opc]);
}
}
-PRIVATE void i_f0(opc)
+static void i_f0(opc)
opcode_pt opc;
{
if (opc < 6)
}
}
-PRIVATE void i_f8(opc)
+static void i_f8(opc)
opcode_pt opc;
{
if (opc < 6)
}
}
-PRIVATE void outad(opc)
+static void outad(opc)
opcode_pt opc;
{
getmodregrm();
outad1(opc);
}
-PRIVATE void outad1(opc)
+static void outad1(opc)
opcode_pt opc;
{
if (!(opc & TOREGBIT))
}
}
-PRIVATE void outalorx(opc)
+static void outalorx(opc)
opcode_pt opc;
{
if (opc & WORDBIT)
outustr(genreg[0]);
}
-PRIVATE void outax()
+static void outax()
{
outustr(genreg[hosize]);
}
-PRIVATE void outbptr()
+static void outbptr()
{
outustr("byte ptr ");
}
-PRIVATE void outbwptr(opc)
+static void outbwptr(opc)
opcode_pt opc;
{
if (mod != REG_MOD)
}
}
-PRIVATE void outea(wordflags)
+static void outea(wordflags)
opcode_pt wordflags;
{
reg_pt base;
}
}
-PRIVATE void outf1()
+static void outf1()
{
outustr("st(");
outbyte((int) (rm + '0'));
#if (_WORD_SIZE == 4)
-PRIVATE void out32offset()
+static void out32offset()
{
off_t off;
}
#endif
-PRIVATE void outfishy()
+static void outfishy()
{
outustr("\t???");
}
-PRIVATE void outgetaddr()
+static void outgetaddr()
{
off_t off;
outh16((u16_t) off);
}
-PRIVATE void outimmed(signwordflag)
+static void outimmed(signwordflag)
opcode_pt signwordflag;
{
su8_pt byte;
Ib();
}
-PRIVATE void outpc(pc)
+static void outpc(pc)
off_t pc;
{
if (hosize == 8)
outh16((u16_t) pc);
}
-PRIVATE void outsegpc()
+static void outsegpc()
{
off_t oldbase;
off_t pc;
uptr.base = oldbase;
}
-PRIVATE void oututstr(s)
+static void oututstr(s)
char *s;
{
outustr(s);
outtab();
}
-PRIVATE void outword()
+static void outword()
{
outustr("dword " + ((16 - hosize) >> 3));
}
-PRIVATE void outwptr()
+static void outwptr()
{
outword();
outustr("ptr ");
}
-PRIVATE void outwsize()
+static void outwsize()
{
if (hosize == 16)
outustr("d");
outustr("w");
}
-PRIVATE void pagef()
+static void pagef()
{
opcode_pt opc;
int regbad;
outstr(fishy);
}
-PRIVATE int puti()
+static int puti()
{
static int hadprefix;
opcode_pt opcode;
return TRUE;
}
-PRIVATE void shift(opc)
+static void shift(opc)
opcode_pt opc;
{
getmodregrm();
outbyte('1');
}
-PRIVATE void checkmemory()
+static void checkmemory()
{
if (mod == REG_MOD)
outfishy();
}
-PRIVATE void CL()
+static void CL()
{
outustr(genreg[1]);
}
-PRIVATE void Eb()
+static void Eb()
{
outea(0);
}
-PRIVATE void Ev()
+static void Ev()
{
outea(WORDBIT);
}
-PRIVATE void EvGv()
+static void EvGv()
{
getmodregrm();
Ev();
Gv1();
}
-PRIVATE void EvIb()
+static void EvIb()
{
Ev();
outcomma();
Ib();
}
-PRIVATE void Ew()
+static void Ew()
{
hosize = 8;
Ev();
}
-PRIVATE void EwRw()
+static void EwRw()
{
hosize = 8;
EvGv();
}
-PRIVATE void Gv()
+static void Gv()
{
getmodregrm();
Gv1();
}
-PRIVATE void Gv1()
+static void Gv1()
{
outustr(genreg[hosize + reg]);
}
-PRIVATE void GvEv()
+static void GvEv()
{
Gv();
outcomma();
Ev();
}
-PRIVATE void GvEw()
+static void GvEw()
{
Gv();
outcomma();
Ew();
}
-PRIVATE void GvM()
+static void GvM()
{
GvEv();
checkmemory();
}
-PRIVATE void GvMa()
+static void GvMa()
{
GvM();
}
-PRIVATE void GvMp()
+static void GvMp()
{
GvM();
}
-PRIVATE void Ib()
+static void Ib()
{
outh8(get8());
}
-PRIVATE void Iw()
+static void Iw()
{
outh16(get16());
}
-PRIVATE void Iv()
+static void Iv()
{
if (hosize == 16)
outh32(get32());
Iw();
}
-PRIVATE void Jb()
+static void Jb()
{
off_t pcjump;
outpc(pcjump + uptr.off);
}
-PRIVATE void Jv()
+static void Jv()
{
off_t pcjump;
outpc(pcjump + uptr.off);
}
-PRIVATE void Ms()
+static void Ms()
{
Ev();
checkmemory();
/********************* DASM ******************************/
-PUBLIC long dasm( addr, count, symflg )
+long dasm( addr, count, symflg )
long addr;
int count;
int symflg;
}
-PRIVATE int show1instruction()
+static int show1instruction()
{
register int column;
int idone;
}
-PRIVATE u8_t get8()
+static u8_t get8()
{
/* get 8 bits current instruction pointer and advance pointer */
return temp;
}
-PRIVATE u16_t get16()
+static u16_t get16()
{
/* get 16 bits from current instruction pointer and advance pointer */
return temp;
}
-PRIVATE u32_t get32()
+static u32_t get32()
{
/* get 32 bits from current instruction pointer and advance pointer */
}
-PRIVATE int outsegaddr(addr)
+static int outsegaddr(addr)
struct address_s *addr;
{
/* print segmented address */
return bytes_printed + 4;
}
-PRIVATE int outssegaddr(addr)
+static int outssegaddr(addr)
struct address_s *addr;
{
/* print 32 bit segmented address and 2 spaces */
return bytes_printed + 2;
}
-PRIVATE u8_t peek_byte(addr)
+static u8_t peek_byte(addr)
off_t addr;
{
return (u8_t) peek_dword(addr) & 0xFF; /* 8 bits only */
}
-PRIVATE u16_t peek_word(addr)
+static u16_t peek_word(addr)
off_t addr;
{
return (u16_t) peek_dword(addr);
#include <string.h>
#include "proto.h"
-FORWARD long value(char *s , char **s_p , int *seg_p );
-FORWARD long lookup(char *s , char **s_p , int *seg_p );
+static long value(char *s , char **s_p , int *seg_p );
+static long lookup(char *s , char **s_p , int *seg_p );
#define idchar(c) (isalpha(c) || isdigit(c) || (c) == '_')
/*
* Get an expression for mdb
*/
-PUBLIC char *getexp(buf, exp_p, seg_p)
+char *getexp(buf, exp_p, seg_p)
char *buf;
int *seg_p;
long *exp_p;
* \n 0L
* then calls lookup for symbols
*/
-PRIVATE long value(s, s_p, seg_p)
+static long value(s, s_p, seg_p)
char *s, **s_p;
int *seg_p;
{
* Handle special cases: _start T: D: S:
* then call symbolvalue()
*/
-PRIVATE long lookup(s, s_p, seg_p)
+static long lookup(s, s_p, seg_p)
char *s, **s_p;
int *seg_p;
{
}
/* Skip spaces */
-PUBLIC char *skip(s)
+char *skip(s)
register char *s;
{
while (isspace(*s)) ++s;
#include <sys/ptrace.h>
#include "proto.h"
-FORWARD void pr_ascii(long val , int size );
+static void pr_ascii(long val , int size );
/* Print ascii */
-PRIVATE void pr_ascii(val, size)
+static void pr_ascii(val, size)
long val;
int size;
{
}
/* Dump stack */
-PUBLIC void dump_stack(cnt)
+void dump_stack(cnt)
long cnt;
{
vir_bytes v, vi;
/* Get file size */
-PUBLIC off_t file_size(fd)
+off_t file_size(fd)
int fd;
{
struct stat st;
}
/* Print help page */
-PUBLIC void help_page()
+void help_page()
{
outstr("\nHelp for mdb. For more details, type 'command ?'\n");
outstr("!#\t- Shell escape / Set Variable or register\n");
outstr(" mdb [-fc] file\n");
}
-PUBLIC void version_info()
+void version_info()
{
Printf("\nmdb version %s.%d for Minix", MDBVERSION, MDBBUILD );
Printf(" %s.%s", OS_RELEASE, OS_VERSION);
}
/* Print help message on command */
-PUBLIC void help_on(h)
+void help_on(h)
int h;
{
unsigned nsym;
};
-PRIVATE struct symtab_s symtab;
-PRIVATE int type_of_exec;
-
-FORWARD int check_exec(struct exec *hdr);
-FORWARD void sortsyms(struct nlist *array , struct nlist *top );
-FORWARD int symeq(char *t , struct nlist *sp );
-FORWARD int symprefix(char *t , struct nlist *sp );
-FORWARD struct nlist *findsname(char *name, int is_text, int allflag);
-FORWARD void outsym(struct nlist *sp, off_t off);
-FORWARD struct nlist *findsval(off_t value, int where);
-
-PUBLIC void syminit( filename )
+static struct symtab_s symtab;
+static int type_of_exec;
+
+static int check_exec(struct exec *hdr);
+static void sortsyms(struct nlist *array , struct nlist *top );
+static int symeq(char *t , struct nlist *sp );
+static int symprefix(char *t , struct nlist *sp );
+static struct nlist *findsname(char *name, int is_text, int allflag);
+static void outsym(struct nlist *sp, off_t off);
+static struct nlist *findsval(off_t value, int where);
+
+void syminit( filename )
char *filename;
{
int fd;
* return type of exec
* or exit
*/
-PRIVATE int check_exec(hdr)
+static int check_exec(hdr)
struct exec *hdr;
{
long magic;
}
-PUBLIC long symbolvalue( name, is_text )
+long symbolvalue( name, is_text )
char *name;
int is_text;
{
return 0L;
}
-PRIVATE struct nlist *findsname( name, is_text, allflag )
+static struct nlist *findsname( name, is_text, allflag )
char *name;
int is_text;
int allflag;
return NULL;
}
-PRIVATE struct nlist *findsval( value, where )
+static struct nlist *findsval( value, where )
off_t value;
int where;
{
}
-PUBLIC void printhex(v)
+void printhex(v)
off_t v;
{
if ( v >= 65536L )
}
-PRIVATE void outsym( sp, off )
+static void outsym( sp, off )
struct nlist *sp;
off_t off;
{
/* shell sort symbols on value */
-PRIVATE void sortsyms( array, top )
+static void sortsyms( array, top )
struct nlist *array;
struct nlist *top;
{
while ( (gap /= 3) != 0 );
}
-PUBLIC void symbolic( value, separator )
+void symbolic( value, separator )
off_t value;
int separator;
{
}
-PRIVATE int symeq( t, sp )
+static int symeq( t, sp )
register char *t;
struct nlist *sp;
{
return strncmp( t, sp->n_name, sizeof sp->n_name ) == 0;
}
-PRIVATE int symprefix( t, sp )
+static int symprefix( t, sp )
register char *t;
struct nlist *sp;
{
/* list all symbols - test for selection criteria */
-PUBLIC void listsym(cmd)
+void listsym(cmd)
char *cmd;
{
register struct symtab_s *tp;
}
-PUBLIC int text_symbol(value)
+int text_symbol(value)
off_t value;
{
struct nlist *sp;
return FALSE;
}
-PUBLIC int finds_data(off,data_seg)
+int finds_data(off,data_seg)
off_t off;
int data_seg;
{
return FALSE;
}
-PUBLIC int finds_pc(pc)
+int finds_pc(pc)
off_t pc;
{
struct nlist *sp;
#define SYSCALL_OLD 0x20CD
#endif
-PRIVATE long intaddr;
+static long intaddr;
-PUBLIC void start_syscall(addr)
+void start_syscall(addr)
long addr;
{
long old;
}
-PUBLIC void do_syscall(addr)
+void do_syscall(addr)
long addr;
{
unsigned reg_ax,reg_bx;
* Call ptrace and check for error if debugging running process
* Otherwise read 'core' file
*/
-PUBLIC long mdbtrace(req, pid, addr, data)
+long mdbtrace(req, pid, addr, data)
int req, pid;
long addr, data;
{
}
/* Used by disassembler */
-PUBLIC u32_t peek_dword(addr)
+u32_t peek_dword(addr)
off_t addr;
{
return mdbtrace(T_GETINS, curpid, addr, 0L);
void eat_file(Ino_t inode, int f);
void enter_dir(Ino_t parent, char *name, Ino_t child);
void incr_size(Ino_t n, long count);
-PRIVATE ino_t alloc_inode(int mode, int usrid, int grpid);
-PRIVATE zone_t alloc_zone(void);
+static ino_t alloc_inode(int mode, int usrid, int grpid);
+static zone_t alloc_zone(void);
void add_zone(Ino_t n, zone_t z, long bytes, long cur_time);
void add_z_1(Ino_t n, zone_t z, long bytes, long cur_time);
void add_z_2(Ino_t n, zone_t z, long bytes, long cur_time);
/*================================================================
* allocation assist group
*===============================================================*/
-PRIVATE ino_t alloc_inode(mode, usrid, grpid)
+static ino_t alloc_inode(mode, usrid, grpid)
int mode, usrid, grpid;
{
ino_t num;
}
-PRIVATE zone_t alloc_zone()
+static zone_t alloc_zone()
{
/* Allocate a new zone */
/* Works for zone > block */
* Tname assumes that the first three letters of the tty's name can be omitted
* and returns the rest (except for the console, which yields "co").
*/
-PRIVATE char *tname(dev_t dev_nr)
+static char *tname(dev_t dev_nr)
{
unsigned int i;
}
/* Find a task by its endpoint. */
-PRIVATE struct pstat *findtask(endpoint_t endpt)
+static struct pstat *findtask(endpoint_t endpt)
{
struct pstat *ps;
unsigned int slot;
}
/* Return canonical task name of the given endpoint. */
-PRIVATE char *taskname(endpoint_t endpt)
+static char *taskname(endpoint_t endpt)
{
struct pstat *ps;
/* Prrecv prints the RECV field for process with pstat buffer pointer ps.
* This is either "ANY", "taskname", or "(blockreason) taskname".
*/
-PRIVATE char *prrecv(struct pstat *ps)
+static char *prrecv(struct pstat *ps)
{
char *blkstr, *task; /* reason for blocking and task */
static char recvstr[20];
return recvstr;
}
-PRIVATE void getkinfo(void)
+static void getkinfo(void)
{
FILE *fp;
#include "config.h"
#include "proto.h"
-PRIVATE int class_recurs; /* Nesting level of class statements */
+static int class_recurs; /* Nesting level of class statements */
#define MAX_CLASS_RECURS 100 /* Max nesting level for classes */
#include "parse.h"
-FORWARD void do_service(config_t *cpe, config_t *config, struct rs_config *);
+static void do_service(config_t *cpe, config_t *config, struct rs_config *);
-PRIVATE void do_class(config_t *cpe, config_t *config, struct rs_config *rs_config)
+static void do_class(config_t *cpe, config_t *config, struct rs_config *rs_config)
{
config_t *cp, *cp1;
class_recurs--;
}
-PRIVATE void do_uid(config_t *cpe, struct rs_start *rs_start)
+static void do_uid(config_t *cpe, struct rs_start *rs_start)
{
uid_t uid;
struct passwd *pw;
rs_start->rss_uid= uid;
}
-PRIVATE void do_sigmgr(config_t *cpe, struct rs_start *rs_start)
+static void do_sigmgr(config_t *cpe, struct rs_start *rs_start)
{
endpoint_t sigmgr_ep;
int r;
rs_start->rss_sigmgr= sigmgr_ep;
}
-PRIVATE void do_type(config_t *cpe, struct rs_config *rs_config)
+static void do_type(config_t *cpe, struct rs_config *rs_config)
{
if (cpe->next != NULL)
{
cpe->file, cpe->line);
}
-PRIVATE void do_descr(config_t *cpe, struct rs_config *rs_config)
+static void do_descr(config_t *cpe, struct rs_config *rs_config)
{
if (cpe->next != NULL)
{
rs_config->descr = cpe->word;
}
-PRIVATE void do_scheduler(config_t *cpe, struct rs_start *rs_start)
+static void do_scheduler(config_t *cpe, struct rs_start *rs_start)
{
endpoint_t scheduler_ep;
int r;
rs_start->rss_scheduler= scheduler_ep;
}
-PRIVATE void do_priority(config_t *cpe, struct rs_start *rs_start)
+static void do_priority(config_t *cpe, struct rs_start *rs_start)
{
int priority_val;
char *check;
rs_start->rss_priority= priority_val;
}
-PRIVATE void do_quantum(config_t *cpe, struct rs_start *rs_start)
+static void do_quantum(config_t *cpe, struct rs_start *rs_start)
{
int quantum_val;
char *check;
rs_start->rss_quantum= quantum_val;
}
-PRIVATE void do_cpu(config_t *cpe, struct rs_start *rs_start)
+static void do_cpu(config_t *cpe, struct rs_start *rs_start)
{
int cpu;
char *check;
rs_start->rss_cpu= cpu;
}
-PRIVATE void do_irq(config_t *cpe, struct rs_start *rs_start)
+static void do_irq(config_t *cpe, struct rs_start *rs_start)
{
int irq;
int first;
}
}
-PRIVATE void do_io(config_t *cpe, struct rs_start *rs_start)
+static void do_io(config_t *cpe, struct rs_start *rs_start)
{
unsigned base, len;
int first;
}
}
-PRIVATE void do_pci_device(config_t *cpe, struct rs_start *rs_start)
+static void do_pci_device(config_t *cpe, struct rs_start *rs_start)
{
u16_t vid, did;
char *check, *check2;
}
}
-PRIVATE void do_pci_class(config_t *cpe, struct rs_start *rs_start)
+static void do_pci_class(config_t *cpe, struct rs_start *rs_start)
{
u8_t baseclass, subclass, interface;
u32_t class_id, mask;
}
}
-PRIVATE void do_pci(config_t *cpe, struct rs_start *rs_start)
+static void do_pci(config_t *cpe, struct rs_start *rs_start)
{
if (cpe == NULL)
return; /* Empty PCI statement */
cpe->word, cpe->file, cpe->line);
}
-PRIVATE void do_ipc(config_t *cpe, struct rs_start *rs_start)
+static void do_ipc(config_t *cpe, struct rs_start *rs_start)
{
char *list;
const char *word;
{ NULL, 0 },
};
-PRIVATE void do_vm(config_t *cpe, struct rs_start *rs_start)
+static void do_vm(config_t *cpe, struct rs_start *rs_start)
{
int i, first;
{ NULL, 0 }
};
-PRIVATE void do_system(config_t *cpe, struct rs_start *rs_start)
+static void do_system(config_t *cpe, struct rs_start *rs_start)
{
int i, first;
}
}
-PRIVATE void do_control(config_t *cpe, struct rs_start *rs_start)
+static void do_control(config_t *cpe, struct rs_start *rs_start)
{
int nr_control = 0;
}
}
-PRIVATE void do_service(config_t *cpe, config_t *config, struct rs_config *rs_config)
+static void do_service(config_t *cpe, config_t *config, struct rs_config *rs_config)
{
struct rs_start *rs_start = &rs_config->rs_start;
config_t *cp;
}
}
-PRIVATE const char *do_config(const char *label, char *filename, struct rs_config *rs_config)
+static const char *do_config(const char *label, char *filename, struct rs_config *rs_config)
{
config_t *config, *cp, *cpe;
struct passwd *pw;
}
/* returns failure */
-PUBLIC const char *parse_config(char *progname, int custom_config, char *req_config,
+const char *parse_config(char *progname, int custom_config, char *req_config,
struct rs_config *rs_config)
{
char *specificconfig, *specific_pkg_config;
#include "proto.h"
/* This array defines all known requests. */
-PRIVATE char *known_requests[] = {
+static char *known_requests[] = {
"up",
"down",
"refresh",
* parameters passed to this utility. Request parameters that are needed
* are stored globally in the following variables:
*/
-PRIVATE int req_type;
-PRIVATE int do_run= 0; /* 'run' command instead of 'up' */
-PRIVATE char *req_label = NULL;
-PRIVATE char *req_path = NULL;
-PRIVATE char *req_path_self = SELF_REQ_PATH;
-PRIVATE char *req_args = "";
-PRIVATE int req_major = 0;
-PRIVATE int devman_id = 0;
-PRIVATE int req_dev_style = STYLE_NDEV;
-PRIVATE long req_period = 0;
-PRIVATE char *req_script = NULL;
-PRIVATE char *req_config = PATH_CONFIG;
-PRIVATE int custom_config_file = 0;
-PRIVATE int req_lu_state = DEFAULT_LU_STATE;
-PRIVATE int req_lu_maxtime = DEFAULT_LU_MAXTIME;
+static int req_type;
+static int do_run= 0; /* 'run' command instead of 'up' */
+static char *req_label = NULL;
+static char *req_path = NULL;
+static char *req_path_self = SELF_REQ_PATH;
+static char *req_args = "";
+static int req_major = 0;
+static int devman_id = 0;
+static int req_dev_style = STYLE_NDEV;
+static long req_period = 0;
+static char *req_script = NULL;
+static char *req_config = PATH_CONFIG;
+static int custom_config_file = 0;
+static int req_lu_state = DEFAULT_LU_STATE;
+static int req_lu_maxtime = DEFAULT_LU_MAXTIME;
/* Buffer to build "/command arg1 arg2 ..." string to pass to RS server. */
-PRIVATE char command[4096];
+static char command[4096];
/* An error occurred. Report the problem, print the usage, and exit.
*/
-PRIVATE void print_usage(char *app_name, char *problem)
+static void print_usage(char *app_name, char *problem)
{
fprintf(stderr, "Warning, %s\n", problem);
fprintf(stderr, "Usage:\n");
/* A request to the RS server failed. Report and exit.
*/
-PRIVATE void failure(int request)
+static void failure(int request)
{
fprintf(stderr, "Request 0x%x to RS failed: %s (error %d)\n", request, strerror(errno), errno);
exit(errno);
/* Parse and verify correctness of arguments. Report problem and exit if an
* error is found. Store needed parameters in global variables.
*/
-PRIVATE int parse_arguments(int argc, char **argv, u32_t *rss_flags)
+static int parse_arguments(int argc, char **argv, u32_t *rss_flags)
{
struct stat stat_buf;
char *hz, *buff;
/* Main program.
*/
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
message m;
int result = EXIT_SUCCESS;
#include "pci.h"
-PUBLIC int acpi_enabled;
-PUBLIC struct machine machine;
+int acpi_enabled;
+struct machine machine;
/* don't know where ACPI tables are, we may need to access any memory */
-PRIVATE int init_mem_priv(void)
+static int init_mem_priv(void)
{
struct mem_range mr;
return sys_privctl(SELF, SYS_PRIV_ADD_MEM, &mr);
}
-PRIVATE void set_machine_mode(void)
+static void set_machine_mode(void)
{
ACPI_OBJECT arg1;
ACPI_OBJECT_LIST args;
machine.apic_enabled ? "APIC" : "PIC");
}
-PRIVATE ACPI_STATUS init_acpica(void)
+static ACPI_STATUS init_acpica(void)
{
ACPI_STATUS status;
return AE_OK;
}
-PUBLIC void init_acpi(void)
+void init_acpi(void)
{
ACPI_STATUS acpi_err;
/* test conditions for acpi */
}
}
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
init_acpi();
return OK;
}
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
extern struct machine machine;
-PRIVATE u32_t pci_inb(u16_t port) {
+static u32_t pci_inb(u16_t port) {
u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
return value;
}
-PRIVATE u32_t pci_inw(u16_t port) {
+static u32_t pci_inw(u16_t port) {
u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
return value;
}
-PRIVATE u32_t pci_inl(u16_t port) {
+static u32_t pci_inl(u16_t port) {
u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
return value;
}
-PRIVATE void pci_outb(u16_t port, u8_t value) {
+static void pci_outb(u16_t port, u8_t value) {
int s;
if ((s=sys_outb(port, value)) !=OK)
printf("ACPI: warning, sys_outb failed: %d\n", s);
}
-PRIVATE void pci_outw(u16_t port, u16_t value) {
+static void pci_outw(u16_t port, u16_t value) {
int s;
if ((s=sys_outw(port, value)) !=OK)
printf("ACPI: warning, sys_outw failed: %d\n", s);
}
-PRIVATE void pci_outl(u16_t port, u32_t value) {
+static void pci_outl(u16_t port, u32_t value) {
int s;
if ((s=sys_outl(port, value)) !=OK)
printf("ACPI: warning, sys_outl failed: %d\n", s);
*
*****************************************************************************/
-PUBLIC ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer (
+ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer (
void)
{
return machine.acpi_rsdp;
struct pci_bridge * children[PCI_MAX_DEVICES];
};
-PRIVATE struct pci_bridge pci_root_bridge;
+static struct pci_bridge pci_root_bridge;
struct irq_resource {
struct pci_bridge * bridge;
ACPI_PCI_ROUTING_TABLE * tbl;
};
-PRIVATE struct pci_bridge * find_bridge(struct pci_bridge * root,
+static struct pci_bridge * find_bridge(struct pci_bridge * root,
int pbnr,
int dev,
int sbnr)
return NULL;
}
-PUBLIC void do_map_bridge(message *m)
+void do_map_bridge(message *m)
{
int err = OK;
unsigned dev = ((struct acpi_map_bridge_req *)m)->device;
}
#if 0
-PRIVATE ACPI_STATUS device_get_int(ACPI_HANDLE handle,
+static ACPI_STATUS device_get_int(ACPI_HANDLE handle,
char * name,
ACPI_INTEGER * val)
{
}
#endif
-PUBLIC void do_get_irq(message *m)
+void do_get_irq(message *m)
{
struct pci_bridge * bridge;
int irq;
((struct acpi_get_irq_resp *)m)->irq = irq;
}
-PRIVATE void add_irq(struct pci_bridge * bridge,
+static void add_irq(struct pci_bridge * bridge,
unsigned dev,
unsigned pin,
u8_t irq)
bridge->irqtable[dev * PCI_MAX_PINS + pin] = irq;
}
-PRIVATE ACPI_STATUS get_irq_resource(ACPI_RESOURCE *res, void *context)
+static ACPI_STATUS get_irq_resource(ACPI_RESOURCE *res, void *context)
{
struct irq_resource * ires = (struct irq_resource *) context;
return AE_OK;
}
-PRIVATE ACPI_STATUS get_pci_irq_routing(struct pci_bridge * bridge)
+static ACPI_STATUS get_pci_irq_routing(struct pci_bridge * bridge)
{
ACPI_STATUS status;
ACPI_BUFFER abuff;
return AE_OK;
}
-PRIVATE void bridge_init_irqtable(struct pci_bridge * bridge)
+static void bridge_init_irqtable(struct pci_bridge * bridge)
{
int i;
bridge->irqtable[i] = -1;
}
-PRIVATE ACPI_STATUS add_pci_dev(ACPI_HANDLE handle,
+static ACPI_STATUS add_pci_dev(ACPI_HANDLE handle,
UINT32 level,
void *context,
void **retval)
return status;
}
-PRIVATE ACPI_STATUS add_pci_root_dev(ACPI_HANDLE handle,
+static ACPI_STATUS add_pci_root_dev(ACPI_HANDLE handle,
UINT32 level,
void *context,
void **retval)
return status;
}
-PUBLIC void pci_scan_devices(void)
+void pci_scan_devices(void)
{
ACPI_STATUS status;
#include "ahci.h"
/* Host Bus Adapter (HBA) state. */
-PRIVATE struct {
+static struct {
volatile u32_t *base; /* base address of memory-mapped registers */
size_t size; /* size of memory-mapped register area */
} hba_state;
/* Port state. */
-PRIVATE struct port_state {
+static struct port_state {
int state; /* port state */
unsigned int flags; /* port flags */
} cmd_info[NR_CMDS];
} port_state[NR_PORTS];
-PRIVATE int ahci_instance; /* driver instance number */
+static int ahci_instance; /* driver instance number */
-PRIVATE int ahci_verbose; /* verbosity level (0..4) */
+static int ahci_verbose; /* verbosity level (0..4) */
/* Timeout values. These can be overridden with environment variables. */
-PRIVATE long ahci_spinup_timeout = SPINUP_TIMEOUT;
-PRIVATE long ahci_sig_timeout = SIG_TIMEOUT;
-PRIVATE long ahci_sig_checks = NR_SIG_CHECKS;
-PRIVATE long ahci_command_timeout = COMMAND_TIMEOUT;
-PRIVATE long ahci_transfer_timeout = TRANSFER_TIMEOUT;
-PRIVATE long ahci_flush_timeout = FLUSH_TIMEOUT;
+static long ahci_spinup_timeout = SPINUP_TIMEOUT;
+static long ahci_sig_timeout = SIG_TIMEOUT;
+static long ahci_sig_checks = NR_SIG_CHECKS;
+static long ahci_command_timeout = COMMAND_TIMEOUT;
+static long ahci_transfer_timeout = TRANSFER_TIMEOUT;
+static long ahci_flush_timeout = FLUSH_TIMEOUT;
-PRIVATE int ahci_map[MAX_DRIVES]; /* device-to-port mapping */
+static int ahci_map[MAX_DRIVES]; /* device-to-port mapping */
-PRIVATE int ahci_exiting = FALSE; /* exit after last close? */
+static int ahci_exiting = FALSE; /* exit after last close? */
#define BUILD_ARG(port, tag) (((port) << 8) | (tag))
#define GET_PORT(arg) ((arg) >> 8)
printf s; \
} while (0)
-PRIVATE void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis,
+static void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis,
u8_t packet[ATAPI_PACKET_SIZE], prd_t *prdt, int nr_prds, int write);
-PRIVATE void port_issue(struct port_state *ps, int cmd, clock_t timeout);
-PRIVATE int port_exec(struct port_state *ps, int cmd, clock_t timeout);
-PRIVATE void port_timeout(struct timer *tp);
-PRIVATE void port_disconnect(struct port_state *ps);
-
-PRIVATE char *ahci_portname(struct port_state *ps);
-PRIVATE int ahci_open(dev_t minor, int access);
-PRIVATE int ahci_close(dev_t minor);
-PRIVATE ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position,
+static void port_issue(struct port_state *ps, int cmd, clock_t timeout);
+static int port_exec(struct port_state *ps, int cmd, clock_t timeout);
+static void port_timeout(struct timer *tp);
+static void port_disconnect(struct port_state *ps);
+
+static char *ahci_portname(struct port_state *ps);
+static int ahci_open(dev_t minor, int access);
+static int ahci_close(dev_t minor);
+static ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iovec, unsigned int count,
int flags);
-PRIVATE struct device *ahci_part(dev_t minor);
-PRIVATE void ahci_alarm(clock_t stamp);
-PRIVATE int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static struct device *ahci_part(dev_t minor);
+static void ahci_alarm(clock_t stamp);
+static int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant);
-PRIVATE void ahci_intr(unsigned int irqs);
-PRIVATE int ahci_device(dev_t minor, device_id_t *id);
-PRIVATE struct port_state *ahci_get_port(dev_t minor);
+static void ahci_intr(unsigned int irqs);
+static int ahci_device(dev_t minor, device_id_t *id);
+static struct port_state *ahci_get_port(dev_t minor);
/* AHCI driver table. */
-PRIVATE struct blockdriver ahci_dtab = {
+static struct blockdriver ahci_dtab = {
BLOCKDRIVER_TYPE_DISK,
ahci_open,
ahci_close,
/*===========================================================================*
* atapi_exec *
*===========================================================================*/
-PRIVATE int atapi_exec(struct port_state *ps, int cmd,
+static int atapi_exec(struct port_state *ps, int cmd,
u8_t packet[ATAPI_PACKET_SIZE], size_t size, int write)
{
/* Execute an ATAPI command. Return OK or error.
/*===========================================================================*
* atapi_test_unit *
*===========================================================================*/
-PRIVATE int atapi_test_unit(struct port_state *ps, int cmd)
+static int atapi_test_unit(struct port_state *ps, int cmd)
{
/* Test whether the ATAPI device and medium are ready.
*/
/*===========================================================================*
* atapi_request_sense *
*===========================================================================*/
-PRIVATE int atapi_request_sense(struct port_state *ps, int cmd, int *sense)
+static int atapi_request_sense(struct port_state *ps, int cmd, int *sense)
{
/* Request error (sense) information from an ATAPI device, and return
* the sense key. The additional sense codes are not used at this time.
/*===========================================================================*
* atapi_load_eject *
*===========================================================================*/
-PRIVATE int atapi_load_eject(struct port_state *ps, int cmd, int load)
+static int atapi_load_eject(struct port_state *ps, int cmd, int load)
{
/* Load or eject a medium in an ATAPI device.
*/
/*===========================================================================*
* atapi_read_capacity *
*===========================================================================*/
-PRIVATE int atapi_read_capacity(struct port_state *ps, int cmd)
+static int atapi_read_capacity(struct port_state *ps, int cmd)
{
/* Retrieve the LBA count and sector size of an ATAPI medium.
*/
/*===========================================================================*
* atapi_check_medium *
*===========================================================================*/
-PRIVATE int atapi_check_medium(struct port_state *ps, int cmd)
+static int atapi_check_medium(struct port_state *ps, int cmd)
{
/* Check whether a medium is present in a removable-media ATAPI device.
* If a new medium is detected, get its total and sector size. Return
/*===========================================================================*
* atapi_id_check *
*===========================================================================*/
-PRIVATE int atapi_id_check(struct port_state *ps, u16_t *buf)
+static int atapi_id_check(struct port_state *ps, u16_t *buf)
{
/* Determine whether we support this ATAPI device based on the
* identification data it returned, and store some of its properties.
/*===========================================================================*
* atapi_transfer *
*===========================================================================*/
-PRIVATE int atapi_transfer(struct port_state *ps, int cmd, u64_t start_lba,
+static int atapi_transfer(struct port_state *ps, int cmd, u64_t start_lba,
unsigned int count, int write, prd_t *prdt, int nr_prds)
{
/* Perform data transfer from or to an ATAPI device.
/*===========================================================================*
* ata_id_check *
*===========================================================================*/
-PRIVATE int ata_id_check(struct port_state *ps, u16_t *buf)
+static int ata_id_check(struct port_state *ps, u16_t *buf)
{
/* Determine whether we support this ATA device based on the
* identification data it returned, and store some of its properties.
/*===========================================================================*
* ata_transfer *
*===========================================================================*/
-PRIVATE int ata_transfer(struct port_state *ps, int cmd, u64_t start_lba,
+static int ata_transfer(struct port_state *ps, int cmd, u64_t start_lba,
unsigned int count, int write, int force, prd_t *prdt, int nr_prds)
{
/* Perform data transfer from or to an ATA device.
/*===========================================================================*
* gen_identify *
*===========================================================================*/
-PRIVATE int gen_identify(struct port_state *ps, int blocking)
+static int gen_identify(struct port_state *ps, int blocking)
{
/* Identify an ATA or ATAPI device. If the blocking flag is set, block
* until the command has completed; otherwise return immediately.
/*===========================================================================*
* gen_flush_wcache *
*===========================================================================*/
-PRIVATE int gen_flush_wcache(struct port_state *ps)
+static int gen_flush_wcache(struct port_state *ps)
{
/* Flush the device's write cache.
*/
/*===========================================================================*
* gen_get_wcache *
*===========================================================================*/
-PRIVATE int gen_get_wcache(struct port_state *ps, int *val)
+static int gen_get_wcache(struct port_state *ps, int *val)
{
/* Retrieve the status of the device's write cache.
*/
/*===========================================================================*
* gen_set_wcache *
*===========================================================================*/
-PRIVATE int gen_set_wcache(struct port_state *ps, int enable)
+static int gen_set_wcache(struct port_state *ps, int enable)
{
/* Enable or disable the device's write cache.
*/
/*===========================================================================*
* ct_set_fis *
*===========================================================================*/
-PRIVATE vir_bytes ct_set_fis(u8_t *ct, cmd_fis_t *fis, unsigned int tag)
+static vir_bytes ct_set_fis(u8_t *ct, cmd_fis_t *fis, unsigned int tag)
{
/* Fill in the Frame Information Structure part of a command table,
* and return the resulting FIS size (in bytes). We only support the
/*===========================================================================*
* ct_set_packet *
*===========================================================================*/
-PRIVATE void ct_set_packet(u8_t *ct, u8_t packet[ATAPI_PACKET_SIZE])
+static void ct_set_packet(u8_t *ct, u8_t packet[ATAPI_PACKET_SIZE])
{
/* Fill in the packet part of a command table.
*/
/*===========================================================================*
* ct_set_prdt *
*===========================================================================*/
-PRIVATE void ct_set_prdt(u8_t *ct, prd_t *prdt, int nr_prds)
+static void ct_set_prdt(u8_t *ct, prd_t *prdt, int nr_prds)
{
/* Fill in the PRDT part of a command table.
*/
/*===========================================================================*
* port_set_cmd *
*===========================================================================*/
-PRIVATE void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis,
+static void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis,
u8_t packet[ATAPI_PACKET_SIZE], prd_t *prdt, int nr_prds, int write)
{
/* Prepare the given command for execution, by constructing a command
/*===========================================================================*
* port_finish_cmd *
*===========================================================================*/
-PRIVATE void port_finish_cmd(struct port_state *ps, int cmd, int result)
+static void port_finish_cmd(struct port_state *ps, int cmd, int result)
{
/* Finish a command that has either succeeded or failed.
*/
/*===========================================================================*
* port_fail_cmds *
*===========================================================================*/
-PRIVATE void port_fail_cmds(struct port_state *ps)
+static void port_fail_cmds(struct port_state *ps)
{
/* Fail all ongoing commands for a device.
*/
/*===========================================================================*
* port_check_cmds *
*===========================================================================*/
-PRIVATE void port_check_cmds(struct port_state *ps)
+static void port_check_cmds(struct port_state *ps)
{
/* Check what commands have completed, and finish them.
*/
/*===========================================================================*
* port_find_cmd *
*===========================================================================*/
-PRIVATE int port_find_cmd(struct port_state *ps)
+static int port_find_cmd(struct port_state *ps)
{
/* Find a free command tag to queue the current request.
*/
/*===========================================================================*
* port_get_padbuf *
*===========================================================================*/
-PRIVATE int port_get_padbuf(struct port_state *ps, size_t size)
+static int port_get_padbuf(struct port_state *ps, size_t size)
{
/* Make available a temporary buffer for use by this port. Enlarge the
* previous buffer if applicable and necessary, potentially changing
/*===========================================================================*
* sum_iovec *
*===========================================================================*/
-PRIVATE int sum_iovec(struct port_state *ps, endpoint_t endpt,
+static int sum_iovec(struct port_state *ps, endpoint_t endpt,
iovec_s_t *iovec, int nr_req, vir_bytes *total)
{
/* Retrieve the total size of the given I/O vector. Check for alignment
/*===========================================================================*
* setup_prdt *
*===========================================================================*/
-PRIVATE int setup_prdt(struct port_state *ps, endpoint_t endpt,
+static int setup_prdt(struct port_state *ps, endpoint_t endpt,
iovec_s_t *iovec, int nr_req, vir_bytes size, vir_bytes lead,
int write, prd_t *prdt)
{
/*===========================================================================*
* port_transfer *
*===========================================================================*/
-PRIVATE ssize_t port_transfer(struct port_state *ps, u64_t pos, u64_t eof,
+static ssize_t port_transfer(struct port_state *ps, u64_t pos, u64_t eof,
endpoint_t endpt, iovec_s_t *iovec, int nr_req, int write, int flags)
{
/* Perform an I/O transfer on a port.
/*===========================================================================*
* port_start *
*===========================================================================*/
-PRIVATE void port_start(struct port_state *ps)
+static void port_start(struct port_state *ps)
{
/* Start the given port, allowing for the execution of commands and the
* transfer of data on that port.
/*===========================================================================*
* port_restart *
*===========================================================================*/
-PRIVATE void port_restart(struct port_state *ps)
+static void port_restart(struct port_state *ps)
{
/* Restart a port after a fatal error has occurred.
*/
/*===========================================================================*
* port_stop *
*===========================================================================*/
-PRIVATE void port_stop(struct port_state *ps)
+static void port_stop(struct port_state *ps)
{
/* Stop the given port, if not already stopped.
*/
/*===========================================================================*
* port_sig_check *
*===========================================================================*/
-PRIVATE void port_sig_check(struct port_state *ps)
+static void port_sig_check(struct port_state *ps)
{
/* Check whether the device's signature has become available yet, and
* if so, start identifying the device.
/*===========================================================================*
* print_string *
*===========================================================================*/
-PRIVATE void print_string(u16_t *buf, int start, int end)
+static void print_string(u16_t *buf, int start, int end)
{
/* Print a string that is stored as little-endian words and padded with
* trailing spaces.
/*===========================================================================*
* port_id_check *
*===========================================================================*/
-PRIVATE void port_id_check(struct port_state *ps, int success)
+static void port_id_check(struct port_state *ps, int success)
{
/* The device identification command has either completed or timed out.
* Decide whether this device is usable or not, and store some of its
/*===========================================================================*
* port_connect *
*===========================================================================*/
-PRIVATE void port_connect(struct port_state *ps)
+static void port_connect(struct port_state *ps)
{
/* A device has been found to be attached to this port. Start the port,
* and do timed polling for its signature to become available.
/*===========================================================================*
* port_disconnect *
*===========================================================================*/
-PRIVATE void port_disconnect(struct port_state *ps)
+static void port_disconnect(struct port_state *ps)
{
/* The device has detached from this port. Stop the port if necessary.
*/
/*===========================================================================*
* port_intr *
*===========================================================================*/
-PRIVATE void port_intr(struct port_state *ps)
+static void port_intr(struct port_state *ps)
{
/* Process an interrupt on this port.
*/
/*===========================================================================*
* port_timeout *
*===========================================================================*/
-PRIVATE void port_timeout(struct timer *tp)
+static void port_timeout(struct timer *tp)
{
/* A timeout has occurred on this port. Figure out what the timeout is
* for, and take appropriate action.
/*===========================================================================*
* port_wait *
*===========================================================================*/
-PRIVATE void port_wait(struct port_state *ps)
+static void port_wait(struct port_state *ps)
{
/* Suspend the current thread until the given port is no longer busy,
* due to either command completion or timeout.
/*===========================================================================*
* port_issue *
*===========================================================================*/
-PRIVATE void port_issue(struct port_state *ps, int cmd, clock_t timeout)
+static void port_issue(struct port_state *ps, int cmd, clock_t timeout)
{
/* Issue a command to the port, and set a timer to trigger a timeout
* if the command takes too long to complete.
/*===========================================================================*
* port_exec *
*===========================================================================*/
-PRIVATE int port_exec(struct port_state *ps, int cmd, clock_t timeout)
+static int port_exec(struct port_state *ps, int cmd, clock_t timeout)
{
/* Execute a command on a port, wait for the command to complete or for
* a timeout, and return whether the command succeeded or not.
/*===========================================================================*
* port_alloc *
*===========================================================================*/
-PRIVATE void port_alloc(struct port_state *ps)
+static void port_alloc(struct port_state *ps)
{
/* Allocate memory for the given port. We try to cram everything into
* one 4K-page in order to limit memory usage as much as possible.
/*===========================================================================*
* port_free *
*===========================================================================*/
-PRIVATE void port_free(struct port_state *ps)
+static void port_free(struct port_state *ps)
{
/* Free previously allocated memory for the given port.
*/
/*===========================================================================*
* port_init *
*===========================================================================*/
-PRIVATE void port_init(struct port_state *ps)
+static void port_init(struct port_state *ps)
{
/* Initialize the given port.
*/
/*===========================================================================*
* ahci_probe *
*===========================================================================*/
-PRIVATE int ahci_probe(int skip)
+static int ahci_probe(int skip)
{
/* Find a matching PCI device.
*/
/*===========================================================================*
* ahci_reset *
*===========================================================================*/
-PRIVATE void ahci_reset(void)
+static void ahci_reset(void)
{
/* Reset the HBA. Do not enable AHCI mode afterwards.
*/
/*===========================================================================*
* ahci_init *
*===========================================================================*/
-PRIVATE void ahci_init(int devind)
+static void ahci_init(int devind)
{
/* Initialize the device.
*/
/*===========================================================================*
* ahci_stop *
*===========================================================================*/
-PRIVATE void ahci_stop(void)
+static void ahci_stop(void)
{
/* Disable AHCI, and clean up resources to the extent possible.
*/
/*===========================================================================*
* ahci_alarm *
*===========================================================================*/
-PRIVATE void ahci_alarm(clock_t stamp)
+static void ahci_alarm(clock_t stamp)
{
/* Process an alarm.
*/
/*===========================================================================*
* ahci_intr *
*===========================================================================*/
-PRIVATE void ahci_intr(unsigned int UNUSED(irqs))
+static void ahci_intr(unsigned int UNUSED(irqs))
{
/* Process an interrupt.
*/
/*===========================================================================*
* ahci_get_var *
*===========================================================================*/
-PRIVATE void ahci_get_var(char *name, long *v, int timeout)
+static void ahci_get_var(char *name, long *v, int timeout)
{
/* Retrieve an environment variable, and optionall adjust it to the
* scale that we are using internally.
/*===========================================================================*
* ahci_get_params *
*===========================================================================*/
-PRIVATE void ahci_get_params(void)
+static void ahci_get_params(void)
{
/* Retrieve and parse parameters passed to this driver, except the
* device-to-port mapping, which has to be parsed later.
/*===========================================================================*
* ahci_set_mapping *
*===========================================================================*/
-PRIVATE void ahci_set_mapping(void)
+static void ahci_set_mapping(void)
{
/* Construct a mapping from device nodes to port numbers.
*/
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the driver.
*/
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* In case of a termination signal, shut down this driver.
*/
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Set callbacks and initialize the System Event Framework (SEF).
*/
/*===========================================================================*
* ahci_portname *
*===========================================================================*/
-PRIVATE char *ahci_portname(struct port_state *ps)
+static char *ahci_portname(struct port_state *ps)
{
/* Return a printable name for the given port. Whenever we can, print a
* "Dx" device number rather than a "Pxx" port number, because the user
/*===========================================================================*
* ahci_map_minor *
*===========================================================================*/
-PRIVATE struct port_state *ahci_map_minor(dev_t minor, struct device **dvp)
+static struct port_state *ahci_map_minor(dev_t minor, struct device **dvp)
{
/* Map a minor device number to a port and a pointer to the partition's
* device structure. Return NULL if this minor device number does not
/*===========================================================================*
* ahci_part *
*===========================================================================*/
-PRIVATE struct device *ahci_part(dev_t minor)
+static struct device *ahci_part(dev_t minor)
{
/* Return a pointer to the partition information structure of the given
* minor device.
/*===========================================================================*
* ahci_open *
*===========================================================================*/
-PRIVATE int ahci_open(dev_t minor, int access)
+static int ahci_open(dev_t minor, int access)
{
/* Open a device.
*/
/*===========================================================================*
* ahci_close *
*===========================================================================*/
-PRIVATE int ahci_close(dev_t minor)
+static int ahci_close(dev_t minor)
{
/* Close a device.
*/
/*===========================================================================*
* ahci_transfer *
*===========================================================================*/
-PRIVATE ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position,
+static ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iovec, unsigned int count, int flags)
{
/* Perform data transfer on the selected device.
/*===========================================================================*
* ahci_ioctl *
*===========================================================================*/
-PRIVATE int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant)
{
/* Process I/O control requests.
/*===========================================================================*
* ahci_device *
*===========================================================================*/
-PRIVATE int ahci_device(dev_t minor, device_id_t *id)
+static int ahci_device(dev_t minor, device_id_t *id)
{
/* Map a minor device number to a device ID.
*/
/*===========================================================================*
* ahci_get_port *
*===========================================================================*/
-PRIVATE struct port_state *ahci_get_port(dev_t minor)
+static struct port_state *ahci_get_port(dev_t minor)
{
/* Get the port structure associated with the given minor device.
* Called only from worker threads, so the minor device is already
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* Driver task.
*/
static void report_exceptions(void);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
int main(void)
{
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the amddev driver. */
int r, n_maps, n_domains, revision;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
int r;
endpoint_t proc_e;
};
/* Timeouts and max retries. */
-PRIVATE int timeout_usecs = DEF_TIMEOUT_USECS;
-PRIVATE int max_errors = MAX_ERRORS;
-PRIVATE long w_standard_timeouts = 0;
-PRIVATE long w_pci_debug = 0;
-PRIVATE long w_instance = 0;
-PRIVATE long disable_dma = 0;
-PRIVATE long atapi_debug = 0;
-PRIVATE long w_identify_wakeup_ticks;
-PRIVATE long wakeup_ticks;
-PRIVATE long w_atapi_dma;
+static int timeout_usecs = DEF_TIMEOUT_USECS;
+static int max_errors = MAX_ERRORS;
+static long w_standard_timeouts = 0;
+static long w_pci_debug = 0;
+static long w_instance = 0;
+static long disable_dma = 0;
+static long atapi_debug = 0;
+static long w_identify_wakeup_ticks;
+static long wakeup_ticks;
+static long w_atapi_dma;
-PRIVATE int w_testing = 0;
-PRIVATE int w_silent = 0;
+static int w_testing = 0;
+static int w_silent = 0;
-PRIVATE int w_next_drive = 0;
+static int w_next_drive = 0;
-PRIVATE u32_t system_hz;
+static u32_t system_hz;
/* The struct wini is indexed by controller first, then drive (0-3).
* Controller 0 is always the 'compatability' ide controller, at
* the fixed locations, whether present or not.
*/
-PRIVATE struct wini { /* main drive struct, one entry per drive */
+static struct wini { /* main drive struct, one entry per drive */
unsigned state; /* drive state: deaf, initialized, dead */
unsigned short w_status; /* device status register */
unsigned base_cmd; /* command base register */
struct device subpart[SUB_PER_DRIVE]; /* subpartitions */
} wini[MAX_DRIVES], *w_wn;
-PRIVATE int w_device = -1;
+static int w_device = -1;
-PUBLIC int w_command; /* current command in execution */
-PRIVATE int w_drive; /* selected drive */
-PRIVATE struct device *w_dv; /* device's base and size */
+int w_command; /* current command in execution */
+static int w_drive; /* selected drive */
+static struct device *w_dv; /* device's base and size */
-PRIVATE u8_t *tmp_buf;
+static u8_t *tmp_buf;
#define ATA_DMA_SECTORS 64
#define ATA_DMA_BUF_SIZE (ATA_DMA_SECTORS*SECTOR_SIZE)
-PRIVATE char *dma_buf;
-PRIVATE phys_bytes dma_buf_phys;
+static char *dma_buf;
+static phys_bytes dma_buf_phys;
#define N_PRDTE 1024 /* Should be enough for large requests */
};
#define PRDT_BYTES (sizeof(struct prdte) * N_PRDTE)
-PRIVATE struct prdte *prdt;
-PRIVATE phys_bytes prdt_phys;
+static struct prdte *prdt;
+static phys_bytes prdt_phys;
#define PRDTE_FL_EOT 0x80 /* End of table */
/* IDE devices we trust are IDE devices. */
-PRIVATE struct quirk
+static struct quirk
{
int pci_class, pci_subclass, pci_interface;
u16_t vendor;
{ 0, 0, 0, 0, 0 } /* end of list */
};
-FORWARD void init_params(void);
-FORWARD void init_drive(struct wini *w, int base_cmd, int base_ctl, int
+static void init_params(void);
+static void init_drive(struct wini *w, int base_cmd, int base_ctl, int
base_dma, int irq, int ack, int hook, int drive);
-FORWARD void init_params_pci(int);
-FORWARD int w_do_open(dev_t minor, int access);
-FORWARD struct device *w_prepare(dev_t dev);
-FORWARD struct device *w_part(dev_t minor);
-FORWARD int w_identify(void);
-FORWARD char *w_name(void);
-FORWARD int w_specify(void);
-FORWARD int w_io_test(void);
-FORWARD ssize_t w_transfer(dev_t minor, int do_write, u64_t position,
+static void init_params_pci(int);
+static int w_do_open(dev_t minor, int access);
+static struct device *w_prepare(dev_t dev);
+static struct device *w_part(dev_t minor);
+static int w_identify(void);
+static char *w_name(void);
+static int w_specify(void);
+static int w_io_test(void);
+static ssize_t w_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t proc_nr, iovec_t *iov, unsigned int nr_req, int flags);
-FORWARD int com_out(struct command *cmd);
-FORWARD int com_out_ext(struct command *cmd);
-FORWARD int setup_dma(unsigned *sizep, endpoint_t proc_nr, iovec_t *iov,
+static int com_out(struct command *cmd);
+static int com_out_ext(struct command *cmd);
+static int setup_dma(unsigned *sizep, endpoint_t proc_nr, iovec_t *iov,
size_t addr_offset, int do_write);
-FORWARD void w_need_reset(void);
-FORWARD void ack_irqs(unsigned int);
-FORWARD int w_do_close(dev_t minor);
-FORWARD int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static void w_need_reset(void);
+static void ack_irqs(unsigned int);
+static int w_do_close(dev_t minor);
+static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant);
-FORWARD void w_hw_int(unsigned int irqs);
-FORWARD int com_simple(struct command *cmd);
-FORWARD void w_timeout(void);
-FORWARD int w_reset(void);
-FORWARD void w_intr_wait(void);
-FORWARD int at_intr_wait(void);
-FORWARD int w_waitfor(int mask, int value);
-FORWARD int w_waitfor_dma(int mask, int value);
-FORWARD void w_geometry(dev_t minor, struct partition *entry);
+static void w_hw_int(unsigned int irqs);
+static int com_simple(struct command *cmd);
+static void w_timeout(void);
+static int w_reset(void);
+static void w_intr_wait(void);
+static int at_intr_wait(void);
+static int w_waitfor(int mask, int value);
+static int w_waitfor_dma(int mask, int value);
+static void w_geometry(dev_t minor, struct partition *entry);
#if ENABLE_ATAPI
-FORWARD int atapi_sendpacket(u8_t *packet, unsigned cnt, int do_dma);
-FORWARD int atapi_intr_wait(int dma, size_t max);
-FORWARD int atapi_open(void);
-FORWARD void atapi_close(void);
-FORWARD int atapi_transfer(int do_write, u64_t position, endpoint_t
+static int atapi_sendpacket(u8_t *packet, unsigned cnt, int do_dma);
+static int atapi_intr_wait(int dma, size_t max);
+static int atapi_open(void);
+static void atapi_close(void);
+static int atapi_transfer(int do_write, u64_t position, endpoint_t
endpt, iovec_t *iov, unsigned int nr_req);
#endif
#define sys_voutb(out, n) at_voutb((out), (n))
-FORWARD int at_voutb(pvb_pair_t *, int n);
+static int at_voutb(pvb_pair_t *, int n);
#define sys_vinb(in, n) at_vinb((in), (n))
-FORWARD int at_vinb(pvb_pair_t *, int n);
+static int at_vinb(pvb_pair_t *, int n);
#undef sys_outb
#undef sys_inb
#undef sys_outl
-FORWARD int at_out(int line, u32_t port, u32_t value, char *typename,
+static int at_out(int line, u32_t port, u32_t value, char *typename,
int type);
-FORWARD int at_in(int line, u32_t port, u32_t *value, char *typename,
+static int at_in(int line, u32_t port, u32_t *value, char *typename,
int type);
#define sys_outb(p, v) at_out(__LINE__, (p), (v), "outb", _DIO_BYTE)
#define sys_outl(p, v) at_out(__LINE__, (p), (v), "outl", _DIO_LONG)
/* Entry points to this driver. */
-PRIVATE struct blockdriver w_dtab = {
+static struct blockdriver w_dtab = {
BLOCKDRIVER_TYPE_DISK,/* handle partition requests */
w_do_open, /* open or mount request, initialize device */
w_do_close, /* release device */
};
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state);
/*===========================================================================*
* at_winchester_task *
*===========================================================================*/
-PUBLIC int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
/* SEF local startup. */
env_setargs(argc, argv);
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the at_wini driver. */
system_hz = sys_hz();
/*===========================================================================*
* init_params *
*===========================================================================*/
-PRIVATE void init_params(void)
+static void init_params(void)
{
/* This routine is called at startup to initialize the drive parameters. */
/*===========================================================================*
* init_drive *
*===========================================================================*/
-PRIVATE void init_drive(struct wini *w, int base_cmd, int base_ctl,
+static void init_drive(struct wini *w, int base_cmd, int base_ctl,
int base_dma, int irq, int ack, int hook, int drive)
{
w->state = 0;
w->dma = 0;
}
-PRIVATE int quirkmatch(struct quirk *table, u8_t bcr, u8_t scr, u8_t interface, u16_t vid, u16_t did) {
+static int quirkmatch(struct quirk *table, u8_t bcr, u8_t scr, u8_t interface, u16_t vid, u16_t did) {
while(table->vendor) {
if(table->vendor == vid && table->device == did &&
table->pci_class == bcr &&
/*===========================================================================*
* init_params_pci *
*===========================================================================*/
-PRIVATE void init_params_pci(int skip)
+static void init_params_pci(int skip)
{
int i, r, devind, drive, pci_compat = 0;
int irq, irq_hook;
/*===========================================================================*
* w_do_open *
*===========================================================================*/
-PRIVATE int w_do_open(dev_t minor, int access)
+static int w_do_open(dev_t minor, int access)
{
/* Device open: Initialize the controller and read the partition table. */
/*===========================================================================*
* w_prepare *
*===========================================================================*/
-PRIVATE struct device *w_prepare(dev_t device)
+static struct device *w_prepare(dev_t device)
{
/* Prepare for I/O on a device. */
w_device = (int) device;
/*===========================================================================*
* w_part *
*===========================================================================*/
-PRIVATE struct device *w_part(dev_t device)
+static struct device *w_part(dev_t device)
{
/* Return a pointer to the partition information of the given minor device. */
/*===========================================================================*
* check_dma *
*===========================================================================*/
-PRIVATE void
+static void
check_dma(struct wini *wn)
{
u32_t dma_status, dma_base;
/*===========================================================================*
* w_identify *
*===========================================================================*/
-PRIVATE int w_identify(void)
+static int w_identify(void)
{
/* Find out if a device exists, if it is an old AT disk, or a newer ATA
* drive, a removable media device, etc.
/*===========================================================================*
* w_name *
*===========================================================================*/
-PRIVATE char *w_name(void)
+static char *w_name(void)
{
/* Return a name for the current device. */
static char name[] = "AT0-D0";
/*===========================================================================*
* w_io_test *
*===========================================================================*/
-PRIVATE int w_io_test(void)
+static int w_io_test(void)
{
int save_dev;
int save_timeout, save_errors, save_wakeup;
/*===========================================================================*
* w_specify *
*===========================================================================*/
-PRIVATE int w_specify(void)
+static int w_specify(void)
{
/* Routine to initialize the drive after boot or when a reset is needed. */
/*===========================================================================*
* do_transfer *
*===========================================================================*/
-PRIVATE int do_transfer(const struct wini *wn, unsigned int precomp,
+static int do_transfer(const struct wini *wn, unsigned int precomp,
unsigned int count, unsigned int sector,
unsigned int do_write, int do_dma)
{
return com_out(&cmd);
}
-PRIVATE void stop_dma(const struct wini *wn)
+static void stop_dma(const struct wini *wn)
{
int r;
if (r != 0) panic("stop_dma: sys_outb failed: %d", r);
}
-PRIVATE void start_dma(const struct wini *wn, int do_write)
+static void start_dma(const struct wini *wn, int do_write)
{
u32_t v;
int r;
if (r != 0) panic("start_dma: sys_outb failed: %d", r);
}
-PRIVATE int error_dma(const struct wini *wn)
+static int error_dma(const struct wini *wn)
{
int r;
u32_t v;
/*===========================================================================*
* w_transfer *
*===========================================================================*/
-PRIVATE ssize_t w_transfer(
+static ssize_t w_transfer(
dev_t minor, /* minor device to perform the transfer on */
int do_write, /* read or write? */
u64_t position, /* offset on device to read or write */
/*===========================================================================*
* com_out *
*===========================================================================*/
-PRIVATE int com_out(cmd)
+static int com_out(cmd)
struct command *cmd; /* Command block */
{
/* Output the command block to the winchester controller and return status */
/*===========================================================================*
* com_out_ext *
*===========================================================================*/
-PRIVATE int com_out_ext(cmd)
+static int com_out_ext(cmd)
struct command *cmd; /* Command block */
{
/* Output the command block to the winchester controller and return status */
/*===========================================================================*
* setup_dma *
*===========================================================================*/
-PRIVATE int setup_dma(
+static int setup_dma(
unsigned *sizep,
endpoint_t proc_nr,
iovec_t *iov,
/*===========================================================================*
* w_need_reset *
*===========================================================================*/
-PRIVATE void w_need_reset(void)
+static void w_need_reset(void)
{
/* The controller needs to be reset. */
struct wini *wn;
/*===========================================================================*
* w_do_close *
*===========================================================================*/
-PRIVATE int w_do_close(dev_t minor)
+static int w_do_close(dev_t minor)
{
/* Device close: Release a device. */
if (w_prepare(minor) == NULL)
/*===========================================================================*
* com_simple *
*===========================================================================*/
-PRIVATE int com_simple(cmd)
+static int com_simple(cmd)
struct command *cmd; /* Command block */
{
/* A simple controller command, only one interrupt and no data-out phase. */
/*===========================================================================*
* w_timeout *
*===========================================================================*/
-PRIVATE void w_timeout(void)
+static void w_timeout(void)
{
struct wini *wn = w_wn;
/*===========================================================================*
* w_reset *
*===========================================================================*/
-PRIVATE int w_reset(void)
+static int w_reset(void)
{
/* Issue a reset to the controller. This is done after any catastrophe,
* like the controller refusing to respond.
/*===========================================================================*
* w_intr_wait *
*===========================================================================*/
-PRIVATE void w_intr_wait(void)
+static void w_intr_wait(void)
{
/* Wait for a task completion interrupt. */
/*===========================================================================*
* at_intr_wait *
*===========================================================================*/
-PRIVATE int at_intr_wait(void)
+static int at_intr_wait(void)
{
/* Wait for an interrupt, study the status bits and return error/success. */
int r, s;
/*===========================================================================*
* w_waitfor *
*===========================================================================*/
-PRIVATE int w_waitfor(mask, value)
+static int w_waitfor(mask, value)
int mask; /* status mask */
int value; /* required status */
{
/*===========================================================================*
* w_waitfor_dma *
*===========================================================================*/
-PRIVATE int w_waitfor_dma(mask, value)
+static int w_waitfor_dma(mask, value)
int mask; /* status mask */
int value; /* required status */
{
/*===========================================================================*
* w_geometry *
*===========================================================================*/
-PRIVATE void w_geometry(dev_t minor, struct partition *entry)
+static void w_geometry(dev_t minor, struct partition *entry)
{
struct wini *wn;
/*===========================================================================*
* atapi_open *
*===========================================================================*/
-PRIVATE int atapi_open(void)
+static int atapi_open(void)
{
/* Should load and lock the device and obtain its size. For now just set the
* size of the device to something big. What is really needed is a generic
/*===========================================================================*
* atapi_close *
*===========================================================================*/
-PRIVATE void atapi_close(void)
+static void atapi_close(void)
{
/* Should unlock the device. For now do nothing. (XXX) */
}
-PRIVATE void sense_request(void)
+static void sense_request(void)
{
int r, i;
static u8_t sense[100], packet[ATAPI_PACKETSIZE];
/*===========================================================================*
* atapi_transfer *
*===========================================================================*/
-PRIVATE int atapi_transfer(
+static int atapi_transfer(
int do_write, /* read or write? */
u64_t position, /* offset on device to read or write */
endpoint_t proc_nr, /* process doing the request */
/*===========================================================================*
* atapi_sendpacket *
*===========================================================================*/
-PRIVATE int atapi_sendpacket(packet, cnt, do_dma)
+static int atapi_sendpacket(packet, cnt, do_dma)
u8_t *packet;
unsigned cnt;
int do_dma;
/*===========================================================================*
* w_ioctl *
*===========================================================================*/
-PRIVATE int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant)
{
int r, timeout, prev, count;
/*===========================================================================*
* w_hw_int *
*===========================================================================*/
-PRIVATE void w_hw_int(unsigned int irqs)
+static void w_hw_int(unsigned int irqs)
{
/* Leftover interrupt(s) received; ack it/them. */
ack_irqs(irqs);
/*===========================================================================*
* ack_irqs *
*===========================================================================*/
-PRIVATE void ack_irqs(unsigned int irqs)
+static void ack_irqs(unsigned int irqs)
{
unsigned int drive;
u32_t w_status;
#define STSTR(a) if (status & STATUS_ ## a) { strcat(str, #a); strcat(str, " "); }
#define ERRSTR(a) if (e & ERROR_ ## a) { strcat(str, #a); strcat(str, " "); }
-PRIVATE char *strstatus(int status)
+static char *strstatus(int status)
{
static char str[200];
str[0] = '\0';
return str;
}
-PRIVATE char *strerr(int e)
+static char *strerr(int e)
{
static char str[200];
str[0] = '\0';
/*===========================================================================*
* atapi_intr_wait *
*===========================================================================*/
-PRIVATE int atapi_intr_wait(int UNUSED(do_dma), size_t UNUSED(max))
+static int atapi_intr_wait(int UNUSED(do_dma), size_t UNUSED(max))
{
/* Wait for an interrupt and study the results. Returns a number of bytes
* that need to be transferred, or an error code.
#undef sys_voutb
#undef sys_vinb
-PRIVATE int at_voutb(pvb_pair_t *pvb, int n)
+static int at_voutb(pvb_pair_t *pvb, int n)
{
int s, i;
if ((s=sys_voutb(pvb,n)) == OK)
panic("sys_voutb failed");
}
-PRIVATE int at_vinb(pvb_pair_t *pvb, int n)
+static int at_vinb(pvb_pair_t *pvb, int n)
{
int s, i;
if ((s=sys_vinb(pvb,n)) == OK)
panic("sys_vinb failed");
}
-PRIVATE int at_out(int line, u32_t port, u32_t value, char *typename, int type)
+static int at_out(int line, u32_t port, u32_t value, char *typename, int type)
{
int s;
s = sys_out(port, value, type);
}
-PRIVATE int at_in(int line, u32_t port, u32_t *value, char *typename, int type)
+static int at_in(int line, u32_t port, u32_t *value, char *typename, int type)
{
int s;
s = sys_in(port, value, type);
/*===========================================================================*
* sef_cb_lu_prepare *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare(int state)
+int sef_cb_lu_prepare(int state)
{
int is_ready;
/*===========================================================================*
* sef_cb_lu_state_isvalid *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid(int state)
+int sef_cb_lu_state_isvalid(int state)
{
return SEF_LU_STATE_IS_STANDARD(state) || AT_STATE_IS_CUSTOM(state);
}
/*===========================================================================*
* sef_cb_lu_state_dump *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_dump(int state)
+void sef_cb_lu_state_dump(int state)
{
sef_lu_dprint("at_wini: live update state = %d\n", state);
sef_lu_dprint("at_wini: w_command = 0x%02X\n", w_command);
u8_t data[ATL2_RXD_SIZE - sizeof(u32_t) * 2];
} rxd_t;
-PRIVATE struct {
+static struct {
int devind; /* PCI device index */
int irq; /* IRQ number */
int hook_id; /* IRQ hook ID */
#define ATL2_ALIGN_32(n) (((n) + 3) & ~3)
-PRIVATE iovec_s_t iovec[NR_IOREQS];
+static iovec_s_t iovec[NR_IOREQS];
-PRIVATE int instance;
+static int instance;
/*===========================================================================*
* atl2_read_vpd *
*===========================================================================*/
-PRIVATE int atl2_read_vpd(int index, u32_t *res)
+static int atl2_read_vpd(int index, u32_t *res)
{
/* Read a value from the VPD register area.
*/
/*===========================================================================*
* atl2_get_vpd_hwaddr *
*===========================================================================*/
-PRIVATE int atl2_get_vpd_hwaddr(void)
+static int atl2_get_vpd_hwaddr(void)
{
/* Read the MAC address from the EEPROM, using the Vital Product Data
* register interface.
/*===========================================================================*
* atl2_get_hwaddr *
*===========================================================================*/
-PRIVATE void atl2_get_hwaddr(void)
+static void atl2_get_hwaddr(void)
{
/* Get the MAC address of the card. First try the EEPROM; if that
* fails, just use whatever the card was already set to.
/*===========================================================================*
* atl2_read_mdio *
*===========================================================================*/
-PRIVATE int atl2_read_mdio(int addr, u16_t *res)
+static int atl2_read_mdio(int addr, u16_t *res)
{
/* Read a MII PHY register using MDIO.
*/
/*===========================================================================*
* atl2_alloc_dma *
*===========================================================================*/
-PRIVATE int atl2_alloc_dma(void)
+static int atl2_alloc_dma(void)
{
/* Allocate DMA ring buffers.
*/
/*===========================================================================*
* atl2_stop *
*===========================================================================*/
-PRIVATE int atl2_stop(void)
+static int atl2_stop(void)
{
/* Stop the device.
*/
/*===========================================================================*
* atl2_reset *
*===========================================================================*/
-PRIVATE int atl2_reset(void)
+static int atl2_reset(void)
{
/* Reset the device to a known good state.
*/
/*===========================================================================*
* atl2_set_mode *
*===========================================================================*/
-PRIVATE void atl2_set_mode(void)
+static void atl2_set_mode(void)
{
/* Reconfigure the device's promiscuity, multicast, and broadcast mode
* settings.
/*===========================================================================*
* atl2_setup *
*===========================================================================*/
-PRIVATE int atl2_setup(void)
+static int atl2_setup(void)
{
/* Set up the device for normal operation.
*/
/*===========================================================================*
* atl2_probe *
*===========================================================================*/
-PRIVATE int atl2_probe(int skip)
+static int atl2_probe(int skip)
{
/* Find a matching PCI device.
*/
/*===========================================================================*
* atl2_init *
*===========================================================================*/
-PRIVATE void atl2_init(int devind)
+static void atl2_init(int devind)
{
/* Initialize the device.
*/
/*===========================================================================*
* atl2_tx_stat *
*===========================================================================*/
-PRIVATE void atl2_tx_stat(u32_t stat)
+static void atl2_tx_stat(u32_t stat)
{
/* Update statistics for packet transmission.
*/
/*===========================================================================*
* atl2_rx_stat *
*===========================================================================*/
-PRIVATE void atl2_rx_stat(u32_t stat)
+static void atl2_rx_stat(u32_t stat)
{
/* Update statistics for packet receipt.
*/
/*===========================================================================*
* atl2_tx_advance *
*===========================================================================*/
-PRIVATE int atl2_tx_advance(void)
+static int atl2_tx_advance(void)
{
/* Advance the TxD/TxS tails by as many sent packets as found.
*/
/*===========================================================================*
* atl2_rx_advance *
*===========================================================================*/
-PRIVATE void atl2_rx_advance(int next)
+static void atl2_rx_advance(int next)
{
/* Advance the RxD tail by as many failed receipts as possible, and
* see if there is an actual packet left to receive. If 'next' is set,
/*===========================================================================*
* atl2_reply *
*===========================================================================*/
-PRIVATE void atl2_reply(void)
+static void atl2_reply(void)
{
/* Send a task reply to Inet.
*/
/*===========================================================================*
* atl2_readv *
*===========================================================================*/
-PRIVATE void atl2_readv(const message *m, int from_int)
+static void atl2_readv(const message *m, int from_int)
{
/* Read packet data.
*/
/*===========================================================================*
* atl2_writev *
*===========================================================================*/
-PRIVATE void atl2_writev(const message *m, int from_int)
+static void atl2_writev(const message *m, int from_int)
{
/* Write packet data.
*/
/*===========================================================================*
* atl2_intr *
*===========================================================================*/
-PRIVATE void atl2_intr(const message *UNUSED(m))
+static void atl2_intr(const message *UNUSED(m))
{
/* Interrupt received.
*/
/*===========================================================================*
* atl2_conf *
*===========================================================================*/
-PRIVATE void atl2_conf(message *m)
+static void atl2_conf(message *m)
{
/* Configure the mode of the card.
*/
/*===========================================================================*
* atl2_getstat *
*===========================================================================*/
-PRIVATE void atl2_getstat(message *m)
+static void atl2_getstat(message *m)
{
/* Copy out statistics.
*/
/*===========================================================================*
* atl2_dump_link *
*===========================================================================*/
-PRIVATE void atl2_dump_link(void)
+static void atl2_dump_link(void)
{
/* Dump link status.
*/
/*===========================================================================*
* atl2_dump *
*===========================================================================*/
-PRIVATE void atl2_dump(void)
+static void atl2_dump(void)
{
/* Dump statistics.
*/
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the atl2 driver.
*/
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* In case of a termination signal, shut down this driver.
* Stop the device, and deallocate resources as proof of concept.
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
#define MUTE 0x80
-FORWARD int ak4531_write(u8_t address, u8_t data);
-FORWARD int ak4531_finished(void);
-FORWARD int set_volume(struct volume_level *level, int cmd_left, int
+static int ak4531_write(u8_t address, u8_t data);
+static int ak4531_finished(void);
+static int set_volume(struct volume_level *level, int cmd_left, int
cmd_right, int max_level);
-PRIVATE u16_t base_address;
-PRIVATE u16_t status_register;
-PRIVATE u16_t status_bit;
-PRIVATE u16_t poll_address;
+static u16_t base_address;
+static u16_t status_register;
+static u16_t status_bit;
+static u16_t poll_address;
u8_t mixer_values[0x20] = {
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, /* 0x00 - 0x07 */
-PRIVATE int ak4531_finished(void) {
+static int ak4531_finished(void) {
int i;
u16_t cstat;
for (i = 0; i < 0x40000; i++) {
}
-PRIVATE int ak4531_write (u8_t address, u8_t data) {
+static int ak4531_write (u8_t address, u8_t data) {
u16_t to_be_written;
}
-PUBLIC int ak4531_init(u16_t base, u16_t status_reg, u16_t bit,
+int ak4531_init(u16_t base, u16_t status_reg, u16_t bit,
u16_t poll) {
int i;
}
-PUBLIC int ak4531_get_set_volume(struct volume_level *level, int flag) {
+int ak4531_get_set_volume(struct volume_level *level, int flag) {
int cmd_left, cmd_right, max_level;
max_level = 0x1f;
}
-PRIVATE int set_volume(struct volume_level *level, int cmd_left, int cmd_right,
+static int set_volume(struct volume_level *level, int cmd_left, int cmd_right,
int max_level) {
if(level->right < 0) level->right = 0;
/* prototypes of private functions */
-FORWARD int detect_hw(void);
-FORWARD int disable_int(int sub_dev);
-FORWARD int set_stereo(u32_t stereo, int sub_dev);
-FORWARD int set_bits(u32_t nr_of_bits, int sub_dev);
-FORWARD int set_sample_rate(u32_t rate, int sub_dev);
-FORWARD int set_sign(u32_t val, int sub_dev);
-FORWARD int get_max_frag_size(u32_t * val, int *len, int sub_dev);
-FORWARD int set_frag_size(u32_t fragment_size, int sub_dev);
-FORWARD int set_int_cnt(int sub_dev);
-FORWARD int free_buf(u32_t *val, int *len, int sub_dev);
-FORWARD int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
-FORWARD int get_set_volume(struct volume_level *level, int *len, int
+static int detect_hw(void);
+static int disable_int(int sub_dev);
+static int set_stereo(u32_t stereo, int sub_dev);
+static int set_bits(u32_t nr_of_bits, int sub_dev);
+static int set_sample_rate(u32_t rate, int sub_dev);
+static int set_sign(u32_t val, int sub_dev);
+static int get_max_frag_size(u32_t * val, int *len, int sub_dev);
+static int set_frag_size(u32_t fragment_size, int sub_dev);
+static int set_int_cnt(int sub_dev);
+static int free_buf(u32_t *val, int *len, int sub_dev);
+static int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
+static int get_set_volume(struct volume_level *level, int *len, int
sub_dev, int flag);
-FORWARD int reset(int sub_dev);
+static int reset(int sub_dev);
DEV_STRUCT dev;
aud_sub_dev_conf_t aud_conf[4];
-PUBLIC sub_dev_t sub_dev[4];
-PUBLIC special_file_t special_file[4];
-PUBLIC drv_t drv;
+sub_dev_t sub_dev[4];
+special_file_t special_file[4];
+drv_t drv;
-PUBLIC int drv_init(void) {
+int drv_init(void) {
drv.DriverName = DRIVER_NAME;
drv.NrOfSubDevices = 4;
drv.NrOfSpecialFiles = 4;
}
-PUBLIC int drv_init_hw (void) {
+int drv_init_hw (void) {
u16_t i, j;
u16_t chip_sel_ctrl_reg;
}
-PRIVATE int detect_hw(void) {
+static int detect_hw(void) {
u32_t device;
int devind;
u16_t v_id, d_id;
}
-PRIVATE int reset(int chan) {
+static int reset(int chan) {
drv_stop(chan);
sub_dev[chan].OutOfData = 1;
}
-PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
+static int set_bits(u32_t nr_of_bits, int sub_dev) {
/* set format bits for specified channel. */
u16_t size_16_bit, ser_interface;
}
-PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
+static int set_stereo(u32_t stereo, int sub_dev) {
/* set format bits for specified channel. */
u16_t stereo_bit, ser_interface;
}
-PRIVATE int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
+static int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
return OK;
}
-PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
+static int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
if (fragment_size > (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments) ||
fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) {
}
-PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
+static int set_sample_rate(u32_t rate, int sub_dev) {
/* currently only 44.1kHz */
u32_t controlRegister;
}
-PRIVATE int set_int_cnt(int chan) {
+static int set_int_cnt(int chan) {
/* Write interrupt count for specified channel.
After <DspFragmentSize> bytes, an interrupt will be generated */
}
-PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
+static int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
*len = sizeof(*val);
*val = (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments);
}
-PRIVATE int disable_int(int chan) {
+static int disable_int(int chan) {
u16_t ser_interface, int_en_bit;
switch(chan) {
}
-PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
+static int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
u16_t samp_ct_reg;
u16_t curr_samp_ct_reg;
u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */
/* returns 1 if there are free buffers */
-PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
+static int free_buf (u32_t *val, int *len, int sub_dev_nr) {
*len = sizeof(*val);
if (sub_dev[sub_dev_nr].BufLength ==
sub_dev[sub_dev_nr].NrOfExtraBuffers) {
}
-PRIVATE int get_set_volume(struct volume_level *level, int *len, int sub_dev,
+static int get_set_volume(struct volume_level *level, int *len, int sub_dev,
int flag) {
*len = sizeof(struct volume_level);
if (sub_dev == MIXER) {
/*===========================================================================*
* helper functions for I/O *
*===========================================================================*/
-PUBLIC u32_t pci_inb(u16_t port) {
+u32_t pci_inb(u16_t port) {
u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
}
-PUBLIC u32_t pci_inw(u16_t port) {
+u32_t pci_inw(u16_t port) {
u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
}
-PUBLIC u32_t pci_inl(u16_t port) {
+u32_t pci_inl(u16_t port) {
u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
}
-PUBLIC void pci_outb(u16_t port, u8_t value) {
+void pci_outb(u16_t port, u8_t value) {
int s;
if ((s=sys_outb(port, value)) !=OK)
printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC void pci_outw(u16_t port, u16_t value) {
+void pci_outw(u16_t port, u16_t value) {
int s;
if ((s=sys_outw(port, value)) !=OK)
printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC void pci_outl(u16_t port, u32_t value) {
+void pci_outl(u16_t port, u32_t value) {
int s;
if ((s=sys_outl(port, value)) !=OK)
printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);
/* AC97 Mixer and Mode control function prototypes */
-FORWARD int AC97_write(const DEV_STRUCT * pCC, u16_t wAddr, u16_t
+static int AC97_write(const DEV_STRUCT * pCC, u16_t wAddr, u16_t
wData);
-FORWARD int AC97_write_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
+static int AC97_write_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
u16_t wData);
-FORWARD int AC97_read_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
+static int AC97_read_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
u16_t *data);
-FORWARD void set_nice_volume(void);
-FORWARD int AC97_get_volume(struct volume_level *level);
-FORWARD int AC97_set_volume(const struct volume_level *level);
+static void set_nice_volume(void);
+static int AC97_get_volume(struct volume_level *level);
+static int AC97_set_volume(const struct volume_level *level);
#if 0
-PRIVATE void set_src_sync_state (int state)
+static void set_src_sync_state (int state)
{
if (state < 0)
SrcSyncState = SRC_UNSYNCED;
#endif
-PRIVATE int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
+static int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
{
u32_t dtemp, i;
u16_t wBaseAddr = pCC->base;
#if 0
-PRIVATE int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data)
+static int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data)
{
u32_t dtemp, i;
u16_t base = pCC->base;
#endif
-PRIVATE int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
+static int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
u16_t wData)
{
/* wait for WIP to go away */
}
-PRIVATE int AC97_read_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
+static int AC97_read_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
u16_t *data)
{
u32_t dtemp;
}
-PRIVATE void set_nice_volume(void) {
+static void set_nice_volume(void) {
/* goofy code to set the DAC1 channel to an audibe volume
to be able to test it without using the mixer */
}
-PRIVATE int get_volume(u8_t *left, u8_t *right, int cmd) {
+static int get_volume(u8_t *left, u8_t *right, int cmd) {
u16_t value;
AC97_read_unsynced(dev, (u16_t)cmd, &value);
}
-PRIVATE int set_volume(int left, int right, int cmd) {
+static int set_volume(int left, int right, int cmd) {
u16_t waarde;
waarde = (u16_t)((left<<8)|right);
}
-PRIVATE int AC97_get_volume(struct volume_level *level) {
+static int AC97_get_volume(struct volume_level *level) {
int cmd;
u8_t left;
u8_t right;
}
-PRIVATE int AC97_set_volume(const struct volume_level *level) {
+static int AC97_set_volume(const struct volume_level *level) {
int cmd;
int left;
int right;
/* prototypes of private functions */
-FORWARD int detect_hw(void);
-FORWARD int disable_int(int sub_dev);
-FORWARD int set_stereo(u32_t stereo, int sub_dev);
-FORWARD int set_bits(u32_t nr_of_bits, int sub_dev);
-FORWARD int set_sample_rate(u32_t rate, int sub_dev);
-FORWARD int set_sign(u32_t val, int sub_dev);
-FORWARD int get_max_frag_size(u32_t * val, int *len, int sub_dev);
-FORWARD int set_frag_size(u32_t fragment_size, int sub_dev);
-FORWARD int set_int_cnt(int sub_dev);
-FORWARD int free_buf(u32_t *val, int *len, int sub_dev);
-FORWARD int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
-FORWARD int get_set_volume(struct volume_level *level, int *len, int
+static int detect_hw(void);
+static int disable_int(int sub_dev);
+static int set_stereo(u32_t stereo, int sub_dev);
+static int set_bits(u32_t nr_of_bits, int sub_dev);
+static int set_sample_rate(u32_t rate, int sub_dev);
+static int set_sign(u32_t val, int sub_dev);
+static int get_max_frag_size(u32_t * val, int *len, int sub_dev);
+static int set_frag_size(u32_t fragment_size, int sub_dev);
+static int set_int_cnt(int sub_dev);
+static int free_buf(u32_t *val, int *len, int sub_dev);
+static int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
+static int get_set_volume(struct volume_level *level, int *len, int
sub_dev, int flag);
-FORWARD int reset(int sub_dev);
+static int reset(int sub_dev);
DEV_STRUCT dev;
aud_sub_dev_conf_t aud_conf[4];
-PUBLIC sub_dev_t sub_dev[4];
-PUBLIC special_file_t special_file[4];
-PUBLIC drv_t drv;
+sub_dev_t sub_dev[4];
+special_file_t special_file[4];
+drv_t drv;
-PUBLIC int drv_init(void) {
+int drv_init(void) {
drv.DriverName = DRIVER_NAME;
drv.NrOfSubDevices = 4;
drv.NrOfSpecialFiles = 4;
}
-PUBLIC int drv_init_hw (void) {
+int drv_init_hw (void) {
u16_t i, j;
/* First, detect the hardware */
}
-PRIVATE int detect_hw(void) {
+static int detect_hw(void) {
u32_t device;
int devind;
u16_t v_id, d_id;
}
-PRIVATE int reset(int chan) {
+static int reset(int chan) {
drv_stop(chan);
sub_dev[chan].OutOfData = 1;
}
-PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
+static int set_bits(u32_t nr_of_bits, int sub_dev) {
/* set format bits for specified channel. */
u16_t size_16_bit, ser_interface;
}
-PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
+static int set_stereo(u32_t stereo, int sub_dev) {
/* set format bits for specified channel. */
u16_t stereo_bit, ser_interface;
}
-PRIVATE int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
+static int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
return OK;
}
-PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
+static int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
if (fragment_size > (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments) ||
fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) {
}
-PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
+static int set_sample_rate(u32_t rate, int sub_dev) {
u32_t src_base_reg;
if (rate > MAX_RATE || rate < MIN_RATE) {
}
-PRIVATE int set_int_cnt(int chan) {
+static int set_int_cnt(int chan) {
/* Write interrupt count for specified channel.
After <DspFragmentSize> bytes, an interrupt will be generated */
}
-PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
+static int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
*len = sizeof(*val);
*val = (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments);
}
-PRIVATE int disable_int(int chan) {
+static int disable_int(int chan) {
u16_t ser_interface, int_en_bit;
switch(chan) {
}
-PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
+static int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
u16_t samp_ct_reg;
u16_t curr_samp_ct_reg;
u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */
/* returns 1 if there are free buffers */
-PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
+static int free_buf (u32_t *val, int *len, int sub_dev_nr) {
*len = sizeof(*val);
if (sub_dev[sub_dev_nr].BufLength ==
sub_dev[sub_dev_nr].NrOfExtraBuffers) {
}
-PRIVATE int get_set_volume(struct volume_level *level, int *len, int sub_dev,
+static int get_set_volume(struct volume_level *level, int *len, int sub_dev,
int flag) {
*len = sizeof(struct volume_level);
if (sub_dev == MIXER) {
/*===========================================================================*
* helper functions for I/O *
*===========================================================================*/
-PUBLIC u32_t pci_inb(u16_t port) {
+u32_t pci_inb(u16_t port) {
u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
}
-PUBLIC u32_t pci_inw(u16_t port) {
+u32_t pci_inw(u16_t port) {
u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
}
-PUBLIC u32_t pci_inl(u16_t port) {
+u32_t pci_inl(u16_t port) {
u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
}
-PUBLIC void pci_outb(u16_t port, u8_t value) {
+void pci_outb(u16_t port, u8_t value) {
int s;
if ((s=sys_outb(port, value)) !=OK)
printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC void pci_outw(u16_t port, u16_t value) {
+void pci_outw(u16_t port, u16_t value) {
int s;
if ((s=sys_outw(port, value)) !=OK)
printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC void pci_outl(u16_t port, u32_t value) {
+void pci_outl(u16_t port, u32_t value) {
int s;
if ((s=sys_outl(port, value)) !=OK)
printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);
-FORWARD int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t
+static int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t
*data);
-FORWARD int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val);
+static int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val);
int src_init ( DEV_STRUCT * DSP ) {
}
-PRIVATE int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
+static int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
u32_t dtemp;
/* wait for ready */
}
-PRIVATE int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) {
+static int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) {
u32_t dtemp;
/* wait for ready */
-FORWARD int get_set_volume(struct volume_level *level, int flag);
-FORWARD int get_set_input(struct inout_ctrl *input, int flag, int
+static int get_set_volume(struct volume_level *level, int flag);
+static int get_set_input(struct inout_ctrl *input, int flag, int
channel);
-FORWARD int get_set_output(struct inout_ctrl *output, int flag);
+static int get_set_output(struct inout_ctrl *output, int flag);
/*=========================================================================*
* mixer_ioctl
*=========================================================================*/
-PUBLIC int mixer_ioctl(int request, void *val, int *UNUSED(len)) {
+int mixer_ioctl(int request, void *val, int *UNUSED(len)) {
int status;
switch(request) {
/*=========================================================================*
* mixer_init
*=========================================================================*/
-PUBLIC int mixer_init() {
+int mixer_init() {
/* Try to detect the mixer by writing to MIXER_DAC_LEVEL if the
* value written can be read back the mixer is there
*/
/*=========================================================================*
* get_set_volume *
*=========================================================================*/
-PRIVATE int get_set_volume(struct volume_level *level, int flag) {
+static int get_set_volume(struct volume_level *level, int flag) {
int cmd_left, cmd_right, shift, max_level;
shift = 3;
/*=========================================================================*
* get_set_input *
*=========================================================================*/
-PRIVATE int get_set_input(struct inout_ctrl *input, int flag, int channel) {
+static int get_set_input(struct inout_ctrl *input, int flag, int channel) {
int input_cmd, input_mask, mask, del_mask, shift;
input_cmd = (channel == 0 ? MIXER_IN_LEFT : MIXER_IN_RIGHT);
/*=========================================================================*
* get_set_output *
*=========================================================================*/
-PRIVATE int get_set_output(struct inout_ctrl *output, int flag) {
+static int get_set_output(struct inout_ctrl *output, int flag) {
int output_mask, mask, del_mask, shift;
mask = mixer_get(MIXER_OUTPUT_CTRL);
-PUBLIC int mixer_set(int reg, int data) {
+int mixer_set(int reg, int data) {
int i;
sb16_outb(MIXER_REG, reg);
-PUBLIC int mixer_get(int reg) {
+int mixer_get(int reg) {
int i;
sb16_outb(MIXER_REG, reg);
#include "mixer.h"
-FORWARD void dsp_dma_setup(phys_bytes address, int count, int sub_dev);
+static void dsp_dma_setup(phys_bytes address, int count, int sub_dev);
-FORWARD int dsp_ioctl(int request, void *val, int *len);
-FORWARD int dsp_set_size(unsigned int size);
-FORWARD int dsp_set_speed(unsigned int speed);
-FORWARD int dsp_set_stereo(unsigned int stereo);
-FORWARD int dsp_set_bits(unsigned int bits);
-FORWARD int dsp_set_sign(unsigned int sign);
-FORWARD int dsp_get_max_frag_size(u32_t *val, int *len);
+static int dsp_ioctl(int request, void *val, int *len);
+static int dsp_set_size(unsigned int size);
+static int dsp_set_speed(unsigned int speed);
+static int dsp_set_stereo(unsigned int stereo);
+static int dsp_set_bits(unsigned int bits);
+static int dsp_set_sign(unsigned int sign);
+static int dsp_get_max_frag_size(u32_t *val, int *len);
-PRIVATE unsigned int DspStereo = DEFAULT_STEREO;
-PRIVATE unsigned int DspSpeed = DEFAULT_SPEED;
-PRIVATE unsigned int DspBits = DEFAULT_BITS;
-PRIVATE unsigned int DspSign = DEFAULT_SIGN;
-PRIVATE unsigned int DspFragmentSize;
+static unsigned int DspStereo = DEFAULT_STEREO;
+static unsigned int DspSpeed = DEFAULT_SPEED;
+static unsigned int DspBits = DEFAULT_BITS;
+static unsigned int DspSign = DEFAULT_SIGN;
+static unsigned int DspFragmentSize;
-PRIVATE phys_bytes DmaPhys;
-PRIVATE int running = FALSE;
+static phys_bytes DmaPhys;
+static int running = FALSE;
-PUBLIC sub_dev_t sub_dev[2];
-PUBLIC special_file_t special_file[3];
-PUBLIC drv_t drv;
+sub_dev_t sub_dev[2];
+special_file_t special_file[3];
+drv_t drv;
-PUBLIC int drv_init(void) {
+int drv_init(void) {
drv.DriverName = "SB16";
drv.NrOfSubDevices = 2;
drv.NrOfSpecialFiles = 3;
}
-PUBLIC int drv_init_hw(void) {
+int drv_init_hw(void) {
int i;
int DspVersion[2];
Dprint(("drv_init_hw():\n"));
-PUBLIC int drv_reset(void) {
+int drv_reset(void) {
int i;
Dprint(("drv_reset():\n"));
-PUBLIC int drv_start(int channel, int DmaMode) {
+int drv_start(int channel, int DmaMode) {
Dprint(("drv_start():\n"));
drv_reset();
-PUBLIC int drv_stop(int sub_dev) {
+int drv_stop(int sub_dev) {
if(running) {
Dprint(("drv_stop():\n"));
dsp_command((DspBits == 8 ? DSP_CMD_DMA8HALT : DSP_CMD_DMA16HALT));
-PUBLIC int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) {
+int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) {
Dprint(("drv_set_dma():\n"));
DmaPhys = dma;
return OK;
-PUBLIC int drv_reenable_int(int UNUSED(chan)) {
+int drv_reenable_int(int UNUSED(chan)) {
Dprint(("drv_reenable_int()\n"));
sb16_inb((DspBits == 8 ? DSP_DATA_AVL : DSP_DATA16_AVL));
return OK;
-PUBLIC int drv_int_sum(void) {
+int drv_int_sum(void) {
return mixer_get(MIXER_IRQ_STATUS) & 0x0F;
}
-PUBLIC int drv_int(int sub_dev) {
+int drv_int(int sub_dev) {
return sub_dev == AUDIO && mixer_get(MIXER_IRQ_STATUS) & 0x03;
}
-PUBLIC int drv_pause(int chan) {
+int drv_pause(int chan) {
drv_stop(chan);
return OK;
}
-PUBLIC int drv_resume(int UNUSED(chan)) {
+int drv_resume(int UNUSED(chan)) {
dsp_command((DspBits == 8 ? DSP_CMD_DMA8CONT : DSP_CMD_DMA16CONT));
return OK;
}
-PUBLIC int drv_io_ctl(int request, void *val, int *len, int sub_dev) {
+int drv_io_ctl(int request, void *val, int *len, int sub_dev) {
Dprint(("dsp_ioctl: got ioctl %d, argument: %d sub_dev: %d\n", request, val, sub_dev));
if(sub_dev == AUDIO) {
-PUBLIC int drv_get_irq(char *irq) {
+int drv_get_irq(char *irq) {
Dprint(("drv_get_irq():\n"));
*irq = SB_IRQ;
return OK;
-PUBLIC int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) {
+int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) {
Dprint(("drv_get_frag_size():\n"));
*frag_size = DspFragmentSize;
return OK;
-PRIVATE int dsp_ioctl(int request, void *val, int *len) {
+static int dsp_ioctl(int request, void *val, int *len) {
int status;
switch(request) {
-PRIVATE void dsp_dma_setup(phys_bytes address, int count, int DmaMode) {
+static void dsp_dma_setup(phys_bytes address, int count, int DmaMode) {
pvb_pair_t pvb[9];
Dprint(("Setting up %d bit DMA\n", DspBits));
-PRIVATE int dsp_set_size(unsigned int size) {
+static int dsp_set_size(unsigned int size) {
Dprint(("dsp_set_size(): set fragment size to %u\n", size));
/* Sanity checks */
-PRIVATE int dsp_set_speed(unsigned int speed) {
+static int dsp_set_speed(unsigned int speed) {
Dprint(("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo));
if(speed < DSP_MIN_SPEED || speed > DSP_MAX_SPEED) {
-PRIVATE int dsp_set_stereo(unsigned int stereo) {
+static int dsp_set_stereo(unsigned int stereo) {
if(stereo) {
DspStereo = 1;
} else {
-PRIVATE int dsp_set_bits(unsigned int bits) {
+static int dsp_set_bits(unsigned int bits) {
/* Sanity checks */
if(bits != 8 && bits != 16) {
return EINVAL;
-PRIVATE int dsp_set_sign(unsigned int sign) {
+static int dsp_set_sign(unsigned int sign) {
Dprint(("sb16: set sign to %u\n", sign));
DspSign = (sign > 0 ? 1 : 0);
-PRIVATE int dsp_get_max_frag_size(u32_t *val, int *len) {
+static int dsp_get_max_frag_size(u32_t *val, int *len) {
*len = sizeof(*val);
*val = sub_dev[AUDIO].DmaSize / sub_dev[AUDIO].NrOfDmaFragments;
return OK;
-PUBLIC int dsp_command(int value) {
+int dsp_command(int value) {
int i;
for (i = 0; i < SB_TIMEOUT; i++) {
-PUBLIC int sb16_inb(int port) {
+int sb16_inb(int port) {
int s;
u32_t value;
-PUBLIC void sb16_outb(int port, int value) {
+void sb16_outb(int port, int value) {
int s;
if ((s=sys_outb(port, value)) != OK)
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
/* Variables. */
-PRIVATE struct wini { /* main drive struct, one entry per drive */
+static struct wini { /* main drive struct, one entry per drive */
unsigned cylinders; /* number of cylinders */
unsigned heads; /* number of heads */
unsigned sectors; /* number of sectors per track */
struct device subpart[SUB_PER_DRIVE]; /* subpartitions */
} wini[MAX_DRIVES], *w_wn;
-PRIVATE int w_drive; /* selected drive */
-PRIVATE struct device *w_dv; /* device's base and size */
-PRIVATE char *bios_buf_v;
-PRIVATE phys_bytes bios_buf_phys;
-PRIVATE int remap_first = 0; /* Remap drives for CD HD emulation */
+static int w_drive; /* selected drive */
+static struct device *w_dv; /* device's base and size */
+static char *bios_buf_v;
+static phys_bytes bios_buf_phys;
+static int remap_first = 0; /* Remap drives for CD HD emulation */
#define BIOSBUF 16384
int main(void);
-FORWARD struct device *w_prepare(dev_t device);
-FORWARD struct device *w_part(dev_t minor);
-FORWARD ssize_t w_transfer(dev_t minor, int do_write, u64_t position,
+static struct device *w_prepare(dev_t device);
+static struct device *w_part(dev_t minor);
+static ssize_t w_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
-FORWARD int w_do_open(dev_t minor, int access);
-FORWARD int w_do_close(dev_t minor);
-FORWARD void w_init(void);
-FORWARD void w_geometry(dev_t minor, struct partition *entry);
-FORWARD int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static int w_do_open(dev_t minor, int access);
+static int w_do_close(dev_t minor);
+static void w_init(void);
+static void w_geometry(dev_t minor, struct partition *entry);
+static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant);
/* Entry points to this driver. */
-PRIVATE struct blockdriver w_dtab = {
+static struct blockdriver w_dtab = {
BLOCKDRIVER_TYPE_DISK, /* handle partition requests */
w_do_open, /* open or mount request, initialize device */
w_do_close, /* release device */
};
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================*
* bios_winchester_task *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* SEF local startup. */
sef_local_startup();
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the bios_wini driver. */
long v;
/*===========================================================================*
* w_prepare *
*===========================================================================*/
-PRIVATE struct device *w_prepare(dev_t device)
+static struct device *w_prepare(dev_t device)
{
/* Prepare for I/O on a device. */
/*===========================================================================*
* w_part *
*===========================================================================*/
-PRIVATE struct device *w_part(dev_t minor)
+static struct device *w_part(dev_t minor)
{
/* Return a pointer to the partition information of the given minor device. */
/*===========================================================================*
* w_transfer *
*===========================================================================*/
-PRIVATE ssize_t w_transfer(
+static ssize_t w_transfer(
dev_t minor, /* minor device number */
int do_write, /* read or write? */
u64_t pos64, /* offset on device to read or write */
/*============================================================================*
* w_do_open *
*============================================================================*/
-PRIVATE int w_do_open(dev_t minor, int UNUSED(access))
+static int w_do_open(dev_t minor, int UNUSED(access))
{
/* Device open: Initialize the controller and read the partition table. */
/*============================================================================*
* w_do_close *
*============================================================================*/
-PRIVATE int w_do_close(dev_t minor)
+static int w_do_close(dev_t minor)
{
/* Device close: Release a device. */
/*===========================================================================*
* w_init *
*===========================================================================*/
-PRIVATE void w_init(void)
+static void w_init(void)
{
/* This routine is called at startup to initialize the drive parameters. */
/*============================================================================*
* w_geometry *
*============================================================================*/
-PRIVATE void w_geometry(dev_t minor, struct partition *entry)
+static void w_geometry(dev_t minor, struct partition *entry)
{
if (w_prepare(minor) == NULL) return;
/*============================================================================*
* w_ioctl *
*============================================================================*/
-PRIVATE int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant)
{
int count;
#include "dec21140A.h"
-PRIVATE u32_t io_inl(u16_t);
-PRIVATE void io_outl(u16_t, u32_t);
-PRIVATE void do_conf(const message *);
-PRIVATE void do_get_stat_s(message *);
-PRIVATE void do_interrupt(const dpeth_t *);
-PRIVATE void do_reply(dpeth_t *);
-PRIVATE void do_vread_s(const message *, int);
-PRIVATE void do_watchdog(void *);
-
-PRIVATE void de_update_conf(dpeth_t *);
-PRIVATE int de_probe(dpeth_t *, int skip);
-PRIVATE void de_conf_addr(dpeth_t *);
-PRIVATE void de_first_init(dpeth_t *);
-PRIVATE void de_reset(const dpeth_t *);
-PRIVATE void de_hw_conf(const dpeth_t *);
-PRIVATE void de_start(const dpeth_t *);
-PRIVATE void de_setup_frame(const dpeth_t *);
-PRIVATE u16_t de_read_rom(const dpeth_t *, u8_t, u8_t);
-PRIVATE int de_calc_iov_size(iovec_dat_s_t *);
-PRIVATE void de_next_iov(iovec_dat_s_t *);
-PRIVATE void do_vwrite_s(const message *, int);
-PRIVATE void de_get_userdata_s(int, cp_grant_id_t, vir_bytes, int, void
+static u32_t io_inl(u16_t);
+static void io_outl(u16_t, u32_t);
+static void do_conf(const message *);
+static void do_get_stat_s(message *);
+static void do_interrupt(const dpeth_t *);
+static void do_reply(dpeth_t *);
+static void do_vread_s(const message *, int);
+static void do_watchdog(void *);
+
+static void de_update_conf(dpeth_t *);
+static int de_probe(dpeth_t *, int skip);
+static void de_conf_addr(dpeth_t *);
+static void de_first_init(dpeth_t *);
+static void de_reset(const dpeth_t *);
+static void de_hw_conf(const dpeth_t *);
+static void de_start(const dpeth_t *);
+static void de_setup_frame(const dpeth_t *);
+static u16_t de_read_rom(const dpeth_t *, u8_t, u8_t);
+static int de_calc_iov_size(iovec_dat_s_t *);
+static void de_next_iov(iovec_dat_s_t *);
+static void do_vwrite_s(const message *, int);
+static void de_get_userdata_s(int, cp_grant_id_t, vir_bytes, int, void
*);
/* Error messages */
static char str_AlignErrMsg[] = "Bad align of buffer/descriptor";
static char str_DevName[] = "dec21140A:eth#?";
-PRIVATE dpeth_t de_state;
-PRIVATE int de_instance;
+static dpeth_t de_state;
+static int de_instance;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the DEC 21140A driver. */
int fkeys, sfkeys;
return OK;
}
-PRIVATE void do_get_stat_s(message * mp)
+static void do_get_stat_s(message * mp)
{
int rc;
dpeth_t *dep;
return;
}
-PRIVATE void do_conf(const message * mp)
+static void do_conf(const message * mp)
{
int r;
dpeth_t *dep;
return;
}
-PRIVATE void do_reply(dpeth_t * dep)
+static void do_reply(dpeth_t * dep)
{
message reply;
int r, flags = DL_NOFLAGS;
return;
}
-PRIVATE void do_watchdog(void *UNUSED(message))
+static void do_watchdog(void *UNUSED(message))
{
/* nothing here yet */
return;
}
-PRIVATE int de_probe(dpeth_t *dep, int skip)
+static int de_probe(dpeth_t *dep, int skip)
{
int i, r, devind;
u16_t vid, did, temp16;
return TRUE;
}
-PRIVATE u16_t de_read_rom(const dpeth_t *dep, u8_t addr, u8_t nbAddrBits){
+static u16_t de_read_rom(const dpeth_t *dep, u8_t addr, u8_t nbAddrBits){
u16_t retVal = 0;
int i;
u32_t csr = 0;
return;
}
-PRIVATE void do_vread_s(const message * mp, int from_int)
+static void do_vread_s(const message * mp, int from_int)
{
u8_t *buffer;
u32_t size;
return;
}
-PRIVATE void de_conf_addr(dpeth_t * dep)
+static void de_conf_addr(dpeth_t * dep)
{
static char ea_fmt[] = "x:x:x:x:x:x";
char ea_key[16];
return;
}
-PRIVATE void de_first_init(dpeth_t *dep)
+static void de_first_init(dpeth_t *dep)
{
int i,j,r;
vir_bytes descr_vir = (vir_bytes)dep->sendrecv_descr_buf;
sys_irqenable(&dep->de_hook);
}
-PRIVATE void do_interrupt(const dpeth_t *dep){
+static void do_interrupt(const dpeth_t *dep){
u32_t val;
val = io_inl(CSR_ADDR(dep, CSR5));
return;
}
-PRIVATE void de_reset(const dpeth_t *dep){
+static void de_reset(const dpeth_t *dep){
io_outl(CSR_ADDR(dep, CSR0), CSR0_SWR);
}
-PRIVATE void de_hw_conf(const dpeth_t *dep){
+static void de_hw_conf(const dpeth_t *dep){
u32_t val;
/* CSR0 - global host bus prop */
io_outl(CSR_ADDR(dep, CSR6), val);
}
-PRIVATE void de_start(const dpeth_t *dep){
+static void de_start(const dpeth_t *dep){
u32_t val;
val = io_inl(CSR_ADDR(dep, CSR6)) | CSR6_ST | CSR6_SR;
io_outl(CSR_ADDR(dep, CSR6), val);
}
-PRIVATE void de_setup_frame(const dpeth_t *dep){
+static void de_setup_frame(const dpeth_t *dep){
int i;
u32_t val;
return;
}
-PRIVATE int de_calc_iov_size(iovec_dat_s_t * iovp){
+static int de_calc_iov_size(iovec_dat_s_t * iovp){
int size, ix;
size = ix = 0;
return size;
}
-PRIVATE void de_get_userdata_s(int user_proc, cp_grant_id_t grant,
+static void de_get_userdata_s(int user_proc, cp_grant_id_t grant,
vir_bytes offset, int count, void *loc_addr){
int rc;
vir_bytes len;
return;
}
-PRIVATE void de_next_iov(iovec_dat_s_t * iovp){
+static void de_next_iov(iovec_dat_s_t * iovp){
iovp->iod_iovec_s -= IOVEC_NR;
iovp->iod_iovec_offset += IOVEC_NR * sizeof(iovec_t);
return;
}
-PRIVATE void do_vwrite_s(const message * mp, int from_int){
+static void do_vwrite_s(const message * mp, int from_int){
static u8_t setupDone = 0;
int size, r, bytes, ix, totalsize;
dpeth_t *dep;
do_reply(dep);
}
-PRIVATE void warning(const char *type, int err){
+static void warning(const char *type, int err){
printf("Warning: %s sys_%s failed (%d)\n", str_DevName, type, err);
return;
}
-PRIVATE u32_t io_inl(u16_t port){
+static u32_t io_inl(u16_t port){
u32_t value;
int rc;
if ((rc = sys_inl(port, &value)) != OK) warning("inl", rc);
return value;
}
-PRIVATE void io_outl(u16_t port, u32_t value){
+static void io_outl(u16_t port, u32_t value){
int rc;
if ((rc = sys_outl(port, value)) != OK) warning("outl", rc);
return;
} dp_conf_t;
#define DP_CONF_NR 4
-PRIVATE dp_conf_t dp_conf[DP_CONF_NR]= /* Card addresses */
+static dp_conf_t dp_conf[DP_CONF_NR]= /* Card addresses */
{
/* I/O port, IRQ, Buffer address. */
{ 0x280, 3, 0xD0000, },
size);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
-PRIVATE void handle_hw_intr(void)
+static void handle_hw_intr(void)
{
int r, irq;
dpeth_t *dep;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the dp8390 driver. */
dpeth_t *dep;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
typedef int(*testf_t) (dpeth_t *dep, int pos, u8_t *pat);
-PRIVATE u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 };
-PRIVATE u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF };
-PRIVATE u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 };
-PRIVATE u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 };
+static u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 };
+static u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF };
+static u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 };
+static u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 };
static int test_8(dpeth_t *dep, int pos, u8_t *pat);
static int test_16(dpeth_t *dep, int pos, u8_t *pat);
static void ee_wds(dpeth_t *dep);
#endif
-PUBLIC int rtl_probe(dep, skip)
+int rtl_probe(dep, skip)
struct dpeth *dep;
int skip;
{
** Name: int el1_probe(dpeth_t *dep)
** Function: Checks for presence of the board.
*/
-PUBLIC int el1_probe(dpeth_t * dep)
+int el1_probe(dpeth_t * dep)
{
int ix;
** Name: int el3_probe(dpeth_t *dep)
** Function: Checks for presence of the board.
*/
-PUBLIC int el3_probe(dpeth_t * dep)
+int el3_probe(dpeth_t * dep)
{
port_t id_port;
** Name: unsigned int inb(unsigned short int port);
** Function: Reads a byte from specified i/o port.
*/
-PUBLIC unsigned int inb(unsigned short port)
+unsigned int inb(unsigned short port)
{
u32_t value;
int rc;
** Name: unsigned int inw(unsigned short int port);
** Function: Reads a word from specified i/o port.
*/
-PUBLIC unsigned int inw(unsigned short port)
+unsigned int inw(unsigned short port)
{
u32_t value;
int rc;
** Name: unsigned int insb(unsigned short int port, int proc_nr, void *buffer, int count);
** Function: Reads a sequence of bytes from specified i/o port to user space buffer.
*/
-PUBLIC void insb(unsigned short int port, endpoint_t proc_nr,
+void insb(unsigned short int port, endpoint_t proc_nr,
void *buffer, int count)
{
int rc;
** Name: void outb(unsigned short int port, unsigned long value);
** Function: Writes a byte to specified i/o port.
*/
-PUBLIC void outb(unsigned short port, unsigned long value)
+void outb(unsigned short port, unsigned long value)
{
int rc;
** Name: void outw(unsigned short int port, unsigned long value);
** Function: Writes a word to specified i/o port.
*/
-PUBLIC void outw(unsigned short port, unsigned long value)
+void outw(unsigned short port, unsigned long value)
{
int rc;
** Name: void outsb(unsigned short int port, int proc_nr, void *buffer, int count);
** Function: Writes a sequence of bytes from user space to specified i/o port.
*/
-PUBLIC void outsb(unsigned short port, endpoint_t proc_nr, void *buffer, int count)
+void outsb(unsigned short port, endpoint_t proc_nr, void *buffer, int count)
{
int rc;
** Name: void dp_next_iovec(iovec_dat_t *iovp)
** Function: Retrieves data from next iovec element.
*/
-PUBLIC void dp_next_iovec(iovec_dat_s_t * iovp)
+void dp_next_iovec(iovec_dat_s_t * iovp)
{
iovp->iod_iovec_s -= IOVEC_NR;
return;
}
-PRIVATE void handle_hw_intr(void)
+static void handle_hw_intr(void)
{
dpeth_t *dep;
}
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*
** Name: int dpeth_task(void)
** Function: Main entry for dp task
*/
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
message m;
int ipc_status;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the dpeth driver. */
int fkeys, sfkeys;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
** Note that the NE1000 is an 8bit card and has a memory
** region distict from the 16bit NE2000.
*/
-PUBLIC int ne_probe(dpeth_t * dep)
+int ne_probe(dpeth_t * dep)
{
int ix, wd, loc1, loc2;
char EPROM[32];
** Name: void *alloc_buff(dpeth_t *dep, int size)
** Function: Allocates a buffer from the common pool.
*/
-PUBLIC void *alloc_buff(dpeth_t *dep, int size)
+void *alloc_buff(dpeth_t *dep, int size)
{
m_hdr_t *ptr, *wrk = allocptr;
int units = ((size + sizeof(m_hdr_t) - 1) / sizeof(m_hdr_t)) + 1;
** Name: void free_buff(dpeth_t *dep, void *blk)
** Function: Returns a buffer to the common pool.
*/
-PUBLIC void free_buff(dpeth_t *dep, void *blk)
+void free_buff(dpeth_t *dep, void *blk)
{
m_hdr_t *wrk, *ptr = (m_hdr_t *) blk - 1;
** Name: void init_buff(dpeth_t *dep, buff_t **tx_buff)
** Function: Initalizes driver data structures.
*/
-PUBLIC void init_buff(dpeth_t *dep, buff_t **tx_buff)
+void init_buff(dpeth_t *dep, buff_t **tx_buff)
{
/* Initializes buffer pool */
** Name: void mem2user(dpeth_t *dep, buff_t *rxbuff);
** Function: Copies a packet from local buffer to user area.
*/
-PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff)
+void mem2user(dpeth_t *dep, buff_t *rxbuff)
{
int bytes, ix = 0;
iovec_dat_s_t *iovp = &dep->de_read_iovec;
** Name: void user2mem(dpeth_t *dep, buff_t *txbuff)
** Function: Copies a packet from user area to local buffer.
*/
-PUBLIC void user2mem(dpeth_t *dep, buff_t *txbuff)
+void user2mem(dpeth_t *dep, buff_t *txbuff)
{
int bytes, ix = 0;
iovec_dat_s_t *iovp = &dep->de_write_iovec;
#include "e1000_reg.h"
#include "e1000_pci.h"
-PRIVATE int e1000_instance;
-PRIVATE e1000_t e1000_state;
-
-PRIVATE void e1000_init(message *mp);
-PRIVATE void e1000_init_pci(void);
-PRIVATE int e1000_probe(e1000_t *e, int skip);
-PRIVATE int e1000_init_hw(e1000_t *e);
-PRIVATE void e1000_init_addr(e1000_t *e);
-PRIVATE void e1000_init_buf(e1000_t *e);
-PRIVATE void e1000_reset_hw(e1000_t *e);
-PRIVATE void e1000_writev_s(message *mp, int from_int);
-PRIVATE void e1000_readv_s(message *mp, int from_int);
-PRIVATE void e1000_getstat_s(message *mp);
-PRIVATE void e1000_interrupt(message *mp);
-PRIVATE int e1000_link_changed(e1000_t *e);
-PRIVATE void e1000_stop(e1000_t *e);
-PRIVATE uint32_t e1000_reg_read(e1000_t *e, uint32_t reg);
-PRIVATE void e1000_reg_write(e1000_t *e, uint32_t reg, uint32_t value);
-PRIVATE void e1000_reg_set(e1000_t *e, uint32_t reg, uint32_t value);
-PRIVATE void e1000_reg_unset(e1000_t *e, uint32_t reg, uint32_t value);
-PRIVATE u16_t eeprom_eerd(void *e, int reg);
-PRIVATE u16_t eeprom_ich(void *e, int reg);
-PRIVATE int eeprom_ich_init(e1000_t *e);
-PRIVATE int eeprom_ich_cycle(const e1000_t *e, u32_t timeout);
-PRIVATE void reply(e1000_t *e);
-PRIVATE void mess_reply(message *req, message *reply);
+static int e1000_instance;
+static e1000_t e1000_state;
+
+static void e1000_init(message *mp);
+static void e1000_init_pci(void);
+static int e1000_probe(e1000_t *e, int skip);
+static int e1000_init_hw(e1000_t *e);
+static void e1000_init_addr(e1000_t *e);
+static void e1000_init_buf(e1000_t *e);
+static void e1000_reset_hw(e1000_t *e);
+static void e1000_writev_s(message *mp, int from_int);
+static void e1000_readv_s(message *mp, int from_int);
+static void e1000_getstat_s(message *mp);
+static void e1000_interrupt(message *mp);
+static int e1000_link_changed(e1000_t *e);
+static void e1000_stop(e1000_t *e);
+static uint32_t e1000_reg_read(e1000_t *e, uint32_t reg);
+static void e1000_reg_write(e1000_t *e, uint32_t reg, uint32_t value);
+static void e1000_reg_set(e1000_t *e, uint32_t reg, uint32_t value);
+static void e1000_reg_unset(e1000_t *e, uint32_t reg, uint32_t value);
+static u16_t eeprom_eerd(void *e, int reg);
+static u16_t eeprom_ich(void *e, int reg);
+static int eeprom_ich_init(e1000_t *e);
+static int eeprom_ich_cycle(const e1000_t *e, u32_t timeout);
+static void reply(e1000_t *e);
+static void mess_reply(message *req, message *reply);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the e1000 driver. */
long v;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
e1000_t *e;
e = &e1000_state;
/*===========================================================================*
* e1000_init *
*===========================================================================*/
-PRIVATE void e1000_init(message *mp)
+static void e1000_init(message *mp)
{
static int first_time = 1;
message reply_mess;
/*===========================================================================*
* e1000_int_pci *
*===========================================================================*/
-PRIVATE void e1000_init_pci()
+static void e1000_init_pci()
{
e1000_t *e;
/*===========================================================================*
* e1000_probe *
*===========================================================================*/
-PRIVATE int e1000_probe(e1000_t *e, int skip)
+static int e1000_probe(e1000_t *e, int skip)
{
int r, devind, ioflag;
u16_t vid, did, cr;
/*===========================================================================*
* e1000_init_hw *
*===========================================================================*/
-PRIVATE int e1000_init_hw(e)
+static int e1000_init_hw(e)
e1000_t *e;
{
int r, i;
/*===========================================================================*
* e1000_init_addr *
*===========================================================================*/
-PRIVATE void e1000_init_addr(e)
+static void e1000_init_addr(e)
e1000_t *e;
{
static char eakey[]= E1000_ENVVAR "#_EA";
/*===========================================================================*
* e1000_init_buf *
*===========================================================================*/
-PRIVATE void e1000_init_buf(e)
+static void e1000_init_buf(e)
e1000_t *e;
{
phys_bytes rx_desc_p, rx_buff_p;
/*===========================================================================*
* e1000_reset_hw *
*===========================================================================*/
-PRIVATE void e1000_reset_hw(e)
+static void e1000_reset_hw(e)
e1000_t *e;
{
/* Assert a Device Reset signal. */
/*===========================================================================*
* e1000_writev_s *
*===========================================================================*/
-PRIVATE void e1000_writev_s(mp, from_int)
+static void e1000_writev_s(mp, from_int)
message *mp;
int from_int;
{
/*===========================================================================*
* e1000_readv_s *
*===========================================================================*/
-PRIVATE void e1000_readv_s(mp, from_int)
+static void e1000_readv_s(mp, from_int)
message *mp;
int from_int;
{
/*===========================================================================*
* e1000_getstat_s *
*===========================================================================*/
-PRIVATE void e1000_getstat_s(mp)
+static void e1000_getstat_s(mp)
message *mp;
{
int r;
/*===========================================================================*
* e1000_interrupt *
*===========================================================================*/
-PRIVATE void e1000_interrupt(mp)
+static void e1000_interrupt(mp)
message *mp;
{
e1000_t *e;
/*===========================================================================*
* e1000_link_changed *
*===========================================================================*/
-PRIVATE int e1000_link_changed(e)
+static int e1000_link_changed(e)
e1000_t *e;
{
E1000_DEBUG(4, ("%s: link_changed()\n", e->name));
/*===========================================================================*
* e1000_stop *
*===========================================================================*/
-PRIVATE void e1000_stop(e)
+static void e1000_stop(e)
e1000_t *e;
{
E1000_DEBUG(3, ("%s: stop()\n", e->name));
/*===========================================================================*
* e1000_reg_read *
*===========================================================================*/
-PRIVATE uint32_t e1000_reg_read(e, reg)
+static uint32_t e1000_reg_read(e, reg)
e1000_t *e;
uint32_t reg;
{
/*===========================================================================*
* e1000_reg_write *
*===========================================================================*/
-PRIVATE void e1000_reg_write(e, reg, value)
+static void e1000_reg_write(e, reg, value)
e1000_t *e;
uint32_t reg;
uint32_t value;
/*===========================================================================*
* e1000_reg_set *
*===========================================================================*/
-PRIVATE void e1000_reg_set(e, reg, value)
+static void e1000_reg_set(e, reg, value)
e1000_t *e;
uint32_t reg;
uint32_t value;
/*===========================================================================*
* e1000_reg_unset *
*===========================================================================*/
-PRIVATE void e1000_reg_unset(e, reg, value)
+static void e1000_reg_unset(e, reg, value)
e1000_t *e;
uint32_t reg;
uint32_t value;
/*===========================================================================*
* eeprom_eerd *
*===========================================================================*/
-PRIVATE u16_t eeprom_eerd(v, reg)
+static u16_t eeprom_eerd(v, reg)
void *v;
int reg;
{
/*===========================================================================*
* eeprom_ich_init *
*===========================================================================*/
-PRIVATE int eeprom_ich_init(e)
+static int eeprom_ich_init(e)
e1000_t *e;
{
union ich8_hws_flash_status hsfsts;
/*===========================================================================*
* eeprom_ich_cycle *
*===========================================================================*/
-PRIVATE int eeprom_ich_cycle(const e1000_t *e, u32_t timeout)
+static int eeprom_ich_cycle(const e1000_t *e, u32_t timeout)
{
union ich8_hws_flash_ctrl hsflctl;
union ich8_hws_flash_status hsfsts;
/*===========================================================================*
* eeprom_ich *
*===========================================================================*/
-PRIVATE u16_t eeprom_ich(v, reg)
+static u16_t eeprom_ich(v, reg)
void *v;
int reg;
{
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(e)
+static void reply(e)
e1000_t *e;
{
message msg;
/*===========================================================================*
* mess_reply *
*===========================================================================*/
-PRIVATE void mess_reply(req, reply_mess)
+static void mess_reply(req, reply_mess)
message *req;
message *reply_mess;
{
/*===========================================================================*
* get_rand *
*===========================================================================*/
-PRIVATE u32_t get_rand(u32_t max)
+static u32_t get_rand(u32_t max)
{
/* Las Vegas algorithm for getting a random number in the range from
* 0 to max, inclusive.
/*===========================================================================*
* get_range *
*===========================================================================*/
-PRIVATE size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
+static size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
u64_t *skip)
{
/* Compute the range within the given request range that is affected
/*===========================================================================*
* limit_range *
*===========================================================================*/
-PRIVATE void limit_range(iovec_t *iov, unsigned *count, size_t size)
+static void limit_range(iovec_t *iov, unsigned *count, size_t size)
{
/* Limit the given vector to the given size.
*/
/*===========================================================================*
* action_io_corrupt *
*===========================================================================*/
-PRIVATE void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
+static void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
u64_t pos, int UNUSED(flag))
{
u64_t skip;
/*===========================================================================*
* action_pre_error *
*===========================================================================*/
-PRIVATE void action_pre_error(struct fbd_rule *rule, iovec_t *iov,
+static void action_pre_error(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *pos)
{
/* Limit the request to the part that precedes the matched range. */
/*===========================================================================*
* action_post_error *
*===========================================================================*/
-PRIVATE void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize),
+static void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize),
int *result)
{
/* Upon success of the first part, return the specified error code. */
/*===========================================================================*
* action_pre_misdir *
*===========================================================================*/
-PRIVATE void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov),
+static void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov),
unsigned *UNUSED(count), size_t *UNUSED(size), u64_t *pos)
{
/* Randomize the request position to fall within the range (and have
/*===========================================================================*
* action_pre_losttorn *
*===========================================================================*/
-PRIVATE void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov,
+static void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *UNUSED(pos))
{
if (*size > rule->params.losttorn.lead)
/*===========================================================================*
* action_post_losttorn *
*===========================================================================*/
-PRIVATE void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize,
+static void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize,
int *result)
{
/* On success, pretend full completion. */
/*===========================================================================*
* action_mask *
*===========================================================================*/
-PUBLIC int action_mask(struct fbd_rule *rule)
+int action_mask(struct fbd_rule *rule)
{
/* Return the hook mask for the given rule's action type. */
/*===========================================================================*
* action_pre_hook *
*===========================================================================*/
-PUBLIC void action_pre_hook(struct fbd_rule *rule, iovec_t *iov,
+void action_pre_hook(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *pos)
{
switch (rule->action) {
/*===========================================================================*
* action_io_hook *
*===========================================================================*/
-PUBLIC void action_io_hook(struct fbd_rule *rule, char *buf, size_t size,
+void action_io_hook(struct fbd_rule *rule, char *buf, size_t size,
u64_t pos, int flag)
{
switch (rule->action) {
/*===========================================================================*
* action_post_hook *
*===========================================================================*/
-PUBLIC void action_post_hook(struct fbd_rule *rule, size_t osize, int *result)
+void action_post_hook(struct fbd_rule *rule, size_t osize, int *result)
{
switch (rule->action) {
case FBD_ACTION_ERROR:
#define BUF_SIZE (NR_IOREQS * CLICK_SIZE) /* 256k */
/* Function declarations. */
-PRIVATE int fbd_open(dev_t minor, int access);
-PRIVATE int fbd_close(dev_t minor);
-PRIVATE int fbd_transfer(dev_t minor, int do_write, u64_t position,
+static int fbd_open(dev_t minor, int access);
+static int fbd_close(dev_t minor);
+static int fbd_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
-PRIVATE int fbd_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static int fbd_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant);
/* Variables. */
-PRIVATE char *fbd_buf; /* scratch buffer */
+static char *fbd_buf; /* scratch buffer */
-PRIVATE char driver_label[32] = ""; /* driver DS label */
-PRIVATE dev_t driver_minor = -1; /* driver's partition minor to use */
-PRIVATE endpoint_t driver_endpt; /* driver endpoint */
+static char driver_label[32] = ""; /* driver DS label */
+static dev_t driver_minor = -1; /* driver's partition minor to use */
+static endpoint_t driver_endpt; /* driver endpoint */
/* Entry points to this driver. */
-PRIVATE struct blockdriver fbd_dtab = {
+static struct blockdriver fbd_dtab = {
BLOCKDRIVER_TYPE_OTHER, /* do not handle partition requests */
fbd_open, /* open or mount request, initialize device */
fbd_close, /* release device */
};
/* Options supported by this driver. */
-PRIVATE struct optset optset_table[] = {
+static struct optset optset_table[] = {
{ "label", OPT_STRING, driver_label, sizeof(driver_label) },
{ "minor", OPT_INT, &driver_minor, 10 },
{ NULL, 0, NULL, 0 }
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
clock_t uptime;
int r;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Terminate immediately upon receiving a SIGTERM. */
if (signo != SIGTERM) return;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* SEF local startup. */
env_setargs(argc, argv);
/*===========================================================================*
* fbd_open *
*===========================================================================*/
-PRIVATE int fbd_open(dev_t UNUSED(minor), int access)
+static int fbd_open(dev_t UNUSED(minor), int access)
{
/* Open a device. */
message m;
/*===========================================================================*
* fbd_close *
*===========================================================================*/
-PRIVATE int fbd_close(dev_t UNUSED(minor))
+static int fbd_close(dev_t UNUSED(minor))
{
/* Close a device. */
message m;
/*===========================================================================*
* fbd_ioctl *
*===========================================================================*/
-PRIVATE int fbd_ioctl(dev_t UNUSED(minor), unsigned int request,
+static int fbd_ioctl(dev_t UNUSED(minor), unsigned int request,
endpoint_t endpt, cp_grant_id_t grant)
{
/* Handle an I/O control request. */
/*===========================================================================*
* fbd_transfer_direct *
*===========================================================================*/
-PRIVATE ssize_t fbd_transfer_direct(int do_write, u64_t position,
+static ssize_t fbd_transfer_direct(int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int count, int flags)
{
/* Forward the entire transfer request, without any intervention. */
/*===========================================================================*
* fbd_transfer_copy *
*===========================================================================*/
-PRIVATE ssize_t fbd_transfer_copy(int do_write, u64_t position,
+static ssize_t fbd_transfer_copy(int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int count, size_t size,
int flags)
{
/*===========================================================================*
* fbd_transfer *
*===========================================================================*/
-PRIVATE int fbd_transfer(dev_t UNUSED(minor), int do_write, u64_t position,
+static int fbd_transfer(dev_t UNUSED(minor), int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags)
{
/* Transfer data from or to the device. */
#include "action.h"
#include "rule.h"
-PRIVATE struct fbd_rule rules[MAX_RULES];
-PRIVATE struct fbd_rule *matches[MAX_RULES];
-PRIVATE int nr_matches;
+static struct fbd_rule rules[MAX_RULES];
+static struct fbd_rule *matches[MAX_RULES];
+static int nr_matches;
/*===========================================================================*
* rule_ctl *
*===========================================================================*/
-PUBLIC int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
+int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
{
/* Handle an I/O control request regarding rules. */
fbd_rulenum_t i;
/*===========================================================================*
* rule_match *
*===========================================================================*/
-PRIVATE int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
+static int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
{
/* Check whether the given rule matches the given parameters. As side
* effect, update counters in the rule as appropriate.
/*===========================================================================*
* rule_find *
*===========================================================================*/
-PUBLIC int rule_find(u64_t pos, size_t size, int flag)
+int rule_find(u64_t pos, size_t size, int flag)
{
/* Find all matching rules, and return a hook mask. */
struct fbd_rule *rule;
/*===========================================================================*
* rule_pre_hook *
*===========================================================================*/
-PUBLIC void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size,
+void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size,
u64_t *pos)
{
int i;
/*===========================================================================*
* rule_io_hook *
*===========================================================================*/
-PUBLIC void rule_io_hook(char *buf, size_t size, u64_t pos, int flag)
+void rule_io_hook(char *buf, size_t size, u64_t pos, int flag)
{
int i;
/*===========================================================================*
* rule_post_hook *
*===========================================================================*/
-PUBLIC void rule_post_hook(size_t osize, int *result)
+void rule_post_hook(size_t osize, int *result)
{
int i;
/*===========================================================================*
* single_revoke *
*===========================================================================*/
-PRIVATE void single_revoke(cp_grant_id_t gid,
+static void single_revoke(cp_grant_id_t gid,
const iovec_s_t vector[NR_IOREQS], int count)
{
/* Revoke all grants associated with a request to a single driver.
int MAIN_MINOR = -1; /* main partition minor nr */
int BACKUP_MINOR = -1; /* backup partition minor nr */
-PRIVATE struct optset optset_table[] = {
+static struct optset optset_table[] = {
{ "label0", OPT_STRING, MAIN_LABEL, LABEL_SIZE },
{ "label1", OPT_STRING, BACKUP_LABEL, LABEL_SIZE },
{ "minor0", OPT_INT, &MAIN_MINOR, 10 },
static char *buf_array, *buffer; /* contiguous buffer */
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* carry *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the filter driver. */
int r;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
*
* 3 720K 1.44M 9 80 300 RPM 250 kbps PS/2, et al.
*/
-PRIVATE struct density {
+static struct density {
u8_t secpt; /* sectors per track */
u8_t cyls; /* tracks per side */
u8_t steps; /* steps per cylinder (2 = double step) */
#define b(d) (1 << (d)) /* bit for density d. */
-PRIVATE struct test_order {
+static struct test_order {
u8_t t_density; /* floppy/drive type */
u8_t t_class; /* limit drive to this class of densities */
} test_order[NT-1] = {
};
/* Variables. */
-PRIVATE struct floppy { /* main drive struct, one entry per drive */
+static struct floppy { /* main drive struct, one entry per drive */
unsigned fl_curcyl; /* current cylinder */
unsigned fl_hardcyl; /* hardware cylinder, as opposed to: */
unsigned fl_cylinder; /* cylinder number addressed */
struct device fl_part[NR_PARTITIONS]; /* partition's base & size */
} floppy[NR_DRIVES];
-PRIVATE int irq_hook_id; /* id of irq hook at the kernel */
-PUBLIC int motor_status; /* bitmap of current motor status */
-PRIVATE int need_reset; /* set to 1 when controller must be reset */
-PUBLIC unsigned f_drive; /* selected drive */
-PRIVATE unsigned f_device; /* selected minor device */
-PRIVATE struct floppy *f_fp; /* current drive */
-PRIVATE struct density *f_dp; /* current density parameters */
-PRIVATE struct density *prev_dp;/* previous density parameters */
-PRIVATE unsigned f_sectors; /* equal to f_dp->secpt (needed a lot) */
-PUBLIC u16_t f_busy; /* BSY_IDLE, BSY_IO, BSY_WAKEN */
-PRIVATE struct device *f_dv; /* device's base and size */
-PRIVATE struct disk_parameter_s fmt_param; /* parameters for format */
-PRIVATE u8_t f_results[MAX_RESULTS];/* the controller can give lots of output */
+static int irq_hook_id; /* id of irq hook at the kernel */
+int motor_status; /* bitmap of current motor status */
+static int need_reset; /* set to 1 when controller must be reset */
+unsigned f_drive; /* selected drive */
+static unsigned f_device; /* selected minor device */
+static struct floppy *f_fp; /* current drive */
+static struct density *f_dp; /* current density parameters */
+static struct density *prev_dp;/* previous density parameters */
+static unsigned f_sectors; /* equal to f_dp->secpt (needed a lot) */
+u16_t f_busy; /* BSY_IDLE, BSY_IO, BSY_WAKEN */
+static struct device *f_dv; /* device's base and size */
+static struct disk_parameter_s fmt_param; /* parameters for format */
+static u8_t f_results[MAX_RESULTS];/* the controller can give lots of output */
/* The floppy uses various timers. These are managed by the floppy driver
* itself, because only a single synchronous alarm is available per process.
* Besides the 'f_tmr_timeout' timer below, the floppy structure for each
* floppy disk drive contains a 'fl_tmr_stop' timer.
*/
-PRIVATE timer_t f_tmr_timeout; /* timer for various timeouts */
-PRIVATE u32_t system_hz; /* system clock frequency */
-FORWARD void f_expire_tmrs(clock_t stamp);
-FORWARD void stop_motor(timer_t *tp);
-FORWARD void f_timeout(timer_t *tp);
-
-FORWARD struct device *f_prepare(dev_t device);
-FORWARD struct device *f_part(dev_t minor);
-FORWARD void f_cleanup(void);
-FORWARD ssize_t f_transfer(dev_t minor, int do_write, u64_t position,
+static timer_t f_tmr_timeout; /* timer for various timeouts */
+static u32_t system_hz; /* system clock frequency */
+static void f_expire_tmrs(clock_t stamp);
+static void stop_motor(timer_t *tp);
+static void f_timeout(timer_t *tp);
+
+static struct device *f_prepare(dev_t device);
+static struct device *f_part(dev_t minor);
+static void f_cleanup(void);
+static ssize_t f_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t proc_nr, iovec_t *iov, unsigned int nr_req, int flags);
-FORWARD int dma_setup(int do_write);
-FORWARD void start_motor(void);
-FORWARD int seek(void);
-FORWARD int fdc_transfer(int do_write);
-FORWARD int fdc_results(void);
-FORWARD int fdc_command(const u8_t *cmd, int len);
-FORWARD void fdc_out(int val);
-FORWARD int recalibrate(void);
-FORWARD void f_reset(void);
-FORWARD int f_intr_wait(void);
-FORWARD int read_id(void);
-FORWARD int f_do_open(dev_t minor, int access);
-FORWARD int f_do_close(dev_t minor);
-FORWARD int test_read(int density);
-FORWARD void f_geometry(dev_t minor, struct partition *entry);
+static int dma_setup(int do_write);
+static void start_motor(void);
+static int seek(void);
+static int fdc_transfer(int do_write);
+static int fdc_results(void);
+static int fdc_command(const u8_t *cmd, int len);
+static void fdc_out(int val);
+static int recalibrate(void);
+static void f_reset(void);
+static int f_intr_wait(void);
+static int read_id(void);
+static int f_do_open(dev_t minor, int access);
+static int f_do_close(dev_t minor);
+static int test_read(int density);
+static void f_geometry(dev_t minor, struct partition *entry);
/* Entry points to this driver. */
-PRIVATE struct blockdriver f_dtab = {
+static struct blockdriver f_dtab = {
BLOCKDRIVER_TYPE_DISK, /* handle partition requests */
f_do_open, /* open or mount request, sense type of diskette */
f_do_close, /* nothing on a close */
static phys_bytes floppy_buf_phys;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state);
-PUBLIC int last_was_write;
+int last_was_write;
/*===========================================================================*
* floppy_task *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* SEF local startup. */
sef_local_startup();
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the floppy driver. */
struct floppy *fp;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
int s;
/*===========================================================================*
* f_expire_tmrs *
*===========================================================================*/
-PRIVATE void f_expire_tmrs(clock_t stamp)
+static void f_expire_tmrs(clock_t stamp)
{
/* A synchronous alarm message was received. Call the watchdog function for
* each expired timer, if any.
/*===========================================================================*
* f_prepare *
*===========================================================================*/
-PRIVATE struct device *f_prepare(dev_t device)
+static struct device *f_prepare(dev_t device)
{
/* Prepare for I/O on a device. */
/*===========================================================================*
* f_part *
*===========================================================================*/
-PRIVATE struct device *f_part(dev_t minor)
+static struct device *f_part(dev_t minor)
{
/* Return a pointer to the partition information of the given minor device. */
/*===========================================================================*
* f_cleanup *
*===========================================================================*/
-PRIVATE void f_cleanup(void)
+static void f_cleanup(void)
{
/* Start a timer to turn the motor off in a few seconds. */
set_timer(&f_fp->fl_tmr_stop, MOTOR_OFF, stop_motor, f_drive);
/*===========================================================================*
* f_transfer *
*===========================================================================*/
-PRIVATE ssize_t f_transfer(
+static ssize_t f_transfer(
dev_t minor, /* minor device number */
int do_write, /* read or write? */
u64_t pos64, /* offset on device to read or write */
/*===========================================================================*
* dma_setup *
*===========================================================================*/
-PRIVATE int dma_setup(int do_write)
+static int dma_setup(int do_write)
{
/* The IBM PC can perform DMA operations by using the DMA chip. To use it,
* the DMA (Direct Memory Access) chip is loaded with the 20-bit memory address
/*===========================================================================*
* start_motor *
*===========================================================================*/
-PRIVATE void start_motor(void)
+static void start_motor(void)
{
/* Control of the floppy disk motors is a big pain. If a motor is off, you
* have to turn it on first, which takes 1/2 second. You can't leave it on
/*===========================================================================*
* stop_motor *
*===========================================================================*/
-PRIVATE void stop_motor(timer_t *tp)
+static void stop_motor(timer_t *tp)
{
/* This routine is called from an alarm timer after several seconds have
* elapsed with no floppy disk activity. It turns the drive motor off.
/*===========================================================================*
* seek *
*===========================================================================*/
-PRIVATE int seek(void)
+static int seek(void)
{
/* Issue a SEEK command on the indicated drive unless the arm is already
* positioned on the correct cylinder.
/*===========================================================================*
* fdc_transfer *
*===========================================================================*/
-PRIVATE int fdc_transfer(int do_write)
+static int fdc_transfer(int do_write)
{
/* The drive is now on the proper cylinder. Read, write or format 1 block. */
/*===========================================================================*
* fdc_results *
*===========================================================================*/
-PRIVATE int fdc_results(void)
+static int fdc_results(void)
{
/* Extract results from the controller after an operation, then allow floppy
* interrupts again.
/*===========================================================================*
* fdc_command *
*===========================================================================*/
-PRIVATE int fdc_command(
+static int fdc_command(
const u8_t *cmd, /* command bytes */
int len /* command length */
)
/*===========================================================================*
* fdc_out *
*===========================================================================*/
-PRIVATE void fdc_out(
+static void fdc_out(
int val /* write this byte to floppy disk controller */
)
{
/*===========================================================================*
* recalibrate *
*===========================================================================*/
-PRIVATE int recalibrate(void)
+static int recalibrate(void)
{
/* The floppy disk controller has no way of determining its absolute arm
* position (cylinder). Instead, it steps the arm a cylinder at a time and
/*===========================================================================*
* f_reset *
*===========================================================================*/
-PRIVATE void f_reset(void)
+static void f_reset(void)
{
/* Issue a reset to the controller. This is done after any catastrophe,
* like the controller refusing to respond.
/*===========================================================================*
* f_intr_wait *
*===========================================================================*/
-PRIVATE int f_intr_wait(void)
+static int f_intr_wait(void)
{
/* Wait for an interrupt, but not forever. The FDC may have all the time of
* the world, but we humans do not.
/*===========================================================================*
* f_timeout *
*===========================================================================*/
-PRIVATE void f_timeout(timer_t *UNUSED(tp))
+static void f_timeout(timer_t *UNUSED(tp))
{
/* This routine is called when a timer expires. Usually to tell that a
* motor has spun up, but also to forge an interrupt when it takes too long
/*===========================================================================*
* read_id *
*===========================================================================*/
-PRIVATE int read_id(void)
+static int read_id(void)
{
/* Determine current cylinder and sector. */
/*===========================================================================*
* f_do_open *
*===========================================================================*/
-PRIVATE int f_do_open(dev_t minor, int UNUSED(access))
+static int f_do_open(dev_t minor, int UNUSED(access))
{
/* Handle an open on a floppy. Determine diskette type if need be. */
/*===========================================================================*
* f_do_close *
*===========================================================================*/
-PRIVATE int f_do_close(dev_t UNUSED(minor))
+static int f_do_close(dev_t UNUSED(minor))
{
/* Handle a close on a floppy. Nothing to do here. */
/*===========================================================================*
* test_read *
*===========================================================================*/
-PRIVATE int test_read(int density)
+static int test_read(int density)
{
/* Try to read the highest numbered sector on cylinder 2. Not all floppy
* types have as many sectors per track, and trying cylinder 2 finds the
/*===========================================================================*
* f_geometry *
*===========================================================================*/
-PRIVATE void f_geometry(dev_t minor, struct partition *entry)
+static void f_geometry(dev_t minor, struct partition *entry)
{
if (f_prepare(minor) == NULL) return;
/*===========================================================================*
* sef_cb_lu_prepare *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare(int state)
+int sef_cb_lu_prepare(int state)
{
int is_ready;
/*===========================================================================*
* sef_cb_lu_state_isvalid *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid(int state)
+int sef_cb_lu_state_isvalid(int state)
{
return SEF_LU_STATE_IS_STANDARD(state) || FL_STATE_IS_CUSTOM(state);
}
/*===========================================================================*
* sef_cb_lu_state_dump *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_dump(int state)
+void sef_cb_lu_state_dump(int state)
{
sef_lu_dprint("floppy: live update state = %d\n", state);
sef_lu_dprint("floppy: f_busy = %d\n", f_busy);
/* ignore interrupt for the moment */
#define interrupt(x) do { } while(0)
-PRIVATE union tmpbuf
+static union tmpbuf
{
char pad[4096];
struct cbl_conf cc;
#define FT_82559 0x4
#define FT_82801 0x8
-PRIVATE int fxp_instance;
+static int fxp_instance;
-PRIVATE fxp_t *fxp_state;
+static fxp_t *fxp_state;
-PRIVATE timer_t fxp_watchdog;
+static timer_t fxp_watchdog;
-PRIVATE u32_t system_hz;
+static u32_t system_hz;
#define fxp_inb(port, offset) (do_inb((port) + (offset)))
#define fxp_inl(port, offset) (do_inl((port) + (offset)))
static void tell_dev(vir_bytes start, size_t size, int pci_bus, int
pci_dev, int pci_func);
-PRIVATE void handle_hw_intr(void)
+static void handle_hw_intr(void)
{
int r;
fxp_t *fp;
}
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the fxp driver. */
long v;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
port_t port;
fxp_t *fp;
/*===========================================================================*
* eeprom_read *
*===========================================================================*/
-PRIVATE u16_t eeprom_read(fp, reg)
+static u16_t eeprom_read(fp, reg)
fxp_t *fp;
int reg;
{
/*===========================================================================*
* eeprom_addrsize *
*===========================================================================*/
-PRIVATE void eeprom_addrsize(fp)
+static void eeprom_addrsize(fp)
fxp_t *fp;
{
port_t port;
/*===========================================================================*
* mii_read *
*===========================================================================*/
-PRIVATE u16_t mii_read(fp, reg)
+static u16_t mii_read(fp, reg)
fxp_t *fp;
int reg;
{
panic("sys_outl failed: %d", r);
}
-PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
+static void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
vir_bytes buf;
size_t size;
int pci_bus;
/*===========================================================================*
* mii_print_stat_speed *
*===========================================================================*/
-PUBLIC void mii_print_stat_speed(u16_t stat, u16_t extstat)
+void mii_print_stat_speed(u16_t stat, u16_t extstat)
{
int fs, ft;
/*===========================================================================*
* mii_print_techab *
*===========================================================================*/
-PUBLIC void mii_print_techab(u16_t techab)
+void mii_print_techab(u16_t techab)
{
int fs, ft;
/*
* Function prototypes for the hello driver.
*/
-FORWARD int hello_open(message *m);
-FORWARD int hello_close(message *m);
-FORWARD struct device * hello_prepare(dev_t device);
-FORWARD int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
+static int hello_open(message *m);
+static int hello_close(message *m);
+static struct device * hello_prepare(dev_t device);
+static int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init(int type, sef_init_info_t *info);
-FORWARD int sef_cb_lu_state_save(int);
-FORWARD int lu_state_restore(void);
+static void sef_local_startup(void);
+static int sef_cb_init(int type, sef_init_info_t *info);
+static int sef_cb_lu_state_save(int);
+static int lu_state_restore(void);
/* Entry points to the hello driver. */
-PRIVATE struct chardriver hello_tab =
+static struct chardriver hello_tab =
{
hello_open,
hello_close,
};
/** Represents the /dev/hello device. */
-PRIVATE struct device hello_device;
+static struct device hello_device;
/** State variable to count the number of times the device has been opened. */
-PRIVATE int open_counter;
+static int open_counter;
-PRIVATE int hello_open(message *UNUSED(m))
+static int hello_open(message *UNUSED(m))
{
printf("hello_open(). Called %d time(s).\n", ++open_counter);
return OK;
}
-PRIVATE int hello_close(message *UNUSED(m))
+static int hello_close(message *UNUSED(m))
{
printf("hello_close()\n");
return OK;
}
-PRIVATE struct device * hello_prepare(dev_t UNUSED(dev))
+static struct device * hello_prepare(dev_t UNUSED(dev))
{
hello_device.dv_base = make64(0, 0);
hello_device.dv_size = make64(strlen(HELLO_MESSAGE), 0);
return &hello_device;
}
-PRIVATE int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
+static int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned nr_req, endpoint_t UNUSED(user_endpt),
unsigned int UNUSED(flags))
{
return ret;
}
-PRIVATE int sef_cb_lu_state_save(int UNUSED(state)) {
+static int sef_cb_lu_state_save(int UNUSED(state)) {
/* Save the state. */
ds_publish_u32("open_counter", open_counter, DSF_OVERWRITE);
return OK;
}
-PRIVATE int lu_state_restore() {
+static int lu_state_restore() {
/* Restore the state. */
u32_t value;
return OK;
}
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/*
* Register init callbacks. Use the same function for all event types
sef_startup();
}
-PRIVATE int sef_cb_init(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the hello driver. */
int do_announce_driver = TRUE;
return OK;
}
-PUBLIC int main(void)
+int main(void)
{
/*
* Perform initialization.
phys_bytes lance_buf_phys;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the lance driver. */
long v;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
/*==========================================================================*
* do_new_kmess *
*==========================================================================*/
-PUBLIC void do_new_kmess(void)
+void do_new_kmess(void)
{
/* Notification for a new kernel message. */
static struct kmessages kmess; /* entire kmess structure */
EXTERN struct logdevice logdevices[NR_DEVS];
/* State management helpers. */
-PRIVATE int is_read_pending;
-PRIVATE int is_select_callback_pending;
-PRIVATE void load_state_info(void)
+static int is_read_pending;
+static int is_select_callback_pending;
+static void load_state_info(void)
{
int i, found_pending;
struct logdevice *log;
/*===========================================================================*
* sef_cb_lu_prepare *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare(int state)
+int sef_cb_lu_prepare(int state)
{
int is_ready;
/*===========================================================================*
* sef_cb_lu_state_isvalid *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid(int state)
+int sef_cb_lu_state_isvalid(int state)
{
return SEF_LU_STATE_IS_STANDARD(state) || LOG_STATE_IS_CUSTOM(state);
}
/*===========================================================================*
* sef_cb_lu_state_dump *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_dump(int state)
+void sef_cb_lu_state_dump(int state)
{
/* Load state information. */
load_state_info();
#define LOGINC(n, i) do { (n) = (((n) + (i)) % LOG_SIZE); } while(0)
-PUBLIC struct logdevice logdevices[NR_DEVS];
-PRIVATE struct device log_geom[NR_DEVS]; /* base and size of devices */
-PRIVATE int log_device = -1; /* current device */
+struct logdevice logdevices[NR_DEVS];
+static struct device log_geom[NR_DEVS]; /* base and size of devices */
+static int log_device = -1; /* current device */
-FORWARD struct device *log_prepare(dev_t device);
-FORWARD int log_transfer(endpoint_t endpt, int opcode, u64_t position,
+static struct device *log_prepare(dev_t device);
+static int log_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags);
-FORWARD int log_do_open(message *m_ptr);
-FORWARD int log_cancel(message *m_ptr);
-FORWARD int log_select(message *m_ptr);
-FORWARD int log_other(message *m_ptr);
-FORWARD int subread(struct logdevice *log, int count, endpoint_t endpt,
+static int log_do_open(message *m_ptr);
+static int log_cancel(message *m_ptr);
+static int log_select(message *m_ptr);
+static int log_other(message *m_ptr);
+static int subread(struct logdevice *log, int count, endpoint_t endpt,
cp_grant_id_t grant, size_t);
/* Entry points to this driver. */
-PRIVATE struct chardriver log_dtab = {
+static struct chardriver log_dtab = {
log_do_open, /* open or mount */
do_nop, /* nothing on a close */
nop_ioctl, /* ioctl nop */
};
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* SEF local startup. */
sef_local_startup();
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the log driver. */
int i;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for a pending message from the kernel, ignore anything else. */
if (signo != SIGKMESS) return;
/*===========================================================================*
* log_prepare *
*===========================================================================*/
-PRIVATE struct device *log_prepare(dev_t device)
+static struct device *log_prepare(dev_t device)
{
/* Prepare for I/O on a device: check if the minor device number is ok. */
/*===========================================================================*
* subwrite *
*===========================================================================*/
-PRIVATE int
+static int
subwrite(struct logdevice *log, int count, endpoint_t endpt,
cp_grant_id_t grant, size_t offset, char *localbuf)
{
/*===========================================================================*
* log_append *
*===========================================================================*/
-PUBLIC void
+void
log_append(char *buf, int count)
{
int w = 0, skip = 0;
/*===========================================================================*
* subread *
*===========================================================================*/
-PRIVATE int
+static int
subread(struct logdevice *log, int count, endpoint_t endpt,
cp_grant_id_t grant, size_t offset)
{
/*===========================================================================*
* log_transfer *
*===========================================================================*/
-PRIVATE int log_transfer(
+static int log_transfer(
endpoint_t endpt, /* endpoint of grant owner */
int opcode, /* DEV_GATHER_S or DEV_SCATTER_S */
u64_t UNUSED(position), /* offset on device to read or write */
/*============================================================================*
* log_do_open *
*============================================================================*/
-PRIVATE int log_do_open(message *m_ptr)
+static int log_do_open(message *m_ptr)
{
if (log_prepare(m_ptr->DEVICE) == NULL) return(ENXIO);
return(OK);
/*============================================================================*
* log_cancel *
*============================================================================*/
-PRIVATE int log_cancel(message *m_ptr)
+static int log_cancel(message *m_ptr)
{
int d;
d = m_ptr->TTY_LINE;
/*============================================================================*
* log_other *
*============================================================================*/
-PRIVATE int log_other(message *m_ptr)
+static int log_other(message *m_ptr)
{
int r;
/*============================================================================*
* log_select *
*============================================================================*/
-PRIVATE int log_select(message *m_ptr)
+static int log_select(message *m_ptr)
{
int d, ready_ops = 0, ops = 0;
d = m_ptr->TTY_LINE;
#define NR_DEVS (7+RAMDISKS) /* number of minor devices */
-PRIVATE struct device m_geom[NR_DEVS]; /* base and size of each device */
-PRIVATE vir_bytes m_vaddrs[NR_DEVS];
-PRIVATE dev_t m_device; /* current minor character device */
+static struct device m_geom[NR_DEVS]; /* base and size of each device */
+static vir_bytes m_vaddrs[NR_DEVS];
+static dev_t m_device; /* current minor character device */
-PRIVATE int openct[NR_DEVS];
+static int openct[NR_DEVS];
-FORWARD struct device *m_prepare(dev_t device);
-FORWARD int m_transfer(endpoint_t endpt, int opcode, u64_t position,
+static struct device *m_prepare(dev_t device);
+static int m_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags);
-FORWARD int m_do_open(message *m_ptr);
-FORWARD int m_do_close(message *m_ptr);
+static int m_do_open(message *m_ptr);
+static int m_do_close(message *m_ptr);
-FORWARD struct device *m_block_part(dev_t minor);
-FORWARD int m_block_transfer(dev_t minor, int do_write, u64_t position,
+static struct device *m_block_part(dev_t minor);
+static int m_block_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
-FORWARD int m_block_open(dev_t minor, int access);
-FORWARD int m_block_close(dev_t minor);
-FORWARD int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t
+static int m_block_open(dev_t minor, int access);
+static int m_block_close(dev_t minor);
+static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t
endpt, cp_grant_id_t grant);
/* Entry points to the CHARACTER part of this driver. */
-PRIVATE struct chardriver m_cdtab = {
+static struct chardriver m_cdtab = {
m_do_open, /* open or mount */
m_do_close, /* nothing on a close */
nop_ioctl, /* no I/O control */
};
/* Entry points to the BLOCK part of this driver. */
-PRIVATE struct blockdriver m_bdtab = {
+static struct blockdriver m_bdtab = {
BLOCKDRIVER_TYPE_DISK,/* handle partition requests */
m_block_open, /* open or mount */
m_block_close, /* nothing on a close */
/* Buffer for the /dev/zero null byte feed. */
#define ZERO_BUF_SIZE 1024
-PRIVATE char dev_zero[ZERO_BUF_SIZE];
+static char dev_zero[ZERO_BUF_SIZE];
#define click_to_round_k(n) \
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
message msg;
int r, ipc_status;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the memory driver. */
int i;
/*===========================================================================*
* m_is_block *
*===========================================================================*/
-PRIVATE int m_is_block(dev_t minor)
+static int m_is_block(dev_t minor)
{
/* Return TRUE iff the given minor device number is for a block device. */
/*===========================================================================*
* m_prepare *
*===========================================================================*/
-PRIVATE struct device *m_prepare(dev_t device)
+static struct device *m_prepare(dev_t device)
{
/* Prepare for I/O on a device: check if the minor device number is ok. */
if (device >= NR_DEVS || m_is_block(device)) return(NULL);
/*===========================================================================*
* m_transfer *
*===========================================================================*/
-PRIVATE int m_transfer(
+static int m_transfer(
endpoint_t endpt, /* endpoint of grant owner */
int opcode, /* DEV_GATHER_S or DEV_SCATTER_S */
u64_t pos64, /* offset on device to read or write */
/*===========================================================================*
* m_do_open *
*===========================================================================*/
-PRIVATE int m_do_open(message *m_ptr)
+static int m_do_open(message *m_ptr)
{
/* Open a memory character device. */
int r;
/*===========================================================================*
* m_do_close *
*===========================================================================*/
-PRIVATE int m_do_close(message *m_ptr)
+static int m_do_close(message *m_ptr)
{
/* Close a memory character device. */
if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO);
/*===========================================================================*
* m_block_part *
*===========================================================================*/
-PRIVATE struct device *m_block_part(dev_t minor)
+static struct device *m_block_part(dev_t minor)
{
/* Prepare for I/O on a device: check if the minor device number is ok. */
if (minor >= NR_DEVS || !m_is_block(minor)) return(NULL);
/*===========================================================================*
* m_block_transfer *
*===========================================================================*/
-PRIVATE int m_block_transfer(
+static int m_block_transfer(
dev_t minor, /* minor device number */
int do_write, /* read or write? */
u64_t pos64, /* offset on device to read or write */
/*===========================================================================*
* m_block_open *
*===========================================================================*/
-PRIVATE int m_block_open(dev_t minor, int UNUSED(access))
+static int m_block_open(dev_t minor, int UNUSED(access))
{
/* Open a memory block device. */
if (m_block_part(minor) == NULL) return(ENXIO);
/*===========================================================================*
* m_block_close *
*===========================================================================*/
-PRIVATE int m_block_close(dev_t minor)
+static int m_block_close(dev_t minor)
{
/* Close a memory block device. */
if (m_block_part(minor) == NULL) return(ENXIO);
/*===========================================================================*
* m_block_ioctl *
*===========================================================================*/
-PRIVATE int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
+static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant)
{
/* I/O controls for the block devices of the memory driver. Currently there is
* *
* Wait msecs milli seconds *
*****************************************************************************/
-PRIVATE void milli_delay(unsigned int msecs)
+static void milli_delay(unsigned int msecs)
{
micro_delay((long)msecs * 1000);
}
* Check whether we have access to the card. Does the SWSUPPORT0 contain the *
* value we put in it earlier? *
*****************************************************************************/
-PRIVATE int hermes_present (hermes_t * hw) {
+static int hermes_present (hermes_t * hw) {
int i = hermes_read_reg (hw, HERMES_SWSUPPORT0) == HERMES_MAGIC;
if (!i)
printf("Hermes: Error, card not present?\n");
#define IRQ_BAP 1
#define ETH_HLEN 14
-PRIVATE t_or or_state;
-PRIVATE int or_instance;
+static t_or or_state;
+static int or_instance;
struct ethhdr {
u8_t h_dest[ETH_ALEN];
********************************************************************/
/* The frequency of each channel in MHz */
-PRIVATE const long channel_frequency[] = {
+static const long channel_frequency[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442,
2447, 2452, 2457, 2462, 2467, 2472, 2484
};
/* The message used in the main loop is made global, so that rl_watchdog_f()
* can change its message type to fake an interrupt message.
*/
-PRIVATE message m;
-PRIVATE int int_event_check; /* set to TRUE if events arrived */
+static message m;
+static int int_event_check; /* set to TRUE if events arrived */
-PRIVATE u32_t system_hz;
+static u32_t system_hz;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*****************************************************************************
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the orinoco driver. */
long v;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
t_or *orp;
#include "pci.h"
-PUBLIC struct pci_acl pci_acl[NR_DRIVERS];
-
-FORWARD void do_init(message *mp);
-FORWARD void do_first_dev(message *mp);
-FORWARD void do_next_dev(message *mp);
-FORWARD void do_find_dev(message *mp);
-FORWARD void do_ids(message *mp);
-FORWARD void do_dev_name_s(message *mp);
-FORWARD void do_slot_name_s(message *mp);
-FORWARD void do_set_acl(message *mp);
-FORWARD void do_del_acl(message *mp);
-FORWARD void do_reserve(message *mp);
-FORWARD void do_attr_r8(message *mp);
-FORWARD void do_attr_r16(message *mp);
-FORWARD void do_attr_r32(message *mp);
-FORWARD void do_attr_w8(message *mp);
-FORWARD void do_attr_w16(message *mp);
-FORWARD void do_attr_w32(message *mp);
-FORWARD void do_get_bar(message *mp);
-FORWARD void do_rescan_bus(message *mp);
-FORWARD void reply(message *mp, int result);
-FORWARD struct rs_pci *find_acl(int endpoint);
+struct pci_acl pci_acl[NR_DRIVERS];
+
+static void do_init(message *mp);
+static void do_first_dev(message *mp);
+static void do_next_dev(message *mp);
+static void do_find_dev(message *mp);
+static void do_ids(message *mp);
+static void do_dev_name_s(message *mp);
+static void do_slot_name_s(message *mp);
+static void do_set_acl(message *mp);
+static void do_del_acl(message *mp);
+static void do_reserve(message *mp);
+static void do_attr_r8(message *mp);
+static void do_attr_r16(message *mp);
+static void do_attr_r32(message *mp);
+static void do_attr_w8(message *mp);
+static void do_attr_w16(message *mp);
+static void do_attr_w32(message *mp);
+static void do_get_bar(message *mp);
+static void do_rescan_bus(message *mp);
+static void reply(message *mp, int result);
+static struct rs_pci *find_acl(int endpoint);
extern int debug;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
int main(void)
{
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_startup();
}
-PRIVATE void do_init(mp)
+static void do_init(mp)
message *mp;
{
int r;
mp->m_source, r);
}
-PRIVATE void do_first_dev(message *mp)
+static void do_first_dev(message *mp)
{
int r, devind;
u16_t vid, did;
}
}
-PRIVATE void do_next_dev(message *mp)
+static void do_next_dev(message *mp)
{
int r, devind;
u16_t vid, did;
}
}
-PRIVATE void do_find_dev(mp)
+static void do_find_dev(mp)
message *mp;
{
int r, devind;
}
}
-PRIVATE void do_ids(mp)
+static void do_ids(mp)
message *mp;
{
int r, devind;
}
}
-PRIVATE void do_dev_name_s(mp)
+static void do_dev_name_s(mp)
message *mp;
{
int r, name_len, len;
}
}
-PRIVATE void do_slot_name_s(mp)
+static void do_slot_name_s(mp)
message *mp;
{
int r, devind, name_len, len;
}
}
-PRIVATE void do_set_acl(mp)
+static void do_set_acl(mp)
message *mp;
{
int i, r, gid;
reply(mp, OK);
}
-PRIVATE void do_del_acl(message *mp)
+static void do_del_acl(message *mp)
{
int i, proc_nr;
reply(mp, OK);
}
-PRIVATE void do_reserve(message *mp)
+static void do_reserve(message *mp)
{
struct rs_pci *aclp;
int r, devind;
}
}
-PRIVATE void do_attr_r8(mp)
+static void do_attr_r8(mp)
message *mp;
{
int r, devind, port;
}
}
-PRIVATE void do_attr_r16(mp)
+static void do_attr_r16(mp)
message *mp;
{
int r, devind, port;
}
}
-PRIVATE void do_attr_r32(mp)
+static void do_attr_r32(mp)
message *mp;
{
int r, devind, port;
}
}
-PRIVATE void do_attr_w8(mp)
+static void do_attr_w8(mp)
message *mp;
{
int r, devind, port;
}
}
-PRIVATE void do_attr_w16(mp)
+static void do_attr_w16(mp)
message *mp;
{
int r, devind, port;
}
}
-PRIVATE void do_attr_w32(mp)
+static void do_attr_w32(mp)
message *mp;
{
int r, devind, port;
}
}
-PRIVATE void do_get_bar(mp)
+static void do_get_bar(mp)
message *mp;
{
int r, devind, port, ioflag;
}
}
-PRIVATE void do_rescan_bus(mp)
+static void do_rescan_bus(mp)
message *mp;
{
int r, busnr;
}
-PRIVATE void reply(mp, result)
+static void reply(mp, result)
message *mp;
int result;
{
}
-PRIVATE struct rs_pci *find_acl(endpoint)
+static struct rs_pci *find_acl(endpoint)
int endpoint;
{
int i;
int debug= 0;
-PRIVATE struct pcibus
+static struct pcibus
{
int pb_type;
int pb_needinit;
u16_t (*pb_rsts)(int busind);
void (*pb_wsts)(int busind, u16_t value);
} pcibus[NR_PCIBUS];
-PRIVATE int nr_pcibus= 0;
+static int nr_pcibus= 0;
-PRIVATE struct pcidev
+static struct pcidev
{
u8_t pd_busnr;
u8_t pd_dev;
#define PBF_IO 1 /* I/O else memory */
#define PBF_INCOMPLETE 2 /* not allocated */
-PRIVATE int nr_pcidev= 0;
-
-FORWARD void pci_intel_init(void);
-FORWARD void probe_bus(int busind);
-FORWARD int is_duplicate(u8_t busnr, u8_t dev, u8_t func);
-FORWARD void record_irq(int devind);
-FORWARD void record_bars_normal(int devind);
-FORWARD void record_bars_bridge(int devind);
-FORWARD void record_bars_cardbus(int devind);
-FORWARD void record_bars(int devind, int last_reg);
-FORWARD int record_bar(int devind, int bar_nr, int last);
-FORWARD void complete_bridges(void);
-FORWARD void complete_bars(void);
-FORWARD void update_bridge4dev_io(int devind, u32_t io_base, u32_t
+static int nr_pcidev= 0;
+
+static void pci_intel_init(void);
+static void probe_bus(int busind);
+static int is_duplicate(u8_t busnr, u8_t dev, u8_t func);
+static void record_irq(int devind);
+static void record_bars_normal(int devind);
+static void record_bars_bridge(int devind);
+static void record_bars_cardbus(int devind);
+static void record_bars(int devind, int last_reg);
+static int record_bar(int devind, int bar_nr, int last);
+static void complete_bridges(void);
+static void complete_bars(void);
+static void update_bridge4dev_io(int devind, u32_t io_base, u32_t
io_size);
-FORWARD int get_freebus(void);
-FORWARD int do_isabridge(int busind);
-FORWARD void do_pcibridge(int busind);
-FORWARD int get_busind(int busnr);
-FORWARD int do_piix(int devind);
-FORWARD int do_amd_isabr(int devind);
-FORWARD int do_sis_isabr(int devind);
-FORWARD int do_via_isabr(int devind);
+static int get_freebus(void);
+static int do_isabridge(int busind);
+static void do_pcibridge(int busind);
+static int get_busind(int busnr);
+static int do_piix(int devind);
+static int do_amd_isabr(int devind);
+static int do_sis_isabr(int devind);
+static int do_via_isabr(int devind);
#if 0
-FORWARD void report_vga(int devind);
+static void report_vga(int devind);
#endif
-FORWARD char *pci_vid_name(u16_t vid);
-FORWARD char *pci_baseclass_name(u8_t baseclass);
-FORWARD char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t
+static char *pci_vid_name(u16_t vid);
+static char *pci_baseclass_name(u8_t baseclass);
+static char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t
infclass);
-FORWARD void ntostr(unsigned n, char **str, char *end);
-
-FORWARD u8_t pci_attr_r8_u(int devind, int port);
-FORWARD u32_t pci_attr_r32_u(int devind, int port);
-
-FORWARD u16_t pci_attr_rsts(int devind);
-FORWARD void pci_attr_wsts(int devind, u16_t value);
-FORWARD u16_t pcibr_std_rsts(int busind);
-FORWARD void pcibr_std_wsts(int busind, u16_t value);
-FORWARD u16_t pcibr_cb_rsts(int busind);
-FORWARD void pcibr_cb_wsts(int busind, u16_t value);
-FORWARD u16_t pcibr_via_rsts(int busind);
-FORWARD void pcibr_via_wsts(int busind, u16_t value);
-FORWARD u8_t pcii_rreg8(int busind, int devind, int port);
-FORWARD u16_t pcii_rreg16(int busind, int devind, int port);
-FORWARD u32_t pcii_rreg32(int busind, int devind, int port);
-FORWARD void pcii_wreg8(int busind, int devind, int port, u8_t value);
-FORWARD void pcii_wreg16(int busind, int devind, int port, u16_t value);
-FORWARD void pcii_wreg32(int busind, int devind, int port, u32_t value);
-FORWARD u16_t pcii_rsts(int busind);
-FORWARD void pcii_wsts(int busind, u16_t value);
-FORWARD void print_capabilities(int devind);
-FORWARD int visible(struct rs_pci *aclp, int devind);
-FORWARD void print_hyper_cap(int devind, u8_t capptr);
-
-PRIVATE struct machine machine;
-PRIVATE endpoint_t acpi_ep;
+static void ntostr(unsigned n, char **str, char *end);
+
+static u8_t pci_attr_r8_u(int devind, int port);
+static u32_t pci_attr_r32_u(int devind, int port);
+
+static u16_t pci_attr_rsts(int devind);
+static void pci_attr_wsts(int devind, u16_t value);
+static u16_t pcibr_std_rsts(int busind);
+static void pcibr_std_wsts(int busind, u16_t value);
+static u16_t pcibr_cb_rsts(int busind);
+static void pcibr_cb_wsts(int busind, u16_t value);
+static u16_t pcibr_via_rsts(int busind);
+static void pcibr_via_wsts(int busind, u16_t value);
+static u8_t pcii_rreg8(int busind, int devind, int port);
+static u16_t pcii_rreg16(int busind, int devind, int port);
+static u32_t pcii_rreg32(int busind, int devind, int port);
+static void pcii_wreg8(int busind, int devind, int port, u8_t value);
+static void pcii_wreg16(int busind, int devind, int port, u16_t value);
+static void pcii_wreg32(int busind, int devind, int port, u32_t value);
+static u16_t pcii_rsts(int busind);
+static void pcii_wsts(int busind, u16_t value);
+static void print_capabilities(int devind);
+static int visible(struct rs_pci *aclp, int devind);
+static void print_hyper_cap(int devind, u8_t capptr);
+
+static struct machine machine;
+static endpoint_t acpi_ep;
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info)
+int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the pci driver. */
long v;
/*===========================================================================*
* map_service *
*===========================================================================*/
-PUBLIC int map_service(rpub)
+int map_service(rpub)
struct rprocpub *rpub;
{
/* Map a new service by registering a new acl entry if required. */
/*===========================================================================*
* helper functions for I/O *
*===========================================================================*/
-PUBLIC unsigned pci_inb(u16_t port) {
+unsigned pci_inb(u16_t port) {
u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
printf("PCI: warning, sys_inb failed: %d\n", s);
return value;
}
-PUBLIC unsigned pci_inw(u16_t port) {
+unsigned pci_inw(u16_t port) {
u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
printf("PCI: warning, sys_inw failed: %d\n", s);
return value;
}
-PUBLIC unsigned pci_inl(u16_t port) {
+unsigned pci_inl(u16_t port) {
u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
printf("PCI: warning, sys_inl failed: %d\n", s);
return value;
}
-PUBLIC void pci_outb(u16_t port, u8_t value) {
+void pci_outb(u16_t port, u8_t value) {
int s;
if ((s=sys_outb(port, value)) !=OK)
printf("PCI: warning, sys_outb failed: %d\n", s);
}
-PUBLIC void pci_outw(u16_t port, u16_t value) {
+void pci_outw(u16_t port, u16_t value) {
int s;
if ((s=sys_outw(port, value)) !=OK)
printf("PCI: warning, sys_outw failed: %d\n", s);
}
-PUBLIC void pci_outl(u16_t port, u32_t value) {
+void pci_outl(u16_t port, u32_t value) {
int s;
if ((s=sys_outl(port, value)) !=OK)
printf("PCI: warning, sys_outl failed: %d\n", s);
/*===========================================================================*
* pci_find_dev *
*===========================================================================*/
-PUBLIC int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp)
+int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp)
{
int devind;
/*===========================================================================*
* pci_first_dev_a *
*===========================================================================*/
-PUBLIC int pci_first_dev_a(
+int pci_first_dev_a(
struct rs_pci *aclp,
int *devindp,
u16_t *vidp,
/*===========================================================================*
* pci_next_dev *
*===========================================================================*/
-PUBLIC int pci_next_dev_a(
+int pci_next_dev_a(
struct rs_pci *aclp,
int *devindp,
u16_t *vidp,
/*===========================================================================*
* pci_reserve_a *
*===========================================================================*/
-PUBLIC int pci_reserve_a(devind, proc, aclp)
+int pci_reserve_a(devind, proc, aclp)
int devind;
endpoint_t proc;
struct rs_pci *aclp;
/*===========================================================================*
* pci_release *
*===========================================================================*/
-PUBLIC void pci_release(proc)
+void pci_release(proc)
endpoint_t proc;
{
int i;
/*===========================================================================*
* pci_ids_s *
*===========================================================================*/
-PUBLIC int pci_ids_s(int devind, u16_t *vidp, u16_t *didp)
+int pci_ids_s(int devind, u16_t *vidp, u16_t *didp)
{
if (devind < 0 || devind >= nr_pcidev)
return EINVAL;
/*===========================================================================*
* pci_rescan_bus *
*===========================================================================*/
-PUBLIC void pci_rescan_bus(u8_t busnr)
+void pci_rescan_bus(u8_t busnr)
{
int busind;
/*===========================================================================*
* pci_slot_name_s *
*===========================================================================*/
-PUBLIC int pci_slot_name_s(devind, cpp)
+int pci_slot_name_s(devind, cpp)
int devind;
char **cpp;
{
/*===========================================================================*
* pci_dev_name *
*===========================================================================*/
-PUBLIC char *pci_dev_name(u16_t vid, u16_t did)
+char *pci_dev_name(u16_t vid, u16_t did)
{
int i;
/*===========================================================================*
* pci_get_bar_s *
*===========================================================================*/
-PUBLIC int pci_get_bar_s(int devind, int port, u32_t *base, u32_t *size,
+int pci_get_bar_s(int devind, int port, u32_t *base, u32_t *size,
int *ioflag)
{
int i, reg;
/*===========================================================================*
* pci_attr_r8_s *
*===========================================================================*/
-PUBLIC int pci_attr_r8_s(int devind, int port, u8_t *vp)
+int pci_attr_r8_s(int devind, int port, u8_t *vp)
{
if (devind < 0 || devind >= nr_pcidev)
return EINVAL;
/*===========================================================================*
* pci_attr_r8_u *
*===========================================================================*/
-PRIVATE u8_t pci_attr_r8_u(devind, port)
+static u8_t pci_attr_r8_u(devind, port)
int devind;
int port;
{
/*===========================================================================*
* pci_attr_r16 *
*===========================================================================*/
-PUBLIC u16_t pci_attr_r16(devind, port)
+u16_t pci_attr_r16(devind, port)
int devind;
int port;
{
/*===========================================================================*
* pci_attr_r32_s *
*===========================================================================*/
-PUBLIC int pci_attr_r32_s(int devind, int port, u32_t *vp)
+int pci_attr_r32_s(int devind, int port, u32_t *vp)
{
if (devind < 0 || devind >= nr_pcidev)
return EINVAL;
/*===========================================================================*
* pci_attr_r32_u *
*===========================================================================*/
-PRIVATE u32_t pci_attr_r32_u(devind, port)
+static u32_t pci_attr_r32_u(devind, port)
int devind;
int port;
{
/*===========================================================================*
* pci_attr_w8 *
*===========================================================================*/
-PUBLIC void pci_attr_w8(int devind, int port, u8_t value)
+void pci_attr_w8(int devind, int port, u8_t value)
{
int busnr, busind;
/*===========================================================================*
* pci_attr_w16 *
*===========================================================================*/
-PUBLIC void pci_attr_w16(int devind, int port, u16_t value)
+void pci_attr_w16(int devind, int port, u16_t value)
{
int busnr, busind;
/*===========================================================================*
* pci_attr_w32 *
*===========================================================================*/
-PUBLIC void pci_attr_w32(int devind, int port, u32_t value)
+void pci_attr_w32(int devind, int port, u32_t value)
{
int busnr, busind;
/*===========================================================================*
* pci_intel_init *
*===========================================================================*/
-PRIVATE void pci_intel_init()
+static void pci_intel_init()
{
/* Try to detect a know PCI controller. Read the Vendor ID and
* the Device ID for function 0 of device 0.
/*===========================================================================*
* probe_bus *
*===========================================================================*/
-PRIVATE void probe_bus(int busind)
+static void probe_bus(int busind)
{
u32_t dev, func, t3;
u16_t vid, did, sts;
/*===========================================================================*
* is_duplicate *
*===========================================================================*/
-PRIVATE int is_duplicate(u8_t busnr, u8_t dev, u8_t func)
+static int is_duplicate(u8_t busnr, u8_t dev, u8_t func)
{
int i;
return 0;
}
-PRIVATE int acpi_get_irq(unsigned bus, unsigned dev, unsigned pin)
+static int acpi_get_irq(unsigned bus, unsigned dev, unsigned pin)
{
int err;
message m;
return ((struct acpi_get_irq_resp *)&m)->irq;
}
-PRIVATE int derive_irq(struct pcidev * dev, int pin)
+static int derive_irq(struct pcidev * dev, int pin)
{
struct pcidev * parent_bridge;
int slot;
/*===========================================================================*
* record_irq *
*===========================================================================*/
-PRIVATE void record_irq(devind)
+static void record_irq(devind)
int devind;
{
int ilr, ipr, busnr, busind, cb_devind;
/*===========================================================================*
* record_bars_normal *
*===========================================================================*/
-PRIVATE void record_bars_normal(devind)
+static void record_bars_normal(devind)
int devind;
{
int i, j, clear_01, clear_23, pb_nr;
/*===========================================================================*
* record_bars_bridge *
*===========================================================================*/
-PRIVATE void record_bars_bridge(devind)
+static void record_bars_bridge(devind)
int devind;
{
u32_t base, limit, size;
/*===========================================================================*
* record_bars_cardbus *
*===========================================================================*/
-PRIVATE void record_bars_cardbus(devind)
+static void record_bars_cardbus(devind)
int devind;
{
u32_t base, limit, size;
/*===========================================================================*
* record_bars *
*===========================================================================*/
-PRIVATE void record_bars(int devind, int last_reg)
+static void record_bars(int devind, int last_reg)
{
int i, reg, width;
/*===========================================================================*
* record_bar *
*===========================================================================*/
-PRIVATE int record_bar(devind, bar_nr, last)
+static int record_bar(devind, bar_nr, last)
int devind;
int bar_nr;
int last;
/*===========================================================================*
* complete_bridges *
*===========================================================================*/
-PRIVATE void complete_bridges()
+static void complete_bridges()
{
int i, freebus, devind, prim_busnr;
/*===========================================================================*
* complete_bars *
*===========================================================================*/
-PRIVATE void complete_bars(void)
+static void complete_bars(void)
{
int i, j, r, bar_nr, reg;
u32_t memgap_low, memgap_high, iogap_low, iogap_high, io_high,
/*===========================================================================*
* update_bridge4dev_io *
*===========================================================================*/
-PRIVATE void update_bridge4dev_io(
+static void update_bridge4dev_io(
int devind,
u32_t io_base,
u32_t io_size
/*===========================================================================*
* get_freebus *
*===========================================================================*/
-PRIVATE int get_freebus()
+static int get_freebus()
{
int i, freebus;
/*===========================================================================*
* do_isabridge *
*===========================================================================*/
-PRIVATE int do_isabridge(busind)
+static int do_isabridge(busind)
int busind;
{
int i, j, r, type, busnr, unknown_bridge, bridge_dev;
* (pbnr) must be already known to acpi and it must map dev as the connection to
* the secondary (sbnr) bus
*/
-PRIVATE void acpi_map_bridge(unsigned pbnr, unsigned dev, unsigned sbnr)
+static void acpi_map_bridge(unsigned pbnr, unsigned dev, unsigned sbnr)
{
int err;
message m;
/*===========================================================================*
* do_pcibridge *
*===========================================================================*/
-PRIVATE void do_pcibridge(busind)
+static void do_pcibridge(busind)
int busind;
{
int i, devind, busnr;
/*===========================================================================*
* get_busind *
*===========================================================================*/
-PRIVATE int get_busind(busnr)
+static int get_busind(busnr)
int busnr;
{
int i;
/*===========================================================================*
* do_piix *
*===========================================================================*/
-PRIVATE int do_piix(int devind)
+static int do_piix(int devind)
{
int i, s, irqrc, irq;
u32_t elcr1, elcr2, elcr;
/*===========================================================================*
* do_amd_isabr *
*===========================================================================*/
-PRIVATE int do_amd_isabr(int devind)
+static int do_amd_isabr(int devind)
{
int i, busnr, dev, func, xdevind, irq, edge;
u8_t levmask;
/*===========================================================================*
* do_sis_isabr *
*===========================================================================*/
-PRIVATE int do_sis_isabr(int devind)
+static int do_sis_isabr(int devind)
{
int i, irq;
/*===========================================================================*
* do_via_isabr *
*===========================================================================*/
-PRIVATE int do_via_isabr(int devind)
+static int do_via_isabr(int devind)
{
int i, irq, edge;
u8_t levmask;
/*===========================================================================*
* report_vga *
*===========================================================================*/
-PRIVATE void report_vga(devind)
+static void report_vga(devind)
int devind;
{
/* Report the amount of video memory. This is needed by the X11R6
/*===========================================================================*
* pci_vid_name *
*===========================================================================*/
-PRIVATE char *pci_vid_name(u16_t vid)
+static char *pci_vid_name(u16_t vid)
{
int i;
/*===========================================================================*
* pci_baseclass_name *
*===========================================================================*/
-PRIVATE char *pci_baseclass_name(u8_t baseclass)
+static char *pci_baseclass_name(u8_t baseclass)
{
int i;
/*===========================================================================*
* pci_subclass_name *
*===========================================================================*/
-PRIVATE char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t infclass)
+static char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t infclass)
{
int i;
/*===========================================================================*
* ntostr *
*===========================================================================*/
-PRIVATE void ntostr(n, str, end)
+static void ntostr(n, str, end)
unsigned n;
char **str;
char *end;
/*===========================================================================*
* pci_attr_rsts *
*===========================================================================*/
-PRIVATE u16_t pci_attr_rsts(devind)
+static u16_t pci_attr_rsts(devind)
int devind;
{
int busnr, busind;
/*===========================================================================*
* pcibr_std_rsts *
*===========================================================================*/
-PRIVATE u16_t pcibr_std_rsts(busind)
+static u16_t pcibr_std_rsts(busind)
int busind;
{
int devind;
/*===========================================================================*
* pcibr_std_wsts *
*===========================================================================*/
-PRIVATE void pcibr_std_wsts(int busind, u16_t value)
+static void pcibr_std_wsts(int busind, u16_t value)
{
int devind;
devind= pcibus[busind].pb_devind;
/*===========================================================================*
* pcibr_cb_rsts *
*===========================================================================*/
-PRIVATE u16_t pcibr_cb_rsts(busind)
+static u16_t pcibr_cb_rsts(busind)
int busind;
{
int devind;
/*===========================================================================*
* pcibr_cb_wsts *
*===========================================================================*/
-PRIVATE void pcibr_cb_wsts(int busind, u16_t value)
+static void pcibr_cb_wsts(int busind, u16_t value)
{
int devind;
devind= pcibus[busind].pb_devind;
/*===========================================================================*
* pcibr_via_rsts *
*===========================================================================*/
-PRIVATE u16_t pcibr_via_rsts(int busind)
+static u16_t pcibr_via_rsts(int busind)
{
return 0;
}
/*===========================================================================*
* pcibr_via_wsts *
*===========================================================================*/
-PRIVATE void pcibr_via_wsts(int busind, u16_t value)
+static void pcibr_via_wsts(int busind, u16_t value)
{
int devind;
devind= pcibus[busind].pb_devind;
/*===========================================================================*
* pci_attr_wsts *
*===========================================================================*/
-PRIVATE void pci_attr_wsts(int devind, u16_t value)
+static void pci_attr_wsts(int devind, u16_t value)
{
int busnr, busind;
/*===========================================================================*
* pcii_rreg8 *
*===========================================================================*/
-PRIVATE u8_t pcii_rreg8(busind, devind, port)
+static u8_t pcii_rreg8(busind, devind, port)
int busind;
int devind;
int port;
/*===========================================================================*
* pcii_rreg16 *
*===========================================================================*/
-PRIVATE u16_t pcii_rreg16(int busind, int devind, int port)
+static u16_t pcii_rreg16(int busind, int devind, int port)
{
u16_t v;
int s;
/*===========================================================================*
* pcii_rreg32 *
*===========================================================================*/
-PRIVATE u32_t pcii_rreg32(int busind, int devind, int port)
+static u32_t pcii_rreg32(int busind, int devind, int port)
{
u32_t v;
int s;
/*===========================================================================*
* pcii_wreg8 *
*===========================================================================*/
-PRIVATE void pcii_wreg8(
+static void pcii_wreg8(
int busind,
int devind,
int port,
/*===========================================================================*
* pcii_wreg16 *
*===========================================================================*/
-PRIVATE void pcii_wreg16(
+static void pcii_wreg16(
int busind,
int devind,
int port,
/*===========================================================================*
* pcii_wreg32 *
*===========================================================================*/
-PRIVATE void pcii_wreg32(
+static void pcii_wreg32(
int busind,
int devind,
int port,
/*===========================================================================*
* pcii_rsts *
*===========================================================================*/
-PRIVATE u16_t pcii_rsts(int busind)
+static u16_t pcii_rsts(int busind)
{
u16_t v;
int s;
/*===========================================================================*
* pcii_wsts *
*===========================================================================*/
-PRIVATE void pcii_wsts(int busind, u16_t value)
+static void pcii_wsts(int busind, u16_t value)
{
int s;
PCII_WREG16_(pcibus[busind].pb_busnr, 0, 0, PCI_SR, value);
/*===========================================================================*
* print_capabilities *
*===========================================================================*/
-PRIVATE void print_capabilities(int devind)
+static void print_capabilities(int devind)
{
u8_t status, capptr, type, next, subtype;
char *str;
/*===========================================================================*
* visible *
*===========================================================================*/
-PRIVATE int visible(aclp, devind)
+static int visible(aclp, devind)
struct rs_pci *aclp;
int devind;
{
/*===========================================================================*
* print_hyper_cap *
*===========================================================================*/
-PRIVATE void print_hyper_cap(int devind, u8_t capptr)
+static void print_hyper_cap(int devind, u8_t capptr)
{
u32_t v;
u16_t cmd;
/*===========================================================================*
* sef_cb_lu_prepare *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare(int state)
+int sef_cb_lu_prepare(int state)
{
int is_ready;
/*===========================================================================*
* sef_cb_lu_state_isvalid *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid(int state)
+int sef_cb_lu_state_isvalid(int state)
{
return SEF_LU_STATE_IS_STANDARD(state) || PR_STATE_IS_CUSTOM(state);
}
/*===========================================================================*
* sef_cb_lu_state_dump *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_dump(int state)
+void sef_cb_lu_state_dump(int state)
{
sef_lu_dprint("printer: live update state = %d\n", state);
sef_lu_dprint("printer: writing = %d\n", writing);
* with the sys_outb() messages exchanged.
*/
-PRIVATE endpoint_t caller; /* process to tell when printing done (FS) */
-PRIVATE int revive_pending; /* set to true if revive is pending */
-PRIVATE int revive_status; /* revive status */
-PRIVATE int done_status; /* status of last output completion */
-PRIVATE int oleft; /* bytes of output left in obuf */
-PRIVATE unsigned char obuf[128]; /* output buffer */
-PRIVATE unsigned const char *optr; /* ptr to next char in obuf to print */
-PRIVATE int orig_count; /* original byte count */
-PRIVATE int port_base; /* I/O port for printer */
-PRIVATE endpoint_t proc_nr; /* user requesting the printing */
-PRIVATE cp_grant_id_t grant_nr; /* grant on which print happens */
-PRIVATE int user_left; /* bytes of output left in user buf */
-PRIVATE vir_bytes user_vir_d; /* offset in user buf */
-PUBLIC int writing; /* nonzero while write is in progress */
-PRIVATE int irq_hook_id; /* id of irq hook at kernel */
-
-FORWARD void do_cancel(message *m_ptr);
-FORWARD void output_done(void);
-FORWARD void do_write(message *m_ptr);
-FORWARD void do_status(message *m_ptr);
-FORWARD void prepare_output(void);
-FORWARD int do_probe(void);
-FORWARD void do_initialize(void);
-FORWARD void reply(int code,int replyee,int proc,int status);
-FORWARD void do_printer_output(void);
+static endpoint_t caller; /* process to tell when printing done (FS) */
+static int revive_pending; /* set to true if revive is pending */
+static int revive_status; /* revive status */
+static int done_status; /* status of last output completion */
+static int oleft; /* bytes of output left in obuf */
+static unsigned char obuf[128]; /* output buffer */
+static unsigned const char *optr; /* ptr to next char in obuf to print */
+static int orig_count; /* original byte count */
+static int port_base; /* I/O port for printer */
+static endpoint_t proc_nr; /* user requesting the printing */
+static cp_grant_id_t grant_nr; /* grant on which print happens */
+static int user_left; /* bytes of output left in user buf */
+static vir_bytes user_vir_d; /* offset in user buf */
+int writing; /* nonzero while write is in progress */
+static int irq_hook_id; /* id of irq hook at kernel */
+
+static void do_cancel(message *m_ptr);
+static void output_done(void);
+static void do_write(message *m_ptr);
+static void do_status(message *m_ptr);
+static void prepare_output(void);
+static int do_probe(void);
+static void do_initialize(void);
+static void reply(int code,int replyee,int proc,int status);
+static void do_printer_output(void);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state);
-PUBLIC int is_status_msg_expected = FALSE;
+int is_status_msg_expected = FALSE;
/*===========================================================================*
* printer_task *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* Main routine of the printer task. */
message pr_mess; /* buffer for all incoming messages */
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the printer driver. */
/*===========================================================================*
* do_write *
*===========================================================================*/
-PRIVATE void do_write(m_ptr)
+static void do_write(m_ptr)
register message *m_ptr; /* pointer to the newly arrived message */
{
/* The printer is used by sending DEV_WRITE messages to it. Process one. */
/*===========================================================================*
* output_done *
*===========================================================================*/
-PRIVATE void output_done()
+static void output_done()
{
/* Previous chunk of printing is finished. Continue if OK and more.
* Otherwise, reply to caller (FS).
/*===========================================================================*
* do_status *
*===========================================================================*/
-PRIVATE void do_status(m_ptr)
+static void do_status(m_ptr)
register message *m_ptr; /* pointer to the newly arrived message */
{
if (revive_pending) {
/*===========================================================================*
* do_cancel *
*===========================================================================*/
-PRIVATE void do_cancel(m_ptr)
+static void do_cancel(m_ptr)
register message *m_ptr; /* pointer to the newly arrived message */
{
/* Cancel a print request that has already started. Usually this means that
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(code, replyee, process, status)
+static void reply(code, replyee, process, status)
int code; /* TASK_REPLY or REVIVE */
int replyee; /* destination for message (normally FS) */
int process; /* which user requested the printing */
/*===========================================================================*
* do_probe *
*===========================================================================*/
-PRIVATE int do_probe(void)
+static int do_probe(void)
{
/* See if there is a printer at all. */
/*===========================================================================*
* do_initialize *
*===========================================================================*/
-PRIVATE void do_initialize()
+static void do_initialize()
{
/* Set global variables and initialize the printer. */
static int initialized = FALSE;
/*==========================================================================*
* prepare_output *
*==========================================================================*/
-PRIVATE void prepare_output()
+static void prepare_output()
{
/* Start next chunk of printer output. Fetch the data from user space. */
int s;
/*===========================================================================*
* do_printer_output *
*===========================================================================*/
-PRIVATE void do_printer_output()
+static void do_printer_output()
{
/* This function does the actual output to the printer. This is called on an
* interrupt message sent from the generic interrupt handler that 'forwards'
#define KRANDOM_PERIOD 1 /* ticks between krandom calls */
-PRIVATE struct device m_geom[NR_DEVS]; /* base and size of each device */
-PRIVATE dev_t m_device; /* current device */
+static struct device m_geom[NR_DEVS]; /* base and size of each device */
+static dev_t m_device; /* current device */
extern int errno; /* error number for PM calls */
-FORWARD struct device *r_prepare(dev_t device);
-FORWARD int r_transfer(endpoint_t endpt, int opcode, u64_t position,
+static struct device *r_prepare(dev_t device);
+static int r_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags);
-FORWARD int r_do_open(message *m_ptr);
-FORWARD void r_random(message *m_ptr);
-FORWARD void r_updatebin(int source, struct k_randomness_bin *rb);
+static int r_do_open(message *m_ptr);
+static void r_random(message *m_ptr);
+static void r_updatebin(int source, struct k_randomness_bin *rb);
/* Entry points to this driver. */
-PRIVATE struct chardriver r_dtab = {
+static struct chardriver r_dtab = {
r_do_open, /* open or mount */
do_nop, /* nothing on a close */
nop_ioctl, /* no I/O controls supported */
/* Buffer for the /dev/random number generator. */
#define RANDOM_BUF_SIZE 1024
-PRIVATE char random_buf[RANDOM_BUF_SIZE];
+static char random_buf[RANDOM_BUF_SIZE];
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* SEF local startup. */
sef_local_startup();
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the random driver. */
static struct k_randomness krandom;
/*===========================================================================*
* r_prepare *
*===========================================================================*/
-PRIVATE struct device *r_prepare(dev_t device)
+static struct device *r_prepare(dev_t device)
{
/* Prepare for I/O on a device: check if the minor device number is ok. */
/*===========================================================================*
* r_transfer *
*===========================================================================*/
-PRIVATE int r_transfer(
+static int r_transfer(
endpoint_t endpt, /* endpoint of grant owner */
int opcode, /* DEV_GATHER or DEV_SCATTER */
u64_t position, /* offset on device to read or write */
/*===========================================================================*
* r_do_open *
*===========================================================================*/
-PRIVATE int r_do_open(message *m_ptr)
+static int r_do_open(message *m_ptr)
{
/* Check device number on open.
*/
/*===========================================================================*
* r_updatebin *
*===========================================================================*/
-PRIVATE void r_updatebin(int source, struct k_randomness_bin *rb)
+static void r_updatebin(int source, struct k_randomness_bin *rb)
{
int r_next, r_size, r_high;
/*===========================================================================*
* r_random *
*===========================================================================*/
-PRIVATE void r_random(message *UNUSED(m_ptr))
+static void r_random(message *UNUSED(m_ptr))
{
/* Fetch random information from the kernel to update /dev/random. */
int s;
* re-seed.
*/
-PRIVATE unsigned long deriv[TOTAL_SOURCES][N_DERIV];
-PRIVATE int pool_ind[TOTAL_SOURCES];
-PRIVATE SHA256_CTX pool_ctx[NR_POOLS];
-PRIVATE unsigned samples= 0;
-PRIVATE int got_seeded= 0;
-PRIVATE u8_t random_key[2*AES_BLOCKSIZE];
-PRIVATE u32_t count_lo, count_hi;
-PRIVATE u32_t reseed_count;
-
-FORWARD void add_sample(int source, unsigned long sample);
-FORWARD void data_block(rd_keyinstance *keyp, void *data);
-FORWARD void reseed(void);
-
-PUBLIC void random_init()
+static unsigned long deriv[TOTAL_SOURCES][N_DERIV];
+static int pool_ind[TOTAL_SOURCES];
+static SHA256_CTX pool_ctx[NR_POOLS];
+static unsigned samples= 0;
+static int got_seeded= 0;
+static u8_t random_key[2*AES_BLOCKSIZE];
+static u32_t count_lo, count_hi;
+static u32_t reseed_count;
+
+static void add_sample(int source, unsigned long sample);
+static void data_block(rd_keyinstance *keyp, void *data);
+static void reseed(void);
+
+void random_init()
{
int i, j;
reseed_count= 0;
}
-PUBLIC int random_isseeded()
+int random_isseeded()
{
if (got_seeded)
return 1;
return 0;
}
-PUBLIC void random_update(source, buf, count)
+void random_update(source, buf, count)
int source;
rand_t *buf;
int count;
reseed();
}
-PUBLIC void random_getbytes(buf, size)
+void random_getbytes(buf, size)
void *buf;
size_t size;
{
data_block(&key, random_key+AES_BLOCKSIZE);
}
-PUBLIC void random_putbytes(buf, size)
+void random_putbytes(buf, size)
void *buf;
size_t size;
{
reseed();
}
-PRIVATE void add_sample(source, sample)
+static void add_sample(source, sample)
int source;
unsigned long sample;
{
pool_ind[source]= pool_nr;
}
-PRIVATE void data_block(keyp, data)
+static void data_block(keyp, data)
rd_keyinstance *keyp;
void *data;
{
count_hi++;
}
-PRIVATE void reseed()
+static void reseed()
{
int i;
SHA256_CTX ctx;
void usage(void);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
int main(int argc, char **argv)
{
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
((s) >= RL_STATE_READ_PROTOCOL_FREE && (s) <= RL_STATE_WRITE_PROTOCOL_FREE)
/* State management helpers. */
-PRIVATE int is_reading;
-PRIVATE int is_writing;
+static int is_reading;
+static int is_writing;
-PRIVATE void load_state_info(void)
+static void load_state_info(void)
{
re_t *rep;
/*===========================================================================*
* sef_cb_lu_prepare *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare(int state)
+int sef_cb_lu_prepare(int state)
{
int is_ready;
/*===========================================================================*
* sef_cb_lu_state_isvalid *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid(int state)
+int sef_cb_lu_state_isvalid(int state)
{
return SEF_LU_STATE_IS_STANDARD(state) || RL_STATE_IS_CUSTOM(state);
}
/*===========================================================================*
* sef_cb_lu_state_dump *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_dump(int state)
+void sef_cb_lu_state_dump(int state)
{
/* Load state information. */
load_state_info();
#include "rtl8139.h"
-PUBLIC re_t re_state;
+re_t re_state;
static int re_instance;
/* The message used in the main loop is made global, so that rl_watchdog_f()
* can change its message type to fake an interrupt message.
*/
-PRIVATE message m;
-PRIVATE int int_event_check; /* set to TRUE if events arrived */
+static message m;
+static int int_event_check; /* set to TRUE if events arrived */
-PRIVATE u32_t system_hz;
+static u32_t system_hz;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state);
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the rtl8139 driver. */
long v;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
re_t *rep;
}
#endif
-PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
+static void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
vir_bytes buf;
size_t size;
int pci_bus;
* The message used in the main loop is made global, so that rl_watchdog_f()
* can change its message type to fake an interrupt message.
*/
-PRIVATE message m;
-PRIVATE int int_event_check; /* set to TRUE if events arrived */
+static message m;
+static int int_event_check; /* set to TRUE if events arrived */
u32_t system_hz;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the rtl8169 driver. */
long v;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
re_t *rep;
/* The use of interrupts is not yet ready for prime time */
#define USE_INTS 0
-PRIVATE struct port
+static struct port
{
int p_devind;
u8_t p_cb_busnr;
volatile struct csr *csr_ptr;
} port;
-PRIVATE int instance;
-PRIVATE int debug;
+static int instance;
+static int debug;
-FORWARD int hw_probe(int skip);
-FORWARD void hw_init(struct port *pp, int devind);
-FORWARD void do_int(struct port *pp);
+static int hw_probe(int skip);
+static void hw_init(struct port *pp, int devind);
+static void do_int(struct port *pp);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the ti1225 driver. */
int r, devind;
/*===========================================================================*
* hw_probe *
*===========================================================================*/
-PRIVATE int hw_probe(int skip)
+static int hw_probe(int skip)
{
u16_t vid, did;
int devind;
/*===========================================================================*
* hw_init *
*===========================================================================*/
-PRIVATE void hw_init(struct port *pp, int devind)
+static void hw_init(struct port *pp, int devind)
{
u8_t v8;
u16_t v16;
/*===========================================================================*
* do_int *
*===========================================================================*/
-PRIVATE void do_int(struct port *pp)
+static void do_int(struct port *pp)
{
int devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv,
socket_5v, socket_3v, socket_Xv, socket_Yv;
#define TIMER_FREQ 1193182L /* clock frequency for timer in PC and AT */
/* Global variables used by the console driver and assembly support. */
-PRIVATE phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */
-PRIVATE phys_bytes vid_base;
-PRIVATE unsigned vid_mask; /* 0x1FFF for color or 0x07FF for mono */
-PRIVATE unsigned blank_color = BLANK_COLOR; /* display code for blank */
+static phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */
+static phys_bytes vid_base;
+static unsigned vid_mask; /* 0x1FFF for color or 0x07FF for mono */
+static unsigned blank_color = BLANK_COLOR; /* display code for blank */
/* Private variables used by the console driver. */
-PRIVATE int vid_port; /* I/O port for accessing 6845 */
-PRIVATE int wrap; /* hardware can wrap? */
-PRIVATE int softscroll; /* 1 = software scrolling, 0 = hardware */
-PRIVATE int beeping; /* speaker is beeping? */
-PRIVATE unsigned font_lines; /* font lines per character */
-PRIVATE unsigned scr_width; /* # characters on a line */
-PRIVATE unsigned scr_lines; /* # lines on the screen */
-PRIVATE unsigned scr_size; /* # characters on the screen */
+static int vid_port; /* I/O port for accessing 6845 */
+static int wrap; /* hardware can wrap? */
+static int softscroll; /* 1 = software scrolling, 0 = hardware */
+static int beeping; /* speaker is beeping? */
+static unsigned font_lines; /* font lines per character */
+static unsigned scr_width; /* # characters on a line */
+static unsigned scr_lines; /* # lines on the screen */
+static unsigned scr_size; /* # characters on the screen */
/* tells mem_vid_copy() to blank the screen */
#define BLANK_MEM ((vir_bytes) 0)
-PRIVATE int disabled_vc = -1; /* Virtual console that was active when
+static int disabled_vc = -1; /* Virtual console that was active when
* disable_console was called.
*/
-PRIVATE int disabled_sm; /* Scroll mode to be restored when re-enabling
+static int disabled_sm; /* Scroll mode to be restored when re-enabling
* console
*/
-PRIVATE char *console_memory = NULL;
-PRIVATE char *font_memory = NULL;
+static char *console_memory = NULL;
+static char *font_memory = NULL;
/* Per console data. */
typedef struct console {
set_6845(VID_ORG, ccons->c_org); \
}
-PRIVATE int nr_cons= 1; /* actual number of consoles */
-PRIVATE console_t cons_table[NR_CONS];
-PRIVATE console_t *curcons = NULL; /* currently visible */
+static int nr_cons= 1; /* actual number of consoles */
+static console_t cons_table[NR_CONS];
+static console_t *curcons = NULL; /* currently visible */
-PRIVATE int shutting_down = FALSE; /* don't allow console switches */
+static int shutting_down = FALSE; /* don't allow console switches */
/* Color if using a color controller. */
#define color (vid_port == C_6845)
/* Map from ANSI colors to the attributes used by the PC */
-PRIVATE int ansi_colors[8] = {0, 4, 2, 6, 1, 5, 3, 7};
+static int ansi_colors[8] = {0, 4, 2, 6, 1, 5, 3, 7};
/* Structure used for font management */
struct sequence {
unsigned char value;
};
-FORWARD int cons_write(struct tty *tp, int try);
-FORWARD void cons_echo(tty_t *tp, int c);
-FORWARD void out_char(console_t *cons, int c);
-FORWARD void cons_putk(int c);
-FORWARD void beep(void);
-FORWARD void do_escape(console_t *cons, int c);
-FORWARD void flush(console_t *cons);
-FORWARD void parse_escape(console_t *cons, int c);
-FORWARD void scroll_screen(console_t *cons, int dir);
-FORWARD void set_6845(int reg, unsigned val);
-FORWARD void stop_beep(timer_t *tmrp);
-FORWARD void cons_org0(void);
-FORWARD void disable_console(void);
-FORWARD void reenable_console(void);
-FORWARD int ga_program(struct sequence *seq);
-FORWARD int cons_ioctl(tty_t *tp, int);
-FORWARD void mem_vid_copy(vir_bytes src, int dst, int count);
-FORWARD void vid_vid_copy(int src, int dst, int count);
+static int cons_write(struct tty *tp, int try);
+static void cons_echo(tty_t *tp, int c);
+static void out_char(console_t *cons, int c);
+static void cons_putk(int c);
+static void beep(void);
+static void do_escape(console_t *cons, int c);
+static void flush(console_t *cons);
+static void parse_escape(console_t *cons, int c);
+static void scroll_screen(console_t *cons, int dir);
+static void set_6845(int reg, unsigned val);
+static void stop_beep(timer_t *tmrp);
+static void cons_org0(void);
+static void disable_console(void);
+static void reenable_console(void);
+static int ga_program(struct sequence *seq);
+static int cons_ioctl(tty_t *tp, int);
+static void mem_vid_copy(vir_bytes src, int dst, int count);
+static void vid_vid_copy(int src, int dst, int count);
#if 0
-FORWARD void get_6845(int reg, unsigned *val);
+static void get_6845(int reg, unsigned *val);
#endif
/*===========================================================================*
* cons_write *
*===========================================================================*/
-PRIVATE int cons_write(tp, try)
+static int cons_write(tp, try)
register struct tty *tp; /* tells which terminal is to be used */
int try;
{
/*===========================================================================*
* cons_echo *
*===========================================================================*/
-PRIVATE void cons_echo(tp, c)
+static void cons_echo(tp, c)
register tty_t *tp; /* pointer to tty struct */
int c; /* character to be echoed */
{
/*===========================================================================*
* out_char *
*===========================================================================*/
-PRIVATE void out_char(cons, c)
+static void out_char(cons, c)
register console_t *cons; /* pointer to console struct */
int c; /* character to be output */
{
/*===========================================================================*
* scroll_screen *
*===========================================================================*/
-PRIVATE void scroll_screen(cons, dir)
+static void scroll_screen(cons, dir)
register console_t *cons; /* pointer to console struct */
int dir; /* SCROLL_UP or SCROLL_DOWN */
{
/*===========================================================================*
* flush *
*===========================================================================*/
-PRIVATE void flush(cons)
+static void flush(cons)
register console_t *cons; /* pointer to console struct */
{
/* Send characters buffered in 'ramqueue' to screen memory, check the new
/*===========================================================================*
* parse_escape *
*===========================================================================*/
-PRIVATE void parse_escape(cons, c)
+static void parse_escape(cons, c)
register console_t *cons; /* pointer to console struct */
char c; /* next character in escape sequence */
{
/*===========================================================================*
* do_escape *
*===========================================================================*/
-PRIVATE void do_escape(cons, c)
+static void do_escape(cons, c)
register console_t *cons; /* pointer to console struct */
char c; /* next character in escape sequence */
{
/*===========================================================================*
* set_6845 *
*===========================================================================*/
-PRIVATE void set_6845(reg, val)
+static void set_6845(reg, val)
int reg; /* which register pair to set */
unsigned val; /* 16-bit value to set it to */
{
/*===========================================================================*
* get_6845 *
*===========================================================================*/
-PRIVATE void get_6845(reg, val)
+static void get_6845(reg, val)
int reg; /* which register pair to set */
unsigned *val; /* 16-bit value to set it to */
{
/*===========================================================================*
* beep *
*===========================================================================*/
-PRIVATE void beep()
+static void beep()
{
/* Making a beeping sound on the speaker (output for CRTL-G).
* This routine works by turning on the bits 0 and 1 in port B of the 8255
/*===========================================================================*
* do_video *
*===========================================================================*/
-PUBLIC void do_video(message *m)
+void do_video(message *m)
{
int r;
/*===========================================================================*
* beep_x *
*===========================================================================*/
-PUBLIC void beep_x(freq, dur)
+void beep_x(freq, dur)
unsigned freq;
clock_t dur;
{
/*===========================================================================*
* stop_beep *
*===========================================================================*/
-PRIVATE void stop_beep(timer_t *UNUSED(tmrp))
+static void stop_beep(timer_t *UNUSED(tmrp))
{
/* Turn off the beeper by turning off bits 0 and 1 in PORT_B. */
u32_t port_b_val;
/*===========================================================================*
* scr_init *
*===========================================================================*/
-PUBLIC void scr_init(tp)
+void scr_init(tp)
tty_t *tp;
{
/* Initialize the screen driver. */
/*===========================================================================*
* do_new_kmess *
*===========================================================================*/
-PUBLIC void do_new_kmess()
+void do_new_kmess()
{
/* Notification for a new kernel message. */
static struct kmessages kmess; /* kmessages structure */
/*===========================================================================*
* cons_putk *
*===========================================================================*/
-PRIVATE void cons_putk(c)
+static void cons_putk(c)
int c; /* character to print */
{
/* This procedure is used to print a character on the console.
/*===========================================================================*
* toggle_scroll *
*===========================================================================*/
-PUBLIC void toggle_scroll()
+void toggle_scroll()
{
/* Toggle between hardware and software scroll. */
/*===========================================================================*
* cons_stop *
*===========================================================================*/
-PUBLIC void cons_stop()
+void cons_stop()
{
/* Prepare for halt or reboot. */
cons_org0();
/*===========================================================================*
* cons_org0 *
*===========================================================================*/
-PRIVATE void cons_org0()
+static void cons_org0()
{
/* Scroll video memory back to put the origin at 0. */
int cons_line;
/*===========================================================================*
* disable_console *
*===========================================================================*/
-PRIVATE void disable_console()
+static void disable_console()
{
if (disabled_vc != -1)
return;
/*===========================================================================*
* reenable_console *
*===========================================================================*/
-PRIVATE void reenable_console()
+static void reenable_console()
{
if (disabled_vc == -1)
return;
/*===========================================================================*
* select_console *
*===========================================================================*/
-PUBLIC void select_console(int cons_line)
+void select_console(int cons_line)
{
/* Set the current console to console number 'cons_line'. */
/*===========================================================================*
* con_loadfont *
*===========================================================================*/
-PUBLIC int con_loadfont(m)
+int con_loadfont(m)
message *m;
{
/*===========================================================================*
* ga_program *
*===========================================================================*/
-PRIVATE int ga_program(seq)
+static int ga_program(seq)
struct sequence *seq;
{
pvb_pair_t char_out[14];
/*===========================================================================*
* cons_ioctl *
*===========================================================================*/
-PRIVATE int cons_ioctl(tty_t *tp, int UNUSED(try))
+static int cons_ioctl(tty_t *tp, int UNUSED(try))
{
/* Set the screen dimensions. */
/*===========================================================================*
* mem_vid_copy *
*===========================================================================*/
-PRIVATE void mem_vid_copy(vir_bytes src, int dst_index, int count)
+static void mem_vid_copy(vir_bytes src, int dst_index, int count)
{
u16_t *src_mem = (u16_t *) src;
while(count > 0) {
/*===========================================================================*
* vid_vid_copy *
*===========================================================================*/
-PRIVATE void vid_vid_copy(int src_index, int dst_index, int count)
+static void vid_vid_copy(int src_index, int dst_index, int count)
{
int backwards = 0;
if(src_index < dst_index)
#include "kernel/type.h"
#include "kernel/proc.h"
-PRIVATE u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
+static u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
#include "keymaps/us-std.src"
};
-PRIVATE u16_t keymap_escaped[NR_SCAN_CODES * MAP_COLS] = {
+static u16_t keymap_escaped[NR_SCAN_CODES * MAP_COLS] = {
#include "keymaps/us-std-esc.src"
};
-PRIVATE int irq_hook_id = -1;
-PRIVATE int aux_irq_hook_id = -1;
+static int irq_hook_id = -1;
+static int aux_irq_hook_id = -1;
/* Standard and AT keyboard. (PS/2 MCA implies AT throughout.) */
#define KEYBD 0x60 /* I/O port for keyboard data */
#define CONSOLE 0 /* line number for console */
#define KB_IN_BYTES 32 /* size of keyboard input buffer */
-PRIVATE char injbuf[KB_IN_BYTES];
-PRIVATE char *injhead = injbuf;
-PRIVATE char *injtail = injbuf;
-PRIVATE int injcount;
-
-PRIVATE char ibuf[KB_IN_BYTES]; /* input buffer */
-PRIVATE char *ihead = ibuf; /* next free spot in input buffer */
-PRIVATE char *itail = ibuf; /* scan code to return to TTY */
-PRIVATE int icount; /* # codes in buffer */
-
-PRIVATE int esc; /* escape scan code detected? */
-PRIVATE int alt_l; /* left alt key state */
-PRIVATE int alt_r; /* right alt key state */
-PRIVATE int alt; /* either alt key */
-PRIVATE int ctrl_l; /* left control key state */
-PRIVATE int ctrl_r; /* right control key state */
-PRIVATE int ctrl; /* either control key */
-PRIVATE int shift_l; /* left shift key state */
-PRIVATE int shift_r; /* right shift key state */
-PRIVATE int shift; /* either shift key */
-PRIVATE int num_down; /* num lock key depressed */
-PRIVATE int caps_down; /* caps lock key depressed */
-PRIVATE int scroll_down; /* scroll lock key depressed */
-PRIVATE int alt_down; /* alt key depressed */
-PRIVATE int locks[NR_CONS]; /* per console lock keys state */
+static char injbuf[KB_IN_BYTES];
+static char *injhead = injbuf;
+static char *injtail = injbuf;
+static int injcount;
+
+static char ibuf[KB_IN_BYTES]; /* input buffer */
+static char *ihead = ibuf; /* next free spot in input buffer */
+static char *itail = ibuf; /* scan code to return to TTY */
+static int icount; /* # codes in buffer */
+
+static int esc; /* escape scan code detected? */
+static int alt_l; /* left alt key state */
+static int alt_r; /* right alt key state */
+static int alt; /* either alt key */
+static int ctrl_l; /* left control key state */
+static int ctrl_r; /* right control key state */
+static int ctrl; /* either control key */
+static int shift_l; /* left shift key state */
+static int shift_r; /* right shift key state */
+static int shift; /* either shift key */
+static int num_down; /* num lock key depressed */
+static int caps_down; /* caps lock key depressed */
+static int scroll_down; /* scroll lock key depressed */
+static int alt_down; /* alt key depressed */
+static int locks[NR_CONS]; /* per console lock keys state */
/* Lock key active bits. Chosen to be equal to the keyboard LED bits. */
#define SCROLL_LOCK 0x01
#define CAPS_LOCK 0x04
#define ALT_LOCK 0x08
-PRIVATE char numpad_map[12] =
+static char numpad_map[12] =
{'H', 'Y', 'A', 'B', 'D', 'C', 'V', 'U', 'G', 'S', 'T', '@'};
-PRIVATE char *fkey_map[12] =
+static char *fkey_map[12] =
{"11", "12", "13", "14", "15", "17", /* F1-F6 */
"18", "19", "20", "21", "23", "24"}; /* F7-F12 */
/* Variables and definition for observed function keys. */
typedef struct observer { int proc_nr; int events; } obs_t;
-PRIVATE obs_t fkey_obs[12]; /* observers for F1-F12 */
-PRIVATE obs_t sfkey_obs[12]; /* observers for SHIFT F1-F12 */
+static obs_t fkey_obs[12]; /* observers for F1-F12 */
+static obs_t sfkey_obs[12]; /* observers for SHIFT F1-F12 */
-PRIVATE struct kbd
+static struct kbd
{
int minor;
int nr_open;
/* Data that is to be sent to the keyboard. Each byte is ACKed by the
* keyboard.
*/
-PRIVATE struct kbd_outack
+static struct kbd_outack
{
unsigned char buf[KBD_OUT_BUFSZ];
int offset;
int expect_ack;
} kbdout;
-PRIVATE int kbd_watchdog_set= 0;
-PRIVATE int kbd_alive= 1;
-PRIVATE long sticky_alt_mode = 0;
-PRIVATE long debug_fkeys = 1;
-PRIVATE timer_t tmr_kbd_wd;
-
-FORWARD void handle_req(struct kbd *kbdp, message *m);
-FORWARD int handle_status(struct kbd *kbdp, message *m);
-FORWARD void kbc_cmd0(int cmd);
-FORWARD void kbc_cmd1(int cmd, int data);
-FORWARD int kbc_read(void);
-FORWARD void kbd_send(void);
-FORWARD int kb_ack(void);
-FORWARD int kb_wait(void);
-FORWARD int func_key(int scode);
-FORWARD int scan_keyboard(unsigned char *bp, int *isauxp);
-FORWARD unsigned make_break(int scode);
-FORWARD void set_leds(void);
-FORWARD void show_key_mappings(void);
-FORWARD int kb_read(struct tty *tp, int try);
-FORWARD unsigned map_key(int scode);
-FORWARD void kbd_watchdog(timer_t *tmrp);
+static int kbd_watchdog_set= 0;
+static int kbd_alive= 1;
+static long sticky_alt_mode = 0;
+static long debug_fkeys = 1;
+static timer_t tmr_kbd_wd;
+
+static void handle_req(struct kbd *kbdp, message *m);
+static int handle_status(struct kbd *kbdp, message *m);
+static void kbc_cmd0(int cmd);
+static void kbc_cmd1(int cmd, int data);
+static int kbc_read(void);
+static void kbd_send(void);
+static int kb_ack(void);
+static int kb_wait(void);
+static int func_key(int scode);
+static int scan_keyboard(unsigned char *bp, int *isauxp);
+static unsigned make_break(int scode);
+static void set_leds(void);
+static void show_key_mappings(void);
+static int kb_read(struct tty *tp, int try);
+static unsigned map_key(int scode);
+static void kbd_watchdog(timer_t *tmrp);
int micro_delay(u32_t usecs)
{
/*===========================================================================*
* do_kbd *
*===========================================================================*/
-PUBLIC void do_kbd(message *m)
+void do_kbd(message *m)
{
handle_req(&kbd, m);
}
/*===========================================================================*
* kbd_status *
*===========================================================================*/
-PUBLIC int kbd_status(message *m)
+int kbd_status(message *m)
{
int r;
/*===========================================================================*
* do_kbdaux *
*===========================================================================*/
-PUBLIC void do_kbdaux(message *m)
+void do_kbdaux(message *m)
{
handle_req(&kbdaux, m);
}
/*===========================================================================*
* handle_req *
*===========================================================================*/
-PRIVATE void handle_req(kbdp, m)
+static void handle_req(kbdp, m)
struct kbd *kbdp;
message *m;
{
/*===========================================================================*
* handle_status *
*===========================================================================*/
-PRIVATE int handle_status(kbdp, m)
+static int handle_status(kbdp, m)
struct kbd *kbdp;
message *m;
{
/*===========================================================================*
* map_key *
*===========================================================================*/
-PRIVATE unsigned map_key(scode)
+static unsigned map_key(scode)
int scode;
{
/* Map a scan code to an ASCII code. */
/*===========================================================================*
* kbd_interrupt *
*===========================================================================*/
-PUBLIC void kbd_interrupt(message *UNUSED(m_ptr))
+void kbd_interrupt(message *UNUSED(m_ptr))
{
/* A keyboard interrupt has occurred. Process it. */
int o, isaux;
}
-PUBLIC void do_kb_inject(message *msg)
+void do_kb_inject(message *msg)
{
unsigned char scode;
/* only handle keyboard events */
/*===========================================================================*
* kb_read *
*===========================================================================*/
-PRIVATE int kb_read(tp, try)
+static int kb_read(tp, try)
tty_t *tp;
int try;
{
/*===========================================================================*
* kbd_send *
*===========================================================================*/
-PRIVATE void kbd_send()
+static void kbd_send()
{
u32_t sb;
int r;
/*===========================================================================*
* make_break *
*===========================================================================*/
-PRIVATE unsigned make_break(scode)
+static unsigned make_break(scode)
int scode; /* scan code of key just struck or released */
{
/* This routine can handle keyboards that interrupt only on key depression,
/*===========================================================================*
* set_leds *
*===========================================================================*/
-PRIVATE void set_leds()
+static void set_leds()
{
/* Set the LEDs on the caps, num, and scroll lock keys */
int s;
/*===========================================================================*
* kbc_cmd0 *
*===========================================================================*/
-PRIVATE void kbc_cmd0(cmd)
+static void kbc_cmd0(cmd)
int cmd;
{
kb_wait();
/*===========================================================================*
* kbc_cmd1 *
*===========================================================================*/
-PRIVATE void kbc_cmd1(cmd, data)
+static void kbc_cmd1(cmd, data)
int cmd;
int data;
{
/*===========================================================================*
* kbc_read *
*===========================================================================*/
-PRIVATE int kbc_read()
+static int kbc_read()
{
int i;
u32_t byte, st;
/*===========================================================================*
* kb_wait *
*===========================================================================*/
-PRIVATE int kb_wait()
+static int kb_wait()
{
/* Wait until the controller is ready; return zero if this times out. */
/*===========================================================================*
* kb_ack *
*===========================================================================*/
-PRIVATE int kb_ack()
+static int kb_ack()
{
/* Wait until kbd acknowledges last command; return zero if this times out. */
/*===========================================================================*
* kb_init *
*===========================================================================*/
-PUBLIC void kb_init(tp)
+void kb_init(tp)
tty_t *tp;
{
/* Initialize the keyboard driver. */
/*===========================================================================*
* kb_init_once *
*===========================================================================*/
-PUBLIC void kb_init_once(void)
+void kb_init_once(void)
{
int i;
u8_t ccb;
/*===========================================================================*
* kbd_loadmap *
*===========================================================================*/
-PUBLIC int kbd_loadmap(m)
+int kbd_loadmap(m)
message *m;
{
/* Load a new keymap. */
/*===========================================================================*
* do_fkey_ctl *
*===========================================================================*/
-PUBLIC void do_fkey_ctl(m_ptr)
+void do_fkey_ctl(m_ptr)
message *m_ptr; /* pointer to the request message */
{
/* This procedure allows processes to register a function key to receive
/*===========================================================================*
* func_key *
*===========================================================================*/
-PRIVATE int func_key(scode)
+static int func_key(scode)
int scode; /* scan code for a function key */
{
/* This procedure traps function keys for debugging purposes. Observers of
/*===========================================================================*
* show_key_mappings *
*===========================================================================*/
-PRIVATE void show_key_mappings()
+static void show_key_mappings()
{
int i,s;
struct proc proc;
/*===========================================================================*
* scan_keyboard *
*===========================================================================*/
-PRIVATE int scan_keyboard(bp, isauxp)
+static int scan_keyboard(bp, isauxp)
unsigned char *bp;
int *isauxp;
{
/*===========================================================================*
* kbd_watchdog *
*===========================================================================*/
-PRIVATE void kbd_watchdog(timer_t *UNUSED(tmrp))
+static void kbd_watchdog(timer_t *UNUSED(tmrp))
{
kbd_watchdog_set= 0;
#define TTY_CLOSED 0x02 /* tty side has closed down */
#define PTY_CLOSED 0x04 /* pty side has closed down */
-PRIVATE pty_t pty_table[NR_PTYS]; /* PTY bookkeeping */
-
-FORWARD int pty_write(tty_t *tp, int try);
-FORWARD void pty_echo(tty_t *tp, int c);
-FORWARD void pty_start(pty_t *pp);
-FORWARD void pty_finish(pty_t *pp);
-FORWARD int pty_read(tty_t *tp, int try);
-FORWARD int pty_close(tty_t *tp, int try);
-FORWARD int pty_icancel(tty_t *tp, int try);
-FORWARD int pty_ocancel(tty_t *tp, int try);
-FORWARD int pty_select(tty_t *tp, message *m);
+static pty_t pty_table[NR_PTYS]; /* PTY bookkeeping */
+
+static int pty_write(tty_t *tp, int try);
+static void pty_echo(tty_t *tp, int c);
+static void pty_start(pty_t *pp);
+static void pty_finish(pty_t *pp);
+static int pty_read(tty_t *tp, int try);
+static int pty_close(tty_t *tp, int try);
+static int pty_icancel(tty_t *tp, int try);
+static int pty_ocancel(tty_t *tp, int try);
+static int pty_select(tty_t *tp, message *m);
/*===========================================================================*
* do_pty *
*===========================================================================*/
-PUBLIC void do_pty(tty_t *tp, message *m_ptr)
+void do_pty(tty_t *tp, message *m_ptr)
{
/* Perform an open/close/read/write call on a /dev/ptypX device. */
pty_t *pp = tp->tty_priv;
/*===========================================================================*
* pty_write *
*===========================================================================*/
-PRIVATE int pty_write(tty_t *tp, int try)
+static int pty_write(tty_t *tp, int try)
{
/* (*dev_write)() routine for PTYs. Transfer bytes from the writer on
* /dev/ttypX to the output buffer.
/*===========================================================================*
* pty_echo *
*===========================================================================*/
-PRIVATE void pty_echo(tty_t *tp, int c)
+static void pty_echo(tty_t *tp, int c)
{
/* Echo one character. (Like pty_write, but only one character, optionally.) */
/*===========================================================================*
* pty_start *
*===========================================================================*/
-PRIVATE void pty_start(pty_t *pp)
+static void pty_start(pty_t *pp)
{
/* Transfer bytes written to the output buffer to the PTY reader. */
int count;
/*===========================================================================*
* pty_finish *
*===========================================================================*/
-PRIVATE void pty_finish(pty_t *pp)
+static void pty_finish(pty_t *pp)
{
/* Finish the read request of a PTY reader if there is at least one byte
* transferred.
/*===========================================================================*
* pty_read *
*===========================================================================*/
-PRIVATE int pty_read(tty_t *tp, int try)
+static int pty_read(tty_t *tp, int try)
{
/* Offer bytes from the PTY writer for input on the TTY. (Do it one byte at
* a time, 99% of the writes will be for one byte, so no sense in being smart.)
/*===========================================================================*
* pty_close *
*===========================================================================*/
-PRIVATE int pty_close(tty_t *tp, int UNUSED(try))
+static int pty_close(tty_t *tp, int UNUSED(try))
{
/* The tty side has closed, so shut down the pty side. */
pty_t *pp = tp->tty_priv;
/*===========================================================================*
* pty_icancel *
*===========================================================================*/
-PRIVATE int pty_icancel(tty_t *tp, int UNUSED(try))
+static int pty_icancel(tty_t *tp, int UNUSED(try))
{
/* Discard waiting input. */
pty_t *pp = tp->tty_priv;
/*===========================================================================*
* pty_ocancel *
*===========================================================================*/
-PRIVATE int pty_ocancel(tty_t *tp, int UNUSED(try))
+static int pty_ocancel(tty_t *tp, int UNUSED(try))
{
/* Drain the output buffer. */
pty_t *pp = tp->tty_priv;
/*===========================================================================*
* pty_init *
*===========================================================================*/
-PUBLIC void pty_init(tty_t *tp)
+void pty_init(tty_t *tp)
{
pty_t *pp;
int line;
/*===========================================================================*
* pty_status *
*===========================================================================*/
-PUBLIC int pty_status(message *m_ptr)
+int pty_status(message *m_ptr)
{
int i, event_found;
pty_t *pp;
/*===========================================================================*
* select_try_pty *
*===========================================================================*/
-PRIVATE int select_try_pty(tty_t *tp, int ops)
+static int select_try_pty(tty_t *tp, int ops)
{
pty_t *pp = tp->tty_priv;
int r = 0;
/*===========================================================================*
* select_retry_pty *
*===========================================================================*/
-PUBLIC void select_retry_pty(tty_t *tp)
+void select_retry_pty(tty_t *tp)
{
pty_t *pp = tp->tty_priv;
int r;
/*===========================================================================*
* pty_select *
*===========================================================================*/
-PRIVATE int pty_select(tty_t *tp, message *m)
+static int pty_select(tty_t *tp, message *m)
{
pty_t *pp = tp->tty_priv;
int ops, ready_ops = 0, watch;
char obuf[RS_OBUFSIZE]; /* output buffer */
} rs232_t;
-PRIVATE rs232_t rs_lines[NR_RS_LINES];
+static rs232_t rs_lines[NR_RS_LINES];
#if (MACHINE == IBM_PC)
/* 8250 base addresses. */
-PRIVATE port_t addr_8250[] = {
+static port_t addr_8250[] = {
0x3F8, /* COM1 */
0x2F8, /* COM2 */
0x3E8, /* COM3 */
};
#endif
-FORWARD void in_int(rs232_t *rs);
-FORWARD void line_int(rs232_t *rs);
-FORWARD void modem_int(rs232_t *rs);
-FORWARD int rs_write(tty_t *tp, int try);
-FORWARD void rs_echo(tty_t *tp, int c);
-FORWARD int rs_ioctl(tty_t *tp, int try);
-FORWARD void rs_config(rs232_t *rs);
-FORWARD int rs_read(tty_t *tp, int try);
-FORWARD int rs_icancel(tty_t *tp, int try);
-FORWARD int rs_ocancel(tty_t *tp, int try);
-FORWARD void rs_ostart(rs232_t *rs);
-FORWARD int rs_break(tty_t *tp, int try);
-FORWARD int rs_close(tty_t *tp, int try);
-FORWARD void out_int(rs232_t *rs);
-FORWARD void rs232_handler(rs232_t *rs);
+static void in_int(rs232_t *rs);
+static void line_int(rs232_t *rs);
+static void modem_int(rs232_t *rs);
+static int rs_write(tty_t *tp, int try);
+static void rs_echo(tty_t *tp, int c);
+static int rs_ioctl(tty_t *tp, int try);
+static void rs_config(rs232_t *rs);
+static int rs_read(tty_t *tp, int try);
+static int rs_icancel(tty_t *tp, int try);
+static int rs_ocancel(tty_t *tp, int try);
+static void rs_ostart(rs232_t *rs);
+static int rs_break(tty_t *tp, int try);
+static int rs_close(tty_t *tp, int try);
+static void out_int(rs232_t *rs);
+static void rs232_handler(rs232_t *rs);
/* XXX */
-PRIVATE void lock(void) {}
-PRIVATE void unlock(void) {}
+static void lock(void) {}
+static void unlock(void) {}
-PRIVATE int my_inb(port_t port)
+static int my_inb(port_t port)
{
int r;
u32_t v = 0;
/*===========================================================================*
* rs_write *
*===========================================================================*/
-PRIVATE int rs_write(register tty_t *tp, int try)
+static int rs_write(register tty_t *tp, int try)
{
/* (*devwrite)() routine for RS232. */
/*===========================================================================*
* rs_echo *
*===========================================================================*/
-PRIVATE void rs_echo(tp, c)
+static void rs_echo(tp, c)
tty_t *tp; /* which TTY */
int c; /* character to echo */
{
/*===========================================================================*
* rs_ioctl *
*===========================================================================*/
-PRIVATE int rs_ioctl(tty_t *tp, int UNUSED(dummy))
+static int rs_ioctl(tty_t *tp, int UNUSED(dummy))
/* tp; which TTY */
{
/* Reconfigure the line as soon as the output has drained. */
/*===========================================================================*
* rs_config *
*===========================================================================*/
-PRIVATE void rs_config(rs232_t *rs)
+static void rs_config(rs232_t *rs)
/* rs which line */
{
/* Set various line control parameters for RS232 I/O.
/*===========================================================================*
* rs_init *
*===========================================================================*/
-PUBLIC void rs_init(tty_t *tp)
+void rs_init(tty_t *tp)
/* tp which TTY */
{
u32_t dummy;
/*===========================================================================*
* rs_interrupt *
*===========================================================================*/
-PUBLIC void rs_interrupt(message *m)
+void rs_interrupt(message *m)
{
unsigned long irq_set;
int i;
/*===========================================================================*
* rs_icancel *
*===========================================================================*/
-PRIVATE int rs_icancel(tty_t *tp, int UNUSED(dummy))
+static int rs_icancel(tty_t *tp, int UNUSED(dummy))
{
/* Cancel waiting input. */
rs232_t *rs = tp->tty_priv;
/*===========================================================================*
* rs_ocancel *
*===========================================================================*/
-PRIVATE int rs_ocancel(tty_t *tp, int UNUSED(dummy))
+static int rs_ocancel(tty_t *tp, int UNUSED(dummy))
{
/* Cancel pending output. */
rs232_t *rs = tp->tty_priv;
/*===========================================================================*
* rs_read *
*===========================================================================*/
-PRIVATE int rs_read(tty_t *tp, int try)
+static int rs_read(tty_t *tp, int try)
{
/* Process characters from the circular input buffer. */
/*===========================================================================*
* rs_ostart *
*===========================================================================*/
-PRIVATE void rs_ostart(rs232_t *rs)
+static void rs_ostart(rs232_t *rs)
{
/* Tell RS232 there is something waiting in the output buffer. */
/*===========================================================================*
* rs_break *
*===========================================================================*/
-PRIVATE int rs_break(tty_t *tp, int UNUSED(dummy))
+static int rs_break(tty_t *tp, int UNUSED(dummy))
{
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
rs232_t *rs = tp->tty_priv;
/*===========================================================================*
* rs_close *
*===========================================================================*/
-PRIVATE int rs_close(tty_t *tp, int UNUSED(dummy))
+static int rs_close(tty_t *tp, int UNUSED(dummy))
{
/* The line is closed; optionally hang up. */
rs232_t *rs = tp->tty_priv;
/*===========================================================================*
* rs232_handler *
*===========================================================================*/
-PRIVATE void rs232_handler(struct rs232 *rs)
+static void rs232_handler(struct rs232 *rs)
{
/* Interrupt hander for RS232. */
/*===========================================================================*
* in_int *
*===========================================================================*/
-PRIVATE void in_int(register rs232_t *rs)
+static void in_int(register rs232_t *rs)
/* rs line with input interrupt */
{
/* Read the data which just arrived.
/*===========================================================================*
* line_int *
*===========================================================================*/
-PRIVATE void line_int(register rs232_t *rs)
+static void line_int(register rs232_t *rs)
/* rs line with line status interrupt */
{
/* Check for and record errors. */
/*===========================================================================*
* modem_int *
*===========================================================================*/
-PRIVATE void modem_int(register rs232_t *rs)
+static void modem_int(register rs232_t *rs)
/* rs line with modem interrupt */
{
/* Get possibly new device-ready status, and clear ODEVREADY if necessary.
/*===========================================================================*
* out_int *
*===========================================================================*/
-PRIVATE void out_int(register rs232_t *rs)
+static void out_int(register rs232_t *rs)
/* rs; line with output interrupt */
{
/* If there is output to do and everything is ready, do it (local device is
struct kmessages kmess;
-FORWARD void tty_timed_out(timer_t *tp);
-FORWARD void settimer(tty_t *tty_ptr, int enable);
-FORWARD void do_cancel(tty_t *tp, message *m_ptr);
-FORWARD void do_ioctl(tty_t *tp, message *m_ptr);
-FORWARD void do_open(tty_t *tp, message *m_ptr);
-FORWARD void do_close(tty_t *tp, message *m_ptr);
-FORWARD void do_read(tty_t *tp, message *m_ptr);
-FORWARD void do_write(tty_t *tp, message *m_ptr);
-FORWARD void do_select(tty_t *tp, message *m_ptr);
-FORWARD void do_status(message *m_ptr);
-FORWARD void in_transfer(tty_t *tp);
-FORWARD int tty_echo(tty_t *tp, int ch);
-FORWARD void rawecho(tty_t *tp, int ch);
-FORWARD int back_over(tty_t *tp);
-FORWARD void reprint(tty_t *tp);
-FORWARD void dev_ioctl(tty_t *tp);
-FORWARD void setattr(tty_t *tp);
-FORWARD void tty_icancel(tty_t *tp);
-FORWARD void tty_init(void);
+static void tty_timed_out(timer_t *tp);
+static void settimer(tty_t *tty_ptr, int enable);
+static void do_cancel(tty_t *tp, message *m_ptr);
+static void do_ioctl(tty_t *tp, message *m_ptr);
+static void do_open(tty_t *tp, message *m_ptr);
+static void do_close(tty_t *tp, message *m_ptr);
+static void do_read(tty_t *tp, message *m_ptr);
+static void do_write(tty_t *tp, message *m_ptr);
+static void do_select(tty_t *tp, message *m_ptr);
+static void do_status(message *m_ptr);
+static void in_transfer(tty_t *tp);
+static int tty_echo(tty_t *tp, int ch);
+static void rawecho(tty_t *tp, int ch);
+static int back_over(tty_t *tp);
+static void reprint(tty_t *tp);
+static void dev_ioctl(tty_t *tp);
+static void setattr(tty_t *tp);
+static void tty_icancel(tty_t *tp);
+static void tty_init(void);
/* Default attributes. */
-PRIVATE struct termios termios_defaults = {
+static struct termios termios_defaults = {
TINPUT_DEF, TOUTPUT_DEF, TCTRL_DEF, TLOCAL_DEF, TSPEED_DEF, TSPEED_DEF,
{
TEOF_DEF, TEOL_DEF, TERASE_DEF, TINTR_DEF, TKILL_DEF, TMIN_DEF,
TREPRINT_DEF, TLNEXT_DEF, TDISCARD_DEF,
},
};
-PRIVATE struct winsize winsize_defaults; /* = all zeroes */
+static struct winsize winsize_defaults; /* = all zeroes */
/* Global variables for the TTY task (declared extern in tty.h). */
-PUBLIC tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
-PUBLIC int ccurrent; /* currently active console */
-PUBLIC struct machine machine; /* kernel environment variables */
-PUBLIC u32_t system_hz;
+tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
+int ccurrent; /* currently active console */
+struct machine machine; /* kernel environment variables */
+u32_t system_hz;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* tty_task *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* Main routine of the terminal task. */
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the tty driver. */
int r;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Check for known signals, ignore anything else. */
switch(signo) {
/*===========================================================================*
* do_status *
*===========================================================================*/
-PRIVATE void do_status(m_ptr)
+static void do_status(m_ptr)
message *m_ptr;
{
register struct tty *tp;
/*===========================================================================*
* do_read *
*===========================================================================*/
-PRIVATE void do_read(tp, m_ptr)
+static void do_read(tp, m_ptr)
register tty_t *tp; /* pointer to tty struct */
register message *m_ptr; /* pointer to message sent to the task */
{
/*===========================================================================*
* do_write *
*===========================================================================*/
-PRIVATE void do_write(tp, m_ptr)
+static void do_write(tp, m_ptr)
register tty_t *tp;
register message *m_ptr; /* pointer to message sent to the task */
{
/*===========================================================================*
* do_ioctl *
*===========================================================================*/
-PRIVATE void do_ioctl(tp, m_ptr)
+static void do_ioctl(tp, m_ptr)
register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */
{
/*===========================================================================*
* do_open *
*===========================================================================*/
-PRIVATE void do_open(tp, m_ptr)
+static void do_open(tp, m_ptr)
register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */
{
/*===========================================================================*
* do_close *
*===========================================================================*/
-PRIVATE void do_close(tp, m_ptr)
+static void do_close(tp, m_ptr)
register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */
{
/*===========================================================================*
* do_cancel *
*===========================================================================*/
-PRIVATE void do_cancel(tp, m_ptr)
+static void do_cancel(tp, m_ptr)
register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */
{
tty_reply(TASK_REPLY, m_ptr->m_source, proc_nr, r);
}
-PUBLIC int select_try(struct tty *tp, int ops)
+int select_try(struct tty *tp, int ops)
{
int ready_ops = 0;
return ready_ops;
}
-PUBLIC int select_retry(struct tty *tp)
+int select_retry(struct tty *tp)
{
if (tp->tty_select_ops && select_try(tp, tp->tty_select_ops))
notify(tp->tty_select_proc);
/*===========================================================================*
* handle_events *
*===========================================================================*/
-PUBLIC void handle_events(tp)
+void handle_events(tp)
tty_t *tp; /* TTY to check for events. */
{
/* Handle any events pending on a TTY. These events are usually device
/*===========================================================================*
* in_transfer *
*===========================================================================*/
-PRIVATE void in_transfer(tp)
+static void in_transfer(tp)
register tty_t *tp; /* pointer to terminal to read from */
{
/* Transfer bytes from the input queue to a process reading from a terminal. */
/*===========================================================================*
* in_process *
*===========================================================================*/
-PRIVATE void in_process_send_byte(
+static void in_process_send_byte(
tty_t *tp, /* terminal on which character has arrived */
int ch /* input character */
)
if (tp->tty_incount == buflen(tp->tty_inbuf)) in_transfer(tp);
}
-PUBLIC int in_process(tp, buf, count, scode)
+int in_process(tp, buf, count, scode)
register tty_t *tp; /* terminal on which character has arrived */
char *buf; /* buffer with input characters */
int count; /* number of input characters */
/*===========================================================================*
* echo *
*===========================================================================*/
-PRIVATE int tty_echo(tp, ch)
+static int tty_echo(tp, ch)
register tty_t *tp; /* terminal on which to echo */
register int ch; /* pointer to character to echo */
{
/*===========================================================================*
* rawecho *
*===========================================================================*/
-PRIVATE void rawecho(tp, ch)
+static void rawecho(tp, ch)
register tty_t *tp;
int ch;
{
/*===========================================================================*
* back_over *
*===========================================================================*/
-PRIVATE int back_over(tp)
+static int back_over(tp)
register tty_t *tp;
{
/* Backspace to previous character on screen and erase it. */
/*===========================================================================*
* reprint *
*===========================================================================*/
-PRIVATE void reprint(tp)
+static void reprint(tp)
register tty_t *tp; /* pointer to tty struct */
{
/* Restore what has been echoed to screen before if the user input has been
/*===========================================================================*
* out_process *
*===========================================================================*/
-PUBLIC void out_process(tp, bstart, bpos, bend, icount, ocount)
+void out_process(tp, bstart, bpos, bend, icount, ocount)
tty_t *tp;
char *bstart, *bpos, *bend; /* start/pos/end of circular buffer */
int *icount; /* # input chars / input chars used */
/*===========================================================================*
* dev_ioctl *
*===========================================================================*/
-PRIVATE void dev_ioctl(tp)
+static void dev_ioctl(tp)
tty_t *tp;
{
/* The ioctl's TCSETSW, TCSETSF and TCDRAIN wait for output to finish to make
/*===========================================================================*
* setattr *
*===========================================================================*/
-PRIVATE void setattr(tp)
+static void setattr(tp)
tty_t *tp;
{
/* Apply the new line attributes (raw/canonical, line speed, etc.) */
/*===========================================================================*
* tty_reply *
*===========================================================================*/
-PUBLIC void
+void
tty_reply_f(
file, line, code, replyee, proc_nr, status)
char *file;
/*===========================================================================*
* sigchar *
*===========================================================================*/
-PUBLIC void sigchar(tp, sig, mayflush)
+void sigchar(tp, sig, mayflush)
register tty_t *tp;
int sig; /* SIGINT, SIGQUIT, SIGKILL or SIGHUP */
int mayflush;
/*===========================================================================*
* tty_icancel *
*===========================================================================*/
-PRIVATE void tty_icancel(tp)
+static void tty_icancel(tp)
register tty_t *tp;
{
/* Discard all pending input, tty buffer or device. */
/*===========================================================================*
* tty_devnop *
*===========================================================================*/
-PRIVATE int tty_devnop(tty_t *UNUSED(tp), int UNUSED(try))
+static int tty_devnop(tty_t *UNUSED(tp), int UNUSED(try))
{
/* Some functions need not be implemented at the device level. */
return 0;
/*===========================================================================*
* tty_init *
*===========================================================================*/
-PRIVATE void tty_init()
+static void tty_init()
{
/* Initialize tty structure and call device initialization routines. */
/*===========================================================================*
* tty_timed_out *
*===========================================================================*/
-PRIVATE void tty_timed_out(timer_t *tp)
+static void tty_timed_out(timer_t *tp)
{
/* This timer has expired. Set the events flag, to force processing. */
tty_t *tty_ptr;
/*===========================================================================*
* settimer *
*===========================================================================*/
-PRIVATE void settimer(tty_ptr, enable)
+static void settimer(tty_ptr, enable)
tty_t *tty_ptr; /* line to set or unset a timer on */
int enable; /* set timer if true, otherwise unset */
{
/*===========================================================================*
* do_select *
*===========================================================================*/
-PRIVATE void do_select(tp, m_ptr)
+static void do_select(tp, m_ptr)
register tty_t *tp; /* pointer to tty struct */
register message *m_ptr; /* pointer to message sent to the task */
{
#define DEFAULT_INTERVAL 1 /* check host time every second */
#define DEFAULT_DRIFT 2 /* update time if delta is >= 2 secs */
-PRIVATE void *vir_ptr;
-PRIVATE phys_bytes phys_ptr;
-PRIVATE port_t port;
-PRIVATE u32_t ticks;
-PRIVATE int interval;
-PRIVATE int drift;
-
-PRIVATE struct optset optset_table[] = {
+static void *vir_ptr;
+static phys_bytes phys_ptr;
+static port_t port;
+static u32_t ticks;
+static int interval;
+static int drift;
+
+static struct optset optset_table[] = {
{ "interval", OPT_INT, &interval, 10 },
{ "drift", OPT_INT, &drift, 10 },
{ NULL, 0, NULL, 0 }
/*===========================================================================*
* vbox_request *
*===========================================================================*/
-PRIVATE int vbox_request(int req_nr, size_t size)
+static int vbox_request(int req_nr, size_t size)
{
/* Perform a VirtualBox backdoor request. */
struct VMMDevRequestHeader *hdr;
/*===========================================================================*
* vbox_init *
*===========================================================================*/
-PRIVATE int vbox_init(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int vbox_init(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the device. */
int devind;
/*===========================================================================*
* vbox_update_time *
*===========================================================================*/
-PRIVATE void vbox_update_time(void)
+static void vbox_update_time(void)
{
/* Update the current time if it has drifted too far. */
struct VMMDevReqHostTime *req;
/*===========================================================================*
* vbox_signal *
*===========================================================================*/
-PRIVATE void vbox_signal(int signo)
+static void vbox_signal(int signo)
{
/* Process a signal. If it is a SIGTERM, terminate immediately. */
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Perform local SEF initialization. */
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* The main message loop. */
message m;
#endif
#define EXTERN extern /* used in *.h files */
-#define PRIVATE static /* PRIVATE x limits the scope of x */
-#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
-#define FORWARD static /* some compilers require this to be 'static'*/
#define TRUE 1 /* used for turning integers into Booleans */
#define FALSE 0 /* used for turning integers into Booleans */
struct acpi_rsdp acpi_rsdp;
-PRIVATE acpi_read_t read_func;
+static acpi_read_t read_func;
#define MAX_RSDT 35 /* ACPI defines 35 signatures */
-PRIVATE struct acpi_rsdt {
+static struct acpi_rsdt {
struct acpi_sdt_header hdr;
u32_t data[MAX_RSDT];
} rsdt;
-PRIVATE struct {
+static struct {
char signature [ACPI_SDT_SIGNATURE_LEN + 1];
size_t length;
} sdt_trans[MAX_RSDT];
-PRIVATE int sdt_count;
+static int sdt_count;
-PRIVATE int acpi_check_csum(struct acpi_sdt_header * tb, size_t size)
+static int acpi_check_csum(struct acpi_sdt_header * tb, size_t size)
{
u8_t total = 0;
int i;
return total == 0 ? 0 : -1;
}
-PRIVATE int acpi_check_signature(const char * orig, const char * match)
+static int acpi_check_signature(const char * orig, const char * match)
{
return strncmp(orig, match, ACPI_SDT_SIGNATURE_LEN);
}
-PRIVATE int acpi_read_sdt_at(phys_bytes addr,
+static int acpi_read_sdt_at(phys_bytes addr,
struct acpi_sdt_header * tb,
size_t size,
const char * name)
return tb->length;
}
-PUBLIC phys_bytes acpi_get_table_base(const char * name)
+phys_bytes acpi_get_table_base(const char * name)
{
int i;
return (phys_bytes) NULL;
}
-PUBLIC size_t acpi_get_table_length(const char * name)
+size_t acpi_get_table_length(const char * name)
{
int i;
return 0;
}
-PRIVATE void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
+static void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
unsigned char type,
unsigned idx)
{
}
#if 0
-PRIVATE void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
+static void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
unsigned idx)
{
u8_t * t, * end;
}
#endif
-PRIVATE int acpi_rsdp_test(void * buff)
+static int acpi_rsdp_test(void * buff)
{
struct acpi_rsdp * rsdp = (struct acpi_rsdp *) buff;
return 1;
}
-PRIVATE int get_acpi_rsdp(void)
+static int get_acpi_rsdp(void)
{
u16_t ebda;
/*
return 0;
}
-PRIVATE int acpi_read_kernel(phys_bytes addr, void * buff, size_t size)
+static int acpi_read_kernel(phys_bytes addr, void * buff, size_t size)
{
phys_copy(addr, vir2phys(buff), size);
return 0;
}
-PUBLIC void acpi_init(void)
+void acpi_init(void)
{
int s, i;
read_func = acpi_read_kernel;
}
}
-PUBLIC struct acpi_madt_ioapic * acpi_get_ioapic_next(void)
+struct acpi_madt_ioapic * acpi_get_ioapic_next(void)
{
static unsigned idx = 0;
static struct acpi_madt_hdr * madt_hdr;
return ret;
}
-PUBLIC struct acpi_madt_lapic * acpi_get_lapic_next(void)
+struct acpi_madt_lapic * acpi_get_lapic_next(void)
{
static unsigned idx = 0;
static struct acpi_madt_hdr * madt_hdr;
#define SPLHI 0xF
-PUBLIC struct io_apic io_apic[MAX_NR_IOAPICS];
-PUBLIC unsigned nioapics;
+struct io_apic io_apic[MAX_NR_IOAPICS];
+unsigned nioapics;
struct irq;
typedef void (* eoi_method_t)(struct irq *);
unsigned state;
};
-PRIVATE struct irq io_apic_irq[NR_IRQ_VECTORS];
+static struct irq io_apic_irq[NR_IRQ_VECTORS];
/*
* to make APIC work if SMP is not configured, we need to set the maximal number
#define VERBOSE_APIC(x) x
-PUBLIC int ioapic_enabled;
-PUBLIC u32_t lapic_addr_vaddr;
-PUBLIC vir_bytes lapic_addr;
-PUBLIC vir_bytes lapic_eoi_addr;
-PUBLIC int bsp_lapic_id;
+int ioapic_enabled;
+u32_t lapic_addr_vaddr;
+vir_bytes lapic_addr;
+vir_bytes lapic_eoi_addr;
+int bsp_lapic_id;
-PRIVATE volatile unsigned probe_ticks;
-PRIVATE u64_t tsc0, tsc1;
-PRIVATE u32_t lapic_tctr0, lapic_tctr1;
+static volatile unsigned probe_ticks;
+static u64_t tsc0, tsc1;
+static u32_t lapic_tctr0, lapic_tctr1;
-PRIVATE unsigned apic_imcrp;
-PRIVATE const unsigned nlints = 0;
+static unsigned apic_imcrp;
+static const unsigned nlints = 0;
-PUBLIC void arch_eoi(void)
+void arch_eoi(void)
{
apic_eoi();
}
* arch specific cpulocals. As this variable is write-once-read-only it is ok to
* have at as an array until we resolve the cpulocals properly
*/
-PRIVATE u32_t lapic_bus_freq[CONFIG_MAX_CPUS];
+static u32_t lapic_bus_freq[CONFIG_MAX_CPUS];
/* the probe period will be roughly 100ms */
#define PROBE_TICKS (system_hz / 10)
#define IOAPIC_IOREGSEL 0x0
#define IOAPIC_IOWIN 0x10
-PRIVATE u32_t ioapic_read(u32_t ioa_base, u32_t reg)
+static u32_t ioapic_read(u32_t ioa_base, u32_t reg)
{
*((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = (reg & 0xff);
return *(u32_t *)(ioa_base + IOAPIC_IOWIN);
}
-PRIVATE void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
+static void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
{
*((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = reg;
*((u32_t *)(ioa_base + IOAPIC_IOWIN)) = val;
void lapic_microsec_sleep(unsigned count);
void apic_idt_init(const int reset);
-PRIVATE void ioapic_enable_pin(vir_bytes ioapic_addr, int pin)
+static void ioapic_enable_pin(vir_bytes ioapic_addr, int pin)
{
u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2);
ioapic_write(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2, lo);
}
-PRIVATE void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
+static void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
{
u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2);
}
#if 0
-PRIVATE void ioapic_redirt_entry_read(void * ioapic_addr,
+static void ioapic_redirt_entry_read(void * ioapic_addr,
int entry,
u32_t *hi,
u32_t *lo)
}
#endif
-PRIVATE void ioapic_redirt_entry_write(void * ioapic_addr,
+static void ioapic_redirt_entry_write(void * ioapic_addr,
int entry,
u32_t hi,
u32_t lo)
#define lapic_test_delivery_val(val, vector) ((val) & (1 << ((vector) & 0x1f)))
-PRIVATE void ioapic_eoi_level(struct irq * irq)
+static void ioapic_eoi_level(struct irq * irq)
{
reg_t tmr;
}
}
-PRIVATE void ioapic_eoi_edge(__unused struct irq * irq)
+static void ioapic_eoi_edge(__unused struct irq * irq)
{
apic_eoi();
}
-PUBLIC void ioapic_eoi(int irq)
+void ioapic_eoi(int irq)
{
if (ioapic_enabled) {
io_apic_irq[irq].eoi(&io_apic_irq[irq]);
irq_8259_eoi(irq);
}
-PUBLIC void ioapic_set_id(u32_t addr, unsigned int id)
+void ioapic_set_id(u32_t addr, unsigned int id)
{
ioapic_write(addr, IOAPIC_ID, id << 24);
}
-PUBLIC int ioapic_enable_all(void)
+int ioapic_enable_all(void)
{
i8259_disable();
}
/* disables a single IO APIC */
-PRIVATE void ioapic_disable(struct io_apic * ioapic)
+static void ioapic_disable(struct io_apic * ioapic)
{
unsigned p;
}
/* disables all IO APICs */
-PUBLIC void ioapic_disable_all(void)
+void ioapic_disable_all(void)
{
unsigned ioa;
if (!ioapic_enabled)
intr_init(INTS_ORIG, 0); /* no auto eoi */
}
-PRIVATE void ioapic_disable_irq(unsigned irq)
+static void ioapic_disable_irq(unsigned irq)
{
assert(io_apic_irq[irq].ioa);
io_apic_irq[irq].state |= IOAPIC_IRQ_STATE_MASKED;
}
-PRIVATE void ioapic_enable_irq(unsigned irq)
+static void ioapic_enable_irq(unsigned irq)
{
assert(io_apic_irq[irq].ioa);
io_apic_irq[irq].state &= ~IOAPIC_IRQ_STATE_MASKED;
}
-PUBLIC void ioapic_unmask_irq(unsigned irq)
+void ioapic_unmask_irq(unsigned irq)
{
if (ioapic_enabled)
ioapic_enable_irq(irq);
irq_8259_unmask(irq);
}
-PUBLIC void ioapic_mask_irq(unsigned irq)
+void ioapic_mask_irq(unsigned irq)
{
if (ioapic_enabled)
ioapic_disable_irq(irq);
irq_8259_mask(irq);
}
-PUBLIC unsigned int apicid(void)
+unsigned int apicid(void)
{
return lapic_read(LAPIC_ID) >> 24;
}
-PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook))
+static int calib_clk_handler(irq_hook_t * UNUSED(hook))
{
u32_t tcrt;
u64_t tsc;
return 1;
}
-PRIVATE int spurious_irq_handler(irq_hook_t * UNUSED(hook))
+static int spurious_irq_handler(irq_hook_t * UNUSED(hook))
{
/*
* Do nothing, only unlock the kernel so we do not deadlock!
return 1;
}
-PRIVATE void apic_calibrate_clocks(unsigned cpu)
+static void apic_calibrate_clocks(unsigned cpu)
{
u32_t lvtt, val, lapic_delta;
u64_t tsc_delta;
BOOT_VERBOSE(cpu_print_freq(cpuid));
}
-PUBLIC void lapic_set_timer_one_shot(const u32_t usec)
+void lapic_set_timer_one_shot(const u32_t usec)
{
/* sleep in micro seconds */
u32_t lvtt;
lapic_write(LAPIC_LVTTR, lvtt);
}
-PUBLIC void lapic_set_timer_periodic(const unsigned freq)
+void lapic_set_timer_periodic(const unsigned freq)
{
/* sleep in micro seconds */
u32_t lvtt;
lapic_write(LAPIC_TIMER_ICR, lapic_ticks_per_clock_tick);
}
-PUBLIC void lapic_stop_timer(void)
+void lapic_stop_timer(void)
{
u32_t lvtt;
lvtt = lapic_read(LAPIC_LVTTR);
lapic_write(LAPIC_TIMER_CCR, 0);
}
-PUBLIC void lapic_restart_timer(void)
+void lapic_restart_timer(void)
{
/* restart the timer only if the counter reached zero, i.e. expired */
if (lapic_read(LAPIC_TIMER_CCR) == 0)
lapic_set_timer_one_shot(1000000/system_hz);
}
-PUBLIC void lapic_microsec_sleep(unsigned count)
+void lapic_microsec_sleep(unsigned count)
{
lapic_set_timer_one_shot(count);
while (lapic_read(LAPIC_TIMER_CCR))
arch_pause();
}
-PRIVATE u32_t lapic_errstatus(void)
+static u32_t lapic_errstatus(void)
{
lapic_write(LAPIC_ESR, 0);
return lapic_read(LAPIC_ESR);
}
-PRIVATE int lapic_disable_in_msr(void)
+static int lapic_disable_in_msr(void)
{
u32_t msr_hi, msr_lo;
return 1;
}
-PUBLIC void lapic_disable(void)
+void lapic_disable(void)
{
/* Disable current APIC and close interrupts from PIC */
u32_t val;
lapic_disable_in_msr();
}
-PRIVATE int lapic_enable_in_msr(void)
+static int lapic_enable_in_msr(void)
{
u32_t msr_hi, msr_lo;
return 1;
}
-PUBLIC int lapic_enable(unsigned cpu)
+int lapic_enable(unsigned cpu)
{
u32_t val, nlvt;
return 1;
}
-PUBLIC void apic_spurios_intr_handler(void)
+void apic_spurios_intr_handler(void)
{
static unsigned x;
printf("WARNING spurious interrupt(s) %d on cpu %d\n", x, cpuid);
}
-PUBLIC void apic_error_intr_handler(void)
+void apic_error_intr_handler(void)
{
static unsigned x;
lapic_errstatus(), x, cpuid);
}
-PRIVATE struct gate_table_s gate_table_ioapic[] = {
+static struct gate_table_s gate_table_ioapic[] = {
{ apic_hwint0, LAPIC_VECTOR( 0), INTR_PRIVILEGE },
{ apic_hwint1, LAPIC_VECTOR( 1), INTR_PRIVILEGE },
{ apic_hwint2, LAPIC_VECTOR( 2), INTR_PRIVILEGE },
{ NULL, 0, 0}
};
-PRIVATE struct gate_table_s gate_table_common[] = {
+static struct gate_table_s gate_table_common[] = {
{ ipc_entry, IPC_VECTOR, USER_PRIVILEGE },
{ kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE },
{ NULL, 0, 0}
};
#ifdef CONFIG_SMP
-PRIVATE struct gate_table_s gate_table_smp[] = {
+static struct gate_table_s gate_table_smp[] = {
{ apic_ipi_sched_intr, APIC_SMP_SCHED_PROC_VECTOR, INTR_PRIVILEGE },
{ apic_ipi_halt_intr, APIC_SMP_CPU_HALT_VECTOR, INTR_PRIVILEGE },
{ NULL, 0, 0}
#endif
#ifdef APIC_DEBUG
-PRIVATE void lapic_set_dummy_handlers(void)
+static void lapic_set_dummy_handlers(void)
{
char * handler;
int vect = 32; /* skip the reserved vectors */
#endif
/* Build descriptors for interrupt gates in IDT. */
-PUBLIC void apic_idt_init(const int reset)
+void apic_idt_init(const int reset)
{
u32_t val;
}
-PRIVATE int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max)
+static int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max)
{
unsigned n = 0;
struct acpi_madt_ioapic * acpi_ioa;
return n;
}
-PUBLIC int detect_ioapics(void)
+int detect_ioapics(void)
{
int status;
#ifdef CONFIG_SMP
-PUBLIC void apic_send_ipi(unsigned vector, unsigned cpu, int type)
+void apic_send_ipi(unsigned vector, unsigned cpu, int type)
{
u32_t icr1, icr2;
}
-PUBLIC int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline)
+int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline)
{
int timeout;
u32_t errstatus = 0;
return 0;
}
-PUBLIC int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline)
+int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline)
{
u32_t ptr, errstatus = 0;
int timeout;
#endif
#ifndef CONFIG_SMP
-PUBLIC int apic_single_cpu_init(void)
+int apic_single_cpu_init(void)
{
if (!cpu_feature_apic_on_chip())
return 0;
}
#endif
-PRIVATE eoi_method_t set_eoi_method(unsigned irq)
+static eoi_method_t set_eoi_method(unsigned irq)
{
/*
* in APIC mode the lowest 16 IRQs are reserved for legacy (E)ISA edge
return ioapic_eoi_level;
}
-PUBLIC void set_irq_redir_low(unsigned irq, u32_t * low)
+void set_irq_redir_low(unsigned irq, u32_t * low)
{
u32_t val = 0;
*low = val;
}
-PUBLIC void ioapic_set_irq(unsigned irq)
+void ioapic_set_irq(unsigned irq)
{
unsigned ioa;
}
}
-PUBLIC void ioapic_unset_irq(unsigned irq)
+void ioapic_unset_irq(unsigned irq)
{
assert(irq < NR_IRQ_VECTORS);
io_apic_irq[irq].eoi = NULL;
}
-PUBLIC void ioapic_reset_pic(void)
+void ioapic_reset_pic(void)
{
apic_idt_init(TRUE); /* reset */
idt_reload();
intr_init(INTS_ORIG, 0); /* no auto eoi */
}
-PRIVATE void irq_lapic_status(int irq)
+static void irq_lapic_status(int irq)
{
u32_t lo;
reg_t tmr, irr, isr;
"masked" : "unmasked");
}
-PUBLIC void dump_apic_irq_state(void)
+void dump_apic_irq_state(void)
{
int irq;
#define TIMER_FREQ 1193182 /* clock frequency for timer in PC and AT */
#define TIMER_COUNT(freq) (TIMER_FREQ/(freq)) /* initial value for counter*/
-PRIVATE irq_hook_t pic_timer_hook; /* interrupt handler hook */
+static irq_hook_t pic_timer_hook; /* interrupt handler hook */
-PRIVATE unsigned probe_ticks;
-PRIVATE u64_t tsc0, tsc1;
+static unsigned probe_ticks;
+static u64_t tsc0, tsc1;
#define PROBE_TICKS (system_hz / 10)
-PRIVATE unsigned tsc_per_ms[CONFIG_MAX_CPUS];
+static unsigned tsc_per_ms[CONFIG_MAX_CPUS];
/*===========================================================================*
* init_8235A_timer *
*===========================================================================*/
-PUBLIC int init_8253A_timer(const unsigned freq)
+int init_8253A_timer(const unsigned freq)
{
/* Initialize channel 0 of the 8253A timer to, e.g., 60 Hz,
* and register the CLOCK task's interrupt handler to be run
/*===========================================================================*
* stop_8235A_timer *
*===========================================================================*/
-PUBLIC void stop_8253A_timer(void)
+void stop_8253A_timer(void)
{
/* Reset the clock to the BIOS rate. (For rebooting.) */
outb(TIMER_MODE, 0x36);
outb(TIMER0, 0);
}
-PRIVATE int calib_cpu_handler(irq_hook_t * UNUSED(hook))
+static int calib_cpu_handler(irq_hook_t * UNUSED(hook))
{
u64_t tsc;
return 1;
}
-PRIVATE void estimate_cpu_freq(void)
+static void estimate_cpu_freq(void)
{
u64_t tsc_delta;
u64_t cpu_freq;
BOOT_VERBOSE(cpu_print_freq(cpuid));
}
-PUBLIC int init_local_timer(unsigned freq)
+int init_local_timer(unsigned freq)
{
#ifdef USE_APIC
/* if we know the address, lapic is enabled and we should use it */
return 0;
}
-PUBLIC void stop_local_timer(void)
+void stop_local_timer(void)
{
#ifdef USE_APIC
if (lapic_addr) {
}
}
-PUBLIC void restart_local_timer(void)
+void restart_local_timer(void)
{
#ifdef USE_APIC
if (lapic_addr) {
#endif
}
-PUBLIC int register_local_timer_handler(const irq_handler_t handler)
+int register_local_timer_handler(const irq_handler_t handler)
{
#ifdef USE_APIC
if (lapic_addr) {
return 0;
}
-PUBLIC void cycles_accounting_init(void)
+void cycles_accounting_init(void)
{
#ifdef CONFIG_SMP
unsigned cpu = cpuid;
make_zero64(get_cpu_var(cpu, cpu_last_idle));
}
-PUBLIC void context_stop(struct proc * p)
+void context_stop(struct proc * p)
{
u64_t tsc, tsc_delta;
u64_t * __tsc_ctr_switch = get_cpulocal_var_ptr(tsc_ctr_switch);
*__tsc_ctr_switch = tsc;
}
-PUBLIC void context_stop_idle(void)
+void context_stop_idle(void)
{
int is_idle;
#ifdef CONFIG_SMP
#endif
}
-PUBLIC u64_t ms_2_cpu_time(unsigned ms)
+u64_t ms_2_cpu_time(unsigned ms)
{
return mul64u(tsc_per_ms[cpuid], ms);
}
-PUBLIC unsigned cpu_time_2_ms(u64_t cpu_time)
+unsigned cpu_time_2_ms(u64_t cpu_time)
{
return div64u(cpu_time, tsc_per_ms[cpuid]);
}
-PUBLIC short cpu_load(void)
+short cpu_load(void)
{
u64_t current_tsc, *current_idle;
u64_t tsc_delta, idle_delta, busy;
return load;
}
-PUBLIC void busy_delay_ms(int ms)
+void busy_delay_ms(int ms)
{
u64_t cycles = ms_2_cpu_time(ms), tsc0, tsc, tsc1;
read_tsc_64(&tsc0);
/*===========================================================================*
* arch_do_vmctl *
*===========================================================================*/
-PUBLIC int arch_do_vmctl(m_ptr, p)
+int arch_do_vmctl(m_ptr, p)
register message *m_ptr; /* pointer to request message */
struct proc *p;
{
static int volatile cpu_down;
/* there can be at most 255 local APIC ids, each fits in 8 bits */
-PRIVATE unsigned char apicid2cpuid[255];
-PUBLIC unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
+static unsigned char apicid2cpuid[255];
+unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
SPINLOCK_DEFINE(smp_cpu_lock)
SPINLOCK_DEFINE(dispq_lock)
-FORWARD void smp_reinit_vars(void);
+static void smp_reinit_vars(void);
/*
* copies the 16-bit AP trampoline code to the first 1M of memory
*/
-PRIVATE phys_bytes copy_trampoline(void)
+static phys_bytes copy_trampoline(void)
{
char * s, *end;
phys_bytes tramp_base = 0;
return tramp_base;
}
-PRIVATE void smp_start_aps(void)
+static void smp_start_aps(void)
{
/*
* Find an address and align it to a 4k boundary.
NOT_REACHABLE;
}
-PUBLIC void smp_halt_cpu (void)
+void smp_halt_cpu (void)
{
NOT_IMPLEMENTED;
}
-PUBLIC void smp_shutdown_aps(void)
+void smp_shutdown_aps(void)
{
unsigned cpu;
return;
}
-PRIVATE void ap_finish_booting(void)
+static void ap_finish_booting(void)
{
unsigned cpu = cpuid;
NOT_REACHABLE;
}
-PUBLIC void smp_ap_boot(void)
+void smp_ap_boot(void)
{
switch_k_stack((char *)get_k_stack_top(__ap_id) -
X86_STACK_TOP_RESERVED, ap_finish_booting);
}
-PRIVATE void smp_reinit_vars(void)
+static void smp_reinit_vars(void)
{
lapic_addr = lapic_eoi_addr = 0;
ioapic_enabled = 0;
ncpus = 1;
}
-PRIVATE void tss_init_all(void)
+static void tss_init_all(void)
{
unsigned cpu;
tss_init(cpu, get_k_stack_top(cpu));
}
-PRIVATE int discover_cpus(void)
+static int discover_cpus(void)
{
struct acpi_madt_lapic * cpu;
return ncpus;
}
-PUBLIC void smp_init (void)
+void smp_init (void)
{
/* read the MP configuration */
if (!discover_cpus()) {
printf("WARNING : SMP initialization failed\n");
}
-PUBLIC void arch_smp_halt_cpu(void)
+void arch_smp_halt_cpu(void)
{
/* say that we are down */
cpu_down = cpuid;
for(;;);
}
-PUBLIC void arch_send_smp_schedule_ipi(unsigned cpu)
+void arch_send_smp_schedule_ipi(unsigned cpu)
{
apic_send_ipi(APIC_SMP_SCHED_PROC_VECTOR, cpu, APIC_IPI_DEST);
}
#include "acpi.h"
#endif
-PRIVATE int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
+static int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
extern __dead void poweroff_jmp();
extern void poweroff16();
/* set OSXMMEXCPT[bit 10] if we provide #XM handler. */
#define CR4_OSXMMEXCPT (1L<<10)
-PUBLIC void * k_stacks;
+void * k_stacks;
-FORWARD void ser_debug(int c);
+static void ser_debug(int c);
#ifdef CONFIG_SMP
-FORWARD void ser_dump_proc_cpu(void);
+static void ser_dump_proc_cpu(void);
#endif
#if !CONFIG_OXPCIE
-FORWARD void ser_init(void);
+static void ser_init(void);
#endif
-PUBLIC __dead void arch_monitor(void)
+__dead void arch_monitor(void)
{
monitor();
}
}
}
-PRIVATE __dead void arch_bios_poweroff(void)
+static __dead void arch_bios_poweroff(void)
{
u32_t cr0;
poweroff_jmp();
}
-PUBLIC int cpu_has_tsc;
+int cpu_has_tsc;
-PUBLIC __dead void arch_shutdown(int how)
+__dead void arch_shutdown(int how)
{
u16_t magic;
vm_stop();
NOT_REACHABLE;
}
-PUBLIC void fpu_init(void)
+void fpu_init(void)
{
unsigned short cw, sw;
}
}
-PUBLIC void save_local_fpu(struct proc *pr, int retain)
+void save_local_fpu(struct proc *pr, int retain)
{
/* Save process FPU context. If the 'retain' flag is set, keep the FPU
* state as is. If the flag is not set, the state is undefined upon
}
}
-PUBLIC void save_fpu(struct proc *pr)
+void save_fpu(struct proc *pr)
{
#ifdef CONFIG_SMP
if (cpuid != pr->p_cpu) {
}
}
-PUBLIC int restore_fpu(struct proc *pr)
+int restore_fpu(struct proc *pr)
{
int failed;
return OK;
}
-PUBLIC void cpu_identify(void)
+void cpu_identify(void)
{
u32_t eax, ebx, ecx, edx;
unsigned cpu = cpuid;
cpu_info[cpu].flags[1] = edx;
}
-PUBLIC void arch_init(void)
+void arch_init(void)
{
#ifdef USE_APIC
/*
}
#ifdef DEBUG_SERIAL
-PUBLIC void ser_putc(char c)
+void ser_putc(char c)
{
int i;
int lsr, thr;
/*===========================================================================*
* do_ser_debug *
*===========================================================================*/
-PUBLIC void do_ser_debug()
+void do_ser_debug()
{
u8_t c, lsr;
ser_debug(c);
}
-PRIVATE void ser_dump_queue_cpu(unsigned cpu)
+static void ser_dump_queue_cpu(unsigned cpu)
{
int q;
struct proc ** rdy_head;
}
}
-PRIVATE void ser_dump_queues(void)
+static void ser_dump_queues(void)
{
#ifdef CONFIG_SMP
unsigned cpu;
#endif
}
-PRIVATE void ser_dump_segs(void)
+static void ser_dump_segs(void)
{
struct proc *pp;
for (pp= BEG_PROC_ADDR; pp < END_PROC_ADDR; pp++)
}
#ifdef CONFIG_SMP
-PRIVATE void dump_bkl_usage(void)
+static void dump_bkl_usage(void)
{
unsigned cpu;
}
}
-PRIVATE void reset_bkl_usage(void)
+static void reset_bkl_usage(void)
{
memset(kernel_ticks, 0, sizeof(kernel_ticks));
memset(bkl_ticks, 0, sizeof(bkl_ticks));
}
#endif
-PRIVATE void ser_debug(const int c)
+static void ser_debug(const int c)
{
serial_debug_active = 1;
serial_debug_active = 0;
}
-PUBLIC void ser_dump_proc()
+void ser_dump_proc()
{
struct proc *pp;
}
#ifdef CONFIG_SMP
-PRIVATE void ser_dump_proc_cpu(void)
+static void ser_dump_proc_cpu(void)
{
struct proc *pp;
unsigned cpu;
#if SPROFILE
-PUBLIC int arch_init_profile_clock(const u32_t freq)
+int arch_init_profile_clock(const u32_t freq)
{
int r;
/* Set CMOS timer frequency. */
return CMOS_CLOCK_IRQ;
}
-PUBLIC void arch_stop_profile_clock(void)
+void arch_stop_profile_clock(void)
{
int r;
/* Disable CMOS timer interrupts. */
outb(RTC_IO, r & ~RTC_B_PIE);
}
-PUBLIC void arch_ack_profile_clock(void)
+void arch_ack_profile_clock(void)
{
/* Mandatory read of CMOS register to re-enable timer interrupts. */
outb(RTC_INDEX, RTC_REG_C);
/* Saved by mpx386.s into these variables. */
u32_t params_size, params_offset, mon_ds;
-PUBLIC int arch_get_params(char *params, int maxsize)
+int arch_get_params(char *params, int maxsize)
{
phys_copy(seg2phys(mon_ds) + params_offset, vir2phys(params),
MIN(maxsize, params_size));
return OK;
}
-PUBLIC int arch_set_params(char *params, int size)
+int arch_set_params(char *params, int size)
{
if(size > params_size)
return E2BIG;
return OK;
}
-PUBLIC void arch_do_syscall(struct proc *proc)
+void arch_do_syscall(struct proc *proc)
{
/* do_ipc assumes that it's running because of the current process */
assert(proc == get_cpulocal_var(proc_ptr));
do_ipc(proc->p_reg.cx, proc->p_reg.retreg, proc->p_reg.bx);
}
-PUBLIC struct proc * arch_finish_switch_to_user(void)
+struct proc * arch_finish_switch_to_user(void)
{
char * stk;
struct proc * p;
return p;
}
-PUBLIC void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigcontext *sc)
+void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigcontext *sc)
{
int fp_error;
}
#if !CONFIG_OXPCIE
-PRIVATE void ser_init(void)
+static void ser_init(void)
{
unsigned char lcr;
unsigned divisor;
* Intel architecture performance counters watchdog
*/
-PRIVATE struct arch_watchdog intel_arch_watchdog;
-PRIVATE struct arch_watchdog amd_watchdog;
+static struct arch_watchdog intel_arch_watchdog;
+static struct arch_watchdog amd_watchdog;
-PRIVATE void intel_arch_watchdog_init(const unsigned cpu)
+static void intel_arch_watchdog_init(const unsigned cpu)
{
u64_t cpuf;
u32_t val;
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
}
-PRIVATE void intel_arch_watchdog_reinit(const unsigned cpu)
+static void intel_arch_watchdog_reinit(const unsigned cpu)
{
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, ex64lo(watchdog->resetval));
}
-PUBLIC int arch_watchdog_init(void)
+int arch_watchdog_init(void)
{
u32_t eax, ebx, ecx, edx;
unsigned cpu = cpuid;
return 0;
}
-PUBLIC void arch_watchdog_stop(void)
+void arch_watchdog_stop(void)
{
}
-PUBLIC void arch_watchdog_lockup(const struct nmi_frame * frame)
+void arch_watchdog_lockup(const struct nmi_frame * frame)
{
printf("KERNEL LOCK UP\n"
"eax 0x%08x\n"
panic("Kernel lockup");
}
-PUBLIC int i386_watchdog_start(void)
+int i386_watchdog_start(void)
{
if (arch_watchdog_init()) {
printf("WARNING watchdog initialization "
return 0;
}
-PRIVATE int intel_arch_watchdog_profile_init(const unsigned freq)
+static int intel_arch_watchdog_profile_init(const unsigned freq)
{
u64_t cpuf;
return OK;
}
-PRIVATE struct arch_watchdog intel_arch_watchdog = {
+static struct arch_watchdog intel_arch_watchdog = {
/*.init = */ intel_arch_watchdog_init,
/*.reinit = */ intel_arch_watchdog_reinit,
/*.profile_init = */ intel_arch_watchdog_profile_init
#define AMD_MSR_EVENT_CTR0 0xc0010004
#define AMD_MSR_EVENT_SEL0_ENABLE (1 << 22)
-PRIVATE void amd_watchdog_init(const unsigned cpu)
+static void amd_watchdog_init(const unsigned cpu)
{
u64_t cpuf;
u32_t val;
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
}
-PRIVATE void amd_watchdog_reinit(const unsigned cpu)
+static void amd_watchdog_reinit(const unsigned cpu)
{
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
ia32_msr_write(AMD_MSR_EVENT_CTR0,
ex64hi(watchdog->resetval), ex64lo(watchdog->resetval));
}
-PRIVATE int amd_watchdog_profile_init(const unsigned freq)
+static int amd_watchdog_profile_init(const unsigned freq)
{
u64_t cpuf;
return OK;
}
-PRIVATE struct arch_watchdog amd_watchdog = {
+static struct arch_watchdog amd_watchdog = {
/*.init = */ amd_watchdog_init,
/*.reinit = */ amd_watchdog_reinit,
/*.profile_init = */ amd_watchdog_profile_init
#include "debugreg.h"
-PUBLIC int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
+int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
{
unsigned long dr7, dr7flags;
/*===========================================================================*
* do_int86 *
*===========================================================================*/
-PUBLIC int do_int86(struct proc * caller, message * m_ptr)
+int do_int86(struct proc * caller, message * m_ptr)
{
data_copy(caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86,
KERNEL, (vir_bytes) ®86, sizeof(reg86));
/*===========================================================================*
* do_iopenable *
*===========================================================================*/
-PUBLIC int do_iopenable(struct proc * caller, message * m_ptr)
+int do_iopenable(struct proc * caller, message * m_ptr)
{
int proc_nr;
/*===========================================================================*
* do_readbios *
*===========================================================================*/
-PUBLIC int do_readbios(struct proc * caller, message * m_ptr)
+int do_readbios(struct proc * caller, message * m_ptr)
{
struct vir_addr src, dst;
/*===========================================================================*
* do_sdevio *
*===========================================================================*/
-PUBLIC int do_sdevio(struct proc * caller, message *m_ptr)
+int do_sdevio(struct proc * caller, message *m_ptr)
{
vir_bytes newoffset;
endpoint_t newep;
{ "SIMD exception", SIGFPE, 386 },
};
-PRIVATE void inkernel_disaster(struct proc *saved_proc,
+static void inkernel_disaster(struct proc *saved_proc,
struct exception_frame *frame, struct ex_s *ep, int is_nested);
extern int catch_pagefaults;
-PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc);
+static void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc);
-PRIVATE void pagefault( struct proc *pr,
+static void pagefault( struct proc *pr,
struct exception_frame * frame,
int is_nested)
{
return;
}
-PRIVATE void inkernel_disaster(struct proc *saved_proc,
+static void inkernel_disaster(struct proc *saved_proc,
struct exception_frame * frame, struct ex_s *ep,
int is_nested)
{
/*===========================================================================*
* exception *
*===========================================================================*/
-PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
+void exception_handler(int is_nested, struct exception_frame * frame)
{
/* An exception or unexpected interrupt has occurred. */
register struct ex_s *ep;
/*===========================================================================*
* proc_stacktrace_execute *
*===========================================================================*/
-PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc)
+static void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc)
{
reg_t v_hbp;
int iskernel;
/*===========================================================================*
* proc_stacktrace *
*===========================================================================*/
-PUBLIC void proc_stacktrace(struct proc *whichproc)
+void proc_stacktrace(struct proc *whichproc)
{
#if USE_SYSDEBUG
proc_stacktrace_execute(whichproc, whichproc->p_reg.fp, whichproc->p_reg.pc);
#endif /* USE_SYSDEBUG */
}
-PUBLIC void enable_fpu_exception(void)
+void enable_fpu_exception(void)
{
u32_t cr0 = read_cr0();
if(!(cr0 & I386_CR0_TS))
write_cr0(cr0 | I386_CR0_TS);
}
-PUBLIC void disable_fpu_exception(void)
+void disable_fpu_exception(void)
{
clts();
}
/*===========================================================================*
* intr_init *
*===========================================================================*/
-PUBLIC int intr_init(const int mine, const int auto_eoi)
+int intr_init(const int mine, const int auto_eoi)
{
/* Initialize the 8259s, finishing with all interrupts disabled. This is
* only done in protected mode, in real mode we don't touch the 8259s, but
return OK;
}
-PUBLIC void irq_8259_unmask(const int irq)
+void irq_8259_unmask(const int irq)
{
const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK;
outb(ctl_mask, inb(ctl_mask) & ~(1 << (irq & 0x7)));
}
-PUBLIC void irq_8259_mask(const int irq)
+void irq_8259_mask(const int irq)
{
const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK;
outb(ctl_mask, inb(ctl_mask) | (1 << (irq & 0x7)));
}
/* Disable 8259 - write 0xFF in OCW1 master and slave. */
-PUBLIC void i8259_disable(void)
+void i8259_disable(void)
{
outb(INT2_CTLMASK, 0xFF);
outb(INT_CTLMASK, 0xFF);
inb(INT_CTLMASK);
}
-PUBLIC void irq_8259_eoi(int irq)
+void irq_8259_eoi(int irq)
{
if (irq < 8)
eoi_8259_master();
#endif
#endif
-PUBLIC int i386_paging_enabled = 0;
+int i386_paging_enabled = 0;
-PRIVATE int psok = 0;
+static int psok = 0;
#define MAX_FREEPDES 2
-PRIVATE int nfreepdes = 0, freepdes[MAX_FREEPDES];
+static int nfreepdes = 0, freepdes[MAX_FREEPDES];
#define HASPT(procptr) ((procptr)->p_seg.p_cr3 != 0)
-FORWARD u32_t phys_get32(phys_bytes v);
-FORWARD void vm_enable_paging(void);
+static u32_t phys_get32(phys_bytes v);
+static void vm_enable_paging(void);
-PUBLIC void segmentation2paging(struct proc * current)
+void segmentation2paging(struct proc * current)
{
/* switch to the current process page tables before turning paging on */
switch_address_space(current);
* pde number to be used, and a pointer to it (linear address) is returned
* for actual use by phys_copy or phys_memset.
*/
-PRIVATE phys_bytes createpde(
+static phys_bytes createpde(
const struct proc *pr, /* Requested process, NULL for physical. */
const phys_bytes linaddr,/* Address after segment translation. */
phys_bytes *bytes, /* Size of chunk, function may truncate it. */
/*===========================================================================*
* lin_lin_copy *
*===========================================================================*/
-PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
+static int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes)
{
u32_t addr;
}
-PRIVATE u32_t phys_get32(phys_bytes addr)
+static u32_t phys_get32(phys_bytes addr)
{
const u32_t v;
int r;
}
#if 0
-PRIVATE char *cr0_str(u32_t e)
+static char *cr0_str(u32_t e)
{
static char str[80];
strcpy(str, "");
return str;
}
-PRIVATE char *cr4_str(u32_t e)
+static char *cr4_str(u32_t e)
{
static char str[80];
strcpy(str, "");
}
#endif
-PUBLIC void vm_stop(void)
+void vm_stop(void)
{
write_cr0(read_cr0() & ~I386_CR0_PG);
}
-PRIVATE void vm_enable_paging(void)
+static void vm_enable_paging(void)
{
u32_t cr0, cr4;
int pgeok;
/*===========================================================================*
* umap_local *
*===========================================================================*/
-PUBLIC phys_bytes umap_local(rp, seg, vir_addr, bytes)
+phys_bytes umap_local(rp, seg, vir_addr, bytes)
register struct proc *rp; /* pointer to proc table entry for process */
int seg; /* T, D, or S segment */
vir_bytes vir_addr; /* virtual address in bytes within the seg */
/*===========================================================================*
* umap_virtual *
*===========================================================================*/
-PUBLIC phys_bytes umap_virtual(rp, seg, vir_addr, bytes)
+phys_bytes umap_virtual(rp, seg, vir_addr, bytes)
register struct proc *rp; /* pointer to proc table entry for process */
int seg; /* T, D, or S segment */
vir_bytes vir_addr; /* virtual address in bytes within the seg */
/*===========================================================================*
* vm_lookup *
*===========================================================================*/
-PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual,
+int vm_lookup(const struct proc *proc, const vir_bytes virtual,
phys_bytes *physical, u32_t *ptent)
{
u32_t *root, *pt;
/*===========================================================================*
* vm_lookup_range *
*===========================================================================*/
-PUBLIC size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr,
+size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr,
phys_bytes *phys_addr, size_t bytes)
{
/* Look up the physical address corresponding to linear virtual address
/*===========================================================================*
* vm_suspend *
*===========================================================================*/
-PRIVATE void vm_suspend(struct proc *caller, const struct proc *target,
+static void vm_suspend(struct proc *caller, const struct proc *target,
const vir_bytes linaddr, const vir_bytes len, const int type)
{
/* This range is not OK for this process. Set parameters
/*===========================================================================*
* vm_check_range *
*===========================================================================*/
-PUBLIC int vm_check_range(struct proc *caller, struct proc *target,
+int vm_check_range(struct proc *caller, struct proc *target,
vir_bytes vir_addr, size_t bytes)
{
/* Public interface to vm_suspend(), for use by kernel calls. On behalf
/*===========================================================================*
* delivermsg *
*===========================================================================*/
-PUBLIC void delivermsg(struct proc *rp)
+void delivermsg(struct proc *rp)
{
int r = OK;
}
#if 0
-PRIVATE char *flagstr(u32_t e, const int dir)
+static char *flagstr(u32_t e, const int dir)
{
static char str[80];
strcpy(str, "");
return str;
}
-PRIVATE void vm_pt_print(u32_t *pagetable, const u32_t v)
+static void vm_pt_print(u32_t *pagetable, const u32_t v)
{
int pte;
int col = 0;
return;
}
-PRIVATE void vm_print(u32_t *root)
+static void vm_print(u32_t *root)
{
int pde;
/*===========================================================================*
* virtual_copy_f *
*===========================================================================*/
-PUBLIC int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck)
+int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck)
struct proc * caller;
struct vir_addr *src_addr; /* source virtual address */
struct vir_addr *dst_addr; /* destination virtual address */
/*===========================================================================*
* data_copy *
*===========================================================================*/
-PUBLIC int data_copy(const endpoint_t from_proc, const vir_bytes from_addr,
+int data_copy(const endpoint_t from_proc, const vir_bytes from_addr,
const endpoint_t to_proc, const vir_bytes to_addr,
size_t bytes)
{
/*===========================================================================*
* data_copy_vmcheck *
*===========================================================================*/
-PUBLIC int data_copy_vmcheck(struct proc * caller,
+int data_copy_vmcheck(struct proc * caller,
const endpoint_t from_proc, const vir_bytes from_addr,
const endpoint_t to_proc, const vir_bytes to_addr,
size_t bytes)
/*===========================================================================*
* arch_pre_exec *
*===========================================================================*/
-PUBLIC void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
+void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
{
/* set program counter and stack pointer. */
pr->p_reg.pc = ip;
/*===========================================================================*
* arch_umap *
*===========================================================================*/
-PUBLIC int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count,
+int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count,
int seg, phys_bytes *addr)
{
switch(seg) {
freepdes[nfreepdes++] = pde;
}
-PRIVATE int oxpcie_mapping_index = -1,
+static int oxpcie_mapping_index = -1,
lapic_mapping_index = -1,
ioapic_first_index = -1,
ioapic_last_index = -1;
-PUBLIC int arch_phys_map(const int index,
+int arch_phys_map(const int index,
phys_bytes *addr,
phys_bytes *len,
int *flags)
return EINVAL;
}
-PUBLIC int arch_phys_map_reply(const int index, const vir_bytes addr)
+int arch_phys_map_reply(const int index, const vir_bytes addr)
{
#ifdef USE_APIC
/* if local APIC is enabled */
return EINVAL;
}
-PUBLIC int arch_enable_paging(struct proc * caller, const message * m_ptr)
+int arch_enable_paging(struct proc * caller, const message * m_ptr)
{
struct vm_ep_data ep_data;
int r;
return OK;
}
-PUBLIC void release_address_space(struct proc *pr)
+void release_address_space(struct proc *pr)
{
pr->p_seg.p_cr3_v = NULL;
}
/* computes a checksum of a buffer of a given length. The byte sum must be zero */
-PUBLIC int platform_tbl_checksum_ok(void *ptr, unsigned int length)
+int platform_tbl_checksum_ok(void *ptr, unsigned int length)
{
u8_t total = 0;
unsigned int i;
return !total;
}
-PUBLIC int platform_tbl_ptr(phys_bytes start,
+int platform_tbl_ptr(phys_bytes start,
phys_bytes end,
unsigned increment,
void * buff,
#include "oxpcie.h"
#include "serial.h"
-PRIVATE unsigned char *oxpcie_vaddr = NULL;
+static unsigned char *oxpcie_vaddr = NULL;
-PUBLIC void oxpcie_set_vaddr(unsigned char *vaddr)
+void oxpcie_set_vaddr(unsigned char *vaddr)
{
oxpcie_vaddr = vaddr;
}
-PRIVATE void oxpcie_init(void)
+static void oxpcie_init(void)
{
printf("oxpcie_init\n");
/* Enable access to EFR and DLM+DLL */
OXPCIE_CPR2 = 0;
}
-PUBLIC void oxpcie_putc(char c)
+void oxpcie_putc(char c)
{
static int inuse = 0;
}
}
-PUBLIC int oxpcie_in(void)
+int oxpcie_in(void)
{
if(vm_running && oxpcie_vaddr) {
int lsr;
#define mb_clear_memrange(start, end) \
phys_memset((start), 0, (end)-(start))
-PRIVATE void mb_itoa(u32_t val, char * out)
+static void mb_itoa(u32_t val, char * out)
{
char ret[ITOA_BUFFER_SIZE];
int i = ITOA_BUFFER_SIZE - 2;
strcpy(out, ret + i + 1);
}
-PRIVATE void mb_itox(u32_t val, char *out)
+static void mb_itox(u32_t val, char *out)
{
char ret[9];
int i = 7;
strcpy(out, ret + i + 1);
}
-PRIVATE void mb_put_char(char c, int line, int col)
+static void mb_put_char(char c, int line, int col)
{
/* Write a char to vga display buffer. */
if (line<MULTIBOOT_CONSOLE_LINES&&col<MULTIBOOT_CONSOLE_COLS)
1);
}
-PRIVATE char mb_get_char(int line, int col)
+static char mb_get_char(int line, int col)
{
char c;
/* Read a char to from display buffer. */
}
/* Give non-zero values to avoid them in BSS */
-PRIVATE int print_line = 1, print_col = 1;
+static int print_line = 1, print_col = 1;
#include <sys/video.h>
-PUBLIC void mb_cls(void)
+void mb_cls(void)
{
int i, j;
/* Clear screen */
outb(C_6845+DATA, 0);
}
-PRIVATE void mb_scroll_up(int lines)
+static void mb_scroll_up(int lines)
{
int i, j;
for (i = 0; i < MULTIBOOT_CONSOLE_LINES; i++ ) {
print_line-= lines;
}
-PUBLIC void mb_print_char(char c)
+void mb_print_char(char c)
{
while (print_line >= MULTIBOOT_CONSOLE_LINES)
mb_scroll_up(1);
mb_scroll_up(1);
}
-PUBLIC void mb_print(char *str)
+void mb_print(char *str)
{
while (*str) {
mb_print_char(*str);
#define KB_OUT_FULL 0x01 /* status bit set when keypress char pending */
#define KB_AUX_BYTE 0x20 /* Auxiliary Device Output Buffer Full */
-PUBLIC int mb_read_char(unsigned char *ch)
+int mb_read_char(unsigned char *ch)
{
unsigned long b, sb;
#ifdef DEBUG_SERIAL
return 0;
}
-PRIVATE void mb_print_hex(u32_t value)
+static void mb_print_hex(u32_t value)
{
int i;
char c;
mb_print(out);
}
-PRIVATE int mb_set_param(char *name, char *value)
+static int mb_set_param(char *name, char *value)
{
char *p = multiboot_param_buf;
char *q;
return 0;
}
-PRIVATE void get_parameters(multiboot_info_t *mbi)
+static void get_parameters(multiboot_info_t *mbi)
{
char mem_value[40], temp[ITOA_BUFFER_SIZE];
int i;
}
}
-PRIVATE void mb_extract_image(multiboot_info_t mbi)
+static void mb_extract_image(multiboot_info_t mbi)
{
multiboot_module_t *mb_module_info;
multiboot_module_t *module;
return;
}
-PUBLIC phys_bytes pre_init(u32_t ebx)
+phys_bytes pre_init(u32_t ebx)
{
multiboot_info_t mbi;
u16_t offset_high;
};
-PUBLIC struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */
+struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */
{ {0},
{0,0,0,0}, /* GDT descriptor */
{0,0,0,0}, /* IDT descriptor */
{0xffff,0,0,0x9b,0xcf,0}, /* kernel CS */
{0xffff,0,0,0x9b,0xcf,0}, /* temp for BIOS (386: monitor CS at startup) */
};
-PRIVATE struct gatedesc_s idt[IDT_SIZE]; /* zero-init so none present */
-PUBLIC struct tss_s tss[CONFIG_MAX_CPUS]; /* zero init */
+static struct gatedesc_s idt[IDT_SIZE]; /* zero-init so none present */
+struct tss_s tss[CONFIG_MAX_CPUS]; /* zero init */
-FORWARD void sdesc(struct segdesc_s *segdp, phys_bytes base, vir_bytes
+static void sdesc(struct segdesc_s *segdp, phys_bytes base, vir_bytes
size);
/*===========================================================================*
* enable_iop *
*===========================================================================*/
-PUBLIC void enable_iop(struct proc *pp)
+void enable_iop(struct proc *pp)
{
/* Allow a user process to use I/O instructions. Change the I/O Permission
* Level bits in the psw. These specify least-privileged Current Permission
/*===========================================================================*
* seg2phys *
*===========================================================================*/
-PUBLIC phys_bytes seg2phys(const u16_t seg)
+phys_bytes seg2phys(const u16_t seg)
{
/* Return the base address of a segment, with seg being a
* register, or a 286/386 segment selector.
/*===========================================================================*
* init_dataseg *
*===========================================================================*/
-PUBLIC void init_dataseg(register struct segdesc_s *segdp,
+void init_dataseg(register struct segdesc_s *segdp,
phys_bytes base, vir_bytes size, const int privilege)
{
/* Build descriptor for a data segment. */
/*===========================================================================*
* init_codeseg *
*===========================================================================*/
-PRIVATE void init_codeseg(register struct segdesc_s *segdp, phys_bytes base,
+static void init_codeseg(register struct segdesc_s *segdp, phys_bytes base,
vir_bytes size, int privilege)
{
/* Build descriptor for a code segment. */
/* CONFORMING = 0, ACCESSED = 0 */
}
-PUBLIC struct gate_table_s gate_table_pic[] = {
+struct gate_table_s gate_table_pic[] = {
{ hwint00, VECTOR( 0), INTR_PRIVILEGE },
{ hwint01, VECTOR( 1), INTR_PRIVILEGE },
{ hwint02, VECTOR( 2), INTR_PRIVILEGE },
{ NULL, 0, 0}
};
-PUBLIC void tss_init(unsigned cpu, void * kernel_stack)
+void tss_init(unsigned cpu, void * kernel_stack)
{
struct tss_s * t = &tss[cpu];
/*===========================================================================*
* prot_init *
*===========================================================================*/
-PUBLIC void prot_init(void)
+void prot_init(void)
{
/* Set up tables for protected mode.
* All GDT slots are allocated at compile time.
tss_init(0, &k_boot_stktop);
}
-PUBLIC void idt_copy_vectors(struct gate_table_s * first)
+void idt_copy_vectors(struct gate_table_s * first)
{
struct gate_table_s *gtp;
for (gtp = first; gtp->gate; gtp++) {
}
/* Build descriptors for interrupt gates in IDT. */
-PUBLIC void idt_init(void)
+void idt_init(void)
{
struct gate_table_s gate_table[] = {
{ divide_error, DIVIDE_VECTOR, INTR_PRIVILEGE },
/*===========================================================================*
* sdesc *
*===========================================================================*/
-PRIVATE void sdesc(segdp, base, size)
+static void sdesc(segdp, base, size)
register struct segdesc_s *segdp;
phys_bytes base;
vir_bytes size;
/*===========================================================================*
* int_gate *
*===========================================================================*/
-PUBLIC void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type)
+void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type)
{
/* Build descriptor for an interrupt gate. */
register struct gatedesc_s *idp;
/*===========================================================================*
* alloc_segments *
*===========================================================================*/
-PUBLIC void alloc_segments(register struct proc *rp)
+void alloc_segments(register struct proc *rp)
{
/* This is called at system initialization from main() and by do_newmap().
* The code has a separate function because of all hardware-dependencies.
/*===========================================================================*
* check_segments *
*===========================================================================*/
-PRIVATE void check_segments(char *File, int line)
+static void check_segments(char *File, int line)
{
int checked = 0;
int fail = 0;
/*===========================================================================*
* printseg *
*===========================================================================*/
-PUBLIC void printseg(char *banner, const int iscs, struct proc *pr,
+void printseg(char *banner, const int iscs, struct proc *pr,
const u32_t selector)
{
#if USE_SYSDEBUG
/*===========================================================================*
* prot_set_kern_seg_limit *
*===========================================================================*/
-PUBLIC int prot_set_kern_seg_limit(const vir_bytes limit)
+int prot_set_kern_seg_limit(const vir_bytes limit)
{
struct proc *rp;
int orig_click;
/* Function prototype for PRIVATE functions.
*/
-FORWARD void load_update(void);
+static void load_update(void);
/* The CLOCK's timers queue. The functions in <timers.h> operate on this.
* Each system process possesses a single synchronous alarm timer. If other
* via (re)set_timer().
* When a timer expires its watchdog function is run by the CLOCK task.
*/
-PRIVATE timer_t *clock_timers; /* queue of CLOCK timers */
-PRIVATE clock_t next_timeout; /* realtime that next timer expires */
+static timer_t *clock_timers; /* queue of CLOCK timers */
+static clock_t next_timeout; /* realtime that next timer expires */
/* The time is incremented by the interrupt handler on each clock tick.
*/
-PRIVATE clock_t realtime = 0; /* real time clock */
+static clock_t realtime = 0; /* real time clock */
/*
* The boot processos timer interrupt handler. In addition to non-boot cpus it
* keeps real time and notifies the clock task if need be
*/
-PUBLIC int timer_int_handler(void)
+int timer_int_handler(void)
{
/* Update user and system accounting times. Charge the current process
* for user time. If the current process is not billable, that is, if a
/*===========================================================================*
* get_uptime *
*===========================================================================*/
-PUBLIC clock_t get_uptime(void)
+clock_t get_uptime(void)
{
/* Get and return the current clock uptime in ticks. */
return(realtime);
/*===========================================================================*
* set_timer *
*===========================================================================*/
-PUBLIC void set_timer(tp, exp_time, watchdog)
+void set_timer(tp, exp_time, watchdog)
struct timer *tp; /* pointer to timer structure */
clock_t exp_time; /* expiration realtime */
tmr_func_t watchdog; /* watchdog to be called */
/*===========================================================================*
* reset_timer *
*===========================================================================*/
-PUBLIC void reset_timer(tp)
+void reset_timer(tp)
struct timer *tp; /* pointer to timer structure */
{
/* The timer pointed to by 'tp' is no longer needed. Remove it from both the
/*===========================================================================*
* load_update *
*===========================================================================*/
-PRIVATE void load_update(void)
+static void load_update(void)
{
u16_t slot;
int enqueued = 0, q;
kloadinfo.last_clock = realtime;
}
-PUBLIC int boot_cpu_init_timer(unsigned freq)
+int boot_cpu_init_timer(unsigned freq)
{
if (init_local_timer(freq))
return -1;
return 0;
}
-PUBLIC int app_cpu_init_timer(unsigned freq)
+int app_cpu_init_timer(unsigned freq)
{
if (init_local_timer(freq))
return -1;
#define MAX_LOOP (NR_PROCS + NR_TASKS)
-PUBLIC int runqueues_ok_cpu(unsigned cpu)
+int runqueues_ok_cpu(unsigned cpu)
{
int q, l = 0;
register struct proc *xp;
}
#ifdef CONFIG_SMP
-PRIVATE int runqueues_ok_all(void)
+static int runqueues_ok_all(void)
{
unsigned c;
return 1;
}
-PUBLIC int runqueues_ok(void)
+int runqueues_ok(void)
{
return runqueues_ok_all();
}
#else
-PUBLIC int runqueues_ok(void)
+int runqueues_ok(void)
{
return runqueues_ok_cpu(0);
}
#endif
-PUBLIC char *
+char *
rtsflagstr(const u32_t flags)
{
static char str[100];
return str;
}
-PUBLIC char *
+char *
miscflagstr(const u32_t flags)
{
static char str[100];
return str;
}
-PUBLIC char *
+char *
schedulerstr(struct proc *scheduler)
{
if (scheduler != NULL)
return "KERNEL";
}
-PRIVATE void
+static void
print_proc_name(struct proc *pp)
{
char *name = pp->p_name;
}
}
-PRIVATE void
+static void
print_endpoint(endpoint_t ep)
{
int proc_nr;
}
}
-PRIVATE void
+static void
print_sigmgr(struct proc *pp)
{
endpoint_t sig_mgr, bak_sig_mgr;
}
}
-PUBLIC void print_proc(struct proc *pp)
+void print_proc(struct proc *pp)
{
endpoint_t dep;
printf("\n");
}
-PRIVATE void print_proc_depends(struct proc *pp, const int level)
+static void print_proc_depends(struct proc *pp, const int level)
{
struct proc *depproc = NULL;
endpoint_t dep;
}
}
-PUBLIC void print_proc_recursive(struct proc *pp)
+void print_proc_recursive(struct proc *pp)
{
print_proc_depends(pp, 0);
}
#if DEBUG_DUMPIPC
-PRIVATE const char *mtypename(int mtype, int iscall)
+static const char *mtypename(int mtype, int iscall)
{
/* use generated file to recognize message types */
if (iscall) {
return NULL;
}
-PRIVATE void printproc(struct proc *rp)
+static void printproc(struct proc *rp)
{
if (rp)
printf(" %s(%d)", rp->p_name, rp - proc);
printf(" kernel");
}
-PRIVATE void printparam(const char *name, const void *data, size_t size)
+static void printparam(const char *name, const void *data, size_t size)
{
printf(" %s=", name);
switch (size) {
}
}
-PRIVATE void printmsg(message *msg, struct proc *src, struct proc *dst,
+static void printmsg(message *msg, struct proc *src, struct proc *dst,
char operation, int iscall, int printparams)
{
const char *name;
#if DEBUG_IPCSTATS
#define IPCPROCS (NR_PROCS+1) /* number of slots we need */
#define KERNELIPC NR_PROCS /* slot number to use for kernel calls */
-PRIVATE int messages[IPCPROCS][IPCPROCS];
+static int messages[IPCPROCS][IPCPROCS];
#define PRINTSLOTS 20
-PRIVATE struct {
+static struct {
int src, dst, messages;
} winners[PRINTSLOTS];
-PRIVATE int total, goodslots;
+static int total, goodslots;
-PRIVATE void printstats(int ticks)
+static void printstats(int ticks)
{
int i;
for(i = 0; i < goodslots; i++) {
printf("total %d/s\n", persec(total));
}
-PRIVATE void sortstats(void)
+static void sortstats(void)
{
/* Print top message senders/receivers. */
int src_slot, dst_slot;
assert(s >= 0 && s < IPCPROCS); \
}
-PRIVATE void statmsg(message *msg, struct proc *srcp, struct proc *dstp)
+static void statmsg(message *msg, struct proc *srcp, struct proc *dstp)
{
int src, dst, now, secs, dt;
static int lastprint;
#endif
#if DEBUG_IPC_HOOK
-PUBLIC void hook_ipc_msgkcall(message *msg, struct proc *proc)
+void hook_ipc_msgkcall(message *msg, struct proc *proc)
{
#if DEBUG_DUMPIPC
printmsg(msg, proc, NULL, 'k', 1, 1);
#endif
}
-PUBLIC void hook_ipc_msgkresult(message *msg, struct proc *proc)
+void hook_ipc_msgkresult(message *msg, struct proc *proc)
{
#if DEBUG_DUMPIPC
printmsg(msg, NULL, proc, 'k', 0, 0);
#endif
}
-PUBLIC void hook_ipc_msgrecv(message *msg, struct proc *src, struct proc *dst)
+void hook_ipc_msgrecv(message *msg, struct proc *src, struct proc *dst)
{
#if DEBUG_DUMPIPC
printmsg(msg, src, dst, 'r', src->p_misc_flags & MF_REPLY_PEND, 0);
#endif
}
-PUBLIC void hook_ipc_msgsend(message *msg, struct proc *src, struct proc *dst)
+void hook_ipc_msgsend(message *msg, struct proc *src, struct proc *dst)
{
#if DEBUG_DUMPIPC
printmsg(msg, src, dst, 's', src->p_misc_flags & MF_REPLY_PEND, 1);
#endif
}
-PUBLIC void hook_ipc_clear(struct proc *p)
+void hook_ipc_clear(struct proc *p)
{
#if DEBUG_IPCSTATS
int slot, i;
/* number of lists of IRQ hooks, one list per supported line. */
-PRIVATE irq_hook_t* irq_handlers[NR_IRQ_VECTORS] = {0};
+static irq_hook_t* irq_handlers[NR_IRQ_VECTORS] = {0};
/*===========================================================================*
* put_irq_handler *
*===========================================================================*/
/* Register an interrupt handler. */
-PUBLIC void put_irq_handler( irq_hook_t* hook, int irq,
+void put_irq_handler( irq_hook_t* hook, int irq,
const irq_handler_t handler)
{
int id;
* rm_irq_handler *
*===========================================================================*/
/* Unregister an interrupt handler. */
-PUBLIC void rm_irq_handler( const irq_hook_t* hook ) {
+void rm_irq_handler( const irq_hook_t* hook ) {
const int irq = hook->irq;
const int id = hook->id;
irq_hook_t **line;
* the end. Before returning, it unmasks the IRQ if and only if all active ID
* bits are cleared, and restart a process.
*/
-PUBLIC void irq_handle(int irq)
+void irq_handle(int irq)
{
irq_hook_t * hook;
}
/* Enable/Disable a interrupt line. */
-PUBLIC void enable_irq(const irq_hook_t *hook)
+void enable_irq(const irq_hook_t *hook)
{
if((irq_actids[hook->irq] &= ~hook->id) == 0) {
hw_intr_unmask(hook->irq);
}
/* Return true if the interrupt was enabled before call. */
-PUBLIC int disable_irq(const irq_hook_t *hook)
+int disable_irq(const irq_hook_t *hook)
{
if(irq_actids[hook->irq] & hook->id) /* already disabled */
return 0;
char *** _penviron;
/* Prototype declarations for PRIVATE functions. */
-FORWARD void announce(void);
+static void announce(void);
-PUBLIC void bsp_finish_booting(void)
+void bsp_finish_booting(void)
{
int i;
#if SPROFILE
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* Start the ball rolling. */
struct boot_image *ip; /* boot image pointer */
/*===========================================================================*
* announce *
*===========================================================================*/
-PRIVATE void announce(void)
+static void announce(void)
{
/* Display the MINIX startup banner. */
printf("\nMINIX %s.%s. "
/*===========================================================================*
* prepare_shutdown *
*===========================================================================*/
-PUBLIC void prepare_shutdown(const int how)
+void prepare_shutdown(const int how)
{
/* This function prepares to shutdown MINIX. */
static timer_t shutdown_timer;
/*===========================================================================*
* shutdown *
*===========================================================================*/
-PUBLIC void minix_shutdown(timer_t *tp)
+void minix_shutdown(timer_t *tp)
{
/* This function is called from prepare_shutdown or stop_sequence to bring
* down MINIX. How to shutdown is in the argument: RBT_HALT (return to the
#include "arch_proto.h"
/* Scheduling and message passing functions */
-FORWARD void idle(void);
+static void idle(void);
/**
* Made public for use in clock.c (for user-space scheduling)
-FORWARD int mini_send(struct proc *caller_ptr, endpoint_t dst_e, message
+static int mini_send(struct proc *caller_ptr, endpoint_t dst_e, message
*m_ptr, int flags);
*/
-FORWARD int mini_receive(struct proc *caller_ptr, endpoint_t src,
+static int mini_receive(struct proc *caller_ptr, endpoint_t src,
message *m_ptr, int flags);
-FORWARD int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t
+static int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t
size);
-FORWARD int deadlock(int function, register struct proc *caller,
+static int deadlock(int function, register struct proc *caller,
endpoint_t src_dst_e);
-FORWARD int try_async(struct proc *caller_ptr);
-FORWARD int try_one(struct proc *src_ptr, struct proc *dst_ptr);
-FORWARD struct proc * pick_proc(void);
-FORWARD void enqueue_head(struct proc *rp);
+static int try_async(struct proc *caller_ptr);
+static int try_one(struct proc *src_ptr, struct proc *dst_ptr);
+static struct proc * pick_proc(void);
+static void enqueue_head(struct proc *rp);
/* all idles share the same idle_priv structure */
-PRIVATE struct priv idle_priv;
+static struct priv idle_priv;
-PRIVATE void set_idle_name(char * name, int n)
+static void set_idle_name(char * name, int n)
{
int i, c;
int p_z = 0;
break; \
}
-PUBLIC void proc_init(void)
+void proc_init(void)
{
struct proc * rp;
struct priv *sp;
}
}
-PRIVATE void switch_address_space_idle(void)
+static void switch_address_space_idle(void)
{
#ifdef CONFIG_SMP
/*
/*===========================================================================*
* idle *
*===========================================================================*/
-PRIVATE void idle(void)
+static void idle(void)
{
struct proc * p;
/*===========================================================================*
* switch_to_user *
*===========================================================================*/
-PUBLIC void switch_to_user(void)
+void switch_to_user(void)
{
/* This function is called an instant before proc_ptr is
* to be scheduled again.
/*
* handler for all synchronous IPC calls
*/
-PRIVATE int do_sync_ipc(struct proc * caller_ptr, /* who made the call */
+static int do_sync_ipc(struct proc * caller_ptr, /* who made the call */
int call_nr, /* system call number and flags */
endpoint_t src_dst_e, /* src or dst of the call */
message *m_ptr) /* users pointer to a message */
return(result);
}
-PUBLIC int do_ipc(reg_t r1, reg_t r2, reg_t r3)
+int do_ipc(reg_t r1, reg_t r2, reg_t r3)
{
struct proc *const caller_ptr = get_cpulocal_var(proc_ptr); /* get pointer to caller */
int call_nr = (int) r1;
/*===========================================================================*
* deadlock *
*===========================================================================*/
-PRIVATE int deadlock(function, cp, src_dst_e)
+static int deadlock(function, cp, src_dst_e)
int function; /* trap number */
register struct proc *cp; /* pointer to caller */
endpoint_t src_dst_e; /* src or dst process */
/*===========================================================================*
* has_pending *
*===========================================================================*/
-PRIVATE int has_pending(sys_map_t *map, int src_p, int asynm)
+static int has_pending(sys_map_t *map, int src_p, int asynm)
{
/* Check to see if there is a pending message from the desired source
* available.
/*===========================================================================*
* has_pending_notify *
*===========================================================================*/
-PUBLIC int has_pending_notify(struct proc * caller, int src_p)
+int has_pending_notify(struct proc * caller, int src_p)
{
sys_map_t * map = &priv(caller)->s_notify_pending;
return has_pending(map, src_p, 0);
/*===========================================================================*
* has_pending_asend *
*===========================================================================*/
-PUBLIC int has_pending_asend(struct proc * caller, int src_p)
+int has_pending_asend(struct proc * caller, int src_p)
{
sys_map_t * map = &priv(caller)->s_asyn_pending;
return has_pending(map, src_p, 1);
/*===========================================================================*
* unset_notify_pending *
*===========================================================================*/
-PUBLIC void unset_notify_pending(struct proc * caller, int src_p)
+void unset_notify_pending(struct proc * caller, int src_p)
{
sys_map_t * map = &priv(caller)->s_notify_pending;
unset_sys_bit(*map, src_p);
/*===========================================================================*
* mini_send *
*===========================================================================*/
-PUBLIC int mini_send(
+int mini_send(
register struct proc *caller_ptr, /* who is trying to send a message? */
endpoint_t dst_e, /* to whom is message being sent? */
message *m_ptr, /* pointer to message buffer */
/*===========================================================================*
* mini_receive *
*===========================================================================*/
-PRIVATE int mini_receive(struct proc * caller_ptr,
+static int mini_receive(struct proc * caller_ptr,
endpoint_t src_e, /* which message source is wanted */
message * m_buff_usr, /* pointer to message buffer */
const int flags)
/*===========================================================================*
* mini_notify *
*===========================================================================*/
-PUBLIC int mini_notify(
+int mini_notify(
const struct proc *caller_ptr, /* sender of the notification */
endpoint_t dst_e /* which process to notify */
)
/*===========================================================================*
* try_deliver_senda *
*===========================================================================*/
-PUBLIC int try_deliver_senda(struct proc *caller_ptr,
+int try_deliver_senda(struct proc *caller_ptr,
asynmsg_t *table,
size_t size)
{
/*===========================================================================*
* mini_senda *
*===========================================================================*/
-PRIVATE int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size)
+static int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size)
{
struct priv *privp;
/*===========================================================================*
* try_async *
*===========================================================================*/
-PRIVATE int try_async(caller_ptr)
+static int try_async(caller_ptr)
struct proc *caller_ptr;
{
int r;
/*===========================================================================*
* try_one *
*===========================================================================*/
-PRIVATE int try_one(struct proc *src_ptr, struct proc *dst_ptr)
+static int try_one(struct proc *src_ptr, struct proc *dst_ptr)
{
/* Try to receive an asynchronous message from 'src_ptr' */
int r = EAGAIN, done, do_notify;
/*===========================================================================*
* cancel_async *
*===========================================================================*/
-PUBLIC int cancel_async(struct proc *src_ptr, struct proc *dst_ptr)
+int cancel_async(struct proc *src_ptr, struct proc *dst_ptr)
{
/* Cancel asynchronous messages from src to dst, because dst is not interested
* in them (e.g., dst has been restarted) */
/*===========================================================================*
* enqueue *
*===========================================================================*/
-PUBLIC void enqueue(
+void enqueue(
register struct proc *rp /* this process is now runnable */
)
{
* process on a run queue. We have to put this process back at the fron to be
* fair
*/
-PRIVATE void enqueue_head(struct proc *rp)
+static void enqueue_head(struct proc *rp)
{
const int q = rp->p_priority; /* scheduling queue to use */
/*===========================================================================*
* dequeue *
*===========================================================================*/
-PUBLIC void dequeue(struct proc *rp)
+void dequeue(struct proc *rp)
/* this process is no longer runnable */
{
/* A process must be removed from the scheduling queues, for example, because
/*===========================================================================*
* pick_proc *
*===========================================================================*/
-PRIVATE struct proc * pick_proc(void)
+static struct proc * pick_proc(void)
{
/* Decide who to run now. A new process is selected an returned.
* When a billable process is selected, record it in 'bill_ptr', so that the
/*===========================================================================*
* endpoint_lookup *
*===========================================================================*/
-PUBLIC struct proc *endpoint_lookup(endpoint_t e)
+struct proc *endpoint_lookup(endpoint_t e)
{
int n;
* isokendpt_f *
*===========================================================================*/
#if DEBUG_ENABLE_IPC_WARNINGS
-PUBLIC int isokendpt_f(file, line, e, p, fatalflag)
+int isokendpt_f(file, line, e, p, fatalflag)
const char *file;
int line;
#else
-PUBLIC int isokendpt_f(e, p, fatalflag)
+int isokendpt_f(e, p, fatalflag)
#endif
endpoint_t e;
int *p;
return ok;
}
-PRIVATE void notify_scheduler(struct proc *p)
+static void notify_scheduler(struct proc *p)
{
message m_no_quantum;
int err;
}
}
-PUBLIC void proc_no_time(struct proc * p)
+void proc_no_time(struct proc * p)
{
if (!proc_kernel_scheduler(p) && priv(p)->s_flags & PREEMPTIBLE) {
/* this dequeues the process */
}
}
-PUBLIC void reset_proc_accounting(struct proc *p)
+void reset_proc_accounting(struct proc *p)
{
p->p_accounting.preempted = 0;
p->p_accounting.ipc_sync = 0;
make_zero64(p->p_accounting.enter_queue);
}
-PUBLIC void copr_not_available_handler(void)
+void copr_not_available_handler(void)
{
struct proc * p;
struct proc ** local_fpu_owner;
NOT_REACHABLE;
}
-PUBLIC void release_fpu(struct proc * p) {
+void release_fpu(struct proc * p) {
struct proc ** fpu_owner_ptr;
fpu_owner_ptr = get_cpu_var_ptr(p->p_cpu, fpu_owner);
char sprof_sample_buffer[SAMPLE_BUFFER_SIZE];
/* Function prototype for the profiling clock handler. */
-FORWARD int profile_clock_handler(irq_hook_t *hook);
+static int profile_clock_handler(irq_hook_t *hook);
/* A hook for the profiling clock interrupt handler. */
-PRIVATE irq_hook_t profile_clock_hook;
+static irq_hook_t profile_clock_hook;
/*===========================================================================*
* init_profile_clock *
*===========================================================================*/
-PUBLIC void init_profile_clock(u32_t freq)
+void init_profile_clock(u32_t freq)
{
int irq;
/*===========================================================================*
* profile_clock_stop *
*===========================================================================*/
-PUBLIC void stop_profile_clock()
+void stop_profile_clock()
{
arch_stop_profile_clock();
rm_irq_handler(&profile_clock_hook);
}
-PRIVATE void sprof_save_sample(struct proc * p, void * pc)
+static void sprof_save_sample(struct proc * p, void * pc)
{
struct sprof_sample *s;
sprof_info.mem_used += sizeof(struct sprof_sample);
}
-PRIVATE void sprof_save_proc(struct proc * p)
+static void sprof_save_proc(struct proc * p)
{
struct sprof_proc * s;
sprof_info.mem_used += sizeof(struct sprof_proc);
}
-PRIVATE void profile_sample(struct proc * p, void * pc)
+static void profile_sample(struct proc * p, void * pc)
{
/* This executes on every tick of the CMOS timer. */
/*===========================================================================*
* profile_clock_handler *
*===========================================================================*/
-PRIVATE int profile_clock_handler(irq_hook_t *hook)
+static int profile_clock_handler(irq_hook_t *hook)
{
struct proc * p;
p = get_cpulocal_var(proc_ptr);
return(1); /* reenable interrupts */
}
-PUBLIC void nmi_sprofile_handler(struct nmi_frame * frame)
+void nmi_sprofile_handler(struct nmi_frame * frame)
{
struct proc * p = get_cpulocal_var(proc_ptr);
/*
struct cprof_tbl_s cprof_tbl[CPROF_TABLE_SIZE_KERNEL];
/* Function that returns table size. */
-PUBLIC int profile_get_tbl_size(void)
+int profile_get_tbl_size(void)
{
return CPROF_TABLE_SIZE_KERNEL;
}
/* Function that returns on which execution of procentry to announce. */
-PUBLIC int profile_get_announce(void)
+int profile_get_announce(void)
{
return CPROF_ACCOUNCE_KERNEL;
}
* The kernel "announces" its control struct and table locations
* to itself through this function.
*/
-PUBLIC void profile_register(ctl_ptr, tbl_ptr)
+void profile_register(ctl_ptr, tbl_ptr)
void *ctl_ptr;
void *tbl_ptr;
{
unsigned ht_per_core;
unsigned bsp_cpu_id;
-PUBLIC struct cpu cpus[CONFIG_MAX_CPUS];
+struct cpu cpus[CONFIG_MAX_CPUS];
/* info passed to another cpu along with a sched ipi */
struct sched_ipi_data {
volatile u32_t data;
};
-PRIVATE struct sched_ipi_data sched_ipi_data[CONFIG_MAX_CPUS];
+static struct sched_ipi_data sched_ipi_data[CONFIG_MAX_CPUS];
#define SCHED_IPI_STOP_PROC 1
#define SCHED_IPI_VM_INHIBIT 2
SPINLOCK_DEFINE(big_kernel_lock)
SPINLOCK_DEFINE(boot_lock)
-PUBLIC void wait_for_APs_to_finish_booting(void)
+void wait_for_APs_to_finish_booting(void)
{
unsigned n = 0;
int i;
BKL_LOCK();
}
-PUBLIC void ap_boot_finished(unsigned cpu)
+void ap_boot_finished(unsigned cpu)
{
ap_cpus_booted++;
}
-PUBLIC void smp_ipi_halt_handler(void)
+void smp_ipi_halt_handler(void)
{
ipi_ack();
stop_local_timer();
arch_smp_halt_cpu();
}
-PUBLIC void smp_schedule(unsigned cpu)
+void smp_schedule(unsigned cpu)
{
arch_send_smp_schedule_ipi(cpu);
}
* the task is finished. Also wait before it finishes task sent by another cpu
* to the same one.
*/
-PRIVATE void smp_schedule_sync(struct proc * p, unsigned task)
+static void smp_schedule_sync(struct proc * p, unsigned task)
{
unsigned cpu = p->p_cpu;
unsigned mycpu = cpuid;
BKL_LOCK();
}
-PUBLIC void smp_schedule_stop_proc(struct proc * p)
+void smp_schedule_stop_proc(struct proc * p)
{
if (proc_is_runnable(p))
smp_schedule_sync(p, SCHED_IPI_STOP_PROC);
assert(RTS_ISSET(p, RTS_PROC_STOP));
}
-PUBLIC void smp_schedule_vminhibit(struct proc * p)
+void smp_schedule_vminhibit(struct proc * p)
{
if (proc_is_runnable(p))
smp_schedule_sync(p, SCHED_IPI_VM_INHIBIT);
assert(RTS_ISSET(p, RTS_VMINHIBIT));
}
-PUBLIC void smp_schedule_stop_proc_save_ctx(struct proc * p)
+void smp_schedule_stop_proc_save_ctx(struct proc * p)
{
/*
* stop the processes and force the complete context of the process to
assert(RTS_ISSET(p, RTS_PROC_STOP));
}
-PUBLIC void smp_schedule_migrate_proc(struct proc * p, unsigned dest_cpu)
+void smp_schedule_migrate_proc(struct proc * p, unsigned dest_cpu)
{
/*
* stop the processes and force the complete context of the process to
RTS_UNSET(p, RTS_PROC_STOP);
}
-PUBLIC void smp_sched_handler(void)
+void smp_sched_handler(void)
{
unsigned flgs;
unsigned cpu = cpuid;
* already called. It only serves the purpose of acknowledging the IPI and
* preempting the current process if the CPU was not idle.
*/
-PUBLIC void smp_ipi_sched_handler(void)
+void smp_ipi_sched_handler(void)
{
struct proc * curr;
/*===========================================================================*
* cstart *
*===========================================================================*/
-PUBLIC void cstart(
+void cstart(
u16_t cs, /* kernel code segment */
u16_t ds, /* kernel data segment */
u16_t mds, /* monitor data segment */
* get_value *
*===========================================================================*/
-PUBLIC char *get_value(
+char *get_value(
const char *params, /* boot monitor parameters */
const char *name /* key to look up */
)
/*===========================================================================*
* env_get *
*===========================================================================*/
-PUBLIC char *env_get(const char *name)
+char *env_get(const char *name)
{
return get_value(params_buffer, name);
}
* because the dummy is declared extern. If an illegal call is given, the
* array size will be negative and this won't compile.
*/
-PRIVATE int (*call_vec[NR_SYS_CALLS])(struct proc * caller, message *m_ptr);
+static int (*call_vec[NR_SYS_CALLS])(struct proc * caller, message *m_ptr);
#define map(call_nr, handler) \
{ int call_index = call_nr-KERNEL_CALL; \
assert(call_index >= 0 && call_index < NR_SYS_CALLS); \
call_vec[call_index] = (handler) ; }
-PRIVATE void kernel_call_finish(struct proc * caller, message *msg, int result)
+static void kernel_call_finish(struct proc * caller, message *msg, int result)
{
if(result == VMSUSPEND) {
/* Special case: message has to be saved for handling
}
}
-PRIVATE int kernel_call_dispatch(struct proc * caller, message *msg)
+static int kernel_call_dispatch(struct proc * caller, message *msg)
{
int result = OK;
int call_nr;
* this function checks the basic syscall parameters and if accepted it
* dispatches its handling to the right handler
*/
-PUBLIC void kernel_call(message *m_user, struct proc * caller)
+void kernel_call(message *m_user, struct proc * caller)
{
int result = OK;
message msg;
/*===========================================================================*
* initialize *
*===========================================================================*/
-PUBLIC void system_init(void)
+void system_init(void)
{
register struct priv *sp;
int i;
/*===========================================================================*
* get_priv *
*===========================================================================*/
-PUBLIC int get_priv(rc, priv_id)
+int get_priv(rc, priv_id)
register struct proc *rc; /* new (child) process pointer */
int priv_id; /* privilege id */
{
/*===========================================================================*
* set_sendto_bit *
*===========================================================================*/
-PUBLIC void set_sendto_bit(const struct proc *rp, int id)
+void set_sendto_bit(const struct proc *rp, int id)
{
/* Allow a process to send messages to the process(es) associated with the
* system privilege structure with the given ID.
/*===========================================================================*
* unset_sendto_bit *
*===========================================================================*/
-PUBLIC void unset_sendto_bit(const struct proc *rp, int id)
+void unset_sendto_bit(const struct proc *rp, int id)
{
/* Prevent a process from sending to another process. Retain the send mask
* symmetry by also unsetting the bit for the other direction.
/*===========================================================================*
* fill_sendto_mask *
*===========================================================================*/
-PUBLIC void fill_sendto_mask(const struct proc *rp, sys_map_t *map)
+void fill_sendto_mask(const struct proc *rp, sys_map_t *map)
{
int i;
/*===========================================================================*
* send_sig *
*===========================================================================*/
-PUBLIC void send_sig(endpoint_t ep, int sig_nr)
+void send_sig(endpoint_t ep, int sig_nr)
{
/* Notify a system process about a signal. This is straightforward. Simply
* set the signal that is to be delivered in the pending signals map and
/*===========================================================================*
* cause_sig *
*===========================================================================*/
-PUBLIC void cause_sig(proc_nr, sig_nr)
+void cause_sig(proc_nr, sig_nr)
proc_nr_t proc_nr; /* process to be signalled */
int sig_nr; /* signal to be sent */
{
/*===========================================================================*
* sig_delay_done *
*===========================================================================*/
-PUBLIC void sig_delay_done(struct proc *rp)
+void sig_delay_done(struct proc *rp)
{
/* A process is now known not to send any direct messages.
* Tell PM that the stop delay has ended, by sending a signal to the process.
/*===========================================================================*
* umap_bios *
*===========================================================================*/
-PUBLIC phys_bytes umap_bios(vir_addr, bytes)
+phys_bytes umap_bios(vir_addr, bytes)
vir_bytes vir_addr; /* virtual address in BIOS segment */
vir_bytes bytes; /* # of bytes to be copied */
{
/*===========================================================================*
* clear_ipc *
*===========================================================================*/
-PRIVATE void clear_ipc(
+static void clear_ipc(
register struct proc *rc /* slot of process to clean up */
)
{
/*===========================================================================*
* clear_endpoint *
*===========================================================================*/
-PUBLIC void clear_endpoint(rc)
+void clear_endpoint(rc)
register struct proc *rc; /* slot of process to clean up */
{
if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint);
/*===========================================================================*
* clear_ipc_refs *
*===========================================================================*/
-PUBLIC void clear_ipc_refs(rc, caller_ret)
+void clear_ipc_refs(rc, caller_ret)
register struct proc *rc; /* slot of process to clean up */
int caller_ret; /* code to return on callers */
{
/*===========================================================================*
* kernel_call_resume *
*===========================================================================*/
-PUBLIC void kernel_call_resume(struct proc *caller)
+void kernel_call_resume(struct proc *caller)
{
int result;
/*===========================================================================*
* sched_proc *
*===========================================================================*/
-PUBLIC int sched_proc(struct proc *p,
+int sched_proc(struct proc *p,
int priority,
int quantum,
int cpu)
/*===========================================================================*
* do_abort *
*===========================================================================*/
-PUBLIC int do_abort(struct proc * caller, message * m_ptr)
+int do_abort(struct proc * caller, message * m_ptr)
{
/* Handle sys_abort. MINIX is unable to continue. This can originate e.g.
* in the PM (normal abort) or TTY (after CTRL-ALT-DEL).
/*===========================================================================*
* do_clear *
*===========================================================================*/
-PUBLIC int do_clear(struct proc * caller, message * m_ptr)
+int do_clear(struct proc * caller, message * m_ptr)
{
/* Handle sys_clear. Only the PM can request other process slots to be cleared
* when a process has exited.
/*===========================================================================*
* do_copy *
*===========================================================================*/
-PUBLIC int do_copy(struct proc * caller, message * m_ptr)
+int do_copy(struct proc * caller, message * m_ptr)
{
/* Handle sys_vircopy() and sys_physcopy(). Copy data using virtual or
* physical addressing. Although a single handler function is used, there
/*===========================================================================*
* do_cprofile *
*===========================================================================*/
-PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
+int do_cprofile(struct proc * caller, message * m_ptr)
{
int proc_nr, i;
phys_bytes len;
/*===========================================================================*
* do_devio *
*===========================================================================*/
-PUBLIC int do_devio(struct proc * caller, message * m_ptr)
+int do_devio(struct proc * caller, message * m_ptr)
{
struct priv *privp;
port_t port;
/*===========================================================================*
* do_endksig *
*===========================================================================*/
-PUBLIC int do_endksig(struct proc * caller, message * m_ptr)
+int do_endksig(struct proc * caller, message * m_ptr)
{
/* Finish up after a kernel type signal, caused by a SYS_KILL message or a
* call to cause_sig by a task. This is called by a signal manager after
/*===========================================================================*
* do_exec *
*===========================================================================*/
-PUBLIC int do_exec(struct proc * caller, message * m_ptr)
+int do_exec(struct proc * caller, message * m_ptr)
{
/* Handle sys_exec(). A process has done a successful EXEC. Patch it up. */
register struct proc *rp;
/*===========================================================================*
* do_exit *
*===========================================================================*/
-PUBLIC int do_exit(struct proc * caller, message * m_ptr)
+int do_exit(struct proc * caller, message * m_ptr)
{
/* Handle sys_exit. A system process has requested to exit. Generate a
* self-termination signal.
/*===========================================================================*
* do_fork *
*===========================================================================*/
-PUBLIC int do_fork(struct proc * caller, message * m_ptr)
+int do_fork(struct proc * caller, message * m_ptr)
{
/* Handle sys_fork(). PR_ENDPT has forked. The child is PR_SLOT. */
#if (_MINIX_CHIP == _CHIP_INTEL)
/*===========================================================================*
* update_idle_time *
*===========================================================================*/
-PRIVATE void update_idle_time(void)
+static void update_idle_time(void)
{
int i;
struct proc * idl = proc_addr(IDLE);
/*===========================================================================*
* do_getinfo *
*===========================================================================*/
-PUBLIC int do_getinfo(struct proc * caller, message * m_ptr)
+int do_getinfo(struct proc * caller, message * m_ptr)
{
/* Request system information to be copied to caller's address space. This
* call simply copies entire data structures to the caller.
/*===========================================================================*
* do_getksig *
*===========================================================================*/
-PUBLIC int do_getksig(struct proc * caller, message * m_ptr)
+int do_getksig(struct proc * caller, message * m_ptr)
{
/* The signal manager is ready to accept signals and repeatedly does a kernel
* call to get one. Find a process with pending signals. If no signals are
#if USE_IRQCTL
-FORWARD int generic_handler(irq_hook_t *hook);
+static int generic_handler(irq_hook_t *hook);
/*===========================================================================*
* do_irqctl *
*===========================================================================*/
-PUBLIC int do_irqctl(struct proc * caller, message * m_ptr)
+int do_irqctl(struct proc * caller, message * m_ptr)
{
/* Dismember the request message. */
int irq_vec;
/*===========================================================================*
* generic_handler *
*===========================================================================*/
-PRIVATE int generic_handler(hook)
+static int generic_handler(hook)
irq_hook_t *hook;
{
/* This function handles hardware interrupt in a simple and generic way. All
/*===========================================================================*
* do_kill *
*===========================================================================*/
-PUBLIC int do_kill(struct proc * caller, message * m_ptr)
+int do_kill(struct proc * caller, message * m_ptr)
{
/* Handle sys_kill(). Cause a signal to be sent to a process. Any request
* is added to the map of pending signals and the signal manager
/*===========================================================================*
* do_getmcontext *
*===========================================================================*/
-PUBLIC int do_getmcontext(struct proc * caller, message * m_ptr)
+int do_getmcontext(struct proc * caller, message * m_ptr)
{
/* Retrieve machine context of a process */
/*===========================================================================*
* do_setmcontext *
*===========================================================================*/
-PUBLIC int do_setmcontext(struct proc * caller, message * m_ptr)
+int do_setmcontext(struct proc * caller, message * m_ptr)
{
/* Set machine context of a process */
/*===========================================================================*
* do_memset *
*===========================================================================*/
-PUBLIC int do_memset(struct proc * caller, message * m_ptr)
+int do_memset(struct proc * caller, message * m_ptr)
{
/* Handle sys_memset(). This writes a pattern into the specified memory. */
unsigned char c = m_ptr->MEM_PATTERN;
/*===========================================================================*
* do_newmap *
*===========================================================================*/
-PUBLIC int do_newmap(struct proc * caller, message * m_ptr)
+int do_newmap(struct proc * caller, message * m_ptr)
{
/* Handle sys_newmap(). Fetch the memory map. */
struct proc *rp; /* process whose map is to be loaded */
/*===========================================================================*
* newmap *
*===========================================================================*/
-PUBLIC int newmap(struct proc *caller, struct proc *rp, struct mem_map *map_ptr)
+int newmap(struct proc *caller, struct proc *rp, struct mem_map *map_ptr)
{
int r;
/* Fetch the memory map. */
#define PRIV_DEBUG 0
-FORWARD int update_priv(struct proc *rp, struct priv *priv);
+static int update_priv(struct proc *rp, struct priv *priv);
/*===========================================================================*
* do_privctl *
*===========================================================================*/
-PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
+int do_privctl(struct proc * caller, message * m_ptr)
{
/* Handle sys_privctl(). Update a process' privileges. If the process is not
* yet a system process, make sure it gets its own privilege structure.
/*===========================================================================*
* update_priv *
*===========================================================================*/
-PRIVATE int update_priv(struct proc *rp, struct priv *priv)
+static int update_priv(struct proc *rp, struct priv *priv)
{
/* Update the privilege structure of a given process. */
/*===========================================================================*
* do_profbuf *
*===========================================================================*/
-PUBLIC int do_profbuf(struct proc * caller, message * m_ptr)
+int do_profbuf(struct proc * caller, message * m_ptr)
{
/* This kernel call is used by profiled system processes when Call
* Profiling is enabled. It is called on the first execution of procentry.
/*===========================================================================*
* do_runctl *
*===========================================================================*/
-PUBLIC int do_runctl(struct proc * caller, message * m_ptr)
+int do_runctl(struct proc * caller, message * m_ptr)
{
/* Control a process's RTS_PROC_STOP flag. Used for process management.
* If the process is queued sending a message or stopped for system call
#define MEM_TOP 0xFFFFFFFFUL
-FORWARD int safecopy(struct proc *, endpoint_t, endpoint_t,
+static int safecopy(struct proc *, endpoint_t, endpoint_t,
cp_grant_id_t, int, int, size_t, vir_bytes, vir_bytes, int);
#define HASGRANTTABLE(gr) \
/*===========================================================================*
* verify_grant *
*===========================================================================*/
-PUBLIC int verify_grant(granter, grantee, grant, bytes, access,
+int verify_grant(granter, grantee, grant, bytes, access,
offset_in, offset_result, e_granter)
endpoint_t granter, grantee; /* copyee, copyer */
cp_grant_id_t grant; /* grant id */
/*===========================================================================*
* safecopy *
*===========================================================================*/
-PRIVATE int safecopy(caller, granter, grantee, grantid, src_seg, dst_seg, bytes,
+static int safecopy(caller, granter, grantee, grantid, src_seg, dst_seg, bytes,
g_offset, addr, access)
struct proc * caller;
endpoint_t granter, grantee;
/*===========================================================================*
* do_safecopy_to *
*===========================================================================*/
-PUBLIC int do_safecopy_to(struct proc * caller, message * m_ptr)
+int do_safecopy_to(struct proc * caller, message * m_ptr)
{
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
(cp_grant_id_t) m_ptr->SCP_GID, m_ptr->SCP_SEG, D,
/*===========================================================================*
* do_safecopy_from *
*===========================================================================*/
-PUBLIC int do_safecopy_from(struct proc * caller, message * m_ptr)
+int do_safecopy_from(struct proc * caller, message * m_ptr)
{
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
(cp_grant_id_t) m_ptr->SCP_GID, D, m_ptr->SCP_SEG,
/*===========================================================================*
* do_vsafecopy *
*===========================================================================*/
-PUBLIC int do_vsafecopy(struct proc * caller, message * m_ptr)
+int do_vsafecopy(struct proc * caller, message * m_ptr)
{
static struct vscp_vec vec[SCPVEC_NR];
static struct vir_addr src, dst;
/*===========================================================================*
* map_invoke_vm *
*===========================================================================*/
-PUBLIC int map_invoke_vm(struct proc * caller,
+int map_invoke_vm(struct proc * caller,
int req_type, /* VMPTYPE_... COWMAP, SMAP, SUNMAP */
endpoint_t end_d, int seg_d, vir_bytes off_d,
endpoint_t end_s, int seg_s, vir_bytes off_s,
/*===========================================================================*
* do_safemap *
*===========================================================================*/
-PUBLIC int do_safemap(struct proc * caller, message * m_ptr)
+int do_safemap(struct proc * caller, message * m_ptr)
{
endpoint_t grantor = m_ptr->SMAP_EP;
cp_grant_id_t gid = (cp_grant_id_t) m_ptr->SMAP_GID;
/*===========================================================================*
* safeunmap *
*===========================================================================*/
-PRIVATE int safeunmap(struct proc * caller, struct map_info_s *p)
+static int safeunmap(struct proc * caller, struct map_info_s *p)
{
vir_bytes offset_result;
endpoint_t new_grantor;
/*===========================================================================*
* do_saferevmap *
*===========================================================================*/
-PUBLIC int do_saferevmap(struct proc * caller, message * m_ptr)
+int do_saferevmap(struct proc * caller, message * m_ptr)
{
struct map_info_s *p;
int flag = m_ptr->SMAP_FLAG;
/*===========================================================================*
* do_safeunmap *
*===========================================================================*/
-PUBLIC int do_safeunmap(struct proc * caller, message * m_ptr)
+int do_safeunmap(struct proc * caller, message * m_ptr)
{
vir_bytes address = (vir_bytes) m_ptr->SMAP_ADDRESS;
int seg = (int)m_ptr->SMAP_SEG;
/*===========================================================================*
* do_schedctl *
*===========================================================================*/
-PUBLIC int do_schedctl(struct proc * caller, message * m_ptr)
+int do_schedctl(struct proc * caller, message * m_ptr)
{
struct proc *p;
unsigned flags;
/*===========================================================================*
* do_schedule *
*===========================================================================*/
-PUBLIC int do_schedule(struct proc * caller, message * m_ptr)
+int do_schedule(struct proc * caller, message * m_ptr)
{
struct proc *p;
int proc_nr;
#if USE_SETALARM
-FORWARD void cause_alarm(timer_t *tp);
+static void cause_alarm(timer_t *tp);
/*===========================================================================*
* do_setalarm *
*===========================================================================*/
-PUBLIC int do_setalarm(struct proc * caller, message * m_ptr)
+int do_setalarm(struct proc * caller, message * m_ptr)
{
/* A process requests a synchronous alarm, or wants to cancel its alarm. */
long exp_time; /* expiration time for this alarm */
/*===========================================================================*
* cause_alarm *
*===========================================================================*/
-PRIVATE void cause_alarm(timer_t *tp)
+static void cause_alarm(timer_t *tp)
{
/* Routine called if a timer goes off and the process requested a synchronous
* alarm. The process number is stored in timer argument 'ta_int'. Notify that
/*===========================================================================*
* do_setgrant *
*===========================================================================*/
-PUBLIC int do_setgrant(struct proc * caller, message * m_ptr)
+int do_setgrant(struct proc * caller, message * m_ptr)
{
int r;
/*===========================================================================*
* do_sigreturn *
*===========================================================================*/
-PUBLIC int do_sigreturn(struct proc * caller, message * m_ptr)
+int do_sigreturn(struct proc * caller, message * m_ptr)
{
/* POSIX style signals require sys_sigreturn to put things in order before
* the signalled process can resume execution
/*===========================================================================*
* do_sigsend *
*===========================================================================*/
-PUBLIC int do_sigsend(struct proc * caller, message * m_ptr)
+int do_sigsend(struct proc * caller, message * m_ptr)
{
/* Handle sys_sigsend, POSIX-style signal handling. */
#if SPROFILE
/* user address to write info struct */
-PRIVATE vir_bytes sprof_info_addr_vir;
+static vir_bytes sprof_info_addr_vir;
-PRIVATE void clean_seen_flag(void)
+static void clean_seen_flag(void)
{
int i;
/*===========================================================================*
* do_sprofile *
*===========================================================================*/
-PUBLIC int do_sprofile(struct proc * caller, message * m_ptr)
+int do_sprofile(struct proc * caller, message * m_ptr)
{
int proc_nr;
int err;
/*===========================================================================*
* do_statectl *
*===========================================================================*/
-PUBLIC int do_statectl(struct proc * caller, message * m_ptr)
+int do_statectl(struct proc * caller, message * m_ptr)
{
/* Handle sys_statectl(). A process has issued a state control request. */
/*===========================================================================*
* do_stime *
*===========================================================================*/
-PUBLIC int do_stime(struct proc * caller, message * m_ptr)
+int do_stime(struct proc * caller, message * m_ptr)
{
boottime= m_ptr->T_BOOTTIME;
return(OK);
/*===========================================================================*
* do_sysctl *
*===========================================================================*/
-PUBLIC int do_sysctl(struct proc * caller, message * m_ptr)
+int do_sysctl(struct proc * caller, message * m_ptr)
{
vir_bytes len, buf;
static char mybuf[DIAG_BUFSIZE];
/*===========================================================================*
* do_times *
*===========================================================================*/
-PUBLIC int do_times(struct proc * caller, message * m_ptr)
+int do_times(struct proc * caller, message * m_ptr)
{
/* Handle sys_times(). Retrieve the accounting information. */
register const struct proc *rp;
/*==========================================================================*
* do_trace *
*==========================================================================*/
-PUBLIC int do_trace(struct proc * caller, message * m_ptr)
+int do_trace(struct proc * caller, message * m_ptr)
{
/* Handle the debugging commands supported by the ptrace system call
* The commands are:
/*==========================================================================*
* do_umap *
*==========================================================================*/
-PUBLIC int do_umap(struct proc * caller, message * m_ptr)
+int do_umap(struct proc * caller, message * m_ptr)
{
int seg_index = m_ptr->CP_SRC_SPACE & SEGMENT_INDEX;
int endpt = (int) m_ptr->CP_SRC_ENDPT;
/*==========================================================================*
* do_umap_remote *
*==========================================================================*/
-PUBLIC int do_umap_remote(struct proc * caller, message * m_ptr)
+int do_umap_remote(struct proc * caller, message * m_ptr)
{
/* Map virtual address to physical, for non-kernel processes. */
int seg_type = m_ptr->CP_SRC_SPACE & SEGMENT_TYPE;
(RTS_ISSET(p, RTS_NO_PRIV) || RTS_ISSET(p, RTS_SIG_PENDING) \
|| (RTS_ISSET(p, RTS_RECEIVING) && !RTS_ISSET(p, RTS_SENDING)))
-FORWARD void adjust_proc_slot(struct proc *rp, struct proc *from_rp);
-FORWARD void adjust_priv_slot(struct priv *privp, struct priv
+static void adjust_proc_slot(struct proc *rp, struct proc *from_rp);
+static void adjust_priv_slot(struct priv *privp, struct priv
*from_privp);
-FORWARD void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_rp,
+static void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_rp,
struct proc *b_copy_rp);
-FORWARD void swap_proc_slot_pointer(struct proc **rpp, struct proc
+static void swap_proc_slot_pointer(struct proc **rpp, struct proc
*src_rp, struct proc *dst_rp);
/*===========================================================================*
* do_update *
*===========================================================================*/
-PUBLIC int do_update(struct proc * caller, message * m_ptr)
+int do_update(struct proc * caller, message * m_ptr)
{
/* Handle sys_update(). Update a process into another by swapping their process
* slots.
/*===========================================================================*
* adjust_proc_slot *
*===========================================================================*/
-PRIVATE void adjust_proc_slot(struct proc *rp, struct proc *from_rp)
+static void adjust_proc_slot(struct proc *rp, struct proc *from_rp)
{
/* Preserve endpoints, slot numbers, priv structure, IPC, FPU pointer. */
rp->p_endpoint = from_rp->p_endpoint;
/*===========================================================================*
* adjust_priv_slot *
*===========================================================================*/
-PRIVATE void adjust_priv_slot(struct priv *privp, struct priv *from_privp)
+static void adjust_priv_slot(struct priv *privp, struct priv *from_privp)
{
/* Preserve privilege ids and non-privilege stuff in the priv structure. */
privp->s_id = from_privp->s_id;
/*===========================================================================*
* swap_fpu_state *
*===========================================================================*/
-PRIVATE void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_rp,
+static void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_rp,
struct proc *b_copy_rp)
{
/* Copy the FPU state from process B's copied slot, using B's original FPU
/*===========================================================================*
* swap_proc_slot_pointer *
*===========================================================================*/
-PRIVATE void swap_proc_slot_pointer(struct proc **rpp, struct proc *src_rp,
+static void swap_proc_slot_pointer(struct proc **rpp, struct proc *src_rp,
struct proc *dst_rp)
{
if(*rpp == src_rp) {
#if USE_VDEVIO
/* Buffer for SYS_VDEVIO to copy (port,value)-pairs from/ to user. */
-PRIVATE char vdevio_buf[VDEVIO_BUF_SIZE];
-PRIVATE pvb_pair_t * const pvb = (pvb_pair_t *) vdevio_buf;
-PRIVATE pvw_pair_t * const pvw = (pvw_pair_t *) vdevio_buf;
-PRIVATE pvl_pair_t * const pvl = (pvl_pair_t *) vdevio_buf;
+static char vdevio_buf[VDEVIO_BUF_SIZE];
+static pvb_pair_t * const pvb = (pvb_pair_t *) vdevio_buf;
+static pvw_pair_t * const pvw = (pvw_pair_t *) vdevio_buf;
+static pvl_pair_t * const pvl = (pvl_pair_t *) vdevio_buf;
/*===========================================================================*
* do_vdevio *
*===========================================================================*/
-PUBLIC int do_vdevio(struct proc * caller, message * m_ptr)
+int do_vdevio(struct proc * caller, message * m_ptr)
{
/* Perform a series of device I/O on behalf of a non-kernel process. The
* I/O addresses and I/O values are fetched from and returned to some buffer
/*===========================================================================*
* do_vmctl *
*===========================================================================*/
-PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
+int do_vmctl(struct proc * caller, message * m_ptr)
{
int proc_nr;
endpoint_t ep = m_ptr->SVMCTL_WHO;
/*===========================================================================*
* do_vtimer *
*===========================================================================*/
-PUBLIC int do_vtimer(struct proc * caller, message * m_ptr)
+int do_vtimer(struct proc * caller, message * m_ptr)
{
/* Set and/or retrieve the value of one of a process' virtual timers. */
struct proc *rp; /* pointer to process the timer belongs to */
/*===========================================================================*
* vtimer_check *
*===========================================================================*/
-PUBLIC void vtimer_check(rp)
+void vtimer_check(rp)
struct proc *rp; /* pointer to the process */
{
/* This is called from the clock task, so we can be interrupted by the clock
/*===========================================================================*
* do_vumap *
*===========================================================================*/
-PUBLIC int do_vumap(struct proc *caller, message *m_ptr)
+int do_vumap(struct proc *caller, message *m_ptr)
{
/* Map a vector of grants or local virtual addresses to physical addresses.
* Designed to be used by drivers to perform an efficient lookup of physical
* to prioritize ping messages periodically delivered to system processes.
*/
-PUBLIC struct boot_image image[] = {
+struct boot_image image[] = {
/* process nr, flags, stack size, name */
{ASYNCM, 0, 0, "asyncm"},
{IDLE, 0, 0, "idle" },
/*===========================================================================*
* panic *
*===========================================================================*/
-PUBLIC void panic(const char *fmt, ...)
+void panic(const char *fmt, ...)
{
va_list arg;
/* The system has run aground of a fatal kernel error. Terminate execution. */
/*===========================================================================*
* kputc *
*===========================================================================*/
-PUBLIC void kputc(c)
+void kputc(c)
int c; /* character to append */
{
/* Accumulate a single character for a kernel message. Send a notification
return;
}
-PUBLIC void cpu_print_freq(unsigned cpu)
+void cpu_print_freq(unsigned cpu)
{
u64_t freq;
printf("CPU %d freq %lu MHz\n", cpu, div64u(freq, 1000000));
}
-PUBLIC int is_fpu(void)
+int is_fpu(void)
{
return get_cpulocal_var(fpu_presence);
}
struct arch_watchdog *watchdog;
int watchdog_enabled;
-PRIVATE void lockup_check(struct nmi_frame * frame)
+static void lockup_check(struct nmi_frame * frame)
{
/* FIXME this should be CPU local */
static unsigned no_ticks;
arch_watchdog_lockup(frame);
}
-PUBLIC void nmi_watchdog_handler(struct nmi_frame * frame)
+void nmi_watchdog_handler(struct nmi_frame * frame)
{
#if SPROFILE
/*
#include <minix/ds.h>
-FORWARD int msg_open(int minor_dev_nr);
-FORWARD int msg_close(int minor_dev_nr);
-FORWARD int msg_ioctl(const message *m_ptr);
-FORWARD void msg_write(const message *m_ptr);
-FORWARD void msg_read(message *m_ptr);
-FORWARD void msg_hardware(void);
-FORWARD void msg_status(message *m_ptr);
-FORWARD int init_driver(void);
-FORWARD int open_sub_dev(int sub_dev_nr, int operation);
-FORWARD int close_sub_dev(int sub_dev_nr);
-FORWARD void handle_int_write(int sub_dev_nr);
-FORWARD void handle_int_read(int sub_dev_nr);
-FORWARD void data_to_user(sub_dev_t *sub_dev_ptr);
-FORWARD void data_from_user(sub_dev_t *sub_dev_ptr);
-FORWARD int init_buffers(sub_dev_t *sub_dev_ptr);
-FORWARD int get_started(sub_dev_t *sub_dev_ptr);
-FORWARD void reply(int code, int replyee, int process,int status);
-FORWARD int io_ctl_length(int io_request);
-FORWARD special_file_t* get_special_file(int minor_dev_nr);
-FORWARD void tell_dev(vir_bytes buf, size_t size, int pci_bus, int
+static int msg_open(int minor_dev_nr);
+static int msg_close(int minor_dev_nr);
+static int msg_ioctl(const message *m_ptr);
+static void msg_write(const message *m_ptr);
+static void msg_read(message *m_ptr);
+static void msg_hardware(void);
+static void msg_status(message *m_ptr);
+static int init_driver(void);
+static int open_sub_dev(int sub_dev_nr, int operation);
+static int close_sub_dev(int sub_dev_nr);
+static void handle_int_write(int sub_dev_nr);
+static void handle_int_read(int sub_dev_nr);
+static void data_to_user(sub_dev_t *sub_dev_ptr);
+static void data_from_user(sub_dev_t *sub_dev_ptr);
+static int init_buffers(sub_dev_t *sub_dev_ptr);
+static int get_started(sub_dev_t *sub_dev_ptr);
+static void reply(int code, int replyee, int process,int status);
+static int io_ctl_length(int io_request);
+static special_file_t* get_special_file(int minor_dev_nr);
+static void tell_dev(vir_bytes buf, size_t size, int pci_bus, int
pci_dev, int pci_func);
-PRIVATE char io_ctl_buf[_IOCPARM_MASK];
-PRIVATE int irq_hook_id = 0; /* id of irq hook at the kernel */
-PRIVATE int irq_hook_set = FALSE;
-PRIVATE int device_available = 0;/*todo*/
+static char io_ctl_buf[_IOCPARM_MASK];
+static int irq_hook_id = 0; /* id of irq hook at the kernel */
+static int irq_hook_set = FALSE;
+static int device_available = 0;/*todo*/
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state);
-PUBLIC int is_status_msg_expected = FALSE;
+int is_status_msg_expected = FALSE;
-PUBLIC int main(void)
+int main(void)
{
int r, caller;
message mess, repl_mess;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the audio driver framework. */
return init_driver();
}
-PRIVATE int init_driver(void) {
+static int init_driver(void) {
u32_t i; char irq;
static int executed = 0;
sub_dev_t* sub_dev_ptr;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
int i;
char irq;
}
}
-PRIVATE int msg_open (int minor_dev_nr) {
+static int msg_open (int minor_dev_nr) {
int r, read_chan, write_chan, io_ctl;
special_file_t* special_file_ptr;
}
-PRIVATE int open_sub_dev(int sub_dev_nr, int dma_mode) {
+static int open_sub_dev(int sub_dev_nr, int dma_mode) {
sub_dev_t* sub_dev_ptr;
sub_dev_ptr = &sub_dev[sub_dev_nr];
}
-PRIVATE int msg_close(int minor_dev_nr) {
+static int msg_close(int minor_dev_nr) {
int r, read_chan, write_chan, io_ctl;
special_file_t* special_file_ptr;
}
-PRIVATE int close_sub_dev(int sub_dev_nr) {
+static int close_sub_dev(int sub_dev_nr) {
sub_dev_t *sub_dev_ptr;
sub_dev_ptr = &sub_dev[sub_dev_nr];
if (sub_dev_ptr->DmaMode == DEV_WRITE_S && !sub_dev_ptr->OutOfData) {
}
-PRIVATE int msg_ioctl(const message *m_ptr)
+static int msg_ioctl(const message *m_ptr)
{
int status, len, chan;
sub_dev_t *sub_dev_ptr;
}
-PRIVATE void msg_write(const message *m_ptr)
+static void msg_write(const message *m_ptr)
{
int chan; sub_dev_t *sub_dev_ptr;
special_file_t* special_file_ptr;
}
-PRIVATE void msg_read(message *m_ptr)
+static void msg_read(message *m_ptr)
{
int chan; sub_dev_t *sub_dev_ptr;
special_file_t* special_file_ptr;
}
-PRIVATE void msg_hardware(void) {
+static void msg_hardware(void) {
u32_t i;
}
-PRIVATE void msg_status(message *m_ptr)
+static void msg_status(message *m_ptr)
{
int i;
}
/* handle interrupt for specified sub device; DmaMode == DEV_WRITE_S*/
-PRIVATE void handle_int_write(int sub_dev_nr)
+static void handle_int_write(int sub_dev_nr)
{
sub_dev_t *sub_dev_ptr;
/* handle interrupt for specified sub device; DmaMode == DEV_READ_S */
-PRIVATE void handle_int_read(int sub_dev_nr)
+static void handle_int_read(int sub_dev_nr)
{
sub_dev_t *sub_dev_ptr;
}
-PRIVATE int get_started(sub_dev_t *sub_dev_ptr) {
+static int get_started(sub_dev_t *sub_dev_ptr) {
u32_t i;
/* enable interrupt messages from MINIX */
}
-PRIVATE void data_from_user(sub_dev_t *subdev)
+static void data_from_user(sub_dev_t *subdev)
{
int r;
message m;
}
-PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr)
+static void data_to_user(sub_dev_t *sub_dev_ptr)
{
int r;
message m;
sub_dev_ptr->RevivePending = 0;
}
-PRIVATE int init_buffers(sub_dev_t *sub_dev_ptr)
+static int init_buffers(sub_dev_t *sub_dev_ptr)
{
#if (CHIP == INTEL)
char *base;
}
-PRIVATE void reply(int code, int replyee, int process, int status) {
+static void reply(int code, int replyee, int process, int status) {
message m;
m.m_type = code; /* DEV_REVIVE */
}
-PRIVATE int io_ctl_length(int io_request) {
+static int io_ctl_length(int io_request) {
io_request >>= 16;
return io_request & _IOCPARM_MASK;
}
-PRIVATE special_file_t* get_special_file(int minor_dev_nr) {
+static special_file_t* get_special_file(int minor_dev_nr) {
int i;
for(i = 0; i < drv.NrOfSpecialFiles; i++) {
return NULL;
}
-PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
+static void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
vir_bytes buf;
size_t size;
int pci_bus;
*/
/* State management helpers */
-PRIVATE int is_read_pending;
-PRIVATE int is_write_pending;
-PRIVATE void load_state_info(void)
+static int is_read_pending;
+static int is_write_pending;
+static void load_state_info(void)
{
int i, dma_mode, found_pending;
/*===========================================================================*
* sef_cb_lu_prepare *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare(int state)
+int sef_cb_lu_prepare(int state)
{
int is_ready;
/*===========================================================================*
* sef_cb_lu_state_isvalid *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid(int state)
+int sef_cb_lu_state_isvalid(int state)
{
return SEF_LU_STATE_IS_STANDARD(state) || AUDIO_STATE_IS_CUSTOM(state);
}
/*===========================================================================*
* sef_cb_lu_state_dump *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_dump(int state)
+void sef_cb_lu_state_dump(int state)
{
/* Load state information. */
load_state_info();
#include "trace.h"
/* Management data for opened devices. */
-PRIVATE int open_devs[MAX_NR_OPEN_DEVICES];
-PRIVATE int next_open_devs_slot = 0;
+static int open_devs[MAX_NR_OPEN_DEVICES];
+static int next_open_devs_slot = 0;
/*===========================================================================*
* clear_open_devs *
*===========================================================================*/
-PRIVATE void clear_open_devs(void)
+static void clear_open_devs(void)
{
/* Reset the set of previously opened minor devices. */
next_open_devs_slot = 0;
/*===========================================================================*
* is_open_dev *
*===========================================================================*/
-PRIVATE int is_open_dev(int device)
+static int is_open_dev(int device)
{
/* Check whether the given minor device has previously been opened. */
int i;
/*===========================================================================*
* set_open_dev *
*===========================================================================*/
-PRIVATE void set_open_dev(int device)
+static void set_open_dev(int device)
{
/* Mark the given minor device as having been opened. */
/*===========================================================================*
* blockdriver_announce *
*===========================================================================*/
-PUBLIC void blockdriver_announce(int type)
+void blockdriver_announce(int type)
{
/* Announce we are up after a fresh start or a restart. */
int r;
/*===========================================================================*
* blockdriver_reply *
*===========================================================================*/
-PUBLIC void blockdriver_reply(message *m_ptr, int ipc_status, int reply)
+void blockdriver_reply(message *m_ptr, int ipc_status, int reply)
{
/* Reply to a block request sent to the driver. */
endpoint_t caller_e;
/*===========================================================================*
* do_open *
*===========================================================================*/
-PRIVATE int do_open(struct blockdriver *bdp, message *mp)
+static int do_open(struct blockdriver *bdp, message *mp)
{
/* Open a minor device. */
/*===========================================================================*
* do_close *
*===========================================================================*/
-PRIVATE int do_close(struct blockdriver *bdp, message *mp)
+static int do_close(struct blockdriver *bdp, message *mp)
{
/* Close a minor device. */
/*===========================================================================*
* do_rdwt *
*===========================================================================*/
-PRIVATE int do_rdwt(struct blockdriver *bdp, message *mp)
+static int do_rdwt(struct blockdriver *bdp, message *mp)
{
/* Carry out a single read or write request. */
iovec_t iovec1;
/*===========================================================================*
* do_vrdwt *
*===========================================================================*/
-PRIVATE int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id)
+static int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id)
{
/* Carry out an device read or write to/from a vector of buffers. */
iovec_t iovec[NR_IOREQS];
/*===========================================================================*
* do_dioctl *
*===========================================================================*/
-PRIVATE int do_dioctl(struct blockdriver *bdp, dev_t minor,
+static int do_dioctl(struct blockdriver *bdp, dev_t minor,
unsigned int request, endpoint_t endpt, cp_grant_id_t grant)
{
/* Carry out a disk-specific I/O control request. */
/*===========================================================================*
* do_ioctl *
*===========================================================================*/
-PRIVATE int do_ioctl(struct blockdriver *bdp, message *mp)
+static int do_ioctl(struct blockdriver *bdp, message *mp)
{
/* Carry out an I/O control request. We forward block trace control requests
* to the tracing module, and handle setting/getting partitions when the driver
/*===========================================================================*
* blockdriver_handle_notify *
*===========================================================================*/
-PUBLIC void blockdriver_handle_notify(struct blockdriver *bdp, message *m_ptr)
+void blockdriver_handle_notify(struct blockdriver *bdp, message *m_ptr)
{
/* Take care of the notifications (interrupt and clock messages) by calling
* the appropiate callback functions. Never send a reply.
/*===========================================================================*
* blockdriver_handle_request *
*===========================================================================*/
-PUBLIC int blockdriver_handle_request(struct blockdriver *bdp, message *m_ptr,
+int blockdriver_handle_request(struct blockdriver *bdp, message *m_ptr,
thread_id_t id)
{
/* Call the appropiate driver function, based on the type of request. Return
mthread_rwlock_t barrier;
} device_t;
-PRIVATE struct blockdriver *bdtab;
-PRIVATE int running = FALSE;
+static struct blockdriver *bdtab;
+static int running = FALSE;
-PRIVATE mthread_key_t worker_key;
+static mthread_key_t worker_key;
-PRIVATE device_t device[MAX_DEVICES];
+static device_t device[MAX_DEVICES];
-PRIVATE worker_t *exited[MAX_THREADS];
-PRIVATE int num_exited = 0;
+static worker_t *exited[MAX_THREADS];
+static int num_exited = 0;
/*===========================================================================*
* enqueue *
*===========================================================================*/
-PRIVATE void enqueue(device_t *dp, const message *m_src, int ipc_status)
+static void enqueue(device_t *dp, const message *m_src, int ipc_status)
{
/* Enqueue a message into the device's queue, and signal the event.
* Must be called from the master thread.
/*===========================================================================*
* try_dequeue *
*===========================================================================*/
-PRIVATE int try_dequeue(device_t *dp, message *m_dst, int *ipc_status)
+static int try_dequeue(device_t *dp, message *m_dst, int *ipc_status)
{
/* See if a message can be dequeued from the current worker thread's device
* queue. If so, dequeue the message and return TRUE. If not, return FALSE.
/*===========================================================================*
* dequeue *
*===========================================================================*/
-PRIVATE int dequeue(device_t *dp, worker_t *wp, message *m_dst,
+static int dequeue(device_t *dp, worker_t *wp, message *m_dst,
int *ipc_status)
{
/* Dequeue a message from the current worker thread's device queue. Block the
/*===========================================================================*
* is_transfer_req *
*===========================================================================*/
-PRIVATE int is_transfer_req(int type)
+static int is_transfer_req(int type)
{
/* Return whether the given block device request is a transfer request.
*/
/*===========================================================================*
* worker_thread *
*===========================================================================*/
-PRIVATE void *worker_thread(void *param)
+static void *worker_thread(void *param)
{
/* The worker thread loop. Set up the thread-specific reference to itself and
* start looping. The loop consists of blocking dequeing and handling messages.
/*===========================================================================*
* master_create_worker *
*===========================================================================*/
-PRIVATE void master_create_worker(worker_t *wp, worker_id_t worker_id,
+static void master_create_worker(worker_t *wp, worker_id_t worker_id,
device_id_t device_id)
{
/* Start a new worker thread.
/*===========================================================================*
* master_destroy_worker *
*===========================================================================*/
-PRIVATE void master_destroy_worker(worker_t *wp)
+static void master_destroy_worker(worker_t *wp)
{
/* Clean up resources used by an exited worker thread.
*/
/*===========================================================================*
* master_handle_exits *
*===========================================================================*/
-PRIVATE void master_handle_exits(void)
+static void master_handle_exits(void)
{
/* Destroy the remains of all exited threads.
*/
/*===========================================================================*
* master_handle_request *
*===========================================================================*/
-PRIVATE void master_handle_request(message *m_ptr, int ipc_status)
+static void master_handle_request(message *m_ptr, int ipc_status)
{
/* For real request messages, query the device ID, start a thread if none is
* free and the maximum number of threads for that device has not yet been
/*===========================================================================*
* master_init *
*===========================================================================*/
-PRIVATE void master_init(struct blockdriver *bdp)
+static void master_init(struct blockdriver *bdp)
{
/* Initialize the state of the master thread.
*/
/*===========================================================================*
* blockdriver_mt_get_tid *
*===========================================================================*/
-PUBLIC thread_id_t blockdriver_mt_get_tid(void)
+thread_id_t blockdriver_mt_get_tid(void)
{
/* Return back the ID of this thread.
*/
/*===========================================================================*
* blockdriver_mt_receive *
*===========================================================================*/
-PRIVATE void blockdriver_mt_receive(message *m_ptr, int *ipc_status)
+static void blockdriver_mt_receive(message *m_ptr, int *ipc_status)
{
/* Receive a message.
*/
/*===========================================================================*
* blockdriver_mt_task *
*===========================================================================*/
-PUBLIC void blockdriver_mt_task(struct blockdriver *driver_tab)
+void blockdriver_mt_task(struct blockdriver *driver_tab)
{
/* The multithreaded driver task.
*/
/*===========================================================================*
* blockdriver_mt_terminate *
*===========================================================================*/
-PUBLIC void blockdriver_mt_terminate(void)
+void blockdriver_mt_terminate(void)
{
/* Instruct libblockdriver to shut down.
*/
/*===========================================================================*
* blockdriver_mt_sleep *
*===========================================================================*/
-PUBLIC void blockdriver_mt_sleep(void)
+void blockdriver_mt_sleep(void)
{
/* Let the current thread sleep until it gets woken up by the master thread.
*/
/*===========================================================================*
* blockdriver_mt_wakeup *
*===========================================================================*/
-PUBLIC void blockdriver_mt_wakeup(thread_id_t id)
+void blockdriver_mt_wakeup(thread_id_t id)
{
/* Wake up a sleeping worker thread from the master thread.
*/
/*===========================================================================*
* blockdriver_mt_set_workers *
*===========================================================================*/
-PUBLIC void blockdriver_mt_set_workers(device_id_t id, int workers)
+void blockdriver_mt_set_workers(device_id_t id, int workers)
{
/* Set the number of worker threads for the given device.
*/
#include "driver.h"
#include "mq.h"
-PRIVATE int running;
+static int running;
/*===========================================================================*
* blockdriver_receive_mq *
*===========================================================================*/
-PUBLIC int blockdriver_receive_mq(message *m_ptr, int *status_ptr)
+int blockdriver_receive_mq(message *m_ptr, int *status_ptr)
{
/* receive() interface for drivers with message queueing. */
/*===========================================================================*
* blockdriver_terminate *
*===========================================================================*/
-PUBLIC void blockdriver_terminate(void)
+void blockdriver_terminate(void)
{
/* Break out of the main driver loop after finishing the current request. */
/*===========================================================================*
* blockdriver_task *
*===========================================================================*/
-PUBLIC void blockdriver_task(struct blockdriver *bdp)
+void blockdriver_task(struct blockdriver *bdp)
{
/* Main program of any block device driver task. */
int r, ipc_status;
/*===========================================================================*
* blockdriver_process *
*===========================================================================*/
-PUBLIC void blockdriver_process(struct blockdriver *bdp, message *m_ptr,
+void blockdriver_process(struct blockdriver *bdp, message *m_ptr,
int ipc_status)
{
/* Handle the given received message. */
/*===========================================================================*
* blockdriver_mq_queue *
*===========================================================================*/
-PUBLIC int blockdriver_mq_queue(message *m, int status)
+int blockdriver_mq_queue(message *m, int status)
{
/* Queue a message for later processing. */
/* Extended partition? */
#define ext_part(s) ((s) == 0x05 || (s) == 0x0F)
-FORWARD void parse_part_table(struct blockdriver *bdp, int device, int
+static void parse_part_table(struct blockdriver *bdp, int device, int
style, int atapi, u8_t *tmp_buf);
-FORWARD void extpartition(struct blockdriver *bdp, int extdev, unsigned
+static void extpartition(struct blockdriver *bdp, int extdev, unsigned
long extbase, u8_t *tmp_buf);
-FORWARD int get_part_table(struct blockdriver *bdp, int device, unsigned
+static int get_part_table(struct blockdriver *bdp, int device, unsigned
long offset, struct part_entry *table, u8_t *tmp_buf);
-FORWARD void sort(struct part_entry *table);
+static void sort(struct part_entry *table);
/*============================================================================*
* partition *
*============================================================================*/
-PUBLIC void partition(bdp, device, style, atapi)
+void partition(bdp, device, style, atapi)
struct blockdriver *bdp; /* device dependent entry points */
int device; /* device to partition */
int style; /* partitioning style: floppy, primary, sub. */
/*============================================================================*
* parse_part_table *
*============================================================================*/
-PRIVATE void parse_part_table(bdp, device, style, atapi, tmp_buf)
+static void parse_part_table(bdp, device, style, atapi, tmp_buf)
struct blockdriver *bdp; /* device dependent entry points */
int device; /* device to partition */
int style; /* partitioning style: floppy, primary, sub. */
/*============================================================================*
* extpartition *
*============================================================================*/
-PRIVATE void extpartition(bdp, extdev, extbase, tmp_buf)
+static void extpartition(bdp, extdev, extbase, tmp_buf)
struct blockdriver *bdp; /* device dependent entry points */
int extdev; /* extended partition to scan */
unsigned long extbase; /* sector offset of the base ext. partition */
/*============================================================================*
* get_part_table *
*============================================================================*/
-PRIVATE int get_part_table(bdp, device, offset, table, tmp_buf)
+static int get_part_table(bdp, device, offset, table, tmp_buf)
struct blockdriver *bdp;
int device;
unsigned long offset; /* sector offset to the table */
/*===========================================================================*
* sort *
*===========================================================================*/
-PRIVATE void sort(table)
+static void sort(table)
struct part_entry *table;
{
/* Sort a partition table. */
STAILQ_ENTRY(mq_cell) next;
};
-PRIVATE struct mq_cell pool[MQ_SIZE];
-PRIVATE STAILQ_HEAD(queue, mq_cell) queue[MAX_DEVICES];
-PRIVATE STAILQ_HEAD(free_list, mq_cell) free_list;
+static struct mq_cell pool[MQ_SIZE];
+static STAILQ_HEAD(queue, mq_cell) queue[MAX_DEVICES];
+static STAILQ_HEAD(free_list, mq_cell) free_list;
/*===========================================================================*
* mq_init *
*===========================================================================*/
-PUBLIC void mq_init(void)
+void mq_init(void)
{
/* Initialize the message queues and message cells.
*/
/*===========================================================================*
* mq_enqueue *
*===========================================================================*/
-PUBLIC int mq_enqueue(device_id_t device_id, const message *mess,
+int mq_enqueue(device_id_t device_id, const message *mess,
int ipc_status)
{
/* Add a message, including its IPC status, to the message queue of a device.
/*===========================================================================*
* mq_dequeue *
*===========================================================================*/
-PUBLIC int mq_dequeue(device_id_t device_id, message *mess, int *ipc_status)
+int mq_dequeue(device_id_t device_id, message *mess, int *ipc_status)
{
/* Return and remove a message, including its IPC status, from the message
* queue of a thread. Return TRUE iff a message was available.
#define NO_TRACEDEV ((dev_t) -1)
#define NO_TIME ((u32_t) -1)
-PRIVATE int trace_enabled = FALSE;
-PRIVATE dev_t trace_dev = NO_TRACEDEV;
-PRIVATE btrace_entry *trace_buf = NULL;
-PRIVATE size_t trace_size = 0;
-PRIVATE size_t trace_pos;
-PRIVATE size_t trace_next;
-PRIVATE u64_t trace_tsc;
+static int trace_enabled = FALSE;
+static dev_t trace_dev = NO_TRACEDEV;
+static btrace_entry *trace_buf = NULL;
+static size_t trace_size = 0;
+static size_t trace_pos;
+static size_t trace_next;
+static u64_t trace_tsc;
/* Pointers to in-progress trace entries for each thread (all worker threads,
* plus one for the main thread). Each pointer is set to NULL whenever no
* operation is currently being traced for that thread, for whatever reason.
*/
-PRIVATE btrace_entry *trace_ptr[MAX_THREADS + 1] = { NULL };
+static btrace_entry *trace_ptr[MAX_THREADS + 1] = { NULL };
/*===========================================================================*
* trace_gettime *
*===========================================================================*/
-PRIVATE u32_t trace_gettime(void)
+static u32_t trace_gettime(void)
{
/* Return the current time, in microseconds since the start of the trace.
*/
/*===========================================================================*
* trace_ctl *
*===========================================================================*/
-PUBLIC int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
+int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant)
{
/* Process a block trace control request.
/*===========================================================================*
* trace_start *
*===========================================================================*/
-PUBLIC void trace_start(thread_id_t id, message *m_ptr)
+void trace_start(thread_id_t id, message *m_ptr)
{
/* Start creating a trace entry.
*/
/*===========================================================================*
* trace_setsize *
*===========================================================================*/
-PUBLIC void trace_setsize(thread_id_t id, size_t size)
+void trace_setsize(thread_id_t id, size_t size)
{
/* Set the current trace entry's actual (byte) size, for vector requests.
*/
/*===========================================================================*
* trace_finish *
*===========================================================================*/
-PUBLIC void trace_finish(thread_id_t id, int result)
+void trace_finish(thread_id_t id, int result)
{
/* Finish a trace entry.
*/
__weak_alias(sysconf, __sysconf)
#endif
-PRIVATE u32_t get_hz(void)
+static u32_t get_hz(void)
{
FILE *fp;
u32_t hz;
return DEFAULT_HZ;
}
-PUBLIC long int sysconf(name)
+long int sysconf(name)
int name; /* property being inspected */
{
switch(name) {
__weak_alias(times, _times)
#endif
-PUBLIC clock_t times(buf)
+clock_t times(buf)
struct tms *buf;
{
message m;
#include <string.h>
#include <utime.h>
-PUBLIC int utime(const char *name, const struct utimbuf *timp)
+int utime(const char *name, const struct utimbuf *timp)
{
message m;
#include <ucontext.h>
#include <unistd.h>
-PUBLIC int setmcontext(const mcontext_t *mcp)
+int setmcontext(const mcontext_t *mcp)
{
message m;
}
-PUBLIC int getmcontext(mcontext_t *mcp)
+int getmcontext(mcontext_t *mcp)
{
message m;
/*===========================================================================*
* setuctx *
*===========================================================================*/
-PUBLIC int setuctx(const ucontext_t *ucp)
+int setuctx(const ucontext_t *ucp)
{
int r;
/*===========================================================================*
* getuctx *
*===========================================================================*/
-PUBLIC int getuctx(ucontext_t *ucp)
+int getuctx(ucontext_t *ucp)
{
int r;
/*===========================================================================*
* makecontext *
*===========================================================================*/
-PUBLIC void makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
+void makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
{
va_list ap;
unsigned int *stack_top;
/*===========================================================================*
* swapcontext *
*===========================================================================*/
-PUBLIC int swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
+int swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
{
int r;
/*===========================================================================*
* resumecontext *
*===========================================================================*/
-PUBLIC void resumecontext(ucontext_t *ucp)
+void resumecontext(ucontext_t *ucp)
{
if (ucp->uc_link == NULL) exit(0);
__weak_alias(access, _access)
#endif
-PUBLIC int access(name, mode)
+int access(name, mode)
_CONST char *name;
int mode;
{
* as with system calls. In this way, if a user inadvertently defines a
* procedure brk, MINIX may continue to work because the true call is _brk.
*/
-PUBLIC int brk(addr)
+int brk(addr)
void *addr;
{
message m;
__weak_alias(fchdir, _fchdir)
#endif
-PUBLIC int chdir(name)
+int chdir(name)
_CONST char *name;
{
message m;
return(_syscall(VFS_PROC_NR, CHDIR, &m));
}
-PUBLIC int fchdir(fd)
+int fchdir(fd)
int fd;
{
message m;
__weak_alias(chmod, _chmod)
#endif
-PUBLIC int chmod(const char *name, mode_t mode)
+int chmod(const char *name, mode_t mode)
{
message m;
__weak_alias(chown, _chown)
#endif
-PUBLIC int chown(const char *name, uid_t owner, gid_t grp)
+int chown(const char *name, uid_t owner, gid_t grp)
{
message m;
__weak_alias(chroot, _chroot)
#endif
-PUBLIC int chroot(name)
+int chroot(name)
_CONST char *name;
{
message m;
__weak_alias(close, _close)
#endif
-PUBLIC int close(fd)
+int close(fd)
int fd;
{
message m;
__weak_alias(dup, _dup)
#endif
-PUBLIC int dup(fd)
+int dup(fd)
int fd;
{
return(fcntl(fd, F_DUPFD, 0));
__weak_alias(dup2, _dup2)
#endif
-PUBLIC int dup2(fd, fd2)
+int dup2(fd, fd2)
int fd, fd2;
{
/* The behavior of dup2 is defined by POSIX in 6.2.1.2 as almost, but not
__weak_alias(fchmod, _fchmod)
#endif
-PUBLIC int fchmod(int fd, mode_t mode)
+int fchmod(int fd, mode_t mode)
{
message m;
__weak_alias(fchown, _fchown)
#endif
-PUBLIC int fchown(int fd, uid_t owner, gid_t grp)
+int fchown(int fd, uid_t owner, gid_t grp)
{
message m;
#endif
#if _ANSI
-PUBLIC int fcntl(int fd, int cmd, ...)
+int fcntl(int fd, int cmd, ...)
#else
-PUBLIC int fcntl(fd, cmd)
+int fcntl(fd, cmd)
int fd;
int cmd;
#endif
__weak_alias(fork, _fork)
#endif
-PUBLIC pid_t fork()
+pid_t fork()
{
message m;
__weak_alias(fpathconf, _fpathconf)
#endif
-PUBLIC long fpathconf(fd, name)
+long fpathconf(fd, name)
int fd; /* file descriptor being interrogated */
int name; /* property being inspected */
{
__weak_alias(fsync, _fsync)
#endif
-PUBLIC int fsync(int fd)
+int fsync(int fd)
{
message m;
#include <dirent.h>
-PUBLIC ssize_t getdents(fd, buffer, nbytes)
+ssize_t getdents(fd, buffer, nbytes)
int fd;
char *buffer;
size_t nbytes;
__weak_alias(getegid, _getegid)
#endif
-PUBLIC gid_t getegid()
+gid_t getegid()
{
message m;
__weak_alias(geteuid, _geteuid)
#endif
-PUBLIC uid_t geteuid()
+uid_t geteuid()
{
message m;
__weak_alias(getgid, _getgid)
#endif
-PUBLIC gid_t getgid()
+gid_t getgid()
{
message m;
#endif
-PUBLIC int getgroups(int ngroups, gid_t *arr)
+int getgroups(int ngroups, gid_t *arr)
{
message m;
m.m1_i1 = ngroups;
__weak_alias(getpgrp, _getpgrp)
#endif
-PUBLIC pid_t getpgrp()
+pid_t getpgrp()
{
message m;
__weak_alias(getpid, _getpid)
#endif
-PUBLIC pid_t getpid()
+pid_t getpid()
{
message m;
__weak_alias(getppid, _getppid)
#endif
-PUBLIC pid_t getppid()
+pid_t getppid()
{
message m;
__weak_alias(getuid, _getuid)
#endif
-PUBLIC uid_t getuid()
+uid_t getuid()
{
message m;
__weak_alias(ioctl, _ioctl)
#endif
-PUBLIC int ioctl(fd, request, data)
+int ioctl(fd, request, data)
int fd;
int request;
void *data;
__weak_alias(kill, _kill)
#endif
-PUBLIC int kill(proc, sig)
+int kill(proc, sig)
int proc; /* which process is to be sent the signal */
int sig; /* signal number */
{
__weak_alias(link, _link)
#endif
-PUBLIC int link(const char *name, const char *name2)
+int link(const char *name, const char *name2)
{
message m;
__weak_alias(lseek, _lseek)
#endif
-PUBLIC off_t lseek(fd, offset, whence)
+off_t lseek(fd, offset, whence)
int fd;
off_t offset;
int whence;
#include <unistd.h>
#include <minix/u64.h>
-PUBLIC int lseek64(fd, offset, whence, newpos)
+int lseek64(fd, offset, whence, newpos)
int fd;
u64_t offset;
int whence;
#include <stdlib.h>
#include <unistd.h>
-PUBLIC int closefrom(int fd)
+int closefrom(int fd)
{
int f, ok = 0, e = 0;
for(f = fd; f < __MINIX_OPEN_MAX; f++) {
__weak_alias(mkdir, _mkdir)
#endif
-PUBLIC int mkdir(const char *name, mode_t mode)
+int mkdir(const char *name, mode_t mode)
{
message m;
__weak_alias(mkfifo, _mkfifo)
#endif
-PUBLIC int mkfifo(const char *name, mode_t mode)
+int mkfifo(const char *name, mode_t mode)
{
return mknod(name, mode | S_IFIFO, (dev_t) 0);
}
#include <unistd.h>
#include <sys/stat.h>
-PUBLIC int mknod(const char *name, mode_t mode, dev_t dev)
+int mknod(const char *name, mode_t mode, dev_t dev)
{
message m;
#include <string.h>
#include <errno.h>
-PUBLIC void *minix_mmap(void *addr, size_t len, int prot, int flags,
+void *minix_mmap(void *addr, size_t len, int prot, int flags,
int fd, off_t offset)
{
message m;
return (void *) m.VMM_RETADDR;
}
-PUBLIC int minix_munmap(void *addr, size_t len)
+int minix_munmap(void *addr, size_t len)
{
message m;
}
-PUBLIC int minix_munmap_text(void *addr, size_t len)
+int minix_munmap_text(void *addr, size_t len)
{
message m;
return _syscall(VM_PROC_NR, VM_MUNMAP_TEXT, &m);
}
-PUBLIC void *vm_remap(endpoint_t d,
+void *vm_remap(endpoint_t d,
endpoint_t s,
void *da,
void *sa,
return (void *) m.VMRE_RETA;
}
-PUBLIC void *vm_remap_ro(endpoint_t d,
+void *vm_remap_ro(endpoint_t d,
endpoint_t s,
void *da,
void *sa,
return (void *) m.VMRE_RETA;
}
-PUBLIC int vm_unmap(endpoint_t endpt, void *addr)
+int vm_unmap(endpoint_t endpt, void *addr)
{
message m;
return _syscall(VM_PROC_NR, VM_SHM_UNMAP, &m);
}
-PUBLIC unsigned long vm_getphys(int endpt, void *addr)
+unsigned long vm_getphys(int endpt, void *addr)
{
message m;
int r;
return m.VMPHYS_RETA;
}
-PUBLIC u8_t vm_getrefcount(endpoint_t endpt, void *addr)
+u8_t vm_getrefcount(endpoint_t endpt, void *addr)
{
message m;
int r;
static char fspath[] = "/sbin/:/usr/pkg/bin/"; /* Must include trailing '/' */
-PRIVATE int rs_down(char *label)
+static int rs_down(char *label)
{
char cmd[200];
if(strlen(_PATH_SERVICE)+strlen(label)+50 >= sizeof(cmd))
return system(cmd);
}
-PUBLIC int mount(special, name, mountflags, type, args)
+int mount(special, name, mountflags, type, args)
char *name, *special, *type, *args;
int mountflags;
{
return r;
}
-PUBLIC int umount(name)
+int umount(name)
_CONST char *name;
{
return umount2(name, 0);
}
-PUBLIC int umount2(name, flags)
+int umount2(name, flags)
_CONST char *name;
int flags;
{
#endif
#if _ANSI
-PUBLIC int open(const char *name, int flags, ...)
+int open(const char *name, int flags, ...)
#else
-PUBLIC int open(const char *name, int flags)
+int open(const char *name, int flags)
#endif
{
va_list argp;
__weak_alias(pathconf, _pathconf)
#endif
-PUBLIC long pathconf(path, name)
+long pathconf(path, name)
_CONST char *path; /* name of file being interrogated */
int name; /* property being inspected */
{
extern char *_brksize;
-PUBLIC void *sbrk(incr)
+void *sbrk(incr)
intptr_t incr;
{
char *newsize, *oldsize;
__weak_alias(vfork, _vfork)
#endif
-PUBLIC pid_t vfork()
+pid_t vfork()
{
message m;
#include <minix/chardriver.h>
#include <minix/ds.h>
-PRIVATE int running;
+static int running;
/* Management data for opened devices. */
-PRIVATE int open_devs[MAX_NR_OPEN_DEVICES];
-PRIVATE int next_open_devs_slot = 0;
+static int open_devs[MAX_NR_OPEN_DEVICES];
+static int next_open_devs_slot = 0;
/*===========================================================================*
* clear_open_devs *
*===========================================================================*/
-PRIVATE void clear_open_devs(void)
+static void clear_open_devs(void)
{
/* Reset the set of previously opened minor devices. */
next_open_devs_slot = 0;
/*===========================================================================*
* is_open_dev *
*===========================================================================*/
-PRIVATE int is_open_dev(int device)
+static int is_open_dev(int device)
{
/* Check whether the given minor device has previously been opened. */
int i;
/*===========================================================================*
* set_open_dev *
*===========================================================================*/
-PRIVATE void set_open_dev(int device)
+static void set_open_dev(int device)
{
/* Mark the given minor device as having been opened. */
/*===========================================================================*
* chardriver_announce *
*===========================================================================*/
-PUBLIC void chardriver_announce(void)
+void chardriver_announce(void)
{
/* Announce we are up after a fresh start or restart. */
int r;
/*===========================================================================*
* async_reply *
*===========================================================================*/
-PRIVATE void async_reply(message *mess, int r)
+static void async_reply(message *mess, int r)
{
/* Send a reply using the asynchronous character device protocol. */
message reply_mess;
/*===========================================================================*
* sync_reply *
*===========================================================================*/
-PRIVATE void sync_reply(message *m_ptr, int ipc_status, int reply)
+static void sync_reply(message *m_ptr, int ipc_status, int reply)
{
/* Reply to a message sent to the driver. */
endpoint_t caller_e, user_e;
/*===========================================================================*
* send_reply *
*===========================================================================*/
-PRIVATE void send_reply(int type, message *m_ptr, int ipc_status, int reply)
+static void send_reply(int type, message *m_ptr, int ipc_status, int reply)
{
/* Prepare and send a reply message. */
/*===========================================================================*
* do_rdwt *
*===========================================================================*/
-PRIVATE int do_rdwt(struct chardriver *cdp, message *mp)
+static int do_rdwt(struct chardriver *cdp, message *mp)
{
/* Carry out a single read or write request. */
iovec_t iovec1;
/*===========================================================================*
* do_vrdwt *
*===========================================================================*/
-PRIVATE int do_vrdwt(struct chardriver *cdp, message *mp)
+static int do_vrdwt(struct chardriver *cdp, message *mp)
{
/* Carry out an device read or write to/from a vector of user addresses.
* The "user addresses" are assumed to be safe, i.e. FS transferring to/from
/*===========================================================================*
* handle_notify *
*===========================================================================*/
-PRIVATE void handle_notify(struct chardriver *cdp, message *m_ptr)
+static void handle_notify(struct chardriver *cdp, message *m_ptr)
{
/* Take care of the notifications (interrupt and clock messages) by calling the
* appropiate callback functions. Never send a reply.
/*===========================================================================*
* handle_request *
*===========================================================================*/
-PRIVATE int handle_request(struct chardriver *cdp, message *m_ptr)
+static int handle_request(struct chardriver *cdp, message *m_ptr)
{
/* Call the appropiate driver function, based on the type of request. Return
* the result code that is to be sent back to the caller, or EDONTREPLY if no
/*===========================================================================*
* chardriver_process *
*===========================================================================*/
-PUBLIC void chardriver_process(struct chardriver *cdp, int driver_type,
+void chardriver_process(struct chardriver *cdp, int driver_type,
message *m_ptr, int ipc_status)
{
/* Handle the given received message. */
/*===========================================================================*
* chardriver_task *
*===========================================================================*/
-PUBLIC void chardriver_task(struct chardriver *cdp, int driver_type)
+void chardriver_task(struct chardriver *cdp, int driver_type)
{
/* Main program of any device driver task. */
int r, ipc_status;
/*===========================================================================*
* do_nop *
*===========================================================================*/
-PUBLIC int do_nop(message *UNUSED(mp))
+int do_nop(message *UNUSED(mp))
{
return(OK);
}
/*===========================================================================*
* nop_ioctl *
*===========================================================================*/
-PUBLIC int nop_ioctl(message *UNUSED(mp))
+int nop_ioctl(message *UNUSED(mp))
{
return(ENOTTY);
}
/*===========================================================================*
* nop_alarm *
*===========================================================================*/
-PUBLIC void nop_alarm(message *UNUSED(mp))
+void nop_alarm(message *UNUSED(mp))
{
/* Ignore the leftover alarm. */
}
/*===========================================================================*
* nop_cleanup *
*===========================================================================*/
-PUBLIC void nop_cleanup(void)
+void nop_cleanup(void)
{
/* Nothing to clean up. */
}
/*===========================================================================*
* nop_cancel *
*===========================================================================*/
-PUBLIC int nop_cancel(message *UNUSED(m))
+int nop_cancel(message *UNUSED(m))
{
/* Nothing to do for cancel. */
return(OK);
/*===========================================================================*
* nop_select *
*===========================================================================*/
-PUBLIC int nop_select(message *UNUSED(m))
+int nop_select(message *UNUSED(m))
{
/* Nothing to do for select. */
return(OK);
*rw_flag);
int put_mtab_entry(char *special, char *mounted_on, char *version, char
*rw_flag);
-PRIVATE void err(char *prog_name, char *str );
+static void err(char *prog_name, char *str );
int load_mtab(prog_name)
}
-PRIVATE void
+static void
err(prog_name, str)
char *prog_name, *str;
{
/*****************************************************************************/
/* ddekit_condvar_init */
/*****************************************************************************/
-PUBLIC ddekit_condvar_t * ddekit_condvar_init(void) {
+ddekit_condvar_t * ddekit_condvar_init(void) {
ddekit_condvar_t *cv;
cv = (ddekit_condvar_t *) ddekit_simple_malloc(sizeof(ddekit_condvar_t));
DDEBUG_MSG_VERBOSE("cv: %p", cv);
/*****************************************************************************/
/* ddekit_condvar_deinit */
/*****************************************************************************/
-PUBLIC void ddekit_condvar_deinit(ddekit_condvar_t *cvp) {
+void ddekit_condvar_deinit(ddekit_condvar_t *cvp) {
DDEBUG_MSG_VERBOSE("cv: %p", cvp);
ddekit_simple_free(cvp);
}
/*****************************************************************************/
/* ddekit_condvar_wait */
/*****************************************************************************/
-PUBLIC void ddekit_condvar_wait(ddekit_condvar_t *cv, ddekit_lock_t *mp) {
+void ddekit_condvar_wait(ddekit_condvar_t *cv, ddekit_lock_t *mp) {
DDEBUG_MSG_VERBOSE("wait cv: %p, thread id: %d, name: %s",
cv, ddekit_thread_myself()->id, ddekit_thread_myself()->name);
/*****************************************************************************/
/* ddekit_condvar_wait_timed */
/*****************************************************************************/
-PUBLIC int ddekit_condvar_wait_timed
+int ddekit_condvar_wait_timed
(ddekit_condvar_t *cvp, ddekit_lock_t *mp, int timo)
{
/*
/*****************************************************************************/
/* ddekit_condvar_signal */
/*****************************************************************************/
-PUBLIC void ddekit_condvar_signal(ddekit_condvar_t *cv)
+void ddekit_condvar_signal(ddekit_condvar_t *cv)
{
DDEBUG_MSG_VERBOSE("cv: %p", cv);
static ddekit_thread_t *dispatch_th = 0;
-FORWARD void dispatcher_thread(void * unused);
-FORWARD void ddekit_dispatcher_thread_init(void);
+static void dispatcher_thread(void * unused);
+static void ddekit_dispatcher_thread_init(void);
/****************************************************************************/
/* dispatcher_thread */
/****************************************************************************/
-PRIVATE void dispatcher_thread(void *unused) {
+static void dispatcher_thread(void *unused) {
/*
* Gets all messages and dispatches them.
/****************************************************************************/
/* ddekit_dispatcher_thread_init */
/****************************************************************************/
-PRIVATE void ddekit_dispatcher_thread_init()
+static void ddekit_dispatcher_thread_init()
{
dispatch_th = ddekit_thread_create(dispatcher_thread, NULL, "dispatch");
/****************************************************************************/
/* ddekit_init */
/****************************************************************************/
-PUBLIC void ddekit_init(void)
+void ddekit_init(void)
{
sef_startup();
/****************************************************************************/
/* __ddekit_add_initcall */
/****************************************************************************/
-PUBLIC void __attribute__((used))
+void __attribute__((used))
__ddekit_add_initcall(struct __ddekit_initcall_s * ic) {
/* This function is required for the DDEKIT_INITCALL makro */
/****************************************************************************/
/* ddekit_do_initcalls */
/****************************************************************************/
-PUBLIC void ddekit_do_initcalls()
+void ddekit_do_initcalls()
{
struct __ddekit_initcall_s *i = 0;
*****************************************************************************/
-FORWARD void ddekit_irq_lock(void);
-FORWARD void ddekit_irq_unlock(void);
-FORWARD struct ddekit_irq_s* find_by_irq(int irq);
-FORWARD void ddekit_irq_remove(struct ddekit_irq_s *irq_s);
-FORWARD void ddekit_irq_thread(void *data);
+static void ddekit_irq_lock(void);
+static void ddekit_irq_unlock(void);
+static struct ddekit_irq_s* find_by_irq(int irq);
+static void ddekit_irq_remove(struct ddekit_irq_s *irq_s);
+static void ddekit_irq_thread(void *data);
/******************************************************************************
* ddekit_irq_lock *
*****************************************************************************/
-PRIVATE void ddekit_irq_lock(void)
+static void ddekit_irq_lock(void)
{
ddekit_lock_lock(&lock);
}
/******************************************************************************
* ddekit_irq_unlock *
*****************************************************************************/
-PRIVATE void ddekit_irq_unlock(void)
+static void ddekit_irq_unlock(void)
{
ddekit_lock_unlock(&lock);
}
/******************************************************************************
* find_by_irq *
*****************************************************************************/
-PRIVATE struct ddekit_irq_s * find_by_irq(int irq)
+static struct ddekit_irq_s * find_by_irq(int irq)
{
struct ddekit_irq_s * irq_s;
ddekit_irq_lock();
/******************************************************************************
* ddekit_irq_remove *
*****************************************************************************/
-PRIVATE void ddekit_irq_remove(struct ddekit_irq_s *irq_s)
+static void ddekit_irq_remove(struct ddekit_irq_s *irq_s)
{
struct ddekit_irq_s *i;
/******************************************************************************
* ddekit_irq_thread *
*****************************************************************************/
-PRIVATE void ddekit_irq_thread(void *data)
+static void ddekit_irq_thread(void *data)
{
/* For each IRQ line an own thread is started */
/******************************************************************************
* _ddekit_interrupt_trigger *
*****************************************************************************/
-PUBLIC void _ddekit_interrupt_trigger(int irq)
+void _ddekit_interrupt_trigger(int irq)
{
struct ddekit_irq_s *irq_s;
/******************************************************************************
* ddekit_lock_init_locked *
*****************************************************************************/
-PUBLIC void ddekit_lock_init_locked(ddekit_lock_t *mtx)
+void ddekit_lock_init_locked(ddekit_lock_t *mtx)
{
(*mtx) = (struct ddekit_lock *)
ddekit_simple_malloc(sizeof(struct ddekit_lock));
/******************************************************************************
* ddekit_lock_init_unlocked *
*****************************************************************************/
-PUBLIC void ddekit_lock_init_unlocked(ddekit_lock_t *mtx)
+void ddekit_lock_init_unlocked(ddekit_lock_t *mtx)
{
(*mtx) = (struct ddekit_lock *)
ddekit_simple_malloc(sizeof(struct ddekit_lock));
/******************************************************************************
* ddekit_lock_deinit *
*****************************************************************************/
-PUBLIC void ddekit_lock_deinit (ddekit_lock_t *mtx)
+void ddekit_lock_deinit (ddekit_lock_t *mtx)
{
ddekit_simple_free(*mtx);
}
/******************************************************************************
* ddekit_lock_lock *
*****************************************************************************/
-PUBLIC void ddekit_lock_lock (ddekit_lock_t *mtx)
+void ddekit_lock_lock (ddekit_lock_t *mtx)
{
if ((*mtx)->owner == NULL) {
(*mtx)->owner = ddekit_thread_myself();
/******************************************************************************
* ddekit_lock_try_lock *
*****************************************************************************/
-PUBLIC int ddekit_lock_try_lock(ddekit_lock_t *mtx)
+int ddekit_lock_try_lock(ddekit_lock_t *mtx)
{
if ((*mtx)->owner == NULL) {
(*mtx)->owner = ddekit_thread_myself();
/******************************************************************************
* ddekit_lock_unlock *
*****************************************************************************/
-PUBLIC void ddekit_lock_unlock (ddekit_lock_t *mtx) {
+void ddekit_lock_unlock (ddekit_lock_t *mtx) {
ddekit_assert((*mtx)->owner != NULL);
(*mtx)->owner = NULL;
if((*mtx)->wait_queue) {
/******************************************************************************
* ddekit_lock_owner *
*****************************************************************************/
-PUBLIC int ddekit_lock_owner(ddekit_lock_t *mtx) {
+int ddekit_lock_owner(ddekit_lock_t *mtx) {
return ddekit_thread_get_id((*mtx)->owner);
}
struct ddekit_slab_slab empty;
};
-FORWARD void ddekit_slab_lock(struct ddekit_slab * sc);
-FORWARD void ddekit_slab_unlock(struct ddekit_slab * sc);
-FORWARD struct ddekit_slab_slab * ddekit_slab_find_slab(struct
+static void ddekit_slab_lock(struct ddekit_slab * sc);
+static void ddekit_slab_unlock(struct ddekit_slab * sc);
+static struct ddekit_slab_slab * ddekit_slab_find_slab(struct
ddekit_slab * sc, void * obj);
-FORWARD void ddekit_slab_slab_insert(struct ddekit_slab_slab *list,
+static void ddekit_slab_slab_insert(struct ddekit_slab_slab *list,
struct ddekit_slab_slab *s);
-FORWARD void ddekit_slab_slab_remove(struct ddekit_slab_slab *s);
-FORWARD void ddekit_slab_grow(struct ddekit_slab * sc);
-FORWARD void *ddekit_slab_getobj(struct ddekit_slab_slab *s);
-FORWARD void ddekit_slab_free_slab(struct ddekit_slab_slab * sl, int
+static void ddekit_slab_slab_remove(struct ddekit_slab_slab *s);
+static void ddekit_slab_grow(struct ddekit_slab * sc);
+static void *ddekit_slab_getobj(struct ddekit_slab_slab *s);
+static void ddekit_slab_free_slab(struct ddekit_slab_slab * sl, int
cont);
/******************************************************************************
* ddekit_simple_malloc *
*****************************************************************************/
-PUBLIC void *ddekit_simple_malloc(unsigned size)
+void *ddekit_simple_malloc(unsigned size)
{
/* Simple memory allocation... malloc and free should be ok... */
void * r = malloc(size);
/******************************************************************************
* ddekit_simple_free *
*****************************************************************************/
-PUBLIC void ddekit_simple_free(void *p)
+void ddekit_simple_free(void *p)
{
DDEBUG_MSG_VERBOSE("%p", p);
free(p);
/******************************************************************************
* ddekit_large_malloc *
*****************************************************************************/
-PUBLIC void *ddekit_large_malloc(int size)
+void *ddekit_large_malloc(int size)
{
ddekit_addr_t phys;
/* allocate a piece of coniguous memory */
/******************************************************************************
* ddekit_large_free *
*****************************************************************************/
-PUBLIC void ddekit_large_free(void *p)
+void ddekit_large_free(void *p)
{
unsigned len;
DDEBUG_MSG_VERBOSE("get size of region %x", p);
/******************************************************************************
* ddekit_contig_malloc *
*****************************************************************************/
-PUBLIC void *ddekit_contig_malloc(unsigned long size, unsigned long low,
+void *ddekit_contig_malloc(unsigned long size, unsigned long low,
unsigned long high, unsigned long aligment,
unsigned long boundary)
{
/******************************************************************************
* ddekit_slab_lock *
*****************************************************************************/
-PRIVATE DDEKIT_INLINE void ddekit_slab_lock(struct ddekit_slab * sc) {
+static DDEKIT_INLINE void ddekit_slab_lock(struct ddekit_slab * sc) {
ddekit_lock_lock(&sc->lock);
}
/******************************************************************************
* ddekit_slab_unlock *
*****************************************************************************/
-PRIVATE DDEKIT_INLINE void ddekit_slab_unlock(struct ddekit_slab * sc) {
+static DDEKIT_INLINE void ddekit_slab_unlock(struct ddekit_slab * sc) {
ddekit_lock_unlock(&sc->lock);
}
/******************************************************************************
* ddekit_slab_find_slab *
*****************************************************************************/
-PRIVATE struct ddekit_slab_slab *
+static struct ddekit_slab_slab *
ddekit_slab_find_slab(struct ddekit_slab * sc, void * obj)
{
/******************************************************************************
* ddekit_slab_slab_remove *
*****************************************************************************/
-PRIVATE void ddekit_slab_slab_remove(struct ddekit_slab_slab *s)
+static void ddekit_slab_slab_remove(struct ddekit_slab_slab *s)
{
s->next->prev = s->prev;
s->prev->next = s->next;
/******************************************************************************
* ddekit_slab_grow *
*****************************************************************************/
-PRIVATE void ddekit_slab_grow(struct ddekit_slab *sc)
+static void ddekit_slab_grow(struct ddekit_slab *sc)
{
/*
* NOTE:
/******************************************************************************
* ddekit_slab_getobj *
*****************************************************************************/
-PRIVATE void *ddekit_slab_getobj(struct ddekit_slab_slab *s)
+static void *ddekit_slab_getobj(struct ddekit_slab_slab *s)
{
struct ddekit_slab *sc;
void *ret = 0;
/******************************************************************************
* ddekit_slab_alloc *
*****************************************************************************/
-PUBLIC void *ddekit_slab_alloc(struct ddekit_slab * sc)
+void *ddekit_slab_alloc(struct ddekit_slab * sc)
{
struct ddekit_slab_slab *s=0;
/******************************************************************************
* ddekit_slab_free *
*****************************************************************************/
-PUBLIC void ddekit_slab_free(struct ddekit_slab *sc, void* obj)
+void ddekit_slab_free(struct ddekit_slab *sc, void* obj)
{
void **p;
/******************************************************************************
* ddekit_slab_set_data *
*****************************************************************************/
-PUBLIC void ddekit_slab_set_data(struct ddekit_slab * sc, void *data)
+void ddekit_slab_set_data(struct ddekit_slab * sc, void *data)
{
ddekit_slab_lock(sc);
sc->data = data;
/******************************************************************************
* ddekit_slab_get_data *
*****************************************************************************/
-PUBLIC void *ddekit_slab_get_data (struct ddekit_slab *sc)
+void *ddekit_slab_get_data (struct ddekit_slab *sc)
{
void *ret;
ddekit_slab_lock(sc);
/******************************************************************************
* ddekit_slab_init *
*****************************************************************************/
-PUBLIC struct ddekit_slab * ddekit_slab_init(unsigned size, int contiguous)
+struct ddekit_slab * ddekit_slab_init(unsigned size, int contiguous)
{
struct ddekit_slab * sc = 0;
/******************************************************************************
* ddekit_slab_free_slab *
*****************************************************************************/
-PRIVATE void ddekit_slab_free_slab(struct ddekit_slab_slab * sl, int cont)
+static void ddekit_slab_free_slab(struct ddekit_slab_slab * sl, int cont)
{
struct ddekit_slab_slab *s,*t;
/******************************************************************************
* ddekit_slab_destroy *
*****************************************************************************/
-PUBLIC void ddekit_slab_destroy(struct ddekit_slab *sc)
+void ddekit_slab_destroy(struct ddekit_slab *sc)
{
DDEBUG_MSG_VERBOSE("%p full", sc);
ddekit_slab_free_slab(&sc->full,sc->contiguous);
struct ddekit_minix_msg_q *next;
};
-PRIVATE struct ddekit_minix_msg_q * _list = NULL;
-FORWARD void _ddekit_minix_queue_msg(struct ddekit_minix_msg_q *mq,
+static struct ddekit_minix_msg_q * _list = NULL;
+static void _ddekit_minix_queue_msg(struct ddekit_minix_msg_q *mq,
message *m);
/*****************************************************************************
* ddekit_minix_create_msg_q *
****************************************************************************/
-PUBLIC struct ddekit_minix_msg_q *
+struct ddekit_minix_msg_q *
ddekit_minix_create_msg_q(unsigned from, unsigned to)
{
struct ddekit_minix_msg_q *mq = (struct ddekit_minix_msg_q *)
/*****************************************************************************
* ddekit_minix_deregister_msg_q *
****************************************************************************/
-PUBLIC void ddekit_minix_deregister_msg_q(struct ddekit_minix_msg_q *mq)
+void ddekit_minix_deregister_msg_q(struct ddekit_minix_msg_q *mq)
{
struct ddekit_minix_msg_q *prev =_list, *it;
/*****************************************************************************
* _ddekit_minix_queue_msg *
****************************************************************************/
-PRIVATE void
+static void
_ddekit_minix_queue_msg(struct ddekit_minix_msg_q *mq, message *m)
{
int full;
/*****************************************************************************
* ddekit_minix_rcv *
****************************************************************************/
-PUBLIC void ddekit_minix_rcv(struct ddekit_minix_msg_q *mq, message *m)
+void ddekit_minix_rcv(struct ddekit_minix_msg_q *mq, message *m)
{
DDEBUG_MSG_VERBOSE("waiting for message");
/****************************************************************************/
/* ddekit_panic */
/****************************************************************************/
-PUBLIC void ddekit_panic(char *fmt, ...)
+void ddekit_panic(char *fmt, ...)
{
int r;
/****************************************************************************/
/* ddekit_debug */
/****************************************************************************/
-PUBLIC void ddekit_debug(char *fmt, ...)
+void ddekit_debug(char *fmt, ...)
{
int r;
va_list va;
struct ddekit_pci_dev pci_devs[PCI_MAX_DEVS];
-FORWARD struct ddekit_pci_dev * ddekit_get_dev_helper(int bus, int slot,
+static struct ddekit_pci_dev * ddekit_get_dev_helper(int bus, int slot,
int func);
/****************************************************************************/
/* ddekit_pci_init_only_one */
/****************************************************************************/
-PUBLIC void ddekit_pci_init_only_one(int skip)
+void ddekit_pci_init_only_one(int skip)
{
/*
* If skip is not PCI_TAKE_ALL this function will skip skip PCI DEVICES
/****************************************************************************/
/* ddekit_pci_get_device_id */
/****************************************************************************/
-PUBLIC void ddekit_pci_init(void)
+void ddekit_pci_init(void)
{
ddekit_pci_init_only_one(DDEKIT_PCI_ANY_ID);
}
/****************************************************************************/
/* ddekit_pci_get_device_id */
/****************************************************************************/
-PRIVATE struct ddekit_pci_dev *
+static struct ddekit_pci_dev *
ddekit_get_dev_helper(int bus, int slot, int func)
{
/*
/****************************************************************************/
/* ddekit_pci_read */
/****************************************************************************/
-PUBLIC int ddekit_pci_read
+int ddekit_pci_read
(int bus, int slot, int func, int pos, int len, ddekit_uint32_t *val)
{
switch(len) {
/****************************************************************************/
/* ddekit_pci_write */
/****************************************************************************/
-PUBLIC int ddekit_pci_write
+int ddekit_pci_write
(int bus, int slot, int func, int pos, int len, ddekit_uint32_t val)
{
switch(len) {
/****************************************************************************/
/* ddekit_pci_readb */
/****************************************************************************/
-PUBLIC int ddekit_pci_readb (int bus, int slot, int func, int pos, ddekit_uint8_t *val) {
+int ddekit_pci_readb (int bus, int slot, int func, int pos, ddekit_uint8_t *val) {
struct ddekit_pci_dev * dev = ddekit_get_dev_helper(bus, slot, func);
if (func!=0) {
*val=0;
/****************************************************************************/
/* ddekit_pci_readw */
/****************************************************************************/
-PUBLIC int ddekit_pci_readw
+int ddekit_pci_readw
(int bus, int slot, int func, int pos, ddekit_uint16_t *val) {
struct ddekit_pci_dev * dev = ddekit_get_dev_helper(bus, slot, func);
if (func!=0) {
/****************************************************************************/
/* ddekit_pci_readl */
/****************************************************************************/
-PUBLIC int ddekit_pci_readl
+int ddekit_pci_readl
(int bus, int slot, int func, int pos, ddekit_uint32_t *val) {
struct ddekit_pci_dev * dev = ddekit_get_dev_helper(bus, slot, func);
if (func!=0) {
/****************************************************************************/
/* ddekit_pci_writeb */
/****************************************************************************/
-PUBLIC int ddekit_pci_writeb
+int ddekit_pci_writeb
(int bus, int slot, int func, int pos, ddekit_uint8_t val) {
struct ddekit_pci_dev * dev = ddekit_get_dev_helper(bus, slot, func);
if (dev) {
/****************************************************************************/
/* ddekit_pci_writel */
/****************************************************************************/
-PUBLIC int ddekit_pci_writew
+int ddekit_pci_writew
(int bus, int slot, int func, int pos, ddekit_uint16_t val) {
struct ddekit_pci_dev * dev = ddekit_get_dev_helper(bus, slot, func);
if (dev) {
/****************************************************************************/
/* ddekit_pci_writel */
/****************************************************************************/
-PUBLIC int ddekit_pci_writel
+int ddekit_pci_writel
(int bus, int slot, int func, int pos, ddekit_uint32_t val) {
struct ddekit_pci_dev * dev = ddekit_get_dev_helper(bus, slot, func);
if (dev) {
/****************************************************************************/
/* ddekit_pci_find_device */
/****************************************************************************/
-PUBLIC struct ddekit_pci_dev *ddekit_pci_find_device
+struct ddekit_pci_dev *ddekit_pci_find_device
(int *bus, int *slot, int *func, struct ddekit_pci_dev *start)
{
int i,search=0;
/****************************************************************************/
/* ddekit_pci_get_vendor */
/****************************************************************************/
-PUBLIC unsigned short ddekit_pci_get_vendor(struct ddekit_pci_dev *dev)
+unsigned short ddekit_pci_get_vendor(struct ddekit_pci_dev *dev)
{
return dev->vid;
}
/****************************************************************************/
/* ddekit_pci_get_device_id */
/****************************************************************************/
-PUBLIC unsigned short ddekit_pci_get_device_id(struct ddekit_pci_dev *dev)
+unsigned short ddekit_pci_get_device_id(struct ddekit_pci_dev *dev)
{
return dev->did;
}
/****************************************************************************/
/* ddekit_pci_enable_device */
/****************************************************************************/
-PUBLIC int ddekit_pci_enable_device(struct ddekit_pci_dev *dev)
+int ddekit_pci_enable_device(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
return 0;
/****************************************************************************/
/* ddekit_pci_disable_device */
/****************************************************************************/
-PUBLIC int ddekit_pci_disable_device(struct ddekit_pci_dev *dev)
+int ddekit_pci_disable_device(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
return 0;
/****************************************************************************/
/* ddekit_pci_set_master */
/****************************************************************************/
-PUBLIC void ddekit_pci_set_master(struct ddekit_pci_dev *dev)
+void ddekit_pci_set_master(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
}
/****************************************************************************/
/* ddekit_pci_get_sub_vendor */
/****************************************************************************/
-PUBLIC unsigned short ddekit_pci_get_sub_vendor(struct ddekit_pci_dev *dev)
+unsigned short ddekit_pci_get_sub_vendor(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
return 0;
/****************************************************************************/
/* ddekit_pci_get_sub_device */
/****************************************************************************/
-PUBLIC unsigned short ddekit_pci_get_sub_device(struct ddekit_pci_dev *dev)
+unsigned short ddekit_pci_get_sub_device(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
return 0;
/****************************************************************************/
/* ddekit_pci_get_dev_class */
/****************************************************************************/
-PUBLIC unsigned ddekit_pci_get_dev_class(struct ddekit_pci_dev *dev)
+unsigned ddekit_pci_get_dev_class(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
return 0;
/****************************************************************************/
/* ddekit_pci_get_irq */
/****************************************************************************/
-PUBLIC unsigned long
+unsigned long
ddekit_pci_get_irq(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
/****************************************************************************/
/* ddekit_pci_get_name */
/****************************************************************************/
-PUBLIC char *ddekit_pci_get_name(struct ddekit_pci_dev *dev)
+char *ddekit_pci_get_name(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
return 0;
/****************************************************************************/
/* ddekit_pci_get_slot_name */
/****************************************************************************/
-PUBLIC char *ddekit_pci_get_slot_name(struct ddekit_pci_dev *dev)
+char *ddekit_pci_get_slot_name(struct ddekit_pci_dev *dev)
{
WARN_UNIMPL;
return 0;
/****************************************************************************/
/* ddekit_pci_get_resource */
/****************************************************************************/
-PUBLIC ddekit_pci_res_t *
+ddekit_pci_res_t *
ddekit_pci_get_resource(struct ddekit_pci_dev *dev, unsigned int idx)
{
WARN_UNIMPL;
/****************************************************************************/
/* ddekit_pci_irq_enable */
/****************************************************************************/
-PUBLIC int ddekit_pci_irq_enable
+int ddekit_pci_irq_enable
(int bus, int slot, int func, int pin, int *irq)
{
/* call not needed */
#include "debug.h"
-FORWARD void lock_pgtab(void);
-FORWARD void unlock_pgtab(void);
-FORWARD struct dde_pgtab_region * allocate_region(void);
-FORWARD void free_region(struct dde_pgtab_region *r);
-FORWARD void add_region(struct dde_pgtab_region *r);
-FORWARD void rm_region(struct dde_pgtab_region *r);
-FORWARD struct dde_pgtab_region * find_region_virt(ddekit_addr_t va);
-FORWARD struct dde_pgtab_region * find_region_phys(ddekit_addr_t pa);
+static void lock_pgtab(void);
+static void unlock_pgtab(void);
+static struct dde_pgtab_region * allocate_region(void);
+static void free_region(struct dde_pgtab_region *r);
+static void add_region(struct dde_pgtab_region *r);
+static void rm_region(struct dde_pgtab_region *r);
+static struct dde_pgtab_region * find_region_virt(ddekit_addr_t va);
+static struct dde_pgtab_region * find_region_phys(ddekit_addr_t pa);
struct dde_pgtab_region {
ddekit_addr_t vm_start;
struct dde_pgtab_region *prev;
};
-PRIVATE struct dde_pgtab_region head = {0,0,0,0,&head,&head};
-PRIVATE ddekit_lock_t lock;
+static struct dde_pgtab_region head = {0,0,0,0,&head,&head};
+static ddekit_lock_t lock;
/*
* INTERNAL HELPERS
/****************************************************************************/
/* lock_pgtab */
/****************************************************************************/
-PRIVATE void lock_pgtab()
+static void lock_pgtab()
{
ddekit_lock_lock(&lock);
}
/****************************************************************************/
/* unlock_pgtab */
/****************************************************************************/
-PRIVATE void unlock_pgtab()
+static void unlock_pgtab()
{
ddekit_lock_unlock(&lock);
}
/****************************************************************************/
/* dde_pgtab_region */
/****************************************************************************/
-PRIVATE struct dde_pgtab_region * allocate_region()
+static struct dde_pgtab_region * allocate_region()
{
struct dde_pgtab_region * res;
/****************************************************************************/
/* free_region */
/****************************************************************************/
-PRIVATE void free_region(struct dde_pgtab_region *r)
+static void free_region(struct dde_pgtab_region *r)
{
ddekit_simple_free(r);
}
/****************************************************************************/
/* add_region */
/****************************************************************************/
-PRIVATE void add_region (struct dde_pgtab_region *r)
+static void add_region (struct dde_pgtab_region *r)
{
r->next = head.next;
head.next = r;
/****************************************************************************/
/* rm_region */
/****************************************************************************/
-PRIVATE void rm_region(struct dde_pgtab_region *r)
+static void rm_region(struct dde_pgtab_region *r)
{
if (r->next) {
r->next->prev = r->prev;
/****************************************************************************/
/* find_region_virt */
/****************************************************************************/
-PRIVATE struct dde_pgtab_region * find_region_virt(ddekit_addr_t va)
+static struct dde_pgtab_region * find_region_virt(ddekit_addr_t va)
{
struct dde_pgtab_region * r;
/****************************************************************************/
/* find_region_phys */
/****************************************************************************/
-PRIVATE struct dde_pgtab_region * find_region_phys(ddekit_addr_t pa)
+static struct dde_pgtab_region * find_region_phys(ddekit_addr_t pa)
{
struct dde_pgtab_region * r;
/****************************************************************************/
/* ddekit_pgtab_do_fo_each_region */
/****************************************************************************/
-PUBLIC void ddekit_pgtab_do_fo_each_region(void (*func) (unsigned, unsigned)) {
+void ddekit_pgtab_do_fo_each_region(void (*func) (unsigned, unsigned)) {
struct dde_pgtab_region * r;
for( r = head.next; r != &head ; r = r->next ) {
/****************************************************************************/
/* ddekit_pgtab_set_region */
/****************************************************************************/
-PUBLIC void ddekit_pgtab_set_region(void *virt, ddekit_addr_t phys, int pages, int type)
+void ddekit_pgtab_set_region(void *virt, ddekit_addr_t phys, int pages, int type)
{
ddekit_pgtab_set_region_with_size(virt, phys, (4096)*pages, type);
}
/****************************************************************************/
/* ddekit_pgtab_set_region_with_size */
/****************************************************************************/
-PUBLIC void ddekit_pgtab_set_region_with_size(void *virt, ddekit_addr_t phys, int size, int type)
+void ddekit_pgtab_set_region_with_size(void *virt, ddekit_addr_t phys, int size, int type)
{
struct dde_pgtab_region * r;
/****************************************************************************/
/* ddekit_pgtab_clear_region */
/****************************************************************************/
-PUBLIC void ddekit_pgtab_clear_region(void *virt, int type) {
+void ddekit_pgtab_clear_region(void *virt, int type) {
struct dde_pgtab_region *r;
/****************************************************************************/
/* ddekit_pgtab_get_physaddr */
/****************************************************************************/
-PUBLIC ddekit_addr_t ddekit_pgtab_get_physaddr(const void *virt)
+ddekit_addr_t ddekit_pgtab_get_physaddr(const void *virt)
{
struct dde_pgtab_region *r;
ddekit_addr_t ret = 0;
/****************************************************************************/
/* ddekit_pgtab_get_virtaddr */
/****************************************************************************/
-PUBLIC ddekit_addr_t ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical)
+ddekit_addr_t ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical)
{
struct dde_pgtab_region *r;
lock_pgtab();
/****************************************************************************/
/* ddekit_pgtab_get_size */
/****************************************************************************/
-PUBLIC int ddekit_pgtab_get_type(const void *virt)
+int ddekit_pgtab_get_type(const void *virt)
{
/*
* needed for dde fbsd
/****************************************************************************/
/* ddekit_pgtab_get_size */
/****************************************************************************/
-PUBLIC int ddekit_pgtab_get_size(const void *virt)
+int ddekit_pgtab_get_size(const void *virt)
{
/*
* needed for fbsd
/****************************************************************************/
/* ddekit_pgtab_init */
/****************************************************************************/
-PUBLIC void ddekit_pgtab_init() {
+void ddekit_pgtab_init() {
/* called by ddekit_init() */
ddekit_lock_init(&lock);
}
/****************************************************************************/
/* ddekit_print */
/****************************************************************************/
-PUBLIC int ddekit_print(const char* c)
+int ddekit_print(const char* c)
{
return ddekit_printf(c);
}
/****************************************************************************/
/* ddekit_printf */
/****************************************************************************/
-PUBLIC int ddekit_printf(const char* fmt, ...)
+int ddekit_printf(const char* fmt, ...)
{
int r;
va_list va;
/****************************************************************************/
/* ddekit_vprintf */
/****************************************************************************/
-PUBLIC int ddekit_vprintf(const char *fmt, va_list va)
+int ddekit_vprintf(const char *fmt, va_list va)
{
return vprintf(fmt, va);
}
/****************************************************************************/
/* ddekit_release_dma */
/****************************************************************************/
-PUBLIC int ddekit_request_dma(int nr) {
+int ddekit_request_dma(int nr) {
WARN_UNIMPL;
/* do we stil use isa dma ? imho no.*/
return -1;
/****************************************************************************/
/* ddekit_request_dma */
/****************************************************************************/
-PUBLIC int ddekit_release_dma(int nr) {
+int ddekit_release_dma(int nr) {
WARN_UNIMPL;
/* do we stil use isa dma ? imho no.*/
return -1;
/****************************************************************************/
/* ddekit_release/request_io */
/****************************************************************************/
-PUBLIC int ddekit_request_io (ddekit_addr_t start, ddekit_addr_t count) {
+int ddekit_request_io (ddekit_addr_t start, ddekit_addr_t count) {
return 0;
}
-PUBLIC int ddekit_release_io (ddekit_addr_t start, ddekit_addr_t count) {
+int ddekit_release_io (ddekit_addr_t start, ddekit_addr_t count) {
return 0;
}
/****************************************************************************/
/* ddekit_request_mem */
/****************************************************************************/
-PUBLIC int ddekit_request_mem
+int ddekit_request_mem
(ddekit_addr_t start, ddekit_addr_t size, ddekit_addr_t *vaddr) {
*vaddr = (ddekit_addr_t) vm_map_phys(SELF, (void *)start, size);
/****************************************************************************/
/* ddekit_release_mem */
/****************************************************************************/
-PUBLIC int ddekit_release_mem(ddekit_addr_t start, ddekit_addr_t size)
+int ddekit_release_mem(ddekit_addr_t start, ddekit_addr_t size)
{
return vm_unmap_phys(SELF,(void *) start, size );
}
/****************************************************************************/
/* ddekit_inb */
/****************************************************************************/
-PUBLIC unsigned char ddekit_inb(ddekit_addr_t port) {
+unsigned char ddekit_inb(ddekit_addr_t port) {
u32_t ret;
if (sys_inb(port, &ret)) {
ddekit_panic("sys_inb failed.");
/****************************************************************************/
/* ddekit_inw */
/****************************************************************************/
-PUBLIC unsigned short ddekit_inw(ddekit_addr_t port) {
+unsigned short ddekit_inw(ddekit_addr_t port) {
u32_t ret;
if (sys_inw(port, &ret)) {
ddekit_panic("sys_inw failed.");
/****************************************************************************/
/* ddekit_inl */
/****************************************************************************/
-PUBLIC unsigned long ddekit_inl(ddekit_addr_t port){
+unsigned long ddekit_inl(ddekit_addr_t port){
u32_t ret;
if (sys_inl(port, &ret)) {
ddekit_panic("sys_outl failed.");
/****************************************************************************/
/* ddekit_outb */
/****************************************************************************/
-PUBLIC void ddekit_outb(ddekit_addr_t port, unsigned char val) {
+void ddekit_outb(ddekit_addr_t port, unsigned char val) {
if (sys_outb(port,val)) {
ddekit_panic("sys_outb failed.");
}
/****************************************************************************/
/* ddekit_outw */
/****************************************************************************/
-PUBLIC void ddekit_outw(ddekit_addr_t port, unsigned short val) {
+void ddekit_outw(ddekit_addr_t port, unsigned short val) {
if (sys_outw(port,val)) {
ddekit_panic("sys_outw failed.");
}
/****************************************************************************/
/* ddekit_outl */
/****************************************************************************/
-PUBLIC void ddekit_outl(ddekit_addr_t port, unsigned long val) {
+void ddekit_outl(ddekit_addr_t port, unsigned long val) {
if (sys_outl(port,val)) {
ddekit_panic("sys_outl failed.");
}
/*****************************************************************************
* ddekit_sem_init *
*************************+**************************************************/
-PUBLIC ddekit_sem_t *ddekit_sem_init(int value)
+ddekit_sem_t *ddekit_sem_init(int value)
{
ddekit_sem_t *sem;
/*****************************************************************************
* ddekit_sem_deinit *
****************************************************************************/
-PUBLIC void ddekit_sem_deinit(ddekit_sem_t *sem)
+void ddekit_sem_deinit(ddekit_sem_t *sem)
{
SEM_DEBUG(p);
ddekit_simple_free(sem);
/*****************************************************************************
* ddekit_sem_down *
****************************************************************************/
-PUBLIC void ddekit_sem_down(ddekit_sem_t *sem)
+void ddekit_sem_down(ddekit_sem_t *sem)
{
SEM_DEBUG(p);
if(sem->count == 0) {
/*****************************************************************************
* ddekit_sem_down_try *
****************************************************************************/
-PUBLIC int ddekit_sem_down_try(ddekit_sem_t *sem)
+int ddekit_sem_down_try(ddekit_sem_t *sem)
{
if(sem->count == 0) {
return -1;
/*****************************************************************************
* ddekit_sem_up *
****************************************************************************/
-PUBLIC void ddekit_sem_up(ddekit_sem_t *sem)
+void ddekit_sem_up(ddekit_sem_t *sem)
{
SEM_DEBUG(p);
if (sem->wait_queue == NULL) {
/****************************************************************************
* ddekit_sem_down_timed *
***************************************************************************/
-PUBLIC int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo )
+int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo )
{
ddekit_panic("not implemented!");
return 0;
/* Incremented to generate unique thread IDs */
-PRIVATE unsigned id;
+static unsigned id;
-PRIVATE ddekit_thread_t *ready_queue[DDEKIT_THREAD_PRIOS];
+static ddekit_thread_t *ready_queue[DDEKIT_THREAD_PRIOS];
-PRIVATE ddekit_thread_t *sleep_queue;
+static ddekit_thread_t *sleep_queue;
/* Handle to the running thread, set in _dde_kit_thread_schedule() */
-PRIVATE ddekit_thread_t *current = NULL;
+static ddekit_thread_t *current = NULL;
-FORWARD void _ddekit_thread_start(ddekit_thread_t *th);
-FORWARD void _ddekit_thread_sleep(unsigned long until);
+static void _ddekit_thread_start(ddekit_thread_t *th);
+static void _ddekit_thread_sleep(unsigned long until);
/*****************************************************************************
* _ddekit_thread_start *
****************************************************************************/
-PRIVATE void _ddekit_thread_start(ddekit_thread_t *th)
+static void _ddekit_thread_start(ddekit_thread_t *th)
{
/* entry point of newly created threads */
th->fun(th->arg);
/*****************************************************************************
* _ddekit_thread_sleep *
****************************************************************************/
-PRIVATE void _ddekit_thread_sleep(unsigned long until)
+static void _ddekit_thread_sleep(unsigned long until)
{
current->next = sleep_queue;
sleep_queue = current;
/*****************************************************************************
* ddekit_yield *
****************************************************************************/
-PUBLIC void ddekit_yield()
+void ddekit_yield()
{
ddekit_thread_schedule();
}
/*****************************************************************************
* ddekit_thread_schedule *
****************************************************************************/
-PUBLIC void ddekit_thread_schedule()
+void ddekit_thread_schedule()
{
_ddekit_thread_enqueue(current);
_ddekit_thread_schedule();
/*****************************************************************************
* ddekit_thread_create *
****************************************************************************/
-PUBLIC ddekit_thread_t *
+ddekit_thread_t *
ddekit_thread_create(void (*fun)(void *), void *arg, const char *name)
{
ddekit_thread_t *th =
/*****************************************************************************
* ddekit_thread_get_data *
****************************************************************************/
-PUBLIC void *ddekit_thread_get_data(ddekit_thread_t *thread)
+void *ddekit_thread_get_data(ddekit_thread_t *thread)
{
return thread->data;
}
/*****************************************************************************
* ddekit_thread_get_my_data *
****************************************************************************/
-PUBLIC void *ddekit_thread_get_my_data(void)
+void *ddekit_thread_get_my_data(void)
{
return current->data;
}
/*****************************************************************************
* ddekit_thread_myself *
****************************************************************************/
-PUBLIC
+
ddekit_thread_t *ddekit_thread_myself(void)
{
return current;
/*****************************************************************************
* ddekit_thread_setup_myself *
****************************************************************************/
-PUBLIC
+
ddekit_thread_t *ddekit_thread_setup_myself(const char *name) {
ddekit_thread_t *th =
(ddekit_thread_t *) ddekit_simple_malloc(sizeof(ddekit_thread_t));
/*****************************************************************************
* ddekit_thread_set_data *
****************************************************************************/
-PUBLIC void ddekit_thread_set_data(ddekit_thread_t *thread, void *data)
+void ddekit_thread_set_data(ddekit_thread_t *thread, void *data)
{
thread->data=data;
}
/*****************************************************************************
* ddekit_thread_set_my_data *
****************************************************************************/
-PUBLIC void ddekit_thread_set_my_data(void *data)
+void ddekit_thread_set_my_data(void *data)
{
current->data = data;
}
/*****************************************************************************
* ddekit_thread_nsleep *
****************************************************************************/
-PUBLIC void ddekit_thread_nsleep(unsigned long nsecs)
+void ddekit_thread_nsleep(unsigned long nsecs)
{
/*
* Cannot use usleep here, because it's implemented in vfs.
/*****************************************************************************
* ddekit_thread_msleep *
****************************************************************************/
-PUBLIC void ddekit_thread_msleep(unsigned long msecs)
+void ddekit_thread_msleep(unsigned long msecs)
{
unsigned long to;
/*****************************************************************************
* ddekit_thread_sleep *
****************************************************************************/
-PUBLIC void ddekit_thread_sleep(ddekit_lock_t *lock)
+void ddekit_thread_sleep(ddekit_lock_t *lock)
{
WARN_UNIMPL;
}
/*****************************************************************************
* ddekit_thread_exit *
****************************************************************************/
-PUBLIC void ddekit_thread_exit()
+void ddekit_thread_exit()
{
ddekit_sem_down(current->sleep_sem);
ddekit_panic("thread running after exit!\n");
/*****************************************************************************
* ddekit_thread_terminate *
****************************************************************************/
-PUBLIC void ddekit_thread_terminate(ddekit_thread_t *thread)
+void ddekit_thread_terminate(ddekit_thread_t *thread)
{
/* todo */
}
/*****************************************************************************
* ddekit_thread_get_name *
****************************************************************************/
-PUBLIC const char *ddekit_thread_get_name(ddekit_thread_t *thread)
+const char *ddekit_thread_get_name(ddekit_thread_t *thread)
{
return thread->name;
}
/*****************************************************************************
* ddekit_thread_get_id *
****************************************************************************/
-PUBLIC int ddekit_thread_get_id(ddekit_thread_t *thread)
+int ddekit_thread_get_id(ddekit_thread_t *thread)
{
return thread->id;
}
/*****************************************************************************
* ddekit_init_threads *
****************************************************************************/
-PUBLIC void ddekit_init_threads(void)
+void ddekit_init_threads(void)
{
int i;
/*****************************************************************************
* _ddekit_thread_schedule *
****************************************************************************/
-PUBLIC void _ddekit_thread_schedule()
+void _ddekit_thread_schedule()
{
DDEBUG_MSG_VERBOSE("called schedule id: %d name %s, prio: %d",
/*****************************************************************************
* _ddekit_thread_enqueue *
****************************************************************************/
-PUBLIC void _ddekit_thread_enqueue(ddekit_thread_t *th)
+void _ddekit_thread_enqueue(ddekit_thread_t *th)
{
DDEBUG_MSG_VERBOSE("enqueueing thread: id: %d name %s, prio: %d",
/*****************************************************************************
* _ddekit_thread_set_myprio *
****************************************************************************/
-PUBLIC void _ddekit_thread_set_myprio(int prio)
+void _ddekit_thread_set_myprio(int prio)
{
DDEBUG_MSG_VERBOSE("changing thread prio, id: %d name %s, old prio: %d, "
"new prio: %d", current->id, current->name, current->prio);
/*****************************************************************************
* _ddekit_thread_wakeup_sleeping *
****************************************************************************/
-PUBLIC void _ddekit_thread_wakeup_sleeping()
+void _ddekit_thread_wakeup_sleeping()
{
ddekit_thread_t *th = sleep_queue;
/*****************************************************************************
* _ddekit_print_backtrace *
****************************************************************************/
-PUBLIC void _ddekit_print_backtrace(ddekit_thread_t *th)
+void _ddekit_print_backtrace(ddekit_thread_t *th)
{
unsigned long bp, pc, hbp;
};
-PRIVATE ddekit_sem_t *pending_timer_ints;
+static ddekit_sem_t *pending_timer_ints;
/* are we currently expecting a alarm notify? */
int _ddekit_timer_pending = 0;
-PUBLIC unsigned long long jiffies;
-PUBLIC unsigned long HZ;
+unsigned long long jiffies;
+unsigned long HZ;
-PRIVATE struct ddekit_timer_s list = {0,0,-1,1,0};
-PRIVATE int _id = 0 ;
-PRIVATE ddekit_thread_t *th;
-PRIVATE ddekit_lock_t lock;
+static struct ddekit_timer_s list = {0,0,-1,1,0};
+static int _id = 0 ;
+static ddekit_thread_t *th;
+static ddekit_lock_t lock;
-FORWARD void lock_timer(void);
-FORWARD void unlock_timer(void);
-FORWARD clock_t get_current_clock(void);
-FORWARD void remove_timer(int id);
-FORWARD int insert_timer(struct ddekit_timer_s *t);
-FORWARD struct ddekit_timer_s * get_next( myclock_t exp );
-FORWARD void ddekit_timer_thread(void *data);
+static void lock_timer(void);
+static void unlock_timer(void);
+static clock_t get_current_clock(void);
+static void remove_timer(int id);
+static int insert_timer(struct ddekit_timer_s *t);
+static struct ddekit_timer_s * get_next( myclock_t exp );
+static void ddekit_timer_thread(void *data);
/****************************************************************************
* Private funtions *
/*****************************************************************************
* lock_timer *
****************************************************************************/
-PRIVATE void lock_timer()
+static void lock_timer()
{
ddekit_lock_lock(&lock);
}
/*****************************************************************************
* remove_timer *
****************************************************************************/
-PRIVATE void remove_timer(int id)
+static void remove_timer(int id)
{
/* removes a timer from the timer list */
struct ddekit_timer_s *l,*m;
/*****************************************************************************
* insert_timer *
****************************************************************************/
-PRIVATE int insert_timer(struct ddekit_timer_s *t)
+static int insert_timer(struct ddekit_timer_s *t)
{
/* inserts a timer to the timer list */
int ret;
/*****************************************************************************
* get_next *
****************************************************************************/
-PRIVATE struct ddekit_timer_s * get_next( myclock_t exp )
+static struct ddekit_timer_s * get_next( myclock_t exp )
{
/*
* this one get the next timer, which's timeout expired,
/*****************************************************************************
* ddekit_timer_thread *
****************************************************************************/
-PRIVATE void ddekit_timer_thread(void * data)
+static void ddekit_timer_thread(void * data)
{
struct ddekit_timer_s * l;
/*****************************************************************************
* ddekit_add_timer *
****************************************************************************/
-PUBLIC int ddekit_add_timer
+int ddekit_add_timer
(void (*fn)(void *), void *args, unsigned long timeout)
{
struct ddekit_timer_s *t;
/*****************************************************************************
* ddekit_del_timer *
****************************************************************************/
-PUBLIC int ddekit_del_timer(int timer)
+int ddekit_del_timer(int timer)
{
remove_timer(timer);
return 0;
/*****************************************************************************
* ddekit_timer_pending *
****************************************************************************/
-PUBLIC int ddekit_timer_pending(int timer)
+int ddekit_timer_pending(int timer)
{
int ret=0;
struct ddekit_timer_s *t;
/*****************************************************************************
* ddekit_init_timers *
****************************************************************************/
-PUBLIC void ddekit_init_timers(void)
+void ddekit_init_timers(void)
{
static int first_time=0;
/*****************************************************************************
* ddekit_get_timer_thread *
****************************************************************************/
-PUBLIC ddekit_thread_t *ddekit_get_timer_thread(void)
+ddekit_thread_t *ddekit_get_timer_thread(void)
{
return th;
}
/*****************************************************************************
* _ddekit_timer_interrupt *
****************************************************************************/
-PUBLIC void _ddekit_timer_interrupt(void)
+void _ddekit_timer_interrupt(void)
{
jiffies = get_current_clock();
DDEBUG_MSG_VERBOSE("now: %d", jiffies);
/*****************************************************************************
* _ddekit_timer_update *
****************************************************************************/
-PUBLIC void _ddekit_timer_update()
+void _ddekit_timer_update()
{
lock_timer();
.prev = &dev_list_head,
};
-PRIVATE struct ddekit_usb_driver *d_usb_driver;
+static struct ddekit_usb_driver *d_usb_driver;
-FORWARD void _ddekit_usb_completion(struct usb_urb *mx);
-FORWARD void _ddekit_usb_connect( unsigned int dev_id, unsigned int
+static void _ddekit_usb_completion(struct usb_urb *mx);
+static void _ddekit_usb_connect( unsigned int dev_id, unsigned int
interfaces);
-FORWARD void _ddekit_usb_disconnect(unsigned dev_id);
+static void _ddekit_usb_disconnect(unsigned dev_id);
struct usb_driver mx_usb_driver = {
.urb_completion = _ddekit_usb_completion,
/*****************************************************************************
* _ddekit_usb_completion *
****************************************************************************/
-PRIVATE void _ddekit_usb_completion(struct usb_urb *mx_urb)
+static void _ddekit_usb_completion(struct usb_urb *mx_urb)
{
struct ddekit_usb_urb *d_urb = (struct ddekit_usb_urb *) mx_urb->priv;
/*****************************************************************************
* _ddekit_usb_connect *
****************************************************************************/
-PRIVATE void _ddekit_usb_connect(unsigned int dev_id, unsigned int interfaces)
+static void _ddekit_usb_connect(unsigned int dev_id, unsigned int interfaces)
{
struct ddekit_usb_dev *d_dev = (struct ddekit_usb_dev *)
ddekit_simple_malloc(sizeof(struct ddekit_usb_dev));
/*****************************************************************************
* _ddekit_usb_disconnect *
****************************************************************************/
-PUBLIC void _ddekit_usb_disconnect(unsigned dev_id)
+void _ddekit_usb_disconnect(unsigned dev_id)
{
/* find dev */
struct ddekit_usb_dev *it;
/*****************************************************************************
* ddekit_usb_dev_set_data *
****************************************************************************/
-PUBLIC int ddekit_usb_dev_set_data(struct ddekit_usb_dev *dev, void *data)
+int ddekit_usb_dev_set_data(struct ddekit_usb_dev *dev, void *data)
{
dev->data = data;
return 0;
/*****************************************************************************
* ddekit_usb_dev_get_data *
****************************************************************************/
-PUBLIC void *ddekit_usb_dev_get_data(struct ddekit_usb_dev *dev)
+void *ddekit_usb_dev_get_data(struct ddekit_usb_dev *dev)
{
return dev->data;
}
/*****************************************************************************
* ddekit_usb_submit_urb *
****************************************************************************/
-PUBLIC int ddekit_usb_submit_urb(struct ddekit_usb_urb *d_urb)
+int ddekit_usb_submit_urb(struct ddekit_usb_urb *d_urb)
{
int res;
unsigned urb_size = USB_URBSIZE(d_urb->size, d_urb->number_of_packets);
/*****************************************************************************
* ddekit_usb_cancle_urb *
****************************************************************************/
-PUBLIC int ddekit_usb_cancle_urb(struct ddekit_usb_urb *d_urb)
+int ddekit_usb_cancle_urb(struct ddekit_usb_urb *d_urb)
{
int res;
/*****************************************************************************
* ddekit_usb_init *
****************************************************************************/
-PUBLIC int ddekit_usb_init
+int ddekit_usb_init
(struct ddekit_usb_driver *drv,
ddekit_usb_malloc_fn *unused,
ddekit_usb_free_fn *_unused)
unsigned int interfaces;
};
-FORWARD struct minix_usb_driver *find_driver(endpoint_t ep);
-FORWARD struct minix_usb_driver *find_unused_driver(void);
-FORWARD int add_to_pending_urbs(struct minix_usb_driver *drv, struct
+static struct minix_usb_driver *find_driver(endpoint_t ep);
+static struct minix_usb_driver *find_unused_driver(void);
+static int add_to_pending_urbs(struct minix_usb_driver *drv, struct
ddekit_usb_urb *urb);
-FORWARD int remove_from_pending_urbs(struct minix_usb_driver *drv,
+static int remove_from_pending_urbs(struct minix_usb_driver *drv,
struct ddekit_usb_urb *urb);
-FORWARD struct ddekit_usb_urb * find_pending_urb(struct minix_usb_driver
+static struct ddekit_usb_urb * find_pending_urb(struct minix_usb_driver
*drv, unsigned urb_id);
-FORWARD void register_driver(message *msg);
-FORWARD struct ddekit_usb_urb *ddekit_usb_urb_from_mx_urb(struct usb_urb
+static void register_driver(message *msg);
+static struct ddekit_usb_urb *ddekit_usb_urb_from_mx_urb(struct usb_urb
*mx_urb);
-FORWARD void submit_urb(message *msg);
-FORWARD void cancle_urb(message *msg);
-FORWARD void completion_callback(void *priv);
+static void submit_urb(message *msg);
+static void cancle_urb(message *msg);
+static void completion_callback(void *priv);
-FORWARD void prepare_devman_usbdev(struct ddekit_usb_dev * dev, int
+static void prepare_devman_usbdev(struct ddekit_usb_dev * dev, int
dev_id, unsigned int interfaces, struct devman_usb_dev *dudev);
-FORWARD void device_disconnect_callback(struct ddekit_usb_dev * dev);
-FORWARD int add_acl(int dev_id, unsigned interfaces, endpoint_t ep);
-FORWARD int del_acl(int dev_id, unsigned interaces, endpoint_t ep);
-FORWARD int handle_msg(message *msg);
-FORWARD void _ddekit_usb_thread();
-FORWARD void device_connect_callback(struct ddekit_usb_dev * dev,
+static void device_disconnect_callback(struct ddekit_usb_dev * dev);
+static int add_acl(int dev_id, unsigned interfaces, endpoint_t ep);
+static int del_acl(int dev_id, unsigned interaces, endpoint_t ep);
+static int handle_msg(message *msg);
+static void _ddekit_usb_thread();
+static void device_connect_callback(struct ddekit_usb_dev * dev,
unsigned int interfaces);
char *_ddekit_usb_get_manufacturer(struct ddekit_usb_dev *ddev);
ddekit_usb_dev *ddev, int inum);
-PRIVATE ddekit_usb_malloc_fn my_malloc;
-PRIVATE ddekit_usb_free_fn my_free;
-PRIVATE struct minix_usb_driver gbl_drivers[MAX_DRIVERS];
-PRIVATE struct minix_usb_device _devices[MAX_DEVS];
+static ddekit_usb_malloc_fn my_malloc;
+static ddekit_usb_free_fn my_free;
+static struct minix_usb_driver gbl_drivers[MAX_DRIVERS];
+static struct minix_usb_device _devices[MAX_DEVS];
-PRIVATE struct ddekit_usb_driver my_driver = {
+static struct ddekit_usb_driver my_driver = {
.completion = completion_callback,
.connect = device_connect_callback,
.disconnect = device_disconnect_callback,
/*****************************************************************************
* find_driver *
****************************************************************************/
-PRIVATE struct minix_usb_driver *find_driver(endpoint_t ep)
+static struct minix_usb_driver *find_driver(endpoint_t ep)
{
int i;
for (i = 0; i < MAX_DRIVERS; i++ ){
/*****************************************************************************
* find_unused_driver *
****************************************************************************/
-PRIVATE struct minix_usb_driver *find_unused_driver()
+static struct minix_usb_driver *find_unused_driver()
{
int i;
for (i = 0; i < MAX_DRIVERS; i++ ){
/*****************************************************************************
* add_to_pending_urbs *
****************************************************************************/
-PRIVATE int add_to_pending_urbs(struct minix_usb_driver *drv,
+static int add_to_pending_urbs(struct minix_usb_driver *drv,
struct ddekit_usb_urb *urb)
{
int i;
/*****************************************************************************
* remove_from_pending_urbs *
****************************************************************************/
-PRIVATE int remove_from_pending_urbs(struct minix_usb_driver *drv,
+static int remove_from_pending_urbs(struct minix_usb_driver *drv,
struct ddekit_usb_urb *urb)
{
int i;
/*****************************************************************************
* find_pending_urb *
****************************************************************************/
-PRIVATE struct ddekit_usb_urb * find_pending_urb(struct minix_usb_driver *drv,
+static struct ddekit_usb_urb * find_pending_urb(struct minix_usb_driver *drv,
unsigned urb_id)
{
int i;
/*****************************************************************************
* register_driver *
****************************************************************************/
-PRIVATE void register_driver(message *msg)
+static void register_driver(message *msg)
{
endpoint_t ep = msg->m_source;
struct minix_usb_driver *drv;
/*****************************************************************************
* deregister_driver *
****************************************************************************/
-PRIVATE void deregister_driver(message *msg)
+static void deregister_driver(message *msg)
{
endpoint_t ep = msg->m_source;
/*****************************************************************************
* ddekit_usb_urb_from_mx_urb *
****************************************************************************/
-PRIVATE struct ddekit_usb_urb *ddekit_usb_urb_from_mx_urb(struct usb_urb *mx_urb)
+static struct ddekit_usb_urb *ddekit_usb_urb_from_mx_urb(struct usb_urb *mx_urb)
{
/*
* A helper function that generates (allocates and initializes)
/*****************************************************************************
* submit_urb *
****************************************************************************/
-PRIVATE void submit_urb(message *msg)
+static void submit_urb(message *msg)
{
/*
* submit_urb
/*****************************************************************************
* cancle_urb *
****************************************************************************/
-PRIVATE void cancle_urb(message *msg)
+static void cancle_urb(message *msg)
{
endpoint_t ep = msg->m_source;
/*****************************************************************************
* completion_callback *
****************************************************************************/
-PRIVATE void completion_callback(void *priv)
+static void completion_callback(void *priv)
{
/*
* completion_callback
/*****************************************************************************
* prepare_devman_usbdev *
****************************************************************************/
-PRIVATE void prepare_devman_usbdev
+static void prepare_devman_usbdev
(struct ddekit_usb_dev * dev, int dev_id, unsigned int interfaces,
struct devman_usb_dev *dudev)
{
/*****************************************************************************
* device_connect_callback *
****************************************************************************/
-PRIVATE void
+static void
device_connect_callback
(struct ddekit_usb_dev * dev, unsigned int interfaces) {
/*****************************************************************************
* device_disconnect_callback *
****************************************************************************/
-PRIVATE void device_disconnect_callback(struct ddekit_usb_dev * dev)
+static void device_disconnect_callback(struct ddekit_usb_dev * dev)
{
int i;
/*****************************************************************************
* add_acl *
****************************************************************************/
-PRIVATE int add_acl(int dev_id, unsigned interfaces, endpoint_t ep)
+static int add_acl(int dev_id, unsigned interfaces, endpoint_t ep)
{
/*
* This functions binds a specific USB interface to a client.
/*****************************************************************************
* del_acl *
****************************************************************************/
-PRIVATE int del_acl(int dev_id, unsigned interfaces, endpoint_t ep)
+static int del_acl(int dev_id, unsigned interfaces, endpoint_t ep)
{
struct minix_usb_driver *drv;
int dev, withdraw = 0;
/*****************************************************************************
* handle_msg *
****************************************************************************/
-PRIVATE int handle_msg(message *msg)
+static int handle_msg(message *msg)
{
/*
* handle_msg
/*****************************************************************************
* devman_tread *
****************************************************************************/
-PRIVATE void devman_thread(void *unused)
+static void devman_thread(void *unused)
{
struct ddekit_minix_msg_q *mq = ddekit_minix_create_msg_q(DEVMAN_BASE,
DEVMAN_BASE + 0xff);
/*****************************************************************************
* _ddekit_usb_thread *
****************************************************************************/
-PRIVATE void _ddekit_usb_thread(void * unused)
+static void _ddekit_usb_thread(void * unused)
{
struct ddekit_minix_msg_q *mq = ddekit_minix_create_msg_q(USB_BASE,
USB_BASE + 0xff);
/*****************************************************************************
* bind_cb *
****************************************************************************/
-PRIVATE int bind_cb (struct devman_usb_bind_cb_data *data, endpoint_t ep)
+static int bind_cb (struct devman_usb_bind_cb_data *data, endpoint_t ep)
{
if(data) {
return add_acl(data->dev_id, data->interface, ep);
/*****************************************************************************
* unbind_cb *
****************************************************************************/
-PRIVATE int unbind_cb (struct devman_usb_bind_cb_data *data, endpoint_t ep)
+static int unbind_cb (struct devman_usb_bind_cb_data *data, endpoint_t ep)
{
if(data) {
return del_acl(data->dev_id, data->interface, ep);
/*****************************************************************************
* ddekit_usb_server_init *
****************************************************************************/
-PUBLIC void ddekit_usb_server_init()
+void ddekit_usb_server_init()
{
int i;
/*
#include "local.h"
-PRIVATE endpoint_t devman_ep;
+static endpoint_t devman_ep;
-FORWARD int save_string(char *buffer, char *src, size_t *offset);
+static int save_string(char *buffer, char *src, size_t *offset);
-PRIVATE TAILQ_HEAD(devlist_head, devman_dev) dev_list;
+static TAILQ_HEAD(devlist_head, devman_dev) dev_list;
/****************************************************************************
* save_string *
***************************************************************************/
-PRIVATE int save_string(char *buffer, char *src, size_t *offset)
+static int save_string(char *buffer, char *src, size_t *offset)
{
unsigned old_offset = *offset;
size_t len = strlen(src) + 1;
/****************************************************************************
* serialize_dev *
***************************************************************************/
-PUBLIC void *serialize_dev(struct devman_dev *dev, size_t *overall_size)
+void *serialize_dev(struct devman_dev *dev, size_t *overall_size)
{
/* determine size of serialized version of dev */
char *buffer;
/****************************************************************************
* devman_add_device *
***************************************************************************/
-PUBLIC int devman_add_device(struct devman_dev *dev)
+int devman_add_device(struct devman_dev *dev)
{
message msg;
int res;
/****************************************************************************
* devman_del_device *
***************************************************************************/
-PUBLIC int devman_del_device(struct devman_dev *dev)
+int devman_del_device(struct devman_dev *dev)
{
message msg;
int res;
/****************************************************************************
* devman_get_ep *
***************************************************************************/
-PUBLIC endpoint_t devman_get_ep()
+endpoint_t devman_get_ep()
{
return devman_ep;
}
/****************************************************************************
* devman_init *
***************************************************************************/
-PUBLIC int devman_init()
+int devman_init()
{
int res;
/****************************************************************************
* do_bind *
***************************************************************************/
-PRIVATE void do_bind(message *m)
+static void do_bind(message *m)
{
struct devman_dev *dev;
int res;
/****************************************************************************
* do_unbind *
***************************************************************************/
-PRIVATE void do_unbind(message *m)
+static void do_unbind(message *m)
{
struct devman_dev *dev;
int res;
/****************************************************************************
* devman_handle_msg *
***************************************************************************/
-PUBLIC int devman_handle_msg(message *m)
+int devman_handle_msg(message *m)
{
/* make sure msg comes from devman server */
if (m->m_source != devman_ep) {
/****************************************************************************
* devman_usb_add_attr *
***************************************************************************/
-PRIVATE void
+static void
devman_usb_add_attr
(struct devman_dev *dev, char *name, char *data)
{
/****************************************************************************
* add_device_attributes *
***************************************************************************/
-PRIVATE void
+static void
add_device_attributes
(struct devman_usb_dev *udev)
{
/****************************************************************************
* add_interface_attributes *
***************************************************************************/
-PRIVATE void
+static void
add_interface_attributes
(struct devman_usb_interface *intf)
{
/****************************************************************************
* devman_usb_device_new *
***************************************************************************/
-PUBLIC struct devman_usb_dev*
+struct devman_usb_dev*
devman_usb_device_new
(int dev_id)
{
/****************************************************************************
* devman_usb_device_delete *
***************************************************************************/
-PUBLIC void devman_usb_device_delete(struct devman_usb_dev *udev)
+void devman_usb_device_delete(struct devman_usb_dev *udev)
{
int i;
struct devman_static_attribute *attr,*temp;
free(udev);
}
-PRIVATE int devman_usb_bind_cb(void *data, endpoint_t ep) {
+static int devman_usb_bind_cb(void *data, endpoint_t ep) {
if (bind_cb) {
return bind_cb((struct devman_usb_bind_cb_data *) data, ep);
} else {
}
}
-PRIVATE int devman_usb_unbind_cb(void *data, endpoint_t ep) {
+static int devman_usb_unbind_cb(void *data, endpoint_t ep) {
if (unbind_cb) {
return unbind_cb((struct devman_usb_bind_cb_data *) data, ep);
} else {
/****************************************************************************
* devman_usb_device_add *
***************************************************************************/
-PUBLIC int devman_usb_device_add(struct devman_usb_dev *dev)
+int devman_usb_device_add(struct devman_usb_dev *dev)
{
int i,res = 0;
add_device_attributes(dev);
/****************************************************************************
* devman_usb_device_remove *
***************************************************************************/
-PUBLIC int devman_usb_device_remove(struct devman_usb_dev *dev)
+int devman_usb_device_remove(struct devman_usb_dev *dev)
{
int i, res = 0;
/****************************************************************************
* devman_usb_init *
***************************************************************************/
-PUBLIC void devman_usb_init
+void devman_usb_init
(int (*_bind_cb) (struct devman_usb_bind_cb_data *data, endpoint_t ep),
int (*_unbind_cb) (struct devman_usb_bind_cb_data *data, endpoint_t ep))
{
STATIC int PushBack;
STATIC int Pushed;
STATIC int Signal;
-FORWARD KEYMAP Map[33];
-FORWARD KEYMAP MetaMap[17];
+static KEYMAP Map[33];
+static KEYMAP MetaMap[17];
STATIC SIZE_T Length;
STATIC SIZE_T ScreenCount;
STATIC SIZE_T ScreenSize;
/*===========================================================================*
* attr_get *
*===========================================================================*/
-PUBLIC void attr_get(attr)
+void attr_get(attr)
struct hgfs_attr *attr;
{
/* Get attribute information from the RPC buffer, storing the requested parts
/*===========================================================================*
* hgfs_getattr *
*===========================================================================*/
-PUBLIC int hgfs_getattr(path, attr)
+int hgfs_getattr(path, attr)
char *path;
struct hgfs_attr *attr;
{
/*===========================================================================*
* hgfs_setattr *
*===========================================================================*/
-PUBLIC int hgfs_setattr(path, attr)
+int hgfs_setattr(path, attr)
char *path;
struct hgfs_attr *attr;
{
/*===========================================================================*
* channel_open *
*===========================================================================*/
-PUBLIC int channel_open(ch, type)
+int channel_open(ch, type)
struct channel *ch; /* struct describing the new channel */
u32_t type; /* channel type: CH_IN or CH_OUT */
{
/*===========================================================================*
* channel_close *
*===========================================================================*/
-PUBLIC void channel_close(ch)
+void channel_close(ch)
struct channel *ch; /* backdoor channel to close */
{
/* Close a previously opened backdoor channel.
/*===========================================================================*
* channel_send *
*===========================================================================*/
-PUBLIC int channel_send(ch, buf, len)
+int channel_send(ch, buf, len)
struct channel *ch; /* backdoor channel to send to */
char *buf; /* buffer to send data from */
int len; /* size of the data to send */
/*===========================================================================*
* channel_recv *
*===========================================================================*/
-PUBLIC int channel_recv(ch, buf, max)
+int channel_recv(ch, buf, max)
struct channel *ch; /* backdoor channel to receive from */
char *buf; /* buffer to receive data into */
int max; /* size of the buffer */
/*===========================================================================*
* hgfs_opendir *
*===========================================================================*/
-PUBLIC int hgfs_opendir(path, handle)
+int hgfs_opendir(path, handle)
char *path;
hgfs_dir_t *handle;
{
/*===========================================================================*
* hgfs_readdir *
*===========================================================================*/
-PUBLIC int hgfs_readdir(handle, index, buf, size, attr)
+int hgfs_readdir(handle, index, buf, size, attr)
hgfs_dir_t handle;
unsigned int index;
char *buf;
/*===========================================================================*
* hgfs_closedir *
*===========================================================================*/
-PUBLIC int hgfs_closedir(handle)
+int hgfs_closedir(handle)
hgfs_dir_t handle;
{
/* Close an open directory.
* that weren't in the original protocol, are being returned now.
*/
#define NERRS 16
-PRIVATE int error_map[NERRS] = {
+static int error_map[NERRS] = {
OK, /* no error */
ENOENT, /* no such file/directory */
EBADF, /* invalid handle */
/*===========================================================================*
* error_convert *
*===========================================================================*/
-PUBLIC int error_convert(err)
+int error_convert(err)
int err;
{
/* Convert a HGFS error into an errno error code.
/*===========================================================================*
* hgfs_open *
*===========================================================================*/
-PUBLIC int hgfs_open(path, flags, mode, handle)
+int hgfs_open(path, flags, mode, handle)
char *path; /* path name to open */
int flags; /* open flags to use */
int mode; /* mode to create (user bits only) */
/*===========================================================================*
* hgfs_read *
*===========================================================================*/
-PUBLIC int hgfs_read(handle, buf, size, off)
+int hgfs_read(handle, buf, size, off)
hgfs_file_t handle; /* handle to open file */
char *buf; /* data buffer or NULL */
size_t size; /* maximum number of bytes to read */
/*===========================================================================*
* hgfs_write *
*===========================================================================*/
-PUBLIC int hgfs_write(handle, buf, len, off, append)
+int hgfs_write(handle, buf, len, off, append)
hgfs_file_t handle; /* handle to open file */
const char *buf; /* data buffer or NULL */
size_t len; /* number of bytes to write */
/*===========================================================================*
* hgfs_close *
*===========================================================================*/
-PUBLIC int hgfs_close(handle)
+int hgfs_close(handle)
hgfs_file_t handle; /* handle to open file */
{
/* Close an open file.
/*===========================================================================*
* hgfs_readbuf *
*===========================================================================*/
-PUBLIC size_t hgfs_readbuf(ptr)
+size_t hgfs_readbuf(ptr)
char **ptr;
{
/* Return information about the read buffer, for zero-copy purposes. Store a
/*===========================================================================*
* hgfs_writebuf *
*===========================================================================*/
-PUBLIC size_t hgfs_writebuf(ptr)
+size_t hgfs_writebuf(ptr)
char **ptr;
{
/* Return information about the write buffer, for zero-copy purposes. Store a
/*===========================================================================*
* hgfs_mkdir *
*===========================================================================*/
-PUBLIC int hgfs_mkdir(path, mode)
+int hgfs_mkdir(path, mode)
char *path;
int mode;
{
/*===========================================================================*
* hgfs_unlink *
*===========================================================================*/
-PUBLIC int hgfs_unlink(path)
+int hgfs_unlink(path)
char *path;
{
/* Delete a file.
/*===========================================================================*
* hgfs_rmdir *
*===========================================================================*/
-PUBLIC int hgfs_rmdir(path)
+int hgfs_rmdir(path)
char *path;
{
/* Remove an empty directory.
/*===========================================================================*
* hgfs_rename *
*===========================================================================*/
-PUBLIC int hgfs_rename(opath, npath)
+int hgfs_rename(opath, npath)
char *opath;
char *npath;
{
/*===========================================================================*
* hgfs_init *
*===========================================================================*/
-PUBLIC int hgfs_init()
+int hgfs_init()
{
/* Initialize the library. Return OK on success, or a negative error code
* otherwise. If EAGAIN is returned, shared folders are disabled; in that
/*===========================================================================*
* hgfs_cleanup *
*===========================================================================*/
-PUBLIC void hgfs_cleanup()
+void hgfs_cleanup()
{
/* Clean up state.
*/
/*===========================================================================*
* hgfs_enabled *
*===========================================================================*/
-PUBLIC int hgfs_enabled()
+int hgfs_enabled()
{
/* Check if shared folders are enabled. Return OK if so, EAGAIN if not, and
* another negative error code on error.
/*===========================================================================*
* hgfs_queryvol *
*===========================================================================*/
-PUBLIC int hgfs_queryvol(path, free, total)
+int hgfs_queryvol(path, free, total)
char *path;
u64_t *free;
u64_t *total;
/*===========================================================================*
* path_put *
*===========================================================================*/
-PUBLIC void path_put(path)
+void path_put(path)
char *path;
{
/* Append the given path name in HGFS format to the RPC buffer. Truncate it
/*===========================================================================*
* path_get *
*===========================================================================*/
-PUBLIC int path_get(path, max)
+int path_get(path, max)
char *path;
int max;
{
#include "inc.h"
-PUBLIC char rpc_buf[RPC_BUF_SIZE];
-PUBLIC char *rpc_ptr;
+char rpc_buf[RPC_BUF_SIZE];
+char *rpc_ptr;
-PRIVATE struct channel rpc_chan;
+static struct channel rpc_chan;
/*===========================================================================*
* rpc_open *
*===========================================================================*/
-PUBLIC int rpc_open()
+int rpc_open()
{
/* Open a HGFS RPC backdoor channel to the VMware host, and make sure that it
* is working. Return OK upon success, or a negative error code otherwise.
/*===========================================================================*
* rpc_query *
*===========================================================================*/
-PUBLIC int rpc_query()
+int rpc_query()
{
/* Send a HGFS RPC query over the backdoor channel. Return OK upon success, or
* a negative error code otherwise; EAGAIN is returned if shared folders are
/*===========================================================================*
* rpc_test *
*===========================================================================*/
-PUBLIC int rpc_test()
+int rpc_test()
{
/* Test whether HGFS communication is working. Return OK on success, EAGAIN if
* shared folders are disabled, or another negative error code upon error.
/*===========================================================================*
* rpc_close *
*===========================================================================*/
-PUBLIC void rpc_close()
+void rpc_close()
{
/* Close the HGFS RPC backdoor channel.
*/
#include "inc.h"
-PRIVATE u64_t time_offset;
+static u64_t time_offset;
/*===========================================================================*
* time_init *
*===========================================================================*/
-PUBLIC void time_init()
+void time_init()
{
/* Initialize the time conversion module.
*/
/*===========================================================================*
* time_put *
*===========================================================================*/
-PUBLIC void time_put(timep)
+void time_put(timep)
time_t *timep;
{
/* Store a UNIX timestamp pointed to by the given pointer onto the RPC buffer,
/*===========================================================================*
* time_get *
*===========================================================================*/
-PUBLIC void time_get(timep)
+void time_get(timep)
time_t *timep;
{
/* Get a HGFS timestamp from the RPC buffer, convert it into a UNIX timestamp,
* unlikely, but negative bit counts are now possible (though unlikely)
* and give silly results.
*/
-PUBLIC int bitmapsize(nr_bits, block_size)
+int bitmapsize(nr_bits, block_size)
bit_t nr_bits;
int block_size;
{
/*===========================================================================*
* conv2 *
*===========================================================================*/
-PUBLIC unsigned conv2(norm, w)
+unsigned conv2(norm, w)
int norm; /* TRUE if no swap, FALSE for byte swap */
int w; /* promotion of 16-bit word to be swapped */
{
/*===========================================================================*
* conv4 *
*===========================================================================*/
-PUBLIC long conv4(norm, x)
+long conv4(norm, x)
int norm; /* TRUE if no swap, FALSE for byte swap */
long x; /* 32-bit long to be byte swapped */
{
/*===========================================================================*
* conv_inode *
*===========================================================================*/
-PUBLIC void conv_inode(rip, dip, dip2, rw_flag, magic)
+void conv_inode(rip, dip, dip2, rw_flag, magic)
register struct inode *rip; /* pointer to the in-core inode struct */
register d1_inode *dip; /* pointer to the V1 on-disk inode struct */
register d2_inode *dip2; /* pointer to the V2 on-disk inode struct */
/*===========================================================================*
* old_icopy *
*===========================================================================*/
-PUBLIC void old_icopy(rip, dip, direction, norm)
+void old_icopy(rip, dip, direction, norm)
register struct inode *rip; /* pointer to the in-core inode struct */
register d1_inode *dip; /* pointer to the d1_inode inode struct */
int direction; /* READING (from disk) or WRITING (to disk) */
/*===========================================================================*
* new_icopy *
*===========================================================================*/
-PUBLIC void new_icopy(rip, dip, direction, norm)
+void new_icopy(rip, dip, direction, norm)
register struct inode *rip; /* pointer to the in-core inode struct */
register d2_inode *dip; /* pointer to the d2_inode struct */
int direction; /* READING (from disk) or WRITING (to disk) */
#include <lib.h>
#include <unistd.h>
-PUBLIC gid_t getngid(endpoint_t proc_ep)
+gid_t getngid(endpoint_t proc_ep)
{
message m;
m.m1_i1 = proc_ep; /* search gid for this process */
#include <lib.h>
#include <unistd.h>
-PUBLIC pid_t getnpid(endpoint_t proc_ep)
+pid_t getnpid(endpoint_t proc_ep)
{
message m;
m.m1_i1 = proc_ep; /* search pid for this process */
#include <unistd.h>
-PUBLIC int getnprocnr(pid_t pid)
+int getnprocnr(pid_t pid)
{
message m;
int t = GETPROCNR;
#include <sys/ucred.h>
#include <unistd.h>
-PUBLIC int getnucred(endpoint_t proc_ep, struct ucred *ucred)
+int getnucred(endpoint_t proc_ep, struct ucred *ucred)
{
message m;
pid_t pid;
#include <lib.h>
#include <unistd.h>
-PUBLIC uid_t getnuid(endpoint_t proc_ep)
+uid_t getnuid(endpoint_t proc_ep)
{
message m;
m.m1_i1 = proc_ep; /* search uid for this process */
#include <unistd.h>
-PUBLIC int getprocnr()
+int getprocnr()
{
message m;
m.m1_i1 = -1; /* don't pass pid to search for */
#include <lib.h>
/* Integer to ASCII for signed decimal integers. */
-PRIVATE int next;
-PRIVATE char qbuf[8];
+static int next;
+static char qbuf[8];
char *itoa(int n);
#include <unistd.h>
-PUBLIC int mapdriver(label, major, dev_style, flags)
+int mapdriver(label, major, dev_style, flags)
char *label;
int major;
int dev_style;
#include <lib.h>
#include <unistd.h>
-PUBLIC int vm_memctl(endpoint_t ep, int req)
+int vm_memctl(endpoint_t ep, int req)
{
message m;
m.VM_RS_CTL_ENDPT = ep;
* return 0, when there are no more processes.
* note that for the return value of 0 and 1, the 'endpt' is set accordingly.
*/
-PUBLIC int vm_query_exit(int *endpt)
+int vm_query_exit(int *endpt)
{
message m;
int r;
return (m.VM_QUERY_IS_MORE ? 1 : 0);
}
-PUBLIC int vm_watch_exit(endpoint_t ep)
+int vm_watch_exit(endpoint_t ep)
{
message m;
#include <lib.h>
#include <unistd.h>
-PUBLIC int vm_set_priv(int nr, void *buf)
+int vm_set_priv(int nr, void *buf)
{
message m;
m.VM_RS_NR = nr;
#include <lib.h>
#include <unistd.h>
-PUBLIC int vm_update(endpoint_t src_e, endpoint_t dst_e)
+int vm_update(endpoint_t src_e, endpoint_t dst_e)
{
message m;
m.VM_RS_SRC_ENDPT = src_e;
#include "global.h"
#include "proto.h"
-FORWARD int mthread_increase_thread_pool(void);
-FORWARD void mthread_thread_init(mthread_thread_t thread, mthread_attr_t
+static int mthread_increase_thread_pool(void);
+static void mthread_thread_init(mthread_thread_t thread, mthread_attr_t
*tattr, void *(*proc)(void *), void *arg);
-FORWARD void mthread_thread_stop(mthread_thread_t thread);
-FORWARD void mthread_trampoline(void);
+static void mthread_thread_stop(mthread_thread_t thread);
+static void mthread_trampoline(void);
-PRIVATE int initialized = 0;
+static int initialized = 0;
#ifndef PGSHIFT
# define PGSHIFT 12 /* XXX: temporarily for ACK */
#endif
#define MTHREAD_GUARDSIZE (1 << PGSHIFT) /* 1 page */
-PRIVATE struct __mthread_attr default_attr = { MTHREAD_STACK_MIN,
+static struct __mthread_attr default_attr = { MTHREAD_STACK_MIN,
NULL,
MTHREAD_CREATE_JOINABLE,
NULL, NULL };
/*===========================================================================*
* mthread_equal *
*===========================================================================*/
-PUBLIC int mthread_equal(l, r)
+int mthread_equal(l, r)
mthread_thread_t l;
mthread_thread_t r;
{
/*===========================================================================*
* mthread_create *
*===========================================================================*/
-PUBLIC int mthread_create(threadid, tattr, proc, arg)
+int mthread_create(threadid, tattr, proc, arg)
mthread_thread_t *threadid;
mthread_attr_t *tattr;
void *(*proc)(void *);
/*===========================================================================*
* mthread_detach *
*===========================================================================*/
-PUBLIC int mthread_detach(detach)
+int mthread_detach(detach)
mthread_thread_t detach;
{
/* Mark a thread as detached. Consequently, upon exit, resources allocated for
/*===========================================================================*
* mthread_exit *
*===========================================================================*/
-PUBLIC void mthread_exit(value)
+void mthread_exit(value)
void *value;
{
/* Make a thread stop running and store the result value. */
/*===========================================================================*
* mthread_find_tcb *
*===========================================================================*/
-PUBLIC mthread_tcb_t * mthread_find_tcb(thread)
+mthread_tcb_t * mthread_find_tcb(thread)
mthread_thread_t thread;
{
mthread_tcb_t *rt = NULL;
/*===========================================================================*
* mthread_increase_thread_pool *
*===========================================================================*/
-PRIVATE int mthread_increase_thread_pool(void)
+static int mthread_increase_thread_pool(void)
{
/* Increase thread pool. No fancy algorithms, just double the size. */
mthread_tcb_t **new_tcb;
/*===========================================================================*
* mthread_init *
*===========================================================================*/
-PUBLIC void mthread_init(void)
+void mthread_init(void)
{
/* Initialize thread system; allocate thread structures and start creating
* threads.
/*===========================================================================*
* mthread_join *
*===========================================================================*/
-PUBLIC int mthread_join(join, value)
+int mthread_join(join, value)
mthread_thread_t join;
void **value;
{
/*===========================================================================*
* mthread_once *
*===========================================================================*/
-PUBLIC int mthread_once(once, proc)
+int mthread_once(once, proc)
mthread_once_t *once;
void (*proc)(void);
{
/*===========================================================================*
* mthread_self *
*===========================================================================*/
-PUBLIC mthread_thread_t mthread_self(void)
+mthread_thread_t mthread_self(void)
{
/* Return the thread id of the thread calling this function. */
/*===========================================================================*
* mthread_thread_init *
*===========================================================================*/
-PRIVATE void mthread_thread_init(thread, tattr, proc, arg)
+static void mthread_thread_init(thread, tattr, proc, arg)
mthread_thread_t thread;
mthread_attr_t *tattr;
void *(*proc)(void *);
/*===========================================================================*
* mthread_thread_reset *
*===========================================================================*/
-PUBLIC void mthread_thread_reset(thread)
+void mthread_thread_reset(thread)
mthread_thread_t thread;
{
/* Reset the thread to its default values. Free the allocated stack space. */
/*===========================================================================*
* mthread_thread_stop *
*===========================================================================*/
-PRIVATE void mthread_thread_stop(thread)
+static void mthread_thread_stop(thread)
mthread_thread_t thread;
{
/* Stop thread from running. Deallocate resources. */
/*===========================================================================*
* mthread_trampoline *
*===========================================================================*/
-PRIVATE void mthread_trampoline(void)
+static void mthread_trampoline(void)
{
/* Execute the /current_thread's/ procedure. Store its result. */
#include "global.h"
#include "proto.h"
-PRIVATE struct __mthread_attr *va_front, *va_rear;
-FORWARD void mthread_attr_add(mthread_attr_t *a);
-FORWARD void mthread_attr_remove(mthread_attr_t *a);
-FORWARD int mthread_attr_valid(mthread_attr_t *a);
+static struct __mthread_attr *va_front, *va_rear;
+static void mthread_attr_add(mthread_attr_t *a);
+static void mthread_attr_remove(mthread_attr_t *a);
+static int mthread_attr_valid(mthread_attr_t *a);
/*===========================================================================*
* mthread_init_valid_attributes *
*===========================================================================*/
-PUBLIC void mthread_init_valid_attributes(void)
+void mthread_init_valid_attributes(void)
{
/* Initialize list of valid attributs */
va_front = va_rear = NULL;
/*===========================================================================*
* mthread_attr_add *
*===========================================================================*/
-PRIVATE void mthread_attr_add(a)
+static void mthread_attr_add(a)
mthread_attr_t *a;
{
/* Add attribute to list of valid, initialized attributes */
/*===========================================================================*
* mthread_attr_destroy *
*===========================================================================*/
-PUBLIC int mthread_attr_destroy(attr)
+int mthread_attr_destroy(attr)
mthread_attr_t *attr;
{
/* Invalidate attribute and deallocate resources. */
/*===========================================================================*
* mthread_attr_init *
*===========================================================================*/
-PUBLIC int mthread_attr_init(attr)
+int mthread_attr_init(attr)
mthread_attr_t *attr; /* Attribute */
{
/* Initialize the attribute to a known state. */
/*===========================================================================*
* mthread_attr_getdetachstate *
*===========================================================================*/
-PUBLIC int mthread_attr_getdetachstate(attr, detachstate)
+int mthread_attr_getdetachstate(attr, detachstate)
mthread_attr_t *attr;
int *detachstate;
{
/*===========================================================================*
* mthread_attr_setdetachstate *
*===========================================================================*/
-PUBLIC int mthread_attr_setdetachstate(attr, detachstate)
+int mthread_attr_setdetachstate(attr, detachstate)
mthread_attr_t *attr;
int detachstate;
{
/*===========================================================================*
* mthread_attr_getstack *
*===========================================================================*/
-PUBLIC int mthread_attr_getstack(attr, stackaddr, stacksize)
+int mthread_attr_getstack(attr, stackaddr, stacksize)
mthread_attr_t *attr;
void **stackaddr;
size_t *stacksize;
/*===========================================================================*
* mthread_attr_getstacksize *
*===========================================================================*/
-PUBLIC int mthread_attr_getstacksize(attr, stacksize)
+int mthread_attr_getstacksize(attr, stacksize)
mthread_attr_t *attr;
size_t *stacksize;
{
/*===========================================================================*
* mthread_attr_setstack *
*===========================================================================*/
-PUBLIC int mthread_attr_setstack(attr, stackaddr, stacksize)
+int mthread_attr_setstack(attr, stackaddr, stacksize)
mthread_attr_t *attr;
void *stackaddr;
size_t stacksize;
/*===========================================================================*
* mthread_attr_setstacksize *
*===========================================================================*/
-PUBLIC int mthread_attr_setstacksize(attr, stacksize)
+int mthread_attr_setstacksize(attr, stacksize)
mthread_attr_t *attr;
size_t stacksize;
{
/*===========================================================================*
* mthread_attr_remove *
*===========================================================================*/
-PRIVATE void mthread_attr_remove(a)
+static void mthread_attr_remove(a)
mthread_attr_t *a;
{
/* Remove attribute from list of valid, initialized attributes */
/*===========================================================================*
* mthread_attr_valid *
*===========================================================================*/
-PRIVATE int mthread_attr_valid(a)
+static int mthread_attr_valid(a)
mthread_attr_t *a;
{
/* Check to see if attribute is on the list of valid attributes */
* mthread_attr_verify *
*===========================================================================*/
#ifdef MDEBUG
-PUBLIC int mthread_attr_verify(void)
+int mthread_attr_verify(void)
{
/* Return true when no attributes are in use */
struct __mthread_attr *loopitem;
#include "proto.h"
#ifdef MTHREAD_STRICT
-PRIVATE struct __mthread_cond *vc_front, *vc_rear;
-FORWARD void mthread_cond_add(mthread_cond_t *c);
-FORWARD void mthread_cond_remove(mthread_cond_t *c);
-FORWARD int mthread_cond_valid(mthread_cond_t *c);
+static struct __mthread_cond *vc_front, *vc_rear;
+static void mthread_cond_add(mthread_cond_t *c);
+static void mthread_cond_remove(mthread_cond_t *c);
+static int mthread_cond_valid(mthread_cond_t *c);
#else
# define mthread_cond_add(c) ((*c)->mc_magic = MTHREAD_INIT_MAGIC)
# define mthread_cond_remove(c) ((*c)->mc_magic = MTHREAD_NOT_INUSE)
/*===========================================================================*
* mthread_init_valid_conditions *
*===========================================================================*/
-PUBLIC void mthread_init_valid_conditions(void)
+void mthread_init_valid_conditions(void)
{
#ifdef MTHREAD_STRICT
/* Initialize condition variable list */
* mthread_cond_add *
*===========================================================================*/
#ifdef MTHREAD_STRICT
-PRIVATE void mthread_cond_add(c)
+static void mthread_cond_add(c)
mthread_cond_t *c;
{
/* Add condition to list of valid, initialized conditions */
/*===========================================================================*
* mthread_cond_broadcast *
*===========================================================================*/
-PUBLIC int mthread_cond_broadcast(cond)
+int mthread_cond_broadcast(cond)
mthread_cond_t *cond;
{
/* Signal all threads waiting for condition 'cond'. */
/*===========================================================================*
* mthread_cond_destroy *
*===========================================================================*/
-PUBLIC int mthread_cond_destroy(cond)
+int mthread_cond_destroy(cond)
mthread_cond_t *cond;
{
/* Destroy a condition variable. Make sure it's not in use */
/*===========================================================================*
* mthread_cond_init *
*===========================================================================*/
-PUBLIC int mthread_cond_init(cond, cattr)
+int mthread_cond_init(cond, cattr)
mthread_cond_t *cond;
mthread_condattr_t *cattr;
{
* mthread_cond_remove *
*===========================================================================*/
#ifdef MTHREAD_STRICT
-PRIVATE void mthread_cond_remove(c)
+static void mthread_cond_remove(c)
mthread_cond_t *c;
{
/* Remove condition from list of valid, initialized conditions */
/*===========================================================================*
* mthread_cond_signal *
*===========================================================================*/
-PUBLIC int mthread_cond_signal(cond)
+int mthread_cond_signal(cond)
mthread_cond_t *cond;
{
/* Signal a thread that condition 'cond' was met. Just a single thread. */
* mthread_cond_valid *
*===========================================================================*/
#ifdef MTHREAD_STRICT
-PRIVATE int mthread_cond_valid(c)
+static int mthread_cond_valid(c)
mthread_cond_t *c;
{
/* Check to see if cond is on the list of valid conditions */
* mthread_cond_verify *
*===========================================================================*/
#ifdef MDEBUG
-PUBLIC int mthread_cond_verify(void)
+int mthread_cond_verify(void)
{
/* Return true in case no condition variables are in use. */
/*===========================================================================*
* mthread_cond_wait *
*===========================================================================*/
-PUBLIC int mthread_cond_wait(cond, mutex)
+int mthread_cond_wait(cond, mutex)
mthread_cond_t *cond;
mthread_mutex_t *mutex;
{
/*===========================================================================*
* mthread_event_init *
*===========================================================================*/
-PUBLIC int mthread_event_init(event)
+int mthread_event_init(event)
mthread_event_t *event; /* The event to be initialized */
{
/* Initialize an event object.
/*===========================================================================*
* mthread_event_destroy *
*===========================================================================*/
-PUBLIC int mthread_event_destroy(event)
+int mthread_event_destroy(event)
mthread_event_t *event; /* The event to be destroyed */
{
/* Destroy an event object.
/*===========================================================================*
* mthread_event_wait *
*===========================================================================*/
-PUBLIC int mthread_event_wait(event)
+int mthread_event_wait(event)
mthread_event_t *event; /* The event to be waited on */
{
/* Wait for an event, blocking the current thread in the process.
/*===========================================================================*
* mthread_event_fire *
*===========================================================================*/
-PUBLIC int mthread_event_fire(event)
+int mthread_event_fire(event)
mthread_event_t *event; /* The event to be fired */
{
/* Fire an event, waking up any thread blocked on it.
/*===========================================================================*
* mthread_event_fire_all *
*===========================================================================*/
-PUBLIC int mthread_event_fire_all(event)
+int mthread_event_fire_all(event)
mthread_event_t *event; /* The event to be fired */
{
/* Fire an event, waking up any thread blocked on it.
#include "global.h"
#include "proto.h"
-PRIVATE int keys_used = 0;
-PRIVATE struct {
+static int keys_used = 0;
+static struct {
int used;
int nvalues;
void *mvalue;
/*===========================================================================*
* mthread_init_keys *
*===========================================================================*/
-PUBLIC void mthread_init_keys(void)
+void mthread_init_keys(void)
{
/* Initialize the table of key entries.
*/
/*===========================================================================*
* mthread_key_create *
*===========================================================================*/
-PUBLIC int mthread_key_create(mthread_key_t *key, void (*destructor)(void *))
+int mthread_key_create(mthread_key_t *key, void (*destructor)(void *))
{
/* Allocate a key.
*/
/*===========================================================================*
* mthread_key_delete *
*===========================================================================*/
-PUBLIC int mthread_key_delete(mthread_key_t key)
+int mthread_key_delete(mthread_key_t key)
{
/* Free up a key, as well as any associated storage space.
*/
/*===========================================================================*
* mthread_getspecific *
*===========================================================================*/
-PUBLIC void *mthread_getspecific(mthread_key_t key)
+void *mthread_getspecific(mthread_key_t key)
{
/* Get this thread's local value for the given key. The default is NULL.
*/
/*===========================================================================*
* mthread_setspecific *
*===========================================================================*/
-PUBLIC int mthread_setspecific(mthread_key_t key, void *value)
+int mthread_setspecific(mthread_key_t key, void *value)
{
/* Set this thread's value for the given key. Allocate more resources as
* necessary.
/*===========================================================================*
* mthread_cleanup_values *
*===========================================================================*/
-PUBLIC void mthread_cleanup_values(void)
+void mthread_cleanup_values(void)
{
/* Clean up all the values associated with an exiting thread, calling keys'
* destruction procedures as appropriate.
* mthread_debug_f *
*===========================================================================*/
#ifdef MDEBUG
-PUBLIC void mthread_debug_f(const char *file, int line, const char *msg)
+void mthread_debug_f(const char *file, int line, const char *msg)
{
/* Print debug message */
printf("MTH (%s:%d): %s\n", file, line, msg);
* mthread_panic_f *
*===========================================================================*/
#ifdef MDEBUG
-PUBLIC void mthread_panic_f(const char *file, int line, const char *msg)
+void mthread_panic_f(const char *file, int line, const char *msg)
{
/* Print panic message to stdout and exit */
volatile int *sf;
exit(1);
}
#else
-PUBLIC void mthread_panic_s(void)
+void mthread_panic_s(void)
{
/* Silent panic */
volatile int *sf;
* mthread_verify_f *
*===========================================================================*/
#ifdef MDEBUG
-PUBLIC void mthread_verify_f(char *file, int line)
+void mthread_verify_f(char *file, int line)
{
/* Verify library state. It is assumed this function is never called from
* a spawned thread, but from the 'main' thread. The library should be
/*===========================================================================*
* mthread_stats *
*===========================================================================*/
-PUBLIC void mthread_stats(void)
+void mthread_stats(void)
{
mthread_thread_t t;
mthread_tcb_t *tcb;
#include "proto.h"
#ifdef MTHREAD_STRICT
-PRIVATE struct __mthread_mutex *vm_front, *vm_rear;
-FORWARD void mthread_mutex_add(mthread_mutex_t *m);
-FORWARD void mthread_mutex_remove(mthread_mutex_t *m);
+static struct __mthread_mutex *vm_front, *vm_rear;
+static void mthread_mutex_add(mthread_mutex_t *m);
+static void mthread_mutex_remove(mthread_mutex_t *m);
#else
# define mthread_mutex_add(m) ((*m)->mm_magic = MTHREAD_INIT_MAGIC)
# define mthread_mutex_remove(m) ((*m)->mm_magic = MTHREAD_NOT_INUSE)
/*===========================================================================*
* mthread_init_valid_mutexes *
*===========================================================================*/
-PUBLIC void mthread_init_valid_mutexes(void)
+void mthread_init_valid_mutexes(void)
{
#ifdef MTHREAD_STRICT
/* Initialize list of valid mutexes */
* mthread_mutex_add *
*===========================================================================*/
#ifdef MTHREAD_STRICT
-PRIVATE void mthread_mutex_add(m)
+static void mthread_mutex_add(m)
mthread_mutex_t *m;
{
/* Add mutex to list of valid, initialized mutexes */
/*===========================================================================*
* mthread_mutex_destroy *
*===========================================================================*/
-PUBLIC int mthread_mutex_destroy(mutex)
+int mthread_mutex_destroy(mutex)
mthread_mutex_t *mutex;
{
/* Invalidate mutex and deallocate resources. */
/*===========================================================================*
* mthread_mutex_init *
*===========================================================================*/
-PUBLIC int mthread_mutex_init(mutex, mattr)
+int mthread_mutex_init(mutex, mattr)
mthread_mutex_t *mutex; /* Mutex that is to be initialized */
mthread_mutexattr_t *mattr; /* Mutex attribute */
{
/*===========================================================================*
* mthread_mutex_lock *
*===========================================================================*/
-PUBLIC int mthread_mutex_lock(mutex)
+int mthread_mutex_lock(mutex)
mthread_mutex_t *mutex; /* Mutex that is to be locked */
{
/* Try to lock this mutex. If already locked, append the current thread to
* mthread_mutex_remove *
*===========================================================================*/
#ifdef MTHREAD_STRICT
-PRIVATE void mthread_mutex_remove(m)
+static void mthread_mutex_remove(m)
mthread_mutex_t *m;
{
/* Remove mutex from list of valid, initialized mutexes */
/*===========================================================================*
* mthread_mutex_trylock *
*===========================================================================*/
-PUBLIC int mthread_mutex_trylock(mutex)
+int mthread_mutex_trylock(mutex)
mthread_mutex_t *mutex; /* Mutex that is to be locked */
{
/* Try to lock this mutex and return OK. If already locked, return error. */
/*===========================================================================*
* mthread_mutex_unlock *
*===========================================================================*/
-PUBLIC int mthread_mutex_unlock(mutex)
+int mthread_mutex_unlock(mutex)
mthread_mutex_t *mutex; /* Mutex that is to be unlocked */
{
/* Unlock a previously locked mutex. If there is a pending lock for this mutex
* mthread_mutex_valid *
*===========================================================================*/
#ifdef MTHREAD_STRICT
-PUBLIC int mthread_mutex_valid(m)
+int mthread_mutex_valid(m)
mthread_mutex_t *m;
{
/* Check to see if mutex is on the list of valid mutexes */
* mthread_mutex_verify *
*===========================================================================*/
#ifdef MDEBUG
-PUBLIC int mthread_mutex_verify(void)
+int mthread_mutex_verify(void)
{
/* Return true when no mutexes are in use */
int r = 1;
/*===========================================================================*
* mthread_queue_add *
*===========================================================================*/
-PUBLIC void mthread_queue_add(queue, thread)
+void mthread_queue_add(queue, thread)
mthread_queue_t *queue; /* Queue we want thread to append to */
mthread_thread_t thread;
{
/*===========================================================================*
* mthread_queue_init *
*===========================================================================*/
-PUBLIC void mthread_queue_init(queue)
+void mthread_queue_init(queue)
mthread_queue_t *queue; /* Queue that has to be initialized */
{
/* Initialize queue to a known state */
/*===========================================================================*
* mthread_queue_isempty *
*===========================================================================*/
-PUBLIC int mthread_queue_isempty(queue)
+int mthread_queue_isempty(queue)
mthread_queue_t *queue;
{
return(queue->mq_head == NULL);
* mthread_dump_queue *
*===========================================================================*/
#ifdef MDEBUG
-PUBLIC void mthread_dump_queue(queue)
+void mthread_dump_queue(queue)
mthread_queue_t *queue;
{
int threshold, count = 0;
/*===========================================================================*
* mthread_queue_remove *
*===========================================================================*/
-PUBLIC mthread_thread_t mthread_queue_remove(queue)
+mthread_thread_t mthread_queue_remove(queue)
mthread_queue_t *queue; /* Queue we want a thread from */
{
/* Get the first thread in this queue, if there is one. */
/*===========================================================================*
* mthread_rwlock_init *
*===========================================================================*/
-PUBLIC int mthread_rwlock_init(rwlock)
+int mthread_rwlock_init(rwlock)
mthread_rwlock_t *rwlock; /* The rwlock to be initialized */
{
/* Initialize a readers/writer lock. */
/*===========================================================================*
* mthread_rwlock_destroy *
*===========================================================================*/
-PUBLIC int mthread_rwlock_destroy(rwlock)
+int mthread_rwlock_destroy(rwlock)
mthread_rwlock_t *rwlock; /* The rwlock to be destroyed */
{
/* Destroy a readers/writer lock. */
/*===========================================================================*
* mthread_rwlock_rdlock *
*===========================================================================*/
-PUBLIC int mthread_rwlock_rdlock(rwlock)
+int mthread_rwlock_rdlock(rwlock)
mthread_rwlock_t *rwlock; /* The rwlock to be read locked */
{
/* Acquire a reader lock. */
/*===========================================================================*
* mthread_rwlock_wrlock *
*===========================================================================*/
-PUBLIC int mthread_rwlock_wrlock(rwlock)
+int mthread_rwlock_wrlock(rwlock)
mthread_rwlock_t *rwlock; /* The rwlock to be write locked */
{
/* Acquire a writer lock. */
/*===========================================================================*
* mthread_rwlock_unlock *
*===========================================================================*/
-PUBLIC int mthread_rwlock_unlock(rwlock)
+int mthread_rwlock_unlock(rwlock)
mthread_rwlock_t *rwlock; /* The rwlock to be unlocked */
{
/* Release a lock. */
#define OLD_CTX &(threads[old_thread]->m_context)
#define CURRENT_CTX &(threads[current_thread]->m_context)
#define CURRENT_STATE threads[current_thread]->m_state
-PRIVATE int yield_all;
+static int yield_all;
/*===========================================================================*
* mthread_getcontext *
*===========================================================================*/
-PUBLIC int mthread_getcontext(ctx)
+int mthread_getcontext(ctx)
ucontext_t *ctx;
{
/* Retrieve this process' current state.*/
/*===========================================================================*
* mthread_schedule *
*===========================================================================*/
-PUBLIC void mthread_schedule(void)
+void mthread_schedule(void)
{
/* Pick a new thread to run and run it. In practice, this involves taking the
* first thread off the (FIFO) run queue and resuming that thread.
/*===========================================================================*
* mthread_init_scheduler *
*===========================================================================*/
-PUBLIC void mthread_init_scheduler(void)
+void mthread_init_scheduler(void)
{
/* Initialize the scheduler */
mthread_queue_init(&run_queue);
/*===========================================================================*
* mthread_suspend *
*===========================================================================*/
-PUBLIC void mthread_suspend(state)
+void mthread_suspend(state)
mthread_state_t state;
{
/* Stop the current thread from running. There can be multiple reasons for
/*===========================================================================*
* mthread_unsuspend *
*===========================================================================*/
-PUBLIC void mthread_unsuspend(thread)
+void mthread_unsuspend(thread)
mthread_thread_t thread; /* Thread to make runnable */
{
/* Mark the state of a thread runnable and add it to the run queue */
/*===========================================================================*
* mthread_yield *
*===========================================================================*/
-PUBLIC int mthread_yield(void)
+int mthread_yield(void)
{
/* Defer further execution of the current thread and let another thread run. */
mthread_tcb_t *tcb;
/*===========================================================================*
* mthread_yield_all *
*===========================================================================*/
-PUBLIC void mthread_yield_all(void)
+void mthread_yield_all(void)
{
/* Yield until there are no more runnable threads left. Two threads calling
* this function will lead to a deadlock.
#include <minix/netdriver.h>
#include <minix/ds.h>
-PRIVATE int conf_expected = TRUE;
+static int conf_expected = TRUE;
/*===========================================================================*
* netdriver_announce *
*===========================================================================*/
-PUBLIC void netdriver_announce()
+void netdriver_announce()
{
/* Announce we are up after a fresh start or restart. */
int r;
/*===========================================================================*
* netdriver_receive *
*===========================================================================*/
-PUBLIC int netdriver_receive(src, m_ptr, status_ptr)
+int netdriver_receive(src, m_ptr, status_ptr)
endpoint_t src;
message *m_ptr;
int *status_ptr;
/*===========================================================================*
* fs_putnode *
*===========================================================================*/
-PUBLIC int fs_putnode(void)
+int fs_putnode(void)
{
/* Find the pnode specified by the request message and decrease its counter.
* Release unused pnode.
/*===========================================================================*
* fs_ftrunc *
*===========================================================================*/
-PUBLIC int fs_ftrunc(void)
+int fs_ftrunc(void)
{
int r;
struct puffs_node *pn;
/*===========================================================================*
* fs_link *
*===========================================================================*/
-PUBLIC int fs_link()
+int fs_link()
{
/* Perform the link(name1, name2) system call. */
/*===========================================================================*
* fs_rdlink *
*===========================================================================*/
-PUBLIC int fs_rdlink()
+int fs_rdlink()
{
register int r; /* return value */
size_t copylen;
/*===========================================================================*
* fs_rename *
*===========================================================================*/
-PUBLIC int fs_rename()
+int fs_rename()
{
/* Perform the rename(name1, name2) system call. */
struct puffs_node *old_dirp, *old_ip; /* ptrs to old dir, file pnodes */
return(r);
}
-FORWARD int remove_dir(struct puffs_node *pn_dir, struct puffs_node *pn,
+static int remove_dir(struct puffs_node *pn_dir, struct puffs_node *pn,
struct puffs_cn *pcn);
-FORWARD int unlink_file(struct puffs_node *dirp, struct puffs_node *pn,
+static int unlink_file(struct puffs_node *dirp, struct puffs_node *pn,
struct puffs_cn *pcn);
/*===========================================================================*
* fs_unlink *
*===========================================================================*/
-PUBLIC int fs_unlink()
+int fs_unlink()
{
/* Perform the unlink(name) or rmdir(name) system call. The code for these two
* is almost the same. They differ only in some condition testing. Unlink()
/*===========================================================================*
* remove_dir *
*===========================================================================*/
-PRIVATE int remove_dir(pn_dir, pn, pcn)
+static int remove_dir(pn_dir, pn, pcn)
struct puffs_node *pn_dir; /* parent directory */
struct puffs_node *pn; /* directory to be removed */
struct puffs_cn *pcn; /* Name, creads of directory */
/*===========================================================================*
* unlink_file *
*===========================================================================*/
-PRIVATE int unlink_file(dirp, pn, pcn)
+static int unlink_file(dirp, pn, pcn)
struct puffs_node *dirp; /* parent directory of file */
struct puffs_node *pn; /* pnode of file, may be NULL too. */
struct puffs_cn *pcn; /* Name, creads of file */
/*===========================================================================*
* fs_sync *
*===========================================================================*/
-PUBLIC int fs_sync()
+int fs_sync()
{
/* Perform the sync() system call. Flush all the tables.
* The order in which the various tables are flushed is critical.
/*===========================================================================*
* fs_flush *
*===========================================================================*/
-PUBLIC int fs_flush()
+int fs_flush()
{
/* Flush the blocks of a device from the cache after writing any dirty blocks
* to disk.
/*===========================================================================*
* fs_new_driver *
*===========================================================================*/
-PUBLIC int fs_new_driver(void)
+int fs_new_driver(void)
{
/* Do not do anything. */
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
-PUBLIC int fs_readsuper()
+int fs_readsuper()
{
struct vattr *root_va;
/*===========================================================================*
* fs_mountpoint *
*===========================================================================*/
-PUBLIC int fs_mountpoint()
+int fs_mountpoint()
{
/* This function looks up the mount point, it checks the condition whether
* the partition can be mounted on the pnode or not.
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
-PUBLIC int fs_unmount()
+int fs_unmount()
{
int error;
/*===========================================================================*
* fs_create *
*===========================================================================*/
-PUBLIC int fs_create()
+int fs_create()
{
int r;
struct puffs_node *pn_dir;
/*===========================================================================*
* fs_mknod *
*===========================================================================*/
-PUBLIC int fs_mknod()
+int fs_mknod()
{
int r;
struct puffs_node *pn_dir;
/*===========================================================================*
* fs_mkdir *
*===========================================================================*/
-PUBLIC int fs_mkdir()
+int fs_mkdir()
{
int r;
struct puffs_node *pn_dir;
/*===========================================================================*
* fs_slink *
*===========================================================================*/
-PUBLIC int fs_slink()
+int fs_slink()
{
int r;
struct pnode *pn; /* pnode containing symbolic link */
/*===========================================================================*
* fs_inhibread *
*===========================================================================*/
-PUBLIC int fs_inhibread()
+int fs_inhibread()
{
return(OK);
}
#include "puffs.h"
#include "puffs_priv.h"
-PUBLIC char dot2[3] = ".."; /* permissions for . and .. */
+char dot2[3] = ".."; /* permissions for . and .. */
-FORWARD char *get_name(char *name, char string[NAME_MAX+1]);
-FORWARD int ltraverse(struct puffs_node *pn, char *suffix);
-FORWARD int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
+static char *get_name(char *name, char string[NAME_MAX+1]);
+static int ltraverse(struct puffs_node *pn, char *suffix);
+static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
puffs_node **res_inop, size_t *offsetp, int *symlinkp);
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
-PUBLIC int fs_lookup()
+int fs_lookup()
{
cp_grant_id_t grant;
int r, r1, flags, symlinks;
/*===========================================================================*
* parse_path *
*===========================================================================*/
-PRIVATE int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
+static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
ino_t dir_ino;
ino_t root_ino;
int flags;
/*===========================================================================*
* ltraverse *
*===========================================================================*/
-PRIVATE int ltraverse(pn, suffix)
+static int ltraverse(pn, suffix)
register struct puffs_node *pn;/* symbolic link */
char *suffix; /* current remaining path. Has to point in the
* user_path buffer
/*===========================================================================*
* advance *
*===========================================================================*/
-PUBLIC struct puffs_node *advance(pn_dir, string, chk_perm)
+struct puffs_node *advance(pn_dir, string, chk_perm)
struct puffs_node *pn_dir; /* pnode for directory to be searched */
char string[NAME_MAX + 1]; /* component name to look for */
int chk_perm; /* check permissions when string is looked up*/
/*===========================================================================*
* get_name *
*===========================================================================*/
-PRIVATE char *get_name(path_name, string)
+static char *get_name(path_name, string)
char *path_name; /* path name to parse */
char string[NAME_MAX+1]; /* component extracted from 'old_name' */
{
#include "puffs.h"
#include "puffs_priv.h"
-FORWARD int in_group(gid_t grp);
+static int in_group(gid_t grp);
/*===========================================================================*
* fs_chmod *
*===========================================================================*/
-PUBLIC int fs_chmod()
+int fs_chmod()
{
/* Perform the chmod(name, mode) system call. */
struct puffs_node *pn;
/*===========================================================================*
* fs_chown *
*===========================================================================*/
-PUBLIC int fs_chown()
+int fs_chown()
{
struct puffs_node *pn;
struct vattr va;
/*===========================================================================*
* forbidden *
*===========================================================================*/
-PUBLIC int forbidden(register struct puffs_node *pn, mode_t access_desired)
+int forbidden(register struct puffs_node *pn, mode_t access_desired)
{
/* Given a pointer to an pnode, 'pn', and the access desired, determine
* if the access is allowed, and if not why not. The routine looks up the
/*===========================================================================*
* in_group *
*===========================================================================*/
-PRIVATE int in_group(gid_t grp)
+static int in_group(gid_t grp)
{
int i;
for(i = 0; i < credentials.vu_ngroups; i++)
/* Declare some local functions. */
-FORWARD void get_work(message *m_in);
-FORWARD void reply(endpoint_t who, message *m_out);
+static void get_work(message *m_in);
+static void reply(endpoint_t who, message *m_out);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
EXTERN int env_argc;
EXTERN char **env_argv;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the Minix file server. */
SELF_E = getprocnr();
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(m_in)
+static void get_work(m_in)
message *m_in; /* pointer to message */
{
int r, srcok = 0;
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(
+static void reply(
endpoint_t who,
message *m_out /* report result */
)
#define GETDENTS_BUFSIZ 4096
-PRIVATE char getdents_buf[GETDENTS_BUFSIZ];
+static char getdents_buf[GETDENTS_BUFSIZ];
#define RW_BUFSIZ (128 << 10)
-PRIVATE char rw_buf[RW_BUFSIZ];
+static char rw_buf[RW_BUFSIZ];
/*===========================================================================*
* fs_readwrite *
*===========================================================================*/
-PUBLIC int fs_readwrite(void)
+int fs_readwrite(void)
{
int r = OK, rw_flag;
cp_grant_id_t gid;
/*===========================================================================*
* fs_breadwrite *
*===========================================================================*/
-PUBLIC int fs_breadwrite(void)
+int fs_breadwrite(void)
{
/* We do not support breads/writes */
panic("bread write requested, but FS doesn't support it!\n");
/*===========================================================================*
* fs_getdents *
*===========================================================================*/
-PUBLIC int fs_getdents(void)
+int fs_getdents(void)
{
int r;
register struct puffs_node *pn;
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
-PUBLIC int fs_fstatfs()
+int fs_fstatfs()
{
int r;
struct statvfs st_vfs;
/*===========================================================================*
* fs_stat *
*===========================================================================*/
-PUBLIC int fs_stat()
+int fs_stat()
{
register int r; /* return value */
register struct puffs_node *pn; /* target pnode */
/*===========================================================================*
* fs_statvfs *
*===========================================================================*/
-PUBLIC int fs_statvfs()
+int fs_statvfs()
{
int r;
struct statvfs st;
#include "fs.h"
-PUBLIC int (*fs_call_vec[])(void) = {
+int (*fs_call_vec[])(void) = {
no_sys, /* 0 not used */
no_sys, /* 1 */ /* Was: fs_getnode */
fs_putnode, /* 2 */
/*===========================================================================*
* fs_utime *
*===========================================================================*/
-PUBLIC int fs_utime()
+int fs_utime()
{
struct puffs_node *pn;
struct vattr va;
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys()
+int no_sys()
{
/* Somebody has used an illegal system call number */
lpuffs_debug("no_sys: invalid call %d\n", req_nr);
/*===========================================================================*
* mfs_nul *
*===========================================================================*/
-PUBLIC void mfs_nul_f(const char *file, int line, char *str, unsigned int len,
+void mfs_nul_f(const char *file, int line, char *str, unsigned int len,
unsigned int maxlen)
{
if (len < maxlen && str[len-1] != '\0') {
/*===========================================================================*
* clock_time *
*===========================================================================*/
-PUBLIC time_t clock_time()
+time_t clock_time()
{
/* This routine returns the time in seconds since 1.1.1970. MINIX is an
* astrophysically naive system that assumes the earth rotates at a constant
/*===========================================================================*
* update_times *
*===========================================================================*/
-PUBLIC int update_times(struct puffs_node *pn, int flags, time_t t)
+int update_times(struct puffs_node *pn, int flags, time_t t)
{
int r;
struct vattr va;
/*===========================================================================*
* lpuffs_debug *
*===========================================================================*/
-PUBLIC void lpuffs_debug(const char *format, ...)
+void lpuffs_debug(const char *format, ...)
{
char buffer[256];
va_list args;
#include <errno.h>
#define ASYN_NR (2*_NR_PROCS)
-PRIVATE asynmsg_t msgtable[ASYN_NR];
-PRIVATE int first_slot = 0, next_slot = 0;
-PRIVATE int initialized = 0;
+static asynmsg_t msgtable[ASYN_NR];
+static int first_slot = 0, next_slot = 0;
+static int initialized = 0;
/*===========================================================================*
* asynsend3 *
*===========================================================================*/
-PUBLIC int asynsend3(dst, mp, fl)
+int asynsend3(dst, mp, fl)
endpoint_t dst;
message *mp;
int fl;
/*===========================================================================*
* asyn_geterror *
*===========================================================================*/
-PUBLIC int asyn_geterror(endpoint_t *dst, message *msg, int *err)
+int asyn_geterror(endpoint_t *dst, message *msg, int *err)
{
int src_ind, flags, result;
static message m;
-PRIVATE int do_invoke_ds(int type, const char *ds_name)
+static int do_invoke_ds(int type, const char *ds_name)
{
cp_grant_id_t g_key;
size_t len_key;
#include "sysutil.h"
#include <string.h>
-PUBLIC int env_argc = 0;
-PUBLIC char **env_argv = NULL;
+int env_argc = 0;
+char **env_argv = NULL;
-FORWARD char *find_key(const char *params, const char *key);
+static char *find_key(const char *params, const char *key);
/*===========================================================================*
* env_setargs *
*===========================================================================*/
-PUBLIC void env_setargs(arg_c, arg_v)
+void env_setargs(arg_c, arg_v)
int arg_c;
char *arg_v[];
{
/*===========================================================================*
* env_get_param *
*===========================================================================*/
-PUBLIC int env_get_param(key, value, max_len)
+int env_get_param(key, value, max_len)
char *key; /* which key to look up */
char *value; /* where to store value */
int max_len; /* maximum length of value */
/*==========================================================================*
* find_key *
*==========================================================================*/
-PRIVATE char *find_key(params,name)
+static char *find_key(params,name)
const char *params;
const char *name;
{
/*=========================================================================*
* env_panic *
*=========================================================================*/
-PUBLIC void env_panic(key)
+void env_panic(key)
char *key; /* environment variable whose value is bogus */
{
static char value[EP_BUF_SIZE] = "<unknown>";
/*=========================================================================*
* env_parse *
*=========================================================================*/
-PUBLIC int env_parse(env, fmt, field, param, min, max)
+int env_parse(env, fmt, field, param, min, max)
char *env; /* environment variable to inspect */
char *fmt; /* template to parse it with */
int field; /* field number of value to return */
* env_memory_parse *
*=========================================================================*/
-PUBLIC int env_memory_parse(mem_chunks, maxchunks)
+int env_memory_parse(mem_chunks, maxchunks)
struct memory *mem_chunks; /* where to store the memory bits */
int maxchunks; /* how many were found */
{
/*=========================================================================*
* env_prefix *
*=========================================================================*/
-PUBLIC int env_prefix(env, prefix)
+int env_prefix(env, prefix)
char *env; /* environment variable to inspect */
char *prefix; /* prefix to test for */
{
/*===========================================================================*
* fkey_ctl *
*===========================================================================*/
-PUBLIC int fkey_ctl(request, fkeys, sfkeys)
+int fkey_ctl(request, fkeys, sfkeys)
int request; /* request to perform */
int *fkeys; /* bit masks for F1-F12 keys */
int *sfkeys; /* bit masks for Shift F1-F12 keys */
/*===========================================================================*
* get_randomness *
*===========================================================================*/
-PUBLIC void get_randomness(rand, source)
+void get_randomness(rand, source)
struct k_randomness *rand;
int source;
{
#include <minix/sysinfo.h>
#include <minix/com.h>
-PUBLIC int getsysinfo(
+int getsysinfo(
endpoint_t who, /* from whom to request info */
int what, /* what information is requested */
void *where, /* where to put it */
/*===========================================================================*
* getuptime *
*===========================================================================*/
-PUBLIC int getuptime(ticks)
+int getuptime(ticks)
clock_t *ticks; /* uptime in ticks */
{
message m;
/*===========================================================================*
* getuptime2 *
*===========================================================================*/
-PUBLIC int getuptime2(ticks, boottime)
+int getuptime2(ticks, boottime)
clock_t *ticks; /* uptime in ticks */
time_t *boottime;
{
/*****************************************************************************
* tty_inject_event *
*****************************************************************************/
-PUBLIC int tty_inject_event(type, code, val)
+int tty_inject_event(type, code, val)
int type;
int code;
int val;
#include <lib.h>
#include <minix/syslib.h>
-PUBLIC int _kernel_call(int syscallnr, message *msgptr)
+int _kernel_call(int syscallnr, message *msgptr)
{
msgptr->m_type = syscallnr;
_do_kernel_call(msgptr);
#include <minix/const.h>
#include <minix/optset.h>
-FORWARD void optset_parse_entry(struct optset *entry, char *ptr, int
+static void optset_parse_entry(struct optset *entry, char *ptr, int
len);
/*===========================================================================*
* optset_parse_entry *
*===========================================================================*/
-PRIVATE void optset_parse_entry(entry, ptr, len)
+static void optset_parse_entry(entry, ptr, len)
struct optset *entry;
char *ptr;
int len;
/*===========================================================================*
* optset_parse *
*===========================================================================*/
-PUBLIC void optset_parse(table, string)
+void optset_parse(table, string)
struct optset *table;
char *string;
{
/*===========================================================================*
* panic *
*===========================================================================*/
-PUBLIC void panic(const char *fmt, ...)
+void panic(const char *fmt, ...)
{
/* Something awful has happened. Panics are caused when an internal
* inconsistency is detected, e.g., a programming error or illegal
/*===========================================================================*
* pci_attr_r16 *
*===========================================================================*/
-PUBLIC u16_t pci_attr_r16(devind, port)
+u16_t pci_attr_r16(devind, port)
int devind;
int port;
{
/*===========================================================================*
* pci_attr_r32 *
*===========================================================================*/
-PUBLIC u32_t pci_attr_r32(devind, port)
+u32_t pci_attr_r32(devind, port)
int devind;
int port;
{
/*===========================================================================*
* pci_attr_r8 *
*===========================================================================*/
-PUBLIC u8_t pci_attr_r8(devind, port)
+u8_t pci_attr_r8(devind, port)
int devind;
int port;
{
/*===========================================================================*
* pci_attr_w16 *
*===========================================================================*/
-PUBLIC void pci_attr_w16(int devind, int port, u16_t value)
+void pci_attr_w16(int devind, int port, u16_t value)
{
int r;
message m;
/*===========================================================================*
* pci_attr_w32 *
*===========================================================================*/
-PUBLIC void pci_attr_w32(int devind, int port, u32_t value)
+void pci_attr_w32(int devind, int port, u32_t value)
{
int r;
message m;
/*===========================================================================*
* pci_attr_w8 *
*===========================================================================*/
-PUBLIC void pci_attr_w8(int devind, int port, u8_t value)
+void pci_attr_w8(int devind, int port, u8_t value)
{
int r;
message m;
/*===========================================================================*
* pci_del_acl *
*===========================================================================*/
-PUBLIC int pci_del_acl(proc_ep)
+int pci_del_acl(proc_ep)
endpoint_t proc_ep;
{
int r;
/*===========================================================================*
* pci_dev_name *
*===========================================================================*/
-PUBLIC char *pci_dev_name(u16_t vid, u16_t did)
+char *pci_dev_name(u16_t vid, u16_t did)
{
static char name[80]; /* We need a better interface for this */
/*===========================================================================*
* pci_find_dev *
*===========================================================================*/
-PUBLIC int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp)
+int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp)
{
int r;
message m;
/*===========================================================================*
* pci_first_dev *
*===========================================================================*/
-PUBLIC int pci_first_dev(devindp, vidp, didp)
+int pci_first_dev(devindp, vidp, didp)
int *devindp;
u16_t *vidp;
u16_t *didp;
/*===========================================================================*
* pci_get_bar *
*===========================================================================*/
-PUBLIC int pci_get_bar(devind, port, base, size, ioflag)
+int pci_get_bar(devind, port, base, size, ioflag)
int devind;
int port;
u32_t *base;
/*===========================================================================*
* pci_ids *
*===========================================================================*/
-PUBLIC void pci_ids(devind, vidp, didp)
+void pci_ids(devind, vidp, didp)
int devind;
u16_t *vidp;
u16_t *didp;
/*===========================================================================*
* pci_init *
*===========================================================================*/
-PUBLIC void pci_init(void)
+void pci_init(void)
{
int r;
message m;
/*===========================================================================*
* pci_next_dev *
*===========================================================================*/
-PUBLIC int pci_next_dev(devindp, vidp, didp)
+int pci_next_dev(devindp, vidp, didp)
int *devindp;
u16_t *vidp;
u16_t *didp;
/*===========================================================================*
* pci_rescan_bus *
*===========================================================================*/
-PUBLIC void pci_rescan_bus(u8_t busnr)
+void pci_rescan_bus(u8_t busnr)
{
int r;
message m;
/*===========================================================================*
* pci_reserve *
*===========================================================================*/
-PUBLIC void pci_reserve(devind)
+void pci_reserve(devind)
int devind;
{
int r;
/*===========================================================================*
* pci_reserve_ok *
*===========================================================================*/
-PUBLIC int pci_reserve_ok(int devind)
+int pci_reserve_ok(int devind)
{
message m;
/*===========================================================================*
* pci_set_acl *
*===========================================================================*/
-PUBLIC int pci_set_acl(rs_pci)
+int pci_set_acl(rs_pci)
struct rs_pci *rs_pci;
{
int r;
/*===========================================================================*
* pci_slot_name *
*===========================================================================*/
-PUBLIC char *pci_slot_name(devind)
+char *pci_slot_name(devind)
int devind;
{
static char name[80]; /* We need a better interface for this */
#include <minix/u64.h>
#include <minix/minlib.h>
-PRIVATE char cpath[CPROF_CPATH_MAX_LEN]; /* current call path string */
-PRIVATE int cpath_len; /* current call path len */
-PRIVATE struct cprof_tbl_s *cprof_slot; /* slot of current function */
+static char cpath[CPROF_CPATH_MAX_LEN]; /* current call path string */
+static int cpath_len; /* current call path len */
+static struct cprof_tbl_s *cprof_slot; /* slot of current function */
struct stack_s { /* stack entry */
int cpath_len; /* call path len */
struct cprof_tbl_s *slot; /* table slot */
u64_t start_2; /* count @ end of procentry */
u64_t spent_deeper; /* spent in called functions */
};
-PRIVATE struct stack_s cprof_stk[CPROF_STACK_SIZE]; /* stack */
-PRIVATE int cprof_stk_top; /* top of stack */
+static struct stack_s cprof_stk[CPROF_STACK_SIZE]; /* stack */
+static int cprof_stk_top; /* top of stack */
EXTERN struct cprof_tbl_s cprof_tbl[]; /* hash table */
-PRIVATE int cprof_tbl_size; /* nr of slots */
-PRIVATE struct cprof_tbl_s *idx[CPROF_INDEX_SIZE]; /* index to table */
-PRIVATE struct cprof_ctl_s control; /* for comms with kernel */
-PRIVATE int cprof_announce; /* announce on n-th execution
+static int cprof_tbl_size; /* nr of slots */
+static struct cprof_tbl_s *idx[CPROF_INDEX_SIZE]; /* index to table */
+static struct cprof_ctl_s control; /* for comms with kernel */
+static int cprof_announce; /* announce on n-th execution
* of procentry */
-PRIVATE int cprof_locked; /* for reentrancy */
+static int cprof_locked; /* for reentrancy */
-FORWARD void cprof_init(void);
-FORWARD void reset(void);
-FORWARD void clear_tbl(void);
+static void cprof_init(void);
+static void reset(void);
+static void clear_tbl(void);
-PUBLIC void procentry (char *name)
+void procentry (char *name)
{
static int init = 0;
unsigned hash = 0, x = 0;
}
-PUBLIC void procexit (char *UNUSED(name))
+void procexit (char *UNUSED(name))
{
u64_t stop, spent;
u32_t tsc_lo, tsc_hi;
}
-PRIVATE void cprof_init()
+static void cprof_init()
{
int i;
}
-PRIVATE void reset()
+static void reset()
{
clear_tbl();
control.reset = 0;
}
-PRIVATE void clear_tbl()
+static void clear_tbl()
{
int i;
struct cprof_tbl_s cprof_tbl[CPROF_TABLE_SIZE_OTHER];
/* Function that returns table size. */
-PUBLIC int profile_get_tbl_size(void)
+int profile_get_tbl_size(void)
{
return CPROF_TABLE_SIZE_OTHER;
}
/* Function that returns on which execution of procentry to announce. */
-PUBLIC int profile_get_announce(void)
+int profile_get_announce(void)
{
return CPROF_ANNOUNCE_OTHER;
}
* Userspace processes announce their control struct and table locations
* to the kernel through this function.
*/
-PUBLIC void profile_register(ctl_ptr, tbl_ptr)
+void profile_register(ctl_ptr, tbl_ptr)
void *ctl_ptr;
void *tbl_ptr;
{
}
#define NR_STATIC_GRANTS 2
-PRIVATE cp_grant_t static_grants[NR_STATIC_GRANTS];
-PRIVATE cp_grant_t *grants = NULL;
-PRIVATE int ngrants = 0;
+static cp_grant_t static_grants[NR_STATIC_GRANTS];
+static cp_grant_t *grants = NULL;
+static int ngrants = 0;
-PRIVATE void
+static void
cpf_grow(void)
{
/* Grow the grants table if possible. */
ngrants = new_size;
}
-PRIVATE cp_grant_id_t
+static cp_grant_id_t
cpf_new_grantslot(void)
{
/* Find a new, free grant slot in the grant table, grow it if
return g;
}
-PUBLIC cp_grant_id_t
+cp_grant_id_t
cpf_grant_direct(endpoint_t who_to, vir_bytes addr, size_t bytes, int access)
{
cp_grant_id_t g;
return g;
}
-PUBLIC cp_grant_id_t
+cp_grant_id_t
cpf_grant_indirect(endpoint_t who_to, endpoint_t who_from, cp_grant_id_t gr)
{
/* Grant process A access into process B. B has granted us access as grant
return g;
}
-PUBLIC cp_grant_id_t
+cp_grant_id_t
cpf_grant_magic(endpoint_t who_to, endpoint_t who_from,
vir_bytes addr, size_t bytes, int access)
{
return g;
}
-PUBLIC int
+int
cpf_revoke(cp_grant_id_t g)
{
/* Revoke previously granted access, identified by grant id. */
return 0;
}
-PUBLIC int
+int
cpf_lookup(cp_grant_id_t g, endpoint_t *granter, endpoint_t *grantee)
{
/* First check slot validity, and if it's in use currently. */
return 0;
}
-PUBLIC int
+int
cpf_getgrants(cp_grant_id_t *grant_ids, int n)
{
int i;
return i;
}
-PUBLIC int
+int
cpf_setgrant_direct(gid, who, addr, bytes, access)
cp_grant_id_t gid;
endpoint_t who;
return 0;
}
-PUBLIC int
+int
cpf_setgrant_indirect(gid, who_to, who_from, his_gid)
cp_grant_id_t gid;
endpoint_t who_to, who_from;
return 0;
}
-PUBLIC int
+int
cpf_setgrant_magic(gid, who_to, who_from, addr, bytes, access)
cp_grant_id_t gid;
endpoint_t who_to, who_from;
return 0;
}
-PUBLIC int
+int
cpf_setgrant_disable(gid)
cp_grant_id_t gid;
{
return 0;
}
-PUBLIC void
+void
cpf_reload(void)
{
/* Inform the kernel about the location of the grant table. This is needed
/*===========================================================================*
* sched_inherit *
*===========================================================================*/
-PUBLIC int sched_inherit(endpoint_t scheduler_e,
+int sched_inherit(endpoint_t scheduler_e,
endpoint_t schedulee_e, endpoint_t parent_e, unsigned maxprio,
endpoint_t *newscheduler_e)
{
/*===========================================================================*
* sched_start *
*===========================================================================*/
-PUBLIC int sched_start(endpoint_t scheduler_e,
+int sched_start(endpoint_t scheduler_e,
endpoint_t schedulee_e,
endpoint_t parent_e,
int maxprio,
/*===========================================================================*
* sched_stop *
*===========================================================================*/
-PUBLIC int sched_stop(endpoint_t scheduler_e, endpoint_t schedulee_e)
+int sched_stop(endpoint_t scheduler_e, endpoint_t schedulee_e)
{
int rv;
message m;
/* Self variables. */
#define SEF_SELF_NAME_MAXLEN 20
-PUBLIC char sef_self_name[SEF_SELF_NAME_MAXLEN];
-PUBLIC endpoint_t sef_self_endpoint;
-PUBLIC int sef_self_priv_flags;
-PUBLIC int sef_self_first_receive_done;
+char sef_self_name[SEF_SELF_NAME_MAXLEN];
+endpoint_t sef_self_endpoint;
+int sef_self_priv_flags;
+int sef_self_first_receive_done;
/* Debug. */
#if SEF_INIT_DEBUG || SEF_LU_DEBUG || SEF_PING_DEBUG || SEF_SIGNAL_DEBUG
#define SEF_DEBUG_HEADER_MAXLEN 32
-PRIVATE time_t sef_debug_boottime = 0;
-PRIVATE u32_t sef_debug_system_hz = 0;
-PRIVATE time_t sef_debug_time_sec = 0;
-PRIVATE time_t sef_debug_time_us = 0;
-PRIVATE char sef_debug_header_buff[SEF_DEBUG_HEADER_MAXLEN];
-FORWARD void sef_debug_refresh_params(void);
-PUBLIC char* sef_debug_header(void);
+static time_t sef_debug_boottime = 0;
+static u32_t sef_debug_system_hz = 0;
+static time_t sef_debug_time_sec = 0;
+static time_t sef_debug_time_us = 0;
+static char sef_debug_header_buff[SEF_DEBUG_HEADER_MAXLEN];
+static void sef_debug_refresh_params(void);
+char* sef_debug_header(void);
#endif
/* SEF Init prototypes. */
/*===========================================================================*
* sef_startup *
*===========================================================================*/
-PUBLIC void sef_startup()
+void sef_startup()
{
/* SEF startup interface for system services. */
int r, status;
/*===========================================================================*
* sef_receive_status *
*===========================================================================*/
-PUBLIC int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr)
+int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr)
{
/* SEF receive() interface for system services. */
int r, status;
/*===========================================================================*
* sef_exit *
*===========================================================================*/
-PUBLIC void sef_exit(int status)
+void sef_exit(int status)
{
/* System services use a special version of exit() that generates a
* self-termination signal.
/*===========================================================================*
* _exit *
*===========================================================================*/
-PUBLIC void _exit(int status)
+void _exit(int status)
{
/* Make exit() an alias for sef_exit() for system services. */
sef_exit(status);
/*===========================================================================*
* __exit *
*===========================================================================*/
-PUBLIC void __exit(int status)
+void __exit(int status)
{
/* Make exit() an alias for sef_exit() for system services. */
sef_exit(status);
/*===========================================================================*
* sef_debug_refresh_params *
*===========================================================================*/
-PRIVATE void sef_debug_refresh_params(void)
+static void sef_debug_refresh_params(void)
{
/* Refresh SEF debug params. */
clock_t uptime;
/*===========================================================================*
* sef_debug_header *
*===========================================================================*/
-PUBLIC char* sef_debug_header(void)
+char* sef_debug_header(void)
{
/* Build and return a SEF debug header. */
sef_debug_refresh_params();
#include <minix/sysutil.h>
#include <minix/gcov.h>
-PRIVATE sef_cb_gcov_t sef_cb_gcov = do_gcov_flush_impl;
+static sef_cb_gcov_t sef_cb_gcov = do_gcov_flush_impl;
/*===========================================================================*
* do_sef_gcov_request *
*===========================================================================*/
-PUBLIC int do_sef_gcov_request(message *m_ptr)
+int do_sef_gcov_request(message *m_ptr)
{
if(!sef_cb_gcov)
return ENOSYS;
/*===========================================================================*
* sef_setcb_gcov *
*===========================================================================*/
-PUBLIC void sef_setcb_gcov(sef_cb_gcov_t cb)
+void sef_setcb_gcov(sef_cb_gcov_t cb)
{
sef_cb_gcov = cb;
}
#include <minix/sysutil.h>
/* SEF Init callbacks. */
-PRIVATE struct sef_cbs {
+static struct sef_cbs {
sef_cb_init_t sef_cb_init_fresh;
sef_cb_init_t sef_cb_init_lu;
sef_cb_init_t sef_cb_init_restart;
};
/* SEF Init prototypes for sef_startup(). */
-PUBLIC int do_sef_rs_init(endpoint_t old_endpoint);
-PUBLIC int do_sef_init_request(message *m_ptr);
+int do_sef_rs_init(endpoint_t old_endpoint);
+int do_sef_init_request(message *m_ptr);
/* Debug. */
EXTERN char* sef_debug_header(void);
/*===========================================================================*
* process_init *
*===========================================================================*/
-PRIVATE int process_init(int type, sef_init_info_t *info)
+static int process_init(int type, sef_init_info_t *info)
{
/* Process initialization. */
int r, result;
/*===========================================================================*
* do_sef_rs_init *
*===========================================================================*/
-PUBLIC int do_sef_rs_init(endpoint_t old_endpoint)
+int do_sef_rs_init(endpoint_t old_endpoint)
{
/* Special SEF Init for RS. */
int r;
/*===========================================================================*
* do_sef_init_request *
*===========================================================================*/
-PUBLIC int do_sef_init_request(message *m_ptr)
+int do_sef_init_request(message *m_ptr)
{
/* Handle a SEF Init request. */
int r;
/*===========================================================================*
* sef_setcb_init_fresh *
*===========================================================================*/
-PUBLIC void sef_setcb_init_fresh(sef_cb_init_t cb)
+void sef_setcb_init_fresh(sef_cb_init_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_init_fresh = cb;
/*===========================================================================*
* sef_setcb_init_lu *
*===========================================================================*/
-PUBLIC void sef_setcb_init_lu(sef_cb_init_t cb)
+void sef_setcb_init_lu(sef_cb_init_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_init_lu = cb;
/*===========================================================================*
* sef_setcb_init_restart *
*===========================================================================*/
-PUBLIC void sef_setcb_init_restart(sef_cb_init_t cb)
+void sef_setcb_init_restart(sef_cb_init_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_init_restart = cb;
/*===========================================================================*
* sef_setcb_init_response *
*===========================================================================*/
-PUBLIC void sef_setcb_init_response(sef_cb_init_response_t cb)
+void sef_setcb_init_response(sef_cb_init_response_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_init_response = cb;
/*===========================================================================*
* sef_cb_init_null *
*===========================================================================*/
-PUBLIC int sef_cb_init_null(int UNUSED(type),
+int sef_cb_init_null(int UNUSED(type),
sef_init_info_t *UNUSED(info))
{
return OK;
/*===========================================================================*
* sef_cb_init_response_null *
*===========================================================================*/
-PUBLIC int sef_cb_init_response_null(message * UNUSED(m_ptr))
+int sef_cb_init_response_null(message * UNUSED(m_ptr))
{
return ENOSYS;
}
/*===========================================================================*
* sef_cb_init_fail *
*===========================================================================*/
-PUBLIC int sef_cb_init_fail(int UNUSED(type), sef_init_info_t *UNUSED(info))
+int sef_cb_init_fail(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
return ENOSYS;
}
/*===========================================================================*
* sef_cb_init_reset *
*===========================================================================*/
-PUBLIC int sef_cb_init_reset(int UNUSED(type), sef_init_info_t *UNUSED(info))
+int sef_cb_init_reset(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Tell RS to reincarnate us, with no old resources, and a new endpoint. */
return ERESTART;
/*===========================================================================*
* sef_cb_init_crash *
*===========================================================================*/
-PUBLIC int sef_cb_init_crash(int UNUSED(type), sef_init_info_t *UNUSED(info))
+int sef_cb_init_crash(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
panic("Simulating a crash at initialization time...");
/*===========================================================================*
* sef_cb_init_response_rs_reply *
*===========================================================================*/
-PUBLIC int sef_cb_init_response_rs_reply(message *m_ptr)
+int sef_cb_init_response_rs_reply(message *m_ptr)
{
int r;
#include <minix/sysutil.h>
/* SEF Live update variables. */
-PRIVATE int sef_lu_state;
+static int sef_lu_state;
/* SEF Live update callbacks. */
-PRIVATE struct sef_cbs {
+static struct sef_cbs {
sef_cb_lu_prepare_t sef_cb_lu_prepare;
sef_cb_lu_state_isvalid_t sef_cb_lu_state_isvalid;
sef_cb_lu_state_changed_t sef_cb_lu_state_changed;
};
/* SEF Live update prototypes for sef_receive(). */
-PUBLIC void do_sef_lu_before_receive(void);
-PUBLIC int do_sef_lu_request(message *m_ptr);
+void do_sef_lu_before_receive(void);
+int do_sef_lu_request(message *m_ptr);
/* SEF Live update helpers. */
-PRIVATE void sef_lu_ready(int result);
+static void sef_lu_ready(int result);
/* Debug. */
EXTERN char* sef_debug_header(void);
-PRIVATE int sef_lu_debug_cycle = 0;
+static int sef_lu_debug_cycle = 0;
/* Information about SELF. */
EXTERN endpoint_t sef_self_endpoint;
/*===========================================================================*
* do_sef_lu_before_receive *
*===========================================================================*/
-PUBLIC void do_sef_lu_before_receive()
+void do_sef_lu_before_receive()
{
/* Handle SEF Live update before receive events. */
int r;
/*===========================================================================*
* do_sef_lu_request *
*===========================================================================*/
-PUBLIC int do_sef_lu_request(message *m_ptr)
+int do_sef_lu_request(message *m_ptr)
{
/* Handle a SEF Live update request. */
int state, old_state, is_valid_state;
/*===========================================================================*
* sef_lu_ready *
*===========================================================================*/
-PRIVATE void sef_lu_ready(int result)
+static void sef_lu_ready(int result)
{
message m;
int old_state, r;
/*===========================================================================*
* sef_setcb_lu_prepare *
*===========================================================================*/
-PUBLIC void sef_setcb_lu_prepare(sef_cb_lu_prepare_t cb)
+void sef_setcb_lu_prepare(sef_cb_lu_prepare_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_lu_prepare = cb;
/*===========================================================================*
* sef_setcb_lu_state_isvalid *
*===========================================================================*/
-PUBLIC void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t cb)
+void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_lu_state_isvalid = cb;
/*===========================================================================*
* sef_setcb_lu_state_changed *
*===========================================================================*/
-PUBLIC void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t cb)
+void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_lu_state_changed = cb;
/*===========================================================================*
* sef_setcb_lu_state_dump *
*===========================================================================*/
-PUBLIC void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t cb)
+void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_lu_state_dump = cb;
/*===========================================================================*
* sef_setcb_lu_state_save *
*===========================================================================*/
-PUBLIC void sef_setcb_lu_state_save(sef_cb_lu_state_save_t cb)
+void sef_setcb_lu_state_save(sef_cb_lu_state_save_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_lu_state_save = cb;
/*===========================================================================*
* sef_setcb_lu_response *
*===========================================================================*/
-PUBLIC void sef_setcb_lu_response(sef_cb_lu_response_t cb)
+void sef_setcb_lu_response(sef_cb_lu_response_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_lu_response = cb;
/*===========================================================================*
* sef_cb_lu_prepare_null *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare_null(int UNUSED(state))
+int sef_cb_lu_prepare_null(int UNUSED(state))
{
return ENOTREADY;
}
/*===========================================================================*
* sef_cb_lu_state_isvalid_null *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid_null(int UNUSED(state))
+int sef_cb_lu_state_isvalid_null(int UNUSED(state))
{
return FALSE;
}
/*===========================================================================*
* sef_cb_lu_state_changed_null *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_changed_null(int UNUSED(old_state),
+void sef_cb_lu_state_changed_null(int UNUSED(old_state),
int UNUSED(state))
{
}
/*===========================================================================*
* sef_cb_lu_state_dump_null *
*===========================================================================*/
-PUBLIC void sef_cb_lu_state_dump_null(int UNUSED(state))
+void sef_cb_lu_state_dump_null(int UNUSED(state))
{
sef_lu_dprint("NULL\n");
}
/*===========================================================================*
* sef_cb_lu_state_save_null *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_save_null(int UNUSED(result))
+int sef_cb_lu_state_save_null(int UNUSED(result))
{
return OK;
}
/*===========================================================================*
* sef_cb_lu_response_null *
*===========================================================================*/
-PUBLIC int sef_cb_lu_response_null(message * UNUSED(m_ptr))
+int sef_cb_lu_response_null(message * UNUSED(m_ptr))
{
return ENOSYS;
}
/*===========================================================================*
* sef_cb_lu_prepare_always_ready *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare_always_ready(int UNUSED(state))
+int sef_cb_lu_prepare_always_ready(int UNUSED(state))
{
return OK;
}
/*===========================================================================*
* sef_cb_lu_prepare_never_ready *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare_never_ready(int UNUSED(state))
+int sef_cb_lu_prepare_never_ready(int UNUSED(state))
{
#if SEF_LU_DEBUG
sef_lu_debug_begin();
/*===========================================================================*
* sef_cb_lu_prepare_crash *
*===========================================================================*/
-PUBLIC int sef_cb_lu_prepare_crash(int UNUSED(state))
+int sef_cb_lu_prepare_crash(int UNUSED(state))
{
panic("Simulating a crash at update prepare time...");
/*===========================================================================*
* sef_cb_lu_state_isvalid_standard *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid_standard(int state)
+int sef_cb_lu_state_isvalid_standard(int state)
{
return SEF_LU_STATE_IS_STANDARD(state);
}
/*===========================================================================*
* sef_cb_lu_state_isvalid_workfree *
*===========================================================================*/
-PUBLIC int sef_cb_lu_state_isvalid_workfree(int state)
+int sef_cb_lu_state_isvalid_workfree(int state)
{
return (state == SEF_LU_STATE_WORK_FREE);
}
/*===========================================================================*
* sef_cb_lu_response_rs_reply *
*===========================================================================*/
-PUBLIC int sef_cb_lu_response_rs_reply(message *m_ptr)
+int sef_cb_lu_response_rs_reply(message *m_ptr)
{
int r;
#include <minix/sysutil.h>
/* SEF Ping callbacks. */
-PRIVATE struct sef_cbs {
+static struct sef_cbs {
sef_cb_ping_reply_t sef_cb_ping_reply;
} sef_cbs = {
SEF_CB_PING_REPLY_DEFAULT
};
/* SEF Ping prototypes for sef_receive(). */
-PUBLIC int do_sef_ping_request(message *m_ptr);
+int do_sef_ping_request(message *m_ptr);
/* Debug. */
EXTERN char* sef_debug_header(void);
/*===========================================================================*
* do_sef_ping_request *
*===========================================================================*/
-PUBLIC int do_sef_ping_request(message *m_ptr)
+int do_sef_ping_request(message *m_ptr)
{
/* Handle a SEF Ping request. */
/*===========================================================================*
* sef_setcb_ping_reply *
*===========================================================================*/
-PUBLIC void sef_setcb_ping_reply(sef_cb_ping_reply_t cb)
+void sef_setcb_ping_reply(sef_cb_ping_reply_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_ping_reply = cb;
/*===========================================================================*
* sef_cb_ping_reply_null *
*===========================================================================*/
-PUBLIC void sef_cb_ping_reply_null(endpoint_t UNUSED(source))
+void sef_cb_ping_reply_null(endpoint_t UNUSED(source))
{
}
/*===========================================================================*
* sef_cb_ping_reply_pong *
*===========================================================================*/
-PUBLIC void sef_cb_ping_reply_pong(endpoint_t source)
+void sef_cb_ping_reply_pong(endpoint_t source)
{
notify(source);
}
#include <minix/sysutil.h>
/* SEF Signal callbacks. */
-PRIVATE struct sef_cbs {
+static struct sef_cbs {
sef_cb_signal_handler_t sef_cb_signal_handler;
sef_cb_signal_manager_t sef_cb_signal_manager;
} sef_cbs = {
};
/* SEF Signal prototypes for sef_receive(). */
-PUBLIC int do_sef_signal_request(message *m_ptr);
+int do_sef_signal_request(message *m_ptr);
/* Debug. */
EXTERN char* sef_debug_header(void);
/*===========================================================================*
* process_sigmgr_signals *
*===========================================================================*/
-PRIVATE void process_sigmgr_signals(void)
+static void process_sigmgr_signals(void)
{
/* A signal manager has pending signals in the kernel. Process them. */
endpoint_t target;
/*===========================================================================*
* process_sigmgr_self_signals *
*===========================================================================*/
-PRIVATE void process_sigmgr_self_signals(sigset_t sigset)
+static void process_sigmgr_self_signals(sigset_t sigset)
{
/* A signal manager has pending signals for itself. Process them. */
int signo;
/*===========================================================================*
* do_sef_signal_request *
*===========================================================================*/
-PUBLIC int do_sef_signal_request(message *m_ptr)
+int do_sef_signal_request(message *m_ptr)
{
/* Handle a SEF Signal request. */
int signo;
/*===========================================================================*
* sef_setcb_signal_handler *
*===========================================================================*/
-PUBLIC void sef_setcb_signal_handler(sef_cb_signal_handler_t cb)
+void sef_setcb_signal_handler(sef_cb_signal_handler_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_signal_handler = cb;
/*===========================================================================*
* sef_setcb_signal_manager *
*===========================================================================*/
-PUBLIC void sef_setcb_signal_manager(sef_cb_signal_manager_t cb)
+void sef_setcb_signal_manager(sef_cb_signal_manager_t cb)
{
assert(cb != NULL);
sef_cbs.sef_cb_signal_manager = cb;
/*===========================================================================*
* sef_cb_signal_handler_null *
*===========================================================================*/
-PUBLIC void sef_cb_signal_handler_null(int signo)
+void sef_cb_signal_handler_null(int signo)
{
}
/*===========================================================================*
* sef_cb_signal_manager_null *
*===========================================================================*/
-PUBLIC int sef_cb_signal_manager_null(endpoint_t target, int signo)
+int sef_cb_signal_manager_null(endpoint_t target, int signo)
{
return OK;
}
/*===========================================================================*
* sef_cb_signal_handler_term *
*===========================================================================*/
-PUBLIC void sef_cb_signal_handler_term(int signo)
+void sef_cb_signal_handler_term(int signo)
{
/* Terminate in case of SIGTERM, ignore other signals. */
if(signo == SIGTERM) {
/*===========================================================================*
* sef_cb_signal_handler_posix_default *
*===========================================================================*/
-PUBLIC void sef_cb_signal_handler_posix_default(int signo)
+void sef_cb_signal_handler_posix_default(int signo)
{
switch(signo) {
/* Ignore when possible. */
/*===========================================================================*
* ser_putc *
*===========================================================================*/
-PUBLIC void ser_putc(char c)
+void ser_putc(char c)
{
u32_t b;
int i;
STATE_UPTIME /* use the clock to spin */
};
-PUBLIC void spin_init(spin_t *s, u32_t usecs)
+void spin_init(spin_t *s, u32_t usecs)
{
/* Initialize the given spin state structure, set to spin at most the
* given number of microseconds.
s->s_timeout = FALSE;
}
-PUBLIC int spin_check(spin_t *s)
+int spin_check(spin_t *s)
{
/* Check whether a timeout has taken place. Return TRUE if the caller
* should continue spinning, and FALSE if a timeout has occurred. The
#include <stdarg.h>
#include <unistd.h>
-PUBLIC int sys_abort(int how, ...)
+int sys_abort(int how, ...)
{
/* Something awful has happened. Abandon ship. */
/*===========================================================================*
* sys_clear *
*===========================================================================*/
-PUBLIC int sys_clear(proc_ep)
+int sys_clear(proc_ep)
endpoint_t proc_ep; /* which process has exited */
{
/* A process has exited. PM tells the kernel.
/*===========================================================================*
* sys_cprof *
*===========================================================================*/
-PUBLIC int sys_cprof(action, size, endpt, ctl_ptr, mem_ptr)
+int sys_cprof(action, size, endpt, ctl_ptr, mem_ptr)
int action; /* get/reset profiling tables */
int size; /* size of allocated memory */
endpoint_t endpt; /* caller endpoint */
/*===========================================================================*
* sys_endksig *
*===========================================================================*/
-PUBLIC int sys_endksig(proc_ep)
+int sys_endksig(proc_ep)
endpoint_t proc_ep; /* process number */
{
message m;
/*===========================================================================*
* sys_enable_iop *
*===========================================================================*/
-PUBLIC int sys_enable_iop(proc_ep)
+int sys_enable_iop(proc_ep)
endpoint_t proc_ep; /* number of process to allow I/O */
{
message m_iop;
#include "syslib.h"
-PUBLIC int sys_exec(proc_ep, ptr, prog_name, initpc)
+int sys_exec(proc_ep, ptr, prog_name, initpc)
endpoint_t proc_ep; /* process that did exec */
char *ptr; /* new stack pointer */
char *prog_name; /* name of the new program */
/*===========================================================================*
* sys_exit *
*===========================================================================*/
-PUBLIC int sys_exit()
+int sys_exit()
{
/* A system process requests to exit. */
message m;
#include "syslib.h"
-PUBLIC int sys_fork(parent, child, child_endpoint, map_ptr, flags, msgaddr)
+int sys_fork(parent, child, child_endpoint, map_ptr, flags, msgaddr)
endpoint_t parent; /* process doing the fork */
endpoint_t child; /* which proc has been created by the fork */
endpoint_t *child_endpoint;
/*===========================================================================*
* sys_getinfo *
*===========================================================================*/
-PUBLIC int sys_getinfo(request, ptr, len, ptr2, len2)
+int sys_getinfo(request, ptr, len, ptr2, len2)
int request; /* system info requested */
void *ptr; /* pointer where to store it */
int len; /* max length of value to get */
/*===========================================================================*
* sys_whoami *
*===========================================================================*/
-PUBLIC int sys_whoami(endpoint_t *who_ep, char *who_name, int len,
+int sys_whoami(endpoint_t *who_ep, char *who_name, int len,
int *priv_flags)
{
message m;
/*===========================================================================*
* sys_getksig *
*===========================================================================*/
-PUBLIC int sys_getksig(proc_ep, k_sig_map)
+int sys_getksig(proc_ep, k_sig_map)
endpoint_t *proc_ep; /* return process number here */
sigset_t *k_sig_map; /* return signal map here */
{
/*===========================================================================*
* sys_in *
*===========================================================================*/
-PUBLIC int sys_in(port, value, type)
+int sys_in(port, value, type)
int port; /* port address to read from */
u32_t *value; /* pointer where to store value */
int type; /* byte, word, long */
/*===========================================================================*
* sys_int86 *
*===========================================================================*/
-PUBLIC int sys_int86(reg86p)
+int sys_int86(reg86p)
struct reg86u *reg86p;
{
message m;
/*===========================================================================*
* sys_irqctl *
*===========================================================================*/
-PUBLIC int sys_irqctl(req, irq_vec, policy, hook_id)
+int sys_irqctl(req, irq_vec, policy, hook_id)
int req; /* IRQ control request */
int irq_vec; /* IRQ vector to control */
int policy; /* bit mask for policy flags */
#include "syslib.h"
-PUBLIC int sys_kill(proc_ep, signr)
+int sys_kill(proc_ep, signr)
endpoint_t proc_ep; /* which proc_ep has exited */
int signr; /* signal number: 1 - 16 */
{
#include "syslib.h"
-PUBLIC int sys_getmcontext(proc, mcp)
+int sys_getmcontext(proc, mcp)
endpoint_t proc; /* process retrieving context */
mcontext_t *mcp; /* where to store context */
{
return r;
}
-PUBLIC int sys_setmcontext(proc, mcp)
+int sys_setmcontext(proc, mcp)
endpoint_t proc; /* process setting context */
mcontext_t *mcp; /* where to get context from */
{
#include "syslib.h"
-PUBLIC int sys_memset(unsigned long pattern, phys_bytes base, phys_bytes bytes)
+int sys_memset(unsigned long pattern, phys_bytes base, phys_bytes bytes)
{
/* Zero a block of data. */
message mess;
#include "syslib.h"
-PUBLIC int sys_newmap(
+int sys_newmap(
endpoint_t proc_ep, /* process whose map is to be changed */
struct mem_map *ptr /* pointer to new map */
)
/*===========================================================================*
* sys_out *
*===========================================================================*/
-PUBLIC int sys_out(port, value, type)
+int sys_out(port, value, type)
int port; /* port address to write to */
u32_t value; /* value to write */
int type; /* byte, word, long */
#include "syslib.h"
-PUBLIC int sys_physcopy(src_proc, src_seg, src_vir,
+int sys_physcopy(src_proc, src_seg, src_vir,
dst_proc, dst_seg, dst_vir, bytes)
endpoint_t src_proc; /* source process */
int src_seg; /* source memory segment */
/*===========================================================================*
* sys_profbuf *
*===========================================================================*/
-PUBLIC int sys_profbuf(ctl_ptr, mem_ptr)
+int sys_profbuf(ctl_ptr, mem_ptr)
void *ctl_ptr; /* pointer to control structure */
void *mem_ptr; /* pointer to profiling table */
{
#include "syslib.h"
-PUBLIC int sys_readbios(address, buf, size)
+int sys_readbios(address, buf, size)
phys_bytes address; /* Absolute memory address */
void *buf; /* Buffer to store the results */
size_t size; /* Amount of data to read */
/*===========================================================================*
* sys_runctl *
*===========================================================================*/
-PUBLIC int sys_runctl(endpoint_t proc_ep, int action, int flags)
+int sys_runctl(endpoint_t proc_ep, int action, int flags)
{
message m;
#include <minix/safecopies.h>
-PUBLIC int sys_safecopyfrom(endpoint_t src_e,
+int sys_safecopyfrom(endpoint_t src_e,
cp_grant_id_t gr_id, vir_bytes offset,
vir_bytes address, size_t bytes,
int my_seg)
}
-PUBLIC int sys_safecopyto(endpoint_t dst_e,
+int sys_safecopyto(endpoint_t dst_e,
cp_grant_id_t gr_id, vir_bytes offset,
vir_bytes address, size_t bytes,
int my_seg)
/*===========================================================================*
* sys_safemap *
*===========================================================================*/
-PUBLIC int sys_safemap(endpoint_t grantor, cp_grant_id_t grant,
+int sys_safemap(endpoint_t grantor, cp_grant_id_t grant,
vir_bytes grant_offset, vir_bytes my_address,
size_t bytes, int my_seg, int writable)
{
/*===========================================================================*
* sys_saferevmap_gid *
*===========================================================================*/
-PUBLIC int sys_saferevmap_gid(cp_grant_id_t grant)
+int sys_saferevmap_gid(cp_grant_id_t grant)
{
/* Grantor revokes safemap by grant id. */
message copy_mess;
/*===========================================================================*
* sys_saferevmap_addr *
*===========================================================================*/
-PUBLIC int sys_saferevmap_addr(vir_bytes addr)
+int sys_saferevmap_addr(vir_bytes addr)
{
/* Grantor revokes safemap by address. */
message copy_mess;
/*===========================================================================*
* sys_safeunmap *
*===========================================================================*/
-PUBLIC int sys_safeunmap(int my_seg, vir_bytes my_address)
+int sys_safeunmap(int my_seg, vir_bytes my_address)
{
/* Requestor unmaps safemap. */
message copy_mess;
#include "syslib.h"
-PUBLIC int sys_schedctl(unsigned flags,
+int sys_schedctl(unsigned flags,
endpoint_t proc_ep,
int priority,
int quantum,
#include "syslib.h"
-PUBLIC int sys_schedule(endpoint_t proc_ep,
+int sys_schedule(endpoint_t proc_ep,
int priority,
int quantum,
int cpu)
/*===========================================================================*
* sys_sdevio *
*===========================================================================*/
-PUBLIC int sys_sdevio(req, port, proc_nr, buffer, count, offset)
+int sys_sdevio(req, port, proc_nr, buffer, count, offset)
int req; /* request: DIO_{IN,OUT}PUT_* */
long port; /* port address to read from */
endpoint_t proc_nr; /* process where buffer is */
/*===========================================================================*
* sys_setalarm *
*===========================================================================*/
-PUBLIC int sys_setalarm(exp_time, abs_time)
+int sys_setalarm(exp_time, abs_time)
clock_t exp_time; /* expiration time for the alarm */
int abs_time; /* use absolute or relative expiration time */
{
/*===========================================================================*
* sys_sigreturn *
*===========================================================================*/
-PUBLIC int sys_sigreturn(proc_ep, sig_ctxt)
+int sys_sigreturn(proc_ep, sig_ctxt)
endpoint_t proc_ep; /* for which process */
struct sigmsg *sig_ctxt; /* POSIX style handling */
{
/*===========================================================================*
* sys_sigsend *
*===========================================================================*/
-PUBLIC int sys_sigsend(proc_ep, sig_ctxt)
+int sys_sigsend(proc_ep, sig_ctxt)
endpoint_t proc_ep; /* for which process */
struct sigmsg *sig_ctxt; /* POSIX style handling */
{
/*===========================================================================*
* sys_sprof *
*===========================================================================*/
-PUBLIC int sys_sprof(action, size, freq, type, endpt, ctl_ptr, mem_ptr)
+int sys_sprof(action, size, freq, type, endpt, ctl_ptr, mem_ptr)
int action; /* start/stop profiling */
int size; /* available profiling memory */
int freq; /* sample frequency */
#include "syslib.h"
-PUBLIC int sys_statectl(int request)
+int sys_statectl(int request)
{
message m;
#include "syslib.h"
-PUBLIC int sys_stime(boottime)
+int sys_stime(boottime)
time_t boottime; /* New boottime */
{
message m;
#include "syslib.h"
-PUBLIC int sys_sysctl(int code, char *arg1, int arg2)
+int sys_sysctl(int code, char *arg1, int arg2)
{
message m;
}
-PUBLIC int sys_sysctl_stacktrace(endpoint_t ep)
+int sys_sysctl_stacktrace(endpoint_t ep)
{
return sys_sysctl(SYSCTL_CODE_STACKTRACE, NULL, ep);
}
#include "syslib.h"
-PUBLIC int sys_times(proc_ep, user_time, sys_time, uptime, boottime)
+int sys_times(proc_ep, user_time, sys_time, uptime, boottime)
endpoint_t proc_ep; /* proc_ep whose times are needed */
clock_t *user_time; /* time spend in the process itself */
clock_t *sys_time; /* time spend in system on behalf of the
#include "syslib.h"
-PUBLIC int sys_trace(req, proc_ep, addr, data_p)
+int sys_trace(req, proc_ep, addr, data_p)
int req;
endpoint_t proc_ep;
long addr, *data_p;
/*===========================================================================*
* sys_umap *
*===========================================================================*/
-PUBLIC int sys_umap(proc_ep, seg, vir_addr, bytes, phys_addr)
+int sys_umap(proc_ep, seg, vir_addr, bytes, phys_addr)
endpoint_t proc_ep; /* process number to do umap for */
int seg; /* T, D, or S segment */
vir_bytes vir_addr; /* address in bytes with segment*/
/*===========================================================================*
* sys_umap_remote *
*===========================================================================*/
-PUBLIC int sys_umap_remote(proc_ep, grantee, seg, vir_addr, bytes, phys_addr)
+int sys_umap_remote(proc_ep, grantee, seg, vir_addr, bytes, phys_addr)
endpoint_t proc_ep; /* process number to do umap for */
endpoint_t grantee; /* process nr to check as grantee */
int seg; /* T, D, or S segment */
/*===========================================================================*
* sys_vinb *
*===========================================================================*/
-PUBLIC int sys_vinb(pvb_pairs, nr_ports)
+int sys_vinb(pvb_pairs, nr_ports)
pvb_pair_t *pvb_pairs; /* (port,byte-value)-pairs */
int nr_ports; /* nr of pairs to be processed */
{
/*===========================================================================*
* sys_vinl *
*===========================================================================*/
-PUBLIC int sys_vinl(pvl_pairs, nr_ports)
+int sys_vinl(pvl_pairs, nr_ports)
pvl_pair_t *pvl_pairs; /* (port,long-value)-pairs */
int nr_ports; /* nr of pairs to be processed */
{
/*===========================================================================*
* sys_vinw *
*===========================================================================*/
-PUBLIC int sys_vinw(pvw_pairs, nr_ports)
+int sys_vinw(pvw_pairs, nr_ports)
pvw_pair_t *pvw_pairs; /* (port,word-value)-pairs */
int nr_ports; /* nr of pairs to be processed */
{
#include "syslib.h"
-PUBLIC int sys_vircopy(src_proc, src_seg, src_vir,
+int sys_vircopy(src_proc, src_seg, src_vir,
dst_proc, dst_seg, dst_vir, bytes)
endpoint_t src_proc; /* source process */
int src_seg; /* source memory segment */
#include "syslib.h"
-PUBLIC int sys_vmctl(endpoint_t who, int param, u32_t value)
+int sys_vmctl(endpoint_t who, int param, u32_t value)
{
message m;
int r;
return(r);
}
-PUBLIC int sys_vmctl_get_cr3_i386(endpoint_t who, u32_t *cr3)
+int sys_vmctl_get_cr3_i386(endpoint_t who, u32_t *cr3)
{
message m;
int r;
return(r);
}
-PUBLIC int sys_vmctl_set_addrspace(endpoint_t who,
+int sys_vmctl_set_addrspace(endpoint_t who,
phys_bytes ptroot, void *ptroot_v)
{
message m;
return(r);
}
-PUBLIC int sys_vmctl_get_memreq(endpoint_t *who, vir_bytes *mem,
+int sys_vmctl_get_memreq(endpoint_t *who, vir_bytes *mem,
vir_bytes *len, int *wrflag, endpoint_t *who_s, vir_bytes *mem_s,
endpoint_t *requestor)
{
return r;
}
-PUBLIC int sys_vmctl_enable_paging(void * data)
+int sys_vmctl_enable_paging(void * data)
{
message m;
m.SVMCTL_WHO = SELF;
return _kernel_call(SYS_VMCTL, &m);
}
-PUBLIC int sys_vmctl_get_mapping(int index,
+int sys_vmctl_get_mapping(int index,
phys_bytes *addr, phys_bytes *len, int *flags)
{
int r;
return OK;
}
-PUBLIC int sys_vmctl_reply_mapping(int index, vir_bytes addr)
+int sys_vmctl_reply_mapping(int index, vir_bytes addr)
{
message m;
/*===========================================================================*
* sys_voutb *
*===========================================================================*/
-PUBLIC int sys_voutb(pvb_pairs, nr_ports)
+int sys_voutb(pvb_pairs, nr_ports)
pvb_pair_t *pvb_pairs; /* (port,byte-value)-pairs */
int nr_ports; /* nr of pairs to be processed */
{
/*===========================================================================*
* sys_voutl *
*===========================================================================*/
-PUBLIC int sys_voutl(pvl_pairs, nr_ports)
+int sys_voutl(pvl_pairs, nr_ports)
pvl_pair_t *pvl_pairs; /* (port,long-value)-pairs */
int nr_ports; /* nr of pairs to be processed */
{
/*===========================================================================*
* sys_voutw *
*===========================================================================*/
-PUBLIC int sys_voutw(pvw_pairs, nr_ports)
+int sys_voutw(pvw_pairs, nr_ports)
pvw_pair_t *pvw_pairs; /* (port,word-value)-pairs */
int nr_ports; /* nr of pairs to be processed */
{
#include <minix/safecopies.h>
-PUBLIC int sys_vsafecopy(struct vscp_vec *vec, int els)
+int sys_vsafecopy(struct vscp_vec *vec, int els)
{
/* Vectored variant of sys_safecopy*. */
#include "syslib.h"
-PUBLIC int sys_vtimer(proc, which, newval, oldval)
+int sys_vtimer(proc, which, newval, oldval)
endpoint_t proc; /* proc to retrieve/set the timer for */
int which; /* timer to retrieve/set */
clock_t *newval; /* if non-NULL, set to this new value */
/*===========================================================================*
* sys_vumap *
*===========================================================================*/
-PUBLIC int sys_vumap(
+int sys_vumap(
endpoint_t endpt, /* source process endpoint, or SELF */
struct vumap_vir *vvec, /* virtual (input) vector */
int vcount, /* number of elements in vvec */
#include <lib.h>
#include <minix/syslib.h>
-PUBLIC int _taskcall(who, syscallnr, msgptr)
+int _taskcall(who, syscallnr, msgptr)
endpoint_t who;
int syscallnr;
register message *msgptr;
/*===========================================================================*
* tickdelay *
*===========================================================================*/
-PUBLIC int tickdelay(ticks)
+int tickdelay(ticks)
long ticks; /* number of ticks to wait */
{
/* This function uses the synchronous alarm to delay for a while. This works
#include <timers.h>
#include <minix/sysutil.h>
-PRIVATE timer_t *timers = NULL;
-PRIVATE int expiring = 0;
+static timer_t *timers = NULL;
+static int expiring = 0;
/*===========================================================================*
* init_timer *
*===========================================================================*/
-PUBLIC void init_timer(timer_t *tp)
+void init_timer(timer_t *tp)
{
tmr_inittimer(tp);
}
/*===========================================================================*
* set_timer *
*===========================================================================*/
-PUBLIC void set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
+void set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
{
int r;
clock_t now, prev_time = 0, next_time;
/*===========================================================================*
* cancel_timer *
*===========================================================================*/
-PUBLIC void cancel_timer(timer_t *tp)
+void cancel_timer(timer_t *tp)
{
clock_t next_time, prev_time;
prev_time = tmrs_clrtimer(&timers, tp, &next_time);
/*===========================================================================*
* expire_timers *
*===========================================================================*/
-PUBLIC void expire_timers(clock_t now)
+void expire_timers(clock_t now)
{
clock_t next_time;
/*===========================================================================*
* vm_brk *
*===========================================================================*/
-PUBLIC int vm_brk(endpoint_t ep, char *addr)
+int vm_brk(endpoint_t ep, char *addr)
{
message m;
/*===========================================================================*
* vm_exec_newmem *
*===========================================================================*/
-PUBLIC int vm_exec_newmem(endpoint_t ep, struct exec_newmem *args,
+int vm_exec_newmem(endpoint_t ep, struct exec_newmem *args,
int argssize, char **ret_stack_top, int *ret_flags)
{
message m;
/*===========================================================================*
* vm_exit *
*===========================================================================*/
-PUBLIC int vm_exit(endpoint_t ep)
+int vm_exit(endpoint_t ep)
{
message m;
int result;
/*===========================================================================*
* vm_willexit *
*===========================================================================*/
-PUBLIC int vm_willexit(endpoint_t ep)
+int vm_willexit(endpoint_t ep)
{
message m;
int result;
/*===========================================================================*
* vm_fork *
*===========================================================================*/
-PUBLIC int vm_fork(endpoint_t ep, int slot, endpoint_t *childep)
+int vm_fork(endpoint_t ep, int slot, endpoint_t *childep)
{
message m;
int result;
/*===========================================================================*
* vm_info_stats *
*===========================================================================*/
-PUBLIC int vm_info_stats(struct vm_stats_info *vsi)
+int vm_info_stats(struct vm_stats_info *vsi)
{
message m;
/*===========================================================================*
* vm_info_usage *
*===========================================================================*/
-PUBLIC int vm_info_usage(endpoint_t who, struct vm_usage_info *vui)
+int vm_info_usage(endpoint_t who, struct vm_usage_info *vui)
{
message m;
/*===========================================================================*
* vm_info_region *
*===========================================================================*/
-PUBLIC int vm_info_region(endpoint_t who, struct vm_region_info *vri,
+int vm_info_region(endpoint_t who, struct vm_region_info *vri,
int count, vir_bytes *next)
{
message m;
#include <string.h>
#include <errno.h>
-PUBLIC void *vm_map_phys(endpoint_t who, void *phaddr, size_t len)
+void *vm_map_phys(endpoint_t who, void *phaddr, size_t len)
{
message m;
int r;
return (void *) m.VMMP_VADDR_REPLY;
}
-PUBLIC int vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
+int vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
{
message m;
/*===========================================================================*
* vm_notify_sig *
*===========================================================================*/
-PUBLIC int vm_notify_sig(endpoint_t ep, endpoint_t ipc_ep)
+int vm_notify_sig(endpoint_t ep, endpoint_t ipc_ep)
{
message m;
int result;
/*===========================================================================*
* vm_push_sig *
*===========================================================================*/
-PUBLIC int vm_push_sig(endpoint_t ep, vir_bytes *old_sp)
+int vm_push_sig(endpoint_t ep, vir_bytes *old_sp)
{
message m;
int result;
/*===========================================================================*
* vm_umap *
*===========================================================================*/
-PUBLIC int vm_umap(int seg, vir_bytes offset, vir_bytes len, phys_bytes *addr)
+int vm_umap(int seg, vir_bytes offset, vir_bytes len, phys_bytes *addr)
{
message m;
int result;
/*===========================================================================*
* vm_forgetblocks *
*===========================================================================*/
-PUBLIC void vm_forgetblocks(void)
+void vm_forgetblocks(void)
{
message m;
_taskcall(VM_PROC_NR, VM_FORGETBLOCKS, &m);
/*===========================================================================*
* vm_forgetblock *
*===========================================================================*/
-PUBLIC int vm_forgetblock(u64_t id)
+int vm_forgetblock(u64_t id)
{
message m;
/*===========================================================================*
* vm_yield_block_get_block *
*===========================================================================*/
-PUBLIC int vm_yield_block_get_block(u64_t yieldid, u64_t getid,
+int vm_yield_block_get_block(u64_t yieldid, u64_t getid,
void *mem, vir_bytes len)
{
message m;
#include <errno.h>
#include <string.h>
-PRIVATE struct usb_urb * pending_urbs = NULL;
-PRIVATE endpoint_t hcd_ep;
+static struct usb_urb * pending_urbs = NULL;
+static endpoint_t hcd_ep;
-FORWARD void _usb_urb_complete(struct usb_driver *ud, long urb_id);
+static void _usb_urb_complete(struct usb_driver *ud, long urb_id);
/*****************************************************************************
* usb_send_urb *
****************************************************************************/
-PUBLIC int usb_send_urb(struct usb_urb* urb)
+int usb_send_urb(struct usb_urb* urb)
{
message msg;
int res;
/*****************************************************************************
* usb_cancle_urb *
****************************************************************************/
-PUBLIC int usb_cancle_urb(struct usb_urb* urb)
+int usb_cancle_urb(struct usb_urb* urb)
{
int res;
message msg;
/*****************************************************************************
* usb_init *
****************************************************************************/
-PUBLIC int usb_init(char *name)
+int usb_init(char *name)
{
int res;
message msg;
/*****************************************************************************
* _usb_urb_complete *
****************************************************************************/
-PRIVATE void _usb_urb_complete(struct usb_driver *ud, long urb_id)
+static void _usb_urb_complete(struct usb_driver *ud, long urb_id)
{
/* find the corresponding URB in the urb_pending list. */
struct usb_urb * urb = NULL;
/*****************************************************************************
* usb_handle_msg *
****************************************************************************/
-PUBLIC int usb_handle_msg(struct usb_driver *ud, message *msg)
+int usb_handle_msg(struct usb_driver *ud, message *msg)
{
/*
* we expect kind of messages:
#include "inc.h"
/* The number of inodes and hash table slots. */
-PRIVATE unsigned int nr_inodes;
+static unsigned int nr_inodes;
/* The table of all the inodes. */
-PRIVATE struct inode *inode;
+static struct inode *inode;
/* The list of unused inodes. */
-PRIVATE TAILQ_HEAD(unused_head, inode) unused_inodes;
+static TAILQ_HEAD(unused_head, inode) unused_inodes;
/* The hash tables for lookup of <parent,name> and <parent,index> to inode. */
-PRIVATE LIST_HEAD(name_head, inode) *parent_name_head;
-PRIVATE LIST_HEAD(index_head, inode) *parent_index_head;
+static LIST_HEAD(name_head, inode) *parent_name_head;
+static LIST_HEAD(index_head, inode) *parent_index_head;
/* Internal integrity check. */
#define CHECK_INODE(node) \
/*===========================================================================*
* init_inodes *
*===========================================================================*/
-PUBLIC void init_inodes(unsigned int inodes, struct inode_stat *stat,
+void init_inodes(unsigned int inodes, struct inode_stat *stat,
index_t nr_indexed_entries)
{
/* Initialize the inode-related state.
/*===========================================================================*
* cleanup_inodes *
*===========================================================================*/
-PUBLIC void cleanup_inodes(void)
+void cleanup_inodes(void)
{
/* Clean up the inode-related state.
*/
/*===========================================================================*
* parent_name_hash *
*===========================================================================*/
-PRIVATE int parent_name_hash(struct inode *parent, char *name)
+static int parent_name_hash(struct inode *parent, char *name)
{
/* Return the hash value of <parent,name> tuple.
*/
/*===========================================================================*
* parent_index_hash *
*===========================================================================*/
-PRIVATE int parent_index_hash(struct inode *parent, index_t index)
+static int parent_index_hash(struct inode *parent, index_t index)
{
/* Return the hash value of a <parent,index> tuple.
*/
/*===========================================================================*
* purge_inode *
*===========================================================================*/
-PUBLIC void purge_inode(struct inode *parent)
+void purge_inode(struct inode *parent)
{
/* Delete a deletable inode to make room for a new inode.
*/
/*===========================================================================*
* add_inode *
*===========================================================================*/
-PUBLIC struct inode *add_inode(struct inode *parent, char *name,
+struct inode *add_inode(struct inode *parent, char *name,
index_t index, struct inode_stat *stat, index_t nr_indexed_entries,
cbdata_t cbdata)
{
/*===========================================================================*
* get_root_inode *
*===========================================================================*/
-PUBLIC struct inode *get_root_inode(void)
+struct inode *get_root_inode(void)
{
/* Return the file system's root inode.
*/
/*===========================================================================*
* get_inode_name *
*===========================================================================*/
-PUBLIC char const *get_inode_name(struct inode *node)
+char const *get_inode_name(struct inode *node)
{
/* Return the name that an inode has in its parent directory.
*/
/*===========================================================================*
* get_inode_index *
*===========================================================================*/
-PUBLIC index_t get_inode_index(struct inode *node)
+index_t get_inode_index(struct inode *node)
{
/* Return the index that an inode has in its parent directory.
*/
/*===========================================================================*
* get_inode_cbdata *
*===========================================================================*/
-PUBLIC cbdata_t get_inode_cbdata(struct inode *node)
+cbdata_t get_inode_cbdata(struct inode *node)
{
/* Return the callback data associated with the given inode.
*/
/*===========================================================================*
* get_parent_inode *
*===========================================================================*/
-PUBLIC struct inode *get_parent_inode(struct inode *node)
+struct inode *get_parent_inode(struct inode *node)
{
/* Return an inode's parent inode.
*/
/*===========================================================================*
* get_first_inode *
*===========================================================================*/
-PUBLIC struct inode *get_first_inode(struct inode *parent)
+struct inode *get_first_inode(struct inode *parent)
{
/* Return a directory's first (non-deleted) child inode.
*/
/*===========================================================================*
* get_next_inode *
*===========================================================================*/
-PUBLIC struct inode *get_next_inode(struct inode *previous)
+struct inode *get_next_inode(struct inode *previous)
{
/* Return a directory's next (non-deleted) child inode.
*/
/*===========================================================================*
* get_inode_number *
*===========================================================================*/
-PUBLIC int get_inode_number(struct inode *node)
+int get_inode_number(struct inode *node)
{
/* Return the inode number of the given inode.
*/
/*===========================================================================*
* get_inode_stat *
*===========================================================================*/
-PUBLIC void get_inode_stat(struct inode *node, struct inode_stat *stat)
+void get_inode_stat(struct inode *node, struct inode_stat *stat)
{
/* Retrieve an inode's status.
*/
/*===========================================================================*
* set_inode_stat *
*===========================================================================*/
-PUBLIC void set_inode_stat(struct inode *node, struct inode_stat *stat)
+void set_inode_stat(struct inode *node, struct inode_stat *stat)
{
/* Set an inode's status.
*/
/*===========================================================================*
* get_inode_by_name *
*===========================================================================*/
-PUBLIC struct inode *get_inode_by_name(struct inode *parent, char *name)
+struct inode *get_inode_by_name(struct inode *parent, char *name)
{
/* Look up an inode using a <parent,name> tuple.
*/
/*===========================================================================*
* get_inode_by_index *
*===========================================================================*/
-PUBLIC struct inode *get_inode_by_index(struct inode *parent, index_t index)
+struct inode *get_inode_by_index(struct inode *parent, index_t index)
{
/* Look up an inode using a <parent,index> tuple.
*/
/*===========================================================================*
* find_inode *
*===========================================================================*/
-PUBLIC struct inode *find_inode(ino_t num)
+struct inode *find_inode(ino_t num)
{
/* Retrieve an inode by inode number.
*/
/*===========================================================================*
* get_inode *
*===========================================================================*/
-PUBLIC struct inode *get_inode(ino_t num)
+struct inode *get_inode(ino_t num)
{
/* Retrieve an inode by inode number, and increase its reference count.
*/
/*===========================================================================*
* put_inode *
*===========================================================================*/
-PUBLIC void put_inode(struct inode *node)
+void put_inode(struct inode *node)
{
/* Decrease an inode's reference count.
*/
/*===========================================================================*
* ref_inode *
*===========================================================================*/
-PUBLIC void ref_inode(struct inode *node)
+void ref_inode(struct inode *node)
{
/* Increase an inode's reference count.
*/
/*===========================================================================*
* unlink_inode *
*===========================================================================*/
-PRIVATE void unlink_inode(struct inode *node)
+static void unlink_inode(struct inode *node)
{
/* Unlink the given node from its parent, if it is still linked in.
*/
/*===========================================================================*
* delete_inode *
*===========================================================================*/
-PUBLIC void delete_inode(struct inode *node)
+void delete_inode(struct inode *node)
{
/* Delete the given inode. If its reference count is nonzero, or it
* still has children that cannot be deleted for the same reason, keep
/*===========================================================================*
* is_inode_deleted *
*===========================================================================*/
-PUBLIC int is_inode_deleted(struct inode *node)
+int is_inode_deleted(struct inode *node)
{
/* Return whether the given inode has been deleted.
*/
/*===========================================================================*
* fs_putnode *
*===========================================================================*/
-PUBLIC int fs_putnode(void)
+int fs_putnode(void)
{
/* Find the inode specified by the request message, and decrease its
* reference count.
/*===========================================================================*
* fs_rdlink *
*===========================================================================*/
-PUBLIC int fs_rdlink(void)
+int fs_rdlink(void)
{
/* Retrieve symbolic link target.
*/
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
-PUBLIC int fs_readsuper(void)
+int fs_readsuper(void)
{
/* This function gets the root inode and sends back its details.
*/
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
-PUBLIC int fs_unmount(void)
+int fs_unmount(void)
{
/* Unmount the file system.
*/
/*===========================================================================*
* access_as_dir *
*===========================================================================*/
-PRIVATE int access_as_dir(struct inode *node, vfs_ucred_t *ucred)
+static int access_as_dir(struct inode *node, vfs_ucred_t *ucred)
{
/* Check whether the given inode may be accessed as directory.
* Return OK or an appropriate error code.
/*===========================================================================*
* next_name *
*===========================================================================*/
-PRIVATE int next_name(char **ptr, char **start, char name[PNAME_MAX+1])
+static int next_name(char **ptr, char **start, char name[PNAME_MAX+1])
{
/* Get the next path component from a path.
*/
/*===========================================================================*
* go_up *
*===========================================================================*/
-PRIVATE int go_up(struct inode *node, struct inode **parent)
+static int go_up(struct inode *node, struct inode **parent)
{
/* Given a directory inode, progress into the parent directory.
*/
/*===========================================================================*
* go_down *
*===========================================================================*/
-PRIVATE int go_down(struct inode *parent, char *name, struct inode **child)
+static int go_down(struct inode *parent, char *name, struct inode **child)
{
/* Given a directory inode and a name, progress into a directory entry.
*/
/*===========================================================================*
* resolve_link *
*===========================================================================*/
-PRIVATE int resolve_link(struct inode *node, char *pptr, char *tail)
+static int resolve_link(struct inode *node, char *pptr, char *tail)
{
/* Given a symbolic link, resolve and return the contents of the link.
*/
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
-PUBLIC int fs_lookup(void)
+int fs_lookup(void)
{
/* Resolve a path string to an inode.
*/
/*===========================================================================*
* fs_read *
*===========================================================================*/
-PUBLIC int fs_read(void)
+int fs_read(void)
{
/* Read from a file.
*/
/*===========================================================================*
* fs_getdents *
*===========================================================================*/
-PUBLIC int fs_getdents(void)
+int fs_getdents(void)
{
/* Retrieve directory entries.
*/
* use: 65599 nice.
* 65587 even better.
*/
-PUBLIC long sdbm_hash(char *str, int len)
+long sdbm_hash(char *str, int len)
{
unsigned long n = 0;
/*===========================================================================*
* fs_stat *
*===========================================================================*/
-PUBLIC int fs_stat(void)
+int fs_stat(void)
{
/* Retrieve file status.
*/
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
-PUBLIC int fs_fstatfs(void)
+int fs_fstatfs(void)
{
/* Retrieve file system statistics.
*/
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
-PUBLIC int fs_statvfs(void)
+int fs_statvfs(void)
{
/* Retrieve file system statistics.
*/
#define _TABLE
#include "inc.h"
-PUBLIC int (*fs_call_vec[])(void) = {
+int (*fs_call_vec[])(void) = {
no_sys, /* 0 */
no_sys, /* 1 getnode */
fs_putnode, /* 2 putnode */
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys(void)
+int no_sys(void)
{
/* This call is not recognized by VTreeFS. If a message hook is
* defined, let it handle the call; otherwise return ENOSYS.
/*===========================================================================*
* do_noop *
*===========================================================================*/
-PUBLIC int do_noop(void)
+int do_noop(void)
{
/* This call has no effect.
*/
#include "inc.h"
-FORWARD int get_work(void);
-FORWARD void send_reply(int err, int transid);
-FORWARD void got_signal(int signal);
+static int get_work(void);
+static void send_reply(int err, int transid);
+static void got_signal(int signal);
-PRIVATE unsigned int inodes;
-PRIVATE struct inode_stat *root_stat;
-PRIVATE index_t root_entries;
+static unsigned int inodes;
+static struct inode_stat *root_stat;
+static index_t root_entries;
/*===========================================================================*
* init_server *
*===========================================================================*/
-PRIVATE int init_server(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int init_server(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize internal state, and register with VFS.
*/
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
sef_setcb_init_fresh(init_server);
sef_setcb_init_restart(init_server);
/*===========================================================================*
* start_vtreefs *
*===========================================================================*/
-PUBLIC void start_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes,
+void start_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes,
struct inode_stat *stat, index_t nr_indexed_entries)
{
/* This is the main routine of this service. The main loop consists of
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE int get_work(void)
+static int get_work(void)
{
/* Retrieve work. Return the call number.
*/
/*===========================================================================*
* send_reply *
*===========================================================================*/
-PRIVATE void send_reply(int err, int transid)
+static void send_reply(int err, int transid)
{
/* Send a reply to the caller.
*/
/*===========================================================================*
* got_signal *
*===========================================================================*/
-PRIVATE void got_signal(int signal)
+static void got_signal(int signal)
{
/* We received a signal. If it is a termination signal, and the file
* system has already been unmounted, clean up and exit.
/*****************************************************************************
* do_bind_device *
****************************************************************************/
-PUBLIC int do_bind_device(message *m)
+int do_bind_device(message *m)
{
struct devman_device *dev;
int res;
/*****************************************************************************
* do_unbind_device *
****************************************************************************/
-PUBLIC int do_unbind_device(message *m)
+int do_unbind_device(message *m)
{
struct devman_device *dev;
int res;
#include <string.h>
#define BUF_SIZE 4096
-PRIVATE char buf[BUF_SIZE + 1];
-PRIVATE size_t off, left, used;
-PRIVATE off_t skip;
+static char buf[BUF_SIZE + 1];
+static size_t off, left, used;
+static off_t skip;
#define MIN(x,y) (x<y?x:y)
/*===========================================================================*
* buf_init *
*===========================================================================*/
-PUBLIC void buf_init(off_t start, size_t len)
+void buf_init(off_t start, size_t len)
{
/* Initialize the buffer for fresh use. The first 'start' bytes of the
* produced output are to be skipped. After that, up to a total of
/*===========================================================================*
* buf_printf *
*===========================================================================*/
-PUBLIC void buf_printf(char *fmt, ...)
+void buf_printf(char *fmt, ...)
{
/* Add formatted text to the end of the buffer.
*/
/*===========================================================================*
* buf_append *
*===========================================================================*/
-PUBLIC void buf_append(char *data, size_t len)
+void buf_append(char *data, size_t len)
{
/* Add arbitrary data to the end of the buffer.
*/
/*===========================================================================*
* buf_get *
*===========================================================================*/
-PUBLIC size_t buf_get(char **ptr)
+size_t buf_get(char **ptr)
{
/* Return the buffer's starting address and the length of the used
* part, not counting the trailing null character for the latter.
#include "proto.h"
-FORWARD struct devman_device*devman_dev_add_child(struct devman_device
+static struct devman_device*devman_dev_add_child(struct devman_device
*parent, struct devman_device_info *devinf);
-FORWARD struct devman_device *_find_dev(struct devman_device *dev, int
+static struct devman_device *_find_dev(struct devman_device *dev, int
dev_id);
-FORWARD int devman_dev_add_info(struct devman_device *dev, struct
+static int devman_dev_add_info(struct devman_device *dev, struct
devman_device_info_entry *entry, char *buf);
-FORWARD int devman_event_read(char **ptr, size_t *len,off_t offset, void
+static int devman_event_read(char **ptr, size_t *len,off_t offset, void
*data);
-FORWARD int devman_del_device(struct devman_device *dev);
+static int devman_del_device(struct devman_device *dev);
-PRIVATE int next_device_id = 1;
+static int next_device_id = 1;
-PRIVATE struct inode_stat default_dir_stat = {
+static struct inode_stat default_dir_stat = {
/* .mode = */ S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH,
/* .uid = */ 0,
/* .gid = */ 0,
/* .dev = */ NO_DEV,
};
-PRIVATE struct inode_stat default_file_stat = {
+static struct inode_stat default_file_stat = {
/* .mode = */ S_IFREG | S_IRUSR | S_IRGRP | S_IROTH,
/* .uid = */ 0,
/* .gid = */ 0,
};
-PRIVATE struct devman_device root_dev;
-PRIVATE struct devman_event_inode event_inode_data = {
+static struct devman_device root_dev;
+static struct devman_event_inode event_inode_data = {
TAILQ_HEAD_INITIALIZER(event_inode_data.event_queue),
};
-PRIVATE struct devman_inode event_inode;
+static struct devman_inode event_inode;
/*===========================================================================*
* devman_generate_path *
*===========================================================================*/
-PRIVATE int
+static int
devman_generate_path(char* buf, int len, struct devman_device *dev)
{
int res =0;
/*===========================================================================*
* devman_device_add_event *
*===========================================================================*/
-PRIVATE void
+static void
devman_device_add_event(struct devman_device* dev)
{
struct devman_event * event;
/*===========================================================================*
* devman_device_remove_event *
*===========================================================================*/
-PRIVATE void
+static void
devman_device_remove_event(struct devman_device* dev)
{
struct devman_event * event;
/*===========================================================================*
* devman_event_read *
*===========================================================================*/
-PRIVATE int
+static int
devman_event_read(char **ptr, size_t *len,off_t offset, void *data)
{
struct devman_event *ev = NULL;
/*===========================================================================*
* devman_static_info_read *
*===========================================================================*/
-PRIVATE int
+static int
devman_static_info_read(char **ptr, size_t *len, off_t offset, void *data)
{
struct devman_static_info_inode *n;
/*===========================================================================*
* devman_init_devices *
*===========================================================================*/
-PUBLIC void devman_init_devices()
+void devman_init_devices()
{
event_inode.data = &event_inode_data;
event_inode.read_fn = devman_event_read;
/*===========================================================================*
* do_reply *
*===========================================================================*/
-PRIVATE void do_reply(message *msg, int res)
+static void do_reply(message *msg, int res)
{
msg->m_type = DEVMAN_REPLY;
msg->DEVMAN_RESULT = res;
/*===========================================================================*
* do_add_device *
*===========================================================================*/
-PUBLIC int do_add_device(message *msg)
+int do_add_device(message *msg)
{
endpoint_t ep = msg->m_source;
int res;
/*===========================================================================*
* _find_dev *
*===========================================================================*/
-PRIVATE struct devman_device *
+static struct devman_device *
_find_dev(struct devman_device *dev, int dev_id)
{
struct devman_device *_dev;
/*===========================================================================*
* devman_find_dev *
*===========================================================================*/
-PUBLIC struct devman_device *devman_find_device(int dev_id)
+struct devman_device *devman_find_device(int dev_id)
{
return _find_dev(&root_dev, dev_id);
}
/*===========================================================================*
* devman_dev_add_static_info *
*===========================================================================*/
-PRIVATE int
+static int
devman_dev_add_static_info
(struct devman_device *dev, char * name, char *data)
{
/*===========================================================================*
* devman_dev_add_child *
*===========================================================================*/
-PRIVATE struct devman_device*
+static struct devman_device*
devman_dev_add_child
(struct devman_device *parent, struct devman_device_info *devinf)
{
/*===========================================================================*
* devman_dev_add_info *
*===========================================================================*/
-PRIVATE int
+static int
devman_dev_add_info
(struct devman_device *dev, struct devman_device_info_entry *entry, char *buf)
{
/*===========================================================================*
* do_del_device *
*===========================================================================*/
-PUBLIC int do_del_device(message *msg)
+int do_del_device(message *msg)
{
int dev_id = msg->DEVMAN_DEVICE_ID;
/*===========================================================================*
* devman_get_device *
*===========================================================================*/
-PUBLIC void devman_get_device(struct devman_device *dev)
+void devman_get_device(struct devman_device *dev)
{
if (dev == NULL || dev == &root_dev) {
return;
/*===========================================================================*
* devman_put_device *
*===========================================================================*/
-PUBLIC void devman_put_device(struct devman_device *dev)
+void devman_put_device(struct devman_device *dev)
{
if (dev == NULL || dev == &root_dev ) {
return;
/*===========================================================================*
* devman_del_device *
*===========================================================================*/
-PRIVATE int devman_del_device(struct devman_device *dev)
+static int devman_del_device(struct devman_device *dev)
{
/* does device have children -> error */
/* evtl. remove links */
#include "devman.h"
#include "proto.h"
-PRIVATE void init_hook(void) {
+static void init_hook(void) {
static int first = 1;
if (first) {
}
-PRIVATE int message_hook (message *m)
+static int message_hook (message *m)
{
switch (m->m_type) {
case DEVMAN_ADD_DEV:
}
}
-PRIVATE int
+static int
read_hook
(struct inode *inode, off_t offset, char **ptr, size_t *len, cbdata_t cbdata)
{
}
-PUBLIC int main (int argc, char* argv[])
+int main (int argc, char* argv[])
{
struct fs_hooks hooks;
#include <minix/endpoint.h>
/* Allocate space for the global variables. */
-PRIVATE endpoint_t who_e; /* caller's proc number */
-PRIVATE int callnr; /* system call number */
+static endpoint_t who_e; /* caller's proc number */
+static int callnr; /* system call number */
/* Declare some local functions. */
-FORWARD void get_work(message *m_ptr);
-FORWARD void reply(endpoint_t whom, message *m_ptr);
+static void get_work(message *m_ptr);
+static void reply(endpoint_t whom, message *m_ptr);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* This is the main routine of this service. The main loop consists of
* three major activities: getting new work, processing the work, and
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(
+static void get_work(
message *m_ptr /* message buffer */
)
{
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(
+static void reply(
endpoint_t who_e, /* destination */
message *m_ptr /* message buffer */
)
#include "store.h"
/* Allocate space for the data store. */
-PRIVATE struct data_store ds_store[NR_DS_KEYS];
-PRIVATE struct subscription ds_subs[NR_DS_SUBS];
+static struct data_store ds_store[NR_DS_KEYS];
+static struct subscription ds_subs[NR_DS_SUBS];
/*===========================================================================*
* alloc_data_slot *
*===========================================================================*/
-PRIVATE struct data_store *alloc_data_slot(void)
+static struct data_store *alloc_data_slot(void)
{
/* Allocate a new data slot. */
int i;
/*===========================================================================*
* alloc_sub_slot *
*===========================================================================*/
-PRIVATE struct subscription *alloc_sub_slot(void)
+static struct subscription *alloc_sub_slot(void)
{
/* Allocate a new subscription slot. */
int i;
/*===========================================================================*
* lookup_entry *
*===========================================================================*/
-PRIVATE struct data_store *lookup_entry(const char *key_name, int type)
+static struct data_store *lookup_entry(const char *key_name, int type)
{
/* Lookup an existing entry by key and type. */
int i;
/*===========================================================================*
* lookup_label_entry *
*===========================================================================*/
-PRIVATE struct data_store *lookup_label_entry(unsigned num)
+static struct data_store *lookup_label_entry(unsigned num)
{
/* Lookup an existing label entry by num. */
int i;
/*===========================================================================*
* lookup_sub *
*===========================================================================*/
-PRIVATE struct subscription *lookup_sub(const char *owner)
+static struct subscription *lookup_sub(const char *owner)
{
/* Lookup an existing subscription given its owner. */
int i;
/*===========================================================================*
* ds_getprocname *
*===========================================================================*/
-PRIVATE char *ds_getprocname(endpoint_t e)
+static char *ds_getprocname(endpoint_t e)
{
/* Get a process name given its endpoint. */
struct data_store *dsp;
/*===========================================================================*
* ds_getprocep *
*===========================================================================*/
-PRIVATE endpoint_t ds_getprocep(const char *s)
+static endpoint_t ds_getprocep(const char *s)
{
/* Get a process endpoint given its name. */
struct data_store *dsp;
/*===========================================================================*
* check_auth *
*===========================================================================*/
-PRIVATE int check_auth(const struct data_store *p, endpoint_t ep, int perm)
+static 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(const message *m_ptr, char *key_name)
+static 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(const struct data_store *dsp, int index)
+static 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(const struct subscription *subp,
+static 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. */
/*===========================================================================*
* update_subscribers *
*===========================================================================*/
-PRIVATE void update_subscribers(struct data_store *dsp, int set)
+static void update_subscribers(struct data_store *dsp, int set)
{
/* If set = 1, set bit in the sub bitmap of any subscription matching the given
* entry, otherwise clear it. In both cases, notify the subscriber.
/*===========================================================================*
* map_service *
*===========================================================================*/
-PRIVATE int map_service(const struct rprocpub *rpub)
+static int map_service(const struct rprocpub *rpub)
{
/* Map a new service by registering its label. */
struct data_store *dsp;
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PUBLIC int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *info)
+int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *info)
{
/* Initialize the data store server. */
int i, r;
/*===========================================================================*
* do_publish *
*===========================================================================*/
-PUBLIC int do_publish(message *m_ptr)
+int do_publish(message *m_ptr)
{
struct data_store *dsp;
char key_name[DS_MAX_KEYLEN];
/*===========================================================================*
* do_retrieve *
*===========================================================================*/
-PUBLIC int do_retrieve(message *m_ptr)
+int do_retrieve(message *m_ptr)
{
struct data_store *dsp;
char key_name[DS_MAX_KEYLEN];
/*===========================================================================*
* do_retrieve_label *
*===========================================================================*/
-PUBLIC int do_retrieve_label(const message *m_ptr)
+int do_retrieve_label(const message *m_ptr)
{
struct data_store *dsp;
int r;
/*===========================================================================*
* do_subscribe *
*===========================================================================*/
-PUBLIC int do_subscribe(message *m_ptr)
+int do_subscribe(message *m_ptr)
{
char regex[DS_MAX_KEYLEN+2];
struct subscription *subp;
/*===========================================================================*
* do_check *
*===========================================================================*/
-PUBLIC int do_check(message *m_ptr)
+int do_check(message *m_ptr)
{
struct subscription *subp;
char *owner;
/*===========================================================================*
* do_delete *
*===========================================================================*/
-PUBLIC int do_delete(message *m_ptr)
+int do_delete(message *m_ptr)
{
struct data_store *dsp;
char key_name[DS_MAX_KEYLEN];
/*===========================================================================*
* do_snapshot *
*===========================================================================*/
-PUBLIC int do_snapshot(message *m_ptr)
+int do_snapshot(message *m_ptr)
{
struct data_store *dsp;
struct dsi_map *p;
/*===========================================================================*
* do_getsysinfo *
*===========================================================================*/
-PUBLIC int do_getsysinfo(const message *m_ptr)
+int do_getsysinfo(const message *m_ptr)
{
vir_bytes src_addr;
size_t length;
#include "const.h"
-FORWARD block_t alloc_block_bit(struct super_block *sp, block_t origin,
+static block_t alloc_block_bit(struct super_block *sp, block_t origin,
struct inode *rip);
/*===========================================================================*
* discard_preallocated_blocks *
*===========================================================================*/
-PUBLIC void discard_preallocated_blocks(struct inode *rip)
+void discard_preallocated_blocks(struct inode *rip)
{
/* When called for rip, discard (free) blocks preallocated for rip,
* otherwise discard all preallocated blocks.
/*===========================================================================*
* alloc_block *
*===========================================================================*/
-PUBLIC block_t alloc_block(struct inode *rip, block_t block)
+block_t alloc_block(struct inode *rip, block_t block)
{
/* Allocate a block for inode. If block is provided, then use it as a goal:
* try to allocate this block or his neghbors.
}
-FORWARD void check_block_number(block_t block, struct super_block *sp,
+static void check_block_number(block_t block, struct super_block *sp,
struct group_desc *gd);
/*===========================================================================*
* alloc_block_bit *
*===========================================================================*/
-PRIVATE block_t alloc_block_bit(sp, goal, rip)
+static block_t alloc_block_bit(sp, goal, rip)
struct super_block *sp; /* the filesystem to allocate from */
block_t goal; /* try to allocate near this block */
struct inode *rip; /* used for preallocation */
/*===========================================================================*
* free_block *
*===========================================================================*/
-PUBLIC void free_block(struct super_block *sp, bit_t bit_returned)
+void free_block(struct super_block *sp, bit_t bit_returned)
{
/* Return a block by turning off its bitmap bit. */
int group; /* group number of bit_returned */
}
-PRIVATE void check_block_number(block_t block, struct super_block *sp,
+static void check_block_number(block_t block, struct super_block *sp,
struct group_desc *gd)
{
#include "super.h"
#include "inode.h"
-FORWARD void rm_lru(struct buf *bp);
-FORWARD void rw_block(struct buf *, int);
+static void rm_lru(struct buf *bp);
+static void rw_block(struct buf *, int);
-PRIVATE int vmcache_avail = -1; /* 0 if not available, >0 if available. */
+static int vmcache_avail = -1; /* 0 if not available, >0 if available. */
/*===========================================================================*
* get_block *
*===========================================================================*/
-PUBLIC struct buf *get_block(
+struct buf *get_block(
register dev_t dev, /* on which device is the block? */
register block_t block, /* which block is wanted? */
int only_search /* if NO_READ, don't read, else act normal */
/*===========================================================================*
* put_block *
*===========================================================================*/
-PUBLIC void put_block(
+void put_block(
register struct buf *bp, /* pointer to the buffer to be released */
int block_type /* INODE_BLOCK, DIRECTORY_BLOCK, or whatever */
)
/*===========================================================================*
* rw_block *
*===========================================================================*/
-PRIVATE void rw_block(
+static void rw_block(
register struct buf *bp, /* buffer pointer */
int rw_flag /* READING or WRITING */
)
/*===========================================================================*
* invalidate *
*===========================================================================*/
-PUBLIC void invalidate(
+void invalidate(
dev_t device /* device whose blocks are to be purged */
)
{
/*===========================================================================*
* flushall *
*===========================================================================*/
-PUBLIC void flushall(
+void flushall(
dev_t dev /* device to flush */
)
{
/*===========================================================================*
* rw_scattered *
*===========================================================================*/
-PUBLIC void rw_scattered(
+void rw_scattered(
dev_t dev, /* major-minor device number */
struct buf **bufq, /* pointer to array of buffers */
int bufqsize, /* number of buffers */
/*===========================================================================*
* rm_lru *
*===========================================================================*/
-PRIVATE void rm_lru(
+static void rm_lru(
struct buf *bp
)
{
/*===========================================================================*
* set_blocksize *
*===========================================================================*/
-PUBLIC void set_blocksize(unsigned int blocksize, u32_t blocks,
+void set_blocksize(unsigned int blocksize, u32_t blocks,
u32_t freeblocks, dev_t majordev)
{
struct buf *bp;
/*===========================================================================*
* buf_pool *
*===========================================================================*/
-PUBLIC void buf_pool(int new_nr_bufs)
+void buf_pool(int new_nr_bufs)
{
/* Initialize the buffer pool. */
register struct buf *bp;
#include "const.h"
-FORWARD bit_t alloc_inode_bit(struct super_block *sp, struct inode
+static bit_t alloc_inode_bit(struct super_block *sp, struct inode
*parent, int is_dir);
-FORWARD void free_inode_bit(struct super_block *sp, bit_t bit_returned,
+static void free_inode_bit(struct super_block *sp, bit_t bit_returned,
int is_dir);
-FORWARD void wipe_inode(struct inode *rip);
+static void wipe_inode(struct inode *rip);
/*===========================================================================*
* alloc_inode *
*===========================================================================*/
-PUBLIC struct inode *alloc_inode(struct inode *parent, mode_t bits)
+struct inode *alloc_inode(struct inode *parent, mode_t bits)
{
/* Allocate a free inode on parent's dev, and return a pointer to it. */
/*===========================================================================*
* free_inode *
*===========================================================================*/
-PUBLIC void free_inode(
+void free_inode(
register struct inode *rip /* inode to free */
)
{
}
-FORWARD int find_group_dir(struct super_block *sp, struct inode
+static int find_group_dir(struct super_block *sp, struct inode
*parent);
-FORWARD int find_group_hashalloc(struct super_block *sp, struct inode
+static int find_group_hashalloc(struct super_block *sp, struct inode
*parent);
-FORWARD int find_group_any(struct super_block *sp, struct inode
+static int find_group_any(struct super_block *sp, struct inode
*parent);
-FORWARD int find_group_orlov(struct super_block *sp, struct inode
+static int find_group_orlov(struct super_block *sp, struct inode
*parent);
/*===========================================================================*
* alloc_inode_bit *
*===========================================================================*/
-PRIVATE bit_t alloc_inode_bit(sp, parent, is_dir)
+static bit_t alloc_inode_bit(sp, parent, is_dir)
struct super_block *sp; /* the filesystem to allocate from */
struct inode *parent; /* parent of newly allocated inode */
int is_dir; /* inode will be a directory if it is TRUE */
/*===========================================================================*
* free_inode_bit *
*===========================================================================*/
-PRIVATE void free_inode_bit(struct super_block *sp, bit_t bit_returned,
+static void free_inode_bit(struct super_block *sp, bit_t bit_returned,
int is_dir)
{
/* Return an inode by turning off its bitmap bit. */
/* it's implemented very close to the linux' find_group_dir() */
-PRIVATE int find_group_dir(struct super_block *sp, struct inode *parent)
+static int find_group_dir(struct super_block *sp, struct inode *parent)
{
int avefreei = sp->s_free_inodes_count / sp->s_groups_count;
struct group_desc *gd, *best_gd = NULL;
* 2) Quadradically rehash on the group number.
* 3) Make a linear search for free inode.
*/
-PRIVATE int find_group_hashalloc(struct super_block *sp, struct inode *parent)
+static int find_group_hashalloc(struct super_block *sp, struct inode *parent)
{
int ngroups = sp->s_groups_count;
struct group_desc *gd;
/* Find first group which has free inode slot.
* This is similar to what MFS does.
*/
-PRIVATE int find_group_any(struct super_block *sp, struct inode *parent)
+static int find_group_any(struct super_block *sp, struct inode *parent)
{
int ngroups = sp->s_groups_count;
struct group_desc *gd;
* min_inodes).
*
*/
-PRIVATE int find_group_orlov(struct super_block *sp, struct inode *parent)
+static int find_group_orlov(struct super_block *sp, struct inode *parent)
{
int avefreei = sp->s_free_inodes_count / sp->s_groups_count;
int avefreeb = sp->s_free_blocks_count / sp->s_groups_count;
/*===========================================================================*
* wipe_inode *
*===========================================================================*/
-PRIVATE void wipe_inode(
+static void wipe_inode(
register struct inode *rip /* the inode to be erased */
)
{
#include "super.h"
#include <minix/vfsif.h>
-FORWARD void icopy(struct inode *rip, d_inode *dip, int direction, int
+static void icopy(struct inode *rip, d_inode *dip, int direction, int
norm);
-FORWARD void addhash_inode(struct inode *node);
-FORWARD void unhash_inode(struct inode *node);
+static void addhash_inode(struct inode *node);
+static void unhash_inode(struct inode *node);
/*===========================================================================*
* fs_putnode *
*===========================================================================*/
-PUBLIC int fs_putnode(void)
+int fs_putnode(void)
{
/* Find the inode specified by the request message and decrease its counter.*/
/*===========================================================================*
* init_inode_cache *
*===========================================================================*/
-PUBLIC void init_inode_cache()
+void init_inode_cache()
{
struct inode *rip;
struct inodelist *rlp;
/*===========================================================================*
* addhash_inode *
*===========================================================================*/
-PRIVATE void addhash_inode(struct inode *node)
+static void addhash_inode(struct inode *node)
{
int hashi = node->i_num & INODE_HASH_MASK;
/*===========================================================================*
* unhash_inode *
*===========================================================================*/
-PRIVATE void unhash_inode(struct inode *node)
+static void unhash_inode(struct inode *node)
{
/* remove from hash table */
LIST_REMOVE(node, i_hash);
/*===========================================================================*
* get_inode *
*===========================================================================*/
-PUBLIC struct inode *get_inode(
+struct inode *get_inode(
dev_t dev, /* device on which inode resides */
ino_t numb /* inode number (ANSI: may not be unshort) */
)
/*===========================================================================*
* find_inode *
*===========================================================================*/
-PUBLIC struct inode *find_inode(
+struct inode *find_inode(
dev_t dev, /* device on which inode resides */
ino_t numb /* inode number (ANSI: may not be unshort) */
)
/*===========================================================================*
* put_inode *
*===========================================================================*/
-PUBLIC void put_inode(
+void put_inode(
register struct inode *rip /* pointer to inode to be released */
)
{
/*===========================================================================*
* update_times *
*===========================================================================*/
-PUBLIC void update_times(
+void update_times(
register struct inode *rip /* pointer to inode to be read/written */
)
{
/*===========================================================================*
* rw_inode *
*===========================================================================*/
-PUBLIC void rw_inode(
+void rw_inode(
register struct inode *rip, /* pointer to inode to be read/written */
int rw_flag /* READING or WRITING */
)
/*===========================================================================*
* icopy *
*===========================================================================*/
-PRIVATE void icopy(
+static void icopy(
register struct inode *rip, /* pointer to the in-core inode struct */
register d_inode *dip, /* pointer to the on-disk struct */
int direction, /* READING (from disk) or WRITING (to disk) */
/*===========================================================================*
* dup_inode *
*===========================================================================*/
-PUBLIC void dup_inode(
+void dup_inode(
struct inode *ip /* The inode to be duplicated. */
)
{
#define SAME 1000
-FORWARD int freesp_inode(struct inode *rip, off_t st, off_t end);
-FORWARD int remove_dir(struct inode *rldirp, struct inode *rip, char
+static int freesp_inode(struct inode *rip, off_t st, off_t end);
+static int remove_dir(struct inode *rldirp, struct inode *rip, char
dir_name[NAME_MAX + 1]);
-FORWARD int unlink_file(struct inode *dirp, struct inode *rip, char
+static int unlink_file(struct inode *dirp, struct inode *rip, char
file_name[NAME_MAX + 1]);
-FORWARD off_t nextblock(off_t pos, int blocksize);
-FORWARD void zeroblock_half(struct inode *i, off_t p, int l);
-FORWARD void zeroblock_range(struct inode *i, off_t p, off_t h);
+static off_t nextblock(off_t pos, int blocksize);
+static void zeroblock_half(struct inode *i, off_t p, int l);
+static void zeroblock_range(struct inode *i, off_t p, off_t h);
/* Args to zeroblock_half() */
#define FIRST_HALF 0
/*===========================================================================*
* fs_link *
*===========================================================================*/
-PUBLIC int fs_link()
+int fs_link()
{
/* Perform the link(name1, name2) system call. */
/*===========================================================================*
* fs_unlink *
*===========================================================================*/
-PUBLIC int fs_unlink()
+int fs_unlink()
{
/* Perform the unlink(name) or rmdir(name) system call. The code for these two
* is almost the same. They differ only in some condition testing. Unlink()
/*===========================================================================*
* fs_rdlink *
*===========================================================================*/
-PUBLIC int fs_rdlink()
+int fs_rdlink()
{
block_t b; /* block containing link text */
struct buf *bp = NULL; /* buffer containing link text */
/*===========================================================================*
* remove_dir *
*===========================================================================*/
-PRIVATE int remove_dir(rldirp, rip, dir_name)
+static int remove_dir(rldirp, rip, dir_name)
struct inode *rldirp; /* parent directory */
struct inode *rip; /* directory to be removed */
char dir_name[NAME_MAX + 1]; /* name of directory to be removed */
/*===========================================================================*
* unlink_file *
*===========================================================================*/
-PRIVATE int unlink_file(dirp, rip, file_name)
+static int unlink_file(dirp, rip, file_name)
struct inode *dirp; /* parent directory of file */
struct inode *rip; /* inode of file, may be NULL too. */
char file_name[NAME_MAX + 1]; /* name of file to be removed */
/*===========================================================================*
* fs_rename *
*===========================================================================*/
-PUBLIC int fs_rename()
+int fs_rename()
{
/* Perform the rename(name1, name2) system call. */
struct inode *old_dirp, *old_ip; /* ptrs to old dir, file inodes */
/*===========================================================================*
* fs_ftrunc *
*===========================================================================*/
-PUBLIC int fs_ftrunc(void)
+int fs_ftrunc(void)
{
struct inode *rip;
off_t start, end;
/*===========================================================================*
* truncate_inode *
*===========================================================================*/
-PUBLIC int truncate_inode(rip, newsize)
+int truncate_inode(rip, newsize)
register struct inode *rip; /* pointer to inode to be truncated */
off_t newsize; /* inode must become this size */
{
/*===========================================================================*
* freesp_inode *
*===========================================================================*/
-PRIVATE int freesp_inode(rip, start, end)
+static int freesp_inode(rip, start, end)
register struct inode *rip; /* pointer to inode to be partly freed */
off_t start, end; /* range of bytes to free (end uninclusive) */
{
/*===========================================================================*
* nextblock *
*===========================================================================*/
-PRIVATE off_t nextblock(pos, block_size)
+static off_t nextblock(pos, block_size)
off_t pos;
unsigned short block_size;
{
/*===========================================================================*
* zeroblock_half *
*===========================================================================*/
-PRIVATE void zeroblock_half(rip, pos, half)
+static void zeroblock_half(rip, pos, half)
struct inode *rip;
off_t pos;
int half;
/*===========================================================================*
* zeroblock_range *
*===========================================================================*/
-PRIVATE void zeroblock_range(rip, pos, len)
+static void zeroblock_range(rip, pos, len)
struct inode *rip;
off_t pos;
off_t len;
#include "inode.h"
/* Declare some local functions. */
-FORWARD void get_work(message *m_in);
-FORWARD void reply(endpoint_t who, message *m_out);
+static void get_work(message *m_in);
+static void reply(endpoint_t who, message *m_out);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
EXTERN int env_argc;
EXTERN char **env_argv;
-PRIVATE struct optset optset_table[] = {
+static struct optset optset_table[] = {
{ "sb", OPT_INT, &opt.block_with_super, 0 },
{ "orlov", OPT_BOOL, &opt.use_orlov, TRUE },
{ "oldalloc", OPT_BOOL, &opt.use_orlov, FALSE },
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
/* This is the main routine of this service. The main loop consists of
* three major activities: getting new work, processing the work, and
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the Minix file server. */
int i;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(m_in)
+static void get_work(m_in)
message *m_in; /* pointer to message */
{
int r, srcok = 0;
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(
+static void reply(
endpoint_t who,
message *m_out /* report result */
)
/*===========================================================================*
* fs_sync *
*===========================================================================*/
-PUBLIC int fs_sync()
+int fs_sync()
{
/* Perform the sync() system call. Flush all the tables.
* The order in which the various tables are flushed is critical. The
/*===========================================================================*
* fs_flush *
*===========================================================================*/
-PUBLIC int fs_flush()
+int fs_flush()
{
/* Flush the blocks of a device from the cache after writing any dirty blocks
* to disk.
/*===========================================================================*
* fs_new_driver *
*===========================================================================*/
-PUBLIC int fs_new_driver(void)
+int fs_new_driver(void)
{
/* Set a new driver endpoint for this device. */
dev_t dev;
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
-PUBLIC int fs_readsuper()
+int fs_readsuper()
{
/* This function reads the superblock of the partition, gets the root inode
* and sends back the details of them. Note, that the FS process does not
/*===========================================================================*
* fs_mountpoint *
*===========================================================================*/
-PUBLIC int fs_mountpoint()
+int fs_mountpoint()
{
/* This function looks up the mount point, it checks the condition whether
* the partition can be mounted on the inode or not.
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
-PUBLIC int fs_unmount()
+int fs_unmount()
{
/* Unmount a file system by device number. */
int count;
#include "super.h"
#include <minix/vfsif.h>
-FORWARD struct inode *new_node(struct inode *ldirp, char *string, mode_t
+static struct inode *new_node(struct inode *ldirp, char *string, mode_t
bits, block_t z0);
/*===========================================================================*
* fs_create *
*===========================================================================*/
-PUBLIC int fs_create()
+int fs_create()
{
phys_bytes len;
int r;
/*===========================================================================*
* fs_mknod *
*===========================================================================*/
-PUBLIC int fs_mknod()
+int fs_mknod()
{
struct inode *ip, *ldirp;
char lastc[NAME_MAX + 1];
/*===========================================================================*
* fs_mkdir *
*===========================================================================*/
-PUBLIC int fs_mkdir()
+int fs_mkdir()
{
int r1, r2; /* status codes */
ino_t dot, dotdot; /* inode numbers for . and .. */
/*===========================================================================*
* fs_slink *
*===========================================================================*/
-PUBLIC int fs_slink()
+int fs_slink()
{
phys_bytes len;
struct inode *sip; /* inode containing symbolic link */
/*===========================================================================*
* new_node *
*===========================================================================*/
-PRIVATE struct inode *new_node(struct inode *ldirp,
+static struct inode *new_node(struct inode *ldirp,
char *string, mode_t bits, block_t b0)
{
/* New_node() is called by fs_open(), fs_mknod(), and fs_mkdir().
/*===========================================================================*
* fs_inhibread *
*===========================================================================*/
-PUBLIC int fs_inhibread()
+int fs_inhibread()
{
struct inode *rip;
#include <minix/vfsif.h>
#include <minix/libminixfs.h>
-PUBLIC char dot1[2] = "."; /* used for search_dir to bypass the access */
-PUBLIC char dot2[3] = ".."; /* permissions for . and .. */
+char dot1[2] = "."; /* used for search_dir to bypass the access */
+char dot2[3] = ".."; /* permissions for . and .. */
-FORWARD char *get_name(char *name, char string[NAME_MAX+1]);
-FORWARD int ltraverse(struct inode *rip, char *suffix);
-FORWARD int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
+static char *get_name(char *name, char string[NAME_MAX+1]);
+static int ltraverse(struct inode *rip, char *suffix);
+static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
inode **res_inop, size_t *offsetp, int *symlinkp);
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
-PUBLIC int fs_lookup()
+int fs_lookup()
{
cp_grant_id_t grant;
int r, r1, flags, symlinks;
/*===========================================================================*
* parse_path *
*===========================================================================*/
-PRIVATE int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
+static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
ino_t dir_ino;
ino_t root_ino;
int flags;
/*===========================================================================*
* ltraverse *
*===========================================================================*/
-PRIVATE int ltraverse(rip, suffix)
+static int ltraverse(rip, suffix)
register struct inode *rip; /* symbolic link */
char *suffix; /* current remaining path. Has to point in the
* user_path buffer
/*===========================================================================*
* advance *
*===========================================================================*/
-PUBLIC struct inode *advance(dirp, string, chk_perm)
+struct inode *advance(dirp, string, chk_perm)
struct inode *dirp; /* inode for directory to be searched */
char string[NAME_MAX + 1]; /* component name to look for */
int chk_perm; /* check permissions when string is looked up*/
/*===========================================================================*
* get_name *
*===========================================================================*/
-PRIVATE char *get_name(path_name, string)
+static char *get_name(path_name, string)
char *path_name; /* path name to parse */
char string[NAME_MAX+1]; /* component extracted from 'old_name' */
{
/*===========================================================================*
* search_dir *
*===========================================================================*/
-PUBLIC int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype)
+int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype)
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
char string[NAME_MAX + 1]; /* component to search for */
ino_t *numb; /* pointer to inode number */
#include "super.h"
#include <minix/vfsif.h>
-FORWARD int in_group(gid_t grp);
+static int in_group(gid_t grp);
/*===========================================================================*
* fs_chmod *
*===========================================================================*/
-PUBLIC int fs_chmod()
+int fs_chmod()
{
/* Perform the chmod(name, mode) system call. */
/*===========================================================================*
* fs_chown *
*===========================================================================*/
-PUBLIC int fs_chown()
+int fs_chown()
{
register struct inode *rip;
register int r;
/*===========================================================================*
* forbidden *
*===========================================================================*/
-PUBLIC int forbidden(register struct inode *rip, mode_t access_desired)
+int forbidden(register struct inode *rip, mode_t access_desired)
{
/* Given a pointer to an inode, 'rip', and the access desired, determine
* if the access is allowed, and if not why not. The routine looks up the
/*===========================================================================*
* in_group *
*===========================================================================*/
-PRIVATE int in_group(gid_t grp)
+static int in_group(gid_t grp)
{
int i;
/*===========================================================================*
* read_only *
*===========================================================================*/
-PUBLIC int read_only(ip)
+int read_only(ip)
struct inode *ip; /* ptr to inode whose file sys is to be cked */
{
/* Check to see if the file system on which the inode 'ip' resides is mounted
#include <sys/param.h>
-FORWARD struct buf *rahead(struct inode *rip, block_t baseblock, u64_t
+static struct buf *rahead(struct inode *rip, block_t baseblock, u64_t
position, unsigned bytes_ahead);
-FORWARD int rw_chunk(struct inode *rip, u64_t position, unsigned off,
+static int rw_chunk(struct inode *rip, u64_t position, unsigned off,
size_t chunk, unsigned left, int rw_flag, cp_grant_id_t gid, unsigned
buf_off, unsigned int block_size, int *completed);
-PRIVATE char getdents_buf[GETDENTS_BUFSIZ];
+static char getdents_buf[GETDENTS_BUFSIZ];
-PRIVATE off_t rdahedpos; /* position to read ahead */
-PRIVATE struct inode *rdahed_inode; /* pointer to inode to read ahead */
+static off_t rdahedpos; /* position to read ahead */
+static struct inode *rdahed_inode; /* pointer to inode to read ahead */
/*===========================================================================*
* fs_readwrite *
*===========================================================================*/
-PUBLIC int fs_readwrite(void)
+int fs_readwrite(void)
{
int r, rw_flag, block_spec;
int regular;
/*===========================================================================*
* fs_breadwrite *
*===========================================================================*/
-PUBLIC int fs_breadwrite(void)
+int fs_breadwrite(void)
{
int r, rw_flag, completed;
cp_grant_id_t gid;
/*===========================================================================*
* rw_chunk *
*===========================================================================*/
-PRIVATE int rw_chunk(rip, position, off, chunk, left, rw_flag, gid,
+static int rw_chunk(rip, position, off, chunk, left, rw_flag, gid,
buf_off, block_size, completed)
register struct inode *rip; /* pointer to inode for file to be rd/wr */
u64_t position; /* position within file to read or write */
/*===========================================================================*
* read_map *
*===========================================================================*/
-PUBLIC block_t read_map(rip, position)
+block_t read_map(rip, position)
register struct inode *rip; /* ptr to inode to map from */
off_t position; /* position in file whose blk wanted */
{
/*===========================================================================*
* rd_indir *
*===========================================================================*/
-PUBLIC block_t rd_indir(bp, index)
+block_t rd_indir(bp, index)
struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */
{
/*===========================================================================*
* read_ahead *
*===========================================================================*/
-PUBLIC void read_ahead()
+void read_ahead()
{
/* Read a block into the cache before it is needed. */
unsigned int block_size;
/*===========================================================================*
* rahead *
*===========================================================================*/
-PRIVATE struct buf *rahead(rip, baseblock, position, bytes_ahead)
+static struct buf *rahead(rip, baseblock, position, bytes_ahead)
register struct inode *rip; /* pointer to inode for file to be read */
block_t baseblock; /* block at current position */
u64_t position; /* position within file */
/*===========================================================================*
* fs_getdents *
*===========================================================================*/
-PUBLIC int fs_getdents(void)
+int fs_getdents(void)
{
register struct inode *rip;
int o, r, done;
/*===========================================================================*
* stat_inode *
*===========================================================================*/
-PRIVATE int stat_inode(
+static int stat_inode(
register struct inode *rip, /* pointer to inode to stat */
endpoint_t who_e, /* Caller endpoint */
cp_grant_id_t gid /* grant for the stat buf */
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
-PUBLIC int fs_fstatfs()
+int fs_fstatfs()
{
struct statfs st;
struct inode *rip;
/*===========================================================================*
* fs_stat *
*===========================================================================*/
-PUBLIC int fs_stat()
+int fs_stat()
{
register int r; /* return value */
register struct inode *rip; /* target inode */
/*===========================================================================*
* fs_statvfs *
*===========================================================================*/
-PUBLIC int fs_statvfs()
+int fs_statvfs()
{
struct statvfs st;
struct super_block *sp;
#include "super.h"
#include "const.h"
-FORWARD off_t ext2_max_size(int block_size);
-FORWARD u32_t ext2_count_dirs(struct super_block *sp);
+static off_t ext2_max_size(int block_size);
+static u32_t ext2_count_dirs(struct super_block *sp);
-FORWARD void super_copy(register struct super_block *dest, register
+static void super_copy(register struct super_block *dest, register
struct super_block *source);
-FORWARD void copy_group_descriptors(register struct group_desc
+static void copy_group_descriptors(register struct group_desc
*dest_array, register struct group_desc *source_array, unsigned int
ngroups);
-PRIVATE off_t super_block_offset;
+static off_t super_block_offset;
/*===========================================================================*
* get_super *
*===========================================================================*/
-PUBLIC struct super_block *get_super(
+struct super_block *get_super(
dev_t dev /* device number whose super_block is sought */
)
{
/*===========================================================================*
* get_block_size *
*===========================================================================*/
-PUBLIC unsigned int get_block_size(dev_t dev)
+unsigned int get_block_size(dev_t dev)
{
if (dev == NO_DEV)
panic("request for block size of NO_DEV");
return(fs_block_size);
}
-PRIVATE struct group_desc *ondisk_group_descs;
+static struct group_desc *ondisk_group_descs;
/*===========================================================================*
* read_super *
*===========================================================================*/
-PUBLIC int read_super(sp)
+int read_super(sp)
register struct super_block *sp; /* pointer to a superblock */
{
/* Read a superblock. */
/*===========================================================================*
* write_super *
*===========================================================================*/
-PUBLIC void write_super(sp)
+void write_super(sp)
struct super_block *sp; /* pointer to a superblock */
{
/* Write a superblock and gdt. */
}
-PRIVATE u32_t ext2_count_dirs(struct super_block *sp)
+static u32_t ext2_count_dirs(struct super_block *sp)
{
u32_t count = 0;
unsigned int i;
* Anyway this function is safe for any change.
* Note: there is also limitation from VFS (to LONG_MAX, i.e. 2GB).
*/
-PRIVATE off_t ext2_max_size(int block_size)
+static off_t ext2_max_size(int block_size)
{
/* 12 is EXT2_NDIR_BLOCKS used in calculations. */
if (EXT2_NDIR_BLOCKS != 12)
/*===========================================================================*
* super_copy *
*===========================================================================*/
-PRIVATE void super_copy(
+static void super_copy(
register struct super_block *dest,
register struct super_block *source
)
/*===========================================================================*
* gd_copy *
*===========================================================================*/
-PRIVATE void gd_copy(
+static void gd_copy(
register struct group_desc *dest,
register struct group_desc *source
)
/*===========================================================================*
* copy_group_descriptors *
*===========================================================================*/
-PRIVATE void copy_group_descriptors(
+static void copy_group_descriptors(
register struct group_desc *dest_array,
register struct group_desc *source_array,
unsigned int ngroups
#include "buf.h"
#include "super.h"
-PUBLIC int (*fs_call_vec[])(void) = {
+int (*fs_call_vec[])(void) = {
no_sys, /* 0 not used */
no_sys, /* 1 */ /* Was: fs_getnode */
fs_putnode, /* 2 */
/*===========================================================================*
* fs_utime *
*===========================================================================*/
-PUBLIC int fs_utime()
+int fs_utime()
{
register struct inode *rip;
register int r;
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys()
+int no_sys()
{
/* Somebody has used an illegal system call number */
printf("no_sys: invalid call %d\n", req_nr);
/*===========================================================================*
* conv2 *
*===========================================================================*/
-PUBLIC unsigned conv2(norm, w)
+unsigned conv2(norm, w)
int norm; /* TRUE if no swap, FALSE for byte swap */
int w; /* promotion of 16-bit word to be swapped */
{
/*===========================================================================*
* conv4 *
*===========================================================================*/
-PUBLIC long conv4(norm, x)
+long conv4(norm, x)
int norm; /* TRUE if no swap, FALSE for byte swap */
long x; /* 32-bit long to be byte swapped */
{
/*===========================================================================*
* clock_time *
*===========================================================================*/
-PUBLIC time_t clock_time()
+time_t clock_time()
{
/* This routine returns the time in seconds since 1.1.1970. MINIX is an
* astrophysically naive system that assumes the earth rotates at a constant
/*===========================================================================*
* mfs_min *
*===========================================================================*/
-PUBLIC int min(unsigned int l, unsigned int r)
+int min(unsigned int l, unsigned int r)
{
if(r >= l) return(l);
/*===========================================================================*
* mfs_nul *
*===========================================================================*/
-PUBLIC void mfs_nul_f(char *file, int line, char *str, unsigned int len,
+void mfs_nul_f(char *file, int line, char *str, unsigned int len,
unsigned int maxlen)
{
if(len < maxlen && str[len-1] != '\0') {
/*===========================================================================*
* sanity_check *
*===========================================================================*/
-PUBLIC void sanitycheck(char *file, int line)
+void sanitycheck(char *file, int line)
{
MYASSERT(SELF_E > 0);
if(superblock->s_dev != NO_DEV) {
/*===========================================================================*
* ansi_strcmp *
*===========================================================================*/
-PUBLIC int ansi_strcmp(register const char* ansi_s, register const char *s2,
+int ansi_strcmp(register const char* ansi_s, register const char *s2,
register size_t ansi_s_length)
{
/* Compare non null-terminated string ansi_s (length=ansi_s_length)
/*===========================================================================*
* setbit *
*===========================================================================*/
-PUBLIC bit_t setbit(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
+bit_t setbit(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
{
/* Find free bit in bitmap and set. Return number of the bit,
* if failed return -1.
/*===========================================================================*
* setbyte *
*===========================================================================*/
-PUBLIC bit_t setbyte(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
+bit_t setbyte(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
{
/* Find free byte in bitmap and set it. Return number of the starting bit,
* if failed return -1.
/*===========================================================================*
* unsetbit *
*===========================================================================*/
-PUBLIC int unsetbit(bitchunk_t *bitmap, bit_t bit)
+int unsetbit(bitchunk_t *bitmap, bit_t bit)
{
/* Unset specified bit. If requested bit is already free return -1,
* otherwise return 0.
#include "inode.h"
#include "super.h"
-FORWARD void wr_indir(struct buf *bp, int index, block_t block);
-FORWARD int empty_indir(struct buf *, struct super_block *);
+static void wr_indir(struct buf *bp, int index, block_t block);
+static int empty_indir(struct buf *, struct super_block *);
/*===========================================================================*
* write_map *
*===========================================================================*/
-PUBLIC int write_map(rip, position, new_block, op)
+int write_map(rip, position, new_block, op)
struct inode *rip; /* pointer to inode to be changed */
off_t position; /* file address to be mapped */
block_t new_block; /* block # to be inserted */
/*===========================================================================*
* wr_indir *
*===========================================================================*/
-PRIVATE void wr_indir(bp, index, block)
+static void wr_indir(bp, index, block)
struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */
block_t block; /* block to write */
/*===========================================================================*
* empty_indir *
*===========================================================================*/
-PRIVATE int empty_indir(bp, sb)
+static int empty_indir(bp, sb)
struct buf *bp; /* pointer to indirect block */
struct super_block *sb; /* superblock of device block resides on */
{
/*===========================================================================*
* new_block *
*===========================================================================*/
-PUBLIC struct buf *new_block(rip, position)
+struct buf *new_block(rip, position)
register struct inode *rip; /* pointer to inode */
off_t position; /* file pointer */
{
/*===========================================================================*
* zero_block *
*===========================================================================*/
-PUBLIC void zero_block(bp)
+void zero_block(bp)
register struct buf *bp; /* pointer to buffer to zero */
{
/* Zero a block. */
#include "inc.h"
-PRIVATE LIST_HEAD(hash_head, inode) hash_table[NUM_HASH_SLOTS];
+static LIST_HEAD(hash_head, inode) hash_table[NUM_HASH_SLOTS];
-FORWARD void del_one_dentry(struct inode *ino);
-FORWARD unsigned int hash_dentry(struct inode *parent, char *name);
+static void del_one_dentry(struct inode *ino);
+static unsigned int hash_dentry(struct inode *parent, char *name);
/*===========================================================================*
* init_dentry *
*===========================================================================*/
-PUBLIC void init_dentry()
+void init_dentry()
{
/* Initialize the names hashtable.
*/
/*===========================================================================*
* lookup_dentry *
*===========================================================================*/
-PUBLIC struct inode *lookup_dentry(parent, name)
+struct inode *lookup_dentry(parent, name)
struct inode *parent;
char *name;
{
/*===========================================================================*
* add_dentry *
*===========================================================================*/
-PUBLIC void add_dentry(parent, name, ino)
+void add_dentry(parent, name, ino)
struct inode *parent;
char *name;
struct inode *ino;
/*===========================================================================*
* del_one_dentry *
*===========================================================================*/
-PRIVATE void del_one_dentry(ino)
+static void del_one_dentry(ino)
struct inode *ino;
{
/* This inode has become inaccessible by name. Disassociate it from its parent
/*===========================================================================*
* del_dentry *
*===========================================================================*/
-PUBLIC void del_dentry(ino)
+void del_dentry(ino)
struct inode *ino;
{
/* Disassociate an inode from its parent, effectively deleting it. Recursively
/*===========================================================================*
* hash_dentry *
*===========================================================================*/
-PRIVATE unsigned int hash_dentry(parent, name)
+static unsigned int hash_dentry(parent, name)
struct inode *parent;
char *name;
{
/*===========================================================================*
* get_handle *
*===========================================================================*/
-PUBLIC int get_handle(ino)
+int get_handle(ino)
struct inode *ino;
{
/* Get an open file or directory handle for an inode.
/*===========================================================================*
* put_handle *
*===========================================================================*/
-PUBLIC void put_handle(ino)
+void put_handle(ino)
struct inode *ino;
{
/* Close an open file or directory handle associated with an inode.
#include "inc.h"
-PRIVATE struct inode inodes[NUM_INODES];
+static struct inode inodes[NUM_INODES];
-PRIVATE TAILQ_HEAD(free_head, inode) free_list;
+static TAILQ_HEAD(free_head, inode) free_list;
/*===========================================================================*
* init_inode *
*===========================================================================*/
-PUBLIC struct inode *init_inode()
+struct inode *init_inode()
{
/* Initialize inode table. Return the root inode.
*/
/*===========================================================================*
* find_inode *
*===========================================================================*/
-PUBLIC struct inode *find_inode(ino_nr)
+struct inode *find_inode(ino_nr)
ino_t ino_nr;
{
/* Get an inode based on its inode number. Do not increase its reference count.
/*===========================================================================*
* get_inode *
*===========================================================================*/
-PUBLIC void get_inode(ino)
+void get_inode(ino)
struct inode *ino;
{
/* Increase the given inode's reference count. If both reference and link
/*===========================================================================*
* put_inode *
*===========================================================================*/
-PUBLIC void put_inode(ino)
+void put_inode(ino)
struct inode *ino;
{
/* Decrease an inode's reference count. If this count has reached zero, close
/*===========================================================================*
* link_inode *
*===========================================================================*/
-PUBLIC void link_inode(parent, ino)
+void link_inode(parent, ino)
struct inode *parent;
struct inode *ino;
{
/*===========================================================================*
* unlink_inode *
*===========================================================================*/
-PUBLIC void unlink_inode(ino)
+void unlink_inode(ino)
struct inode *ino;
{
/* Unlink an inode from its parent. If both reference and link count have
/*===========================================================================*
* get_free_inode *
*===========================================================================*/
-PUBLIC struct inode *get_free_inode()
+struct inode *get_free_inode()
{
/* Return a free inode object (with reference count 1), if available.
*/
/*===========================================================================*
* have_free_inode *
*===========================================================================*/
-PUBLIC int have_free_inode()
+int have_free_inode()
{
/* Check whether there are any free inodes at the moment. Kind of lame, but
* this allows for easier error recovery in some places.
/*===========================================================================*
* have_used_inode *
*===========================================================================*/
-PUBLIC int have_used_inode()
+int have_used_inode()
{
/* Check whether any inodes are still in use, that is, any of the inodes have
* a reference count larger than zero.
/*===========================================================================*
* do_putnode *
*===========================================================================*/
-PUBLIC int do_putnode()
+int do_putnode()
{
/* Decrease an inode's reference count.
*/
#include <fcntl.h>
-FORWARD int force_remove(char *path, int dir);
+static int force_remove(char *path, int dir);
/*===========================================================================*
* do_create *
*===========================================================================*/
-PUBLIC int do_create()
+int do_create()
{
/* Create a new file.
*/
/*===========================================================================*
* do_mkdir *
*===========================================================================*/
-PUBLIC int do_mkdir()
+int do_mkdir()
{
/* Make a new directory.
*/
/*===========================================================================*
* force_remove *
*===========================================================================*/
-PRIVATE int force_remove(path, dir)
+static int force_remove(path, dir)
char *path; /* path to file or directory */
int dir; /* TRUE iff directory */
{
/*===========================================================================*
* do_unlink *
*===========================================================================*/
-PUBLIC int do_unlink()
+int do_unlink()
{
/* Delete a file.
*/
/*===========================================================================*
* do_rmdir *
*===========================================================================*/
-PUBLIC int do_rmdir()
+int do_rmdir()
{
/* Remove an empty directory.
*/
/*===========================================================================*
* do_rename *
*===========================================================================*/
-PUBLIC int do_rename()
+int do_rename()
{
/* Rename a file or directory.
*/
#include "inc.h"
-FORWARD int get_mask(vfs_ucred_t *ucred);
-FORWARD int access_as_dir(struct inode *ino, struct hgfs_attr *attr, int
+static int get_mask(vfs_ucred_t *ucred);
+static int access_as_dir(struct inode *ino, struct hgfs_attr *attr, int
uid, int mask);
-FORWARD int next_name(char **ptr, char **start, char name[NAME_MAX+1]);
-FORWARD int go_up(char path[PATH_MAX], struct inode *ino, struct inode
+static int next_name(char **ptr, char **start, char name[NAME_MAX+1]);
+static int go_up(char path[PATH_MAX], struct inode *ino, struct inode
**res_ino, struct hgfs_attr *attr);
-FORWARD int go_down(char path[PATH_MAX], struct inode *ino, char *name,
+static int go_down(char path[PATH_MAX], struct inode *ino, char *name,
struct inode **res_ino, struct hgfs_attr *attr);
/*===========================================================================*
* get_mask *
*===========================================================================*/
-PRIVATE int get_mask(ucred)
+static int get_mask(ucred)
vfs_ucred_t *ucred; /* credentials of the caller */
{
/* Given the caller's credentials, precompute a search access mask to test
/*===========================================================================*
* access_as_dir *
*===========================================================================*/
-PRIVATE int access_as_dir(ino, attr, uid, mask)
+static int access_as_dir(ino, attr, uid, mask)
struct inode *ino; /* the inode to test */
struct hgfs_attr *attr; /* attributes of the inode */
int uid; /* UID of the caller */
/*===========================================================================*
* next_name *
*===========================================================================*/
-PRIVATE int next_name(ptr, start, name)
+static int next_name(ptr, start, name)
char **ptr; /* cursor pointer into path (in, out) */
char **start; /* place to store start of name */
char name[NAME_MAX+1]; /* place to store name */
/*===========================================================================*
* go_up *
*===========================================================================*/
-PRIVATE int go_up(path, ino, res_ino, attr)
+static int go_up(path, ino, res_ino, attr)
char path[PATH_MAX]; /* path to take the last part from */
struct inode *ino; /* inode of the current directory */
struct inode **res_ino; /* place to store resulting inode */
/*===========================================================================*
* go_down *
*===========================================================================*/
-PRIVATE int go_down(path, parent, name, res_ino, attr)
+static int go_down(path, parent, name, res_ino, attr)
char path[PATH_MAX]; /* path to add the name to */
struct inode *parent; /* inode of the current directory */
char *name; /* name of the directory entry */
/*===========================================================================*
* do_lookup *
*===========================================================================*/
-PUBLIC int do_lookup()
+int do_lookup()
{
/* Resolve a path string to an inode.
*/
#include <unistd.h>
#include <stdlib.h>
-FORWARD void get_work(endpoint_t *who_e);
-FORWARD void send_reply(int err, int transid);
+static void get_work(endpoint_t *who_e);
+static void send_reply(int err, int transid);
-PRIVATE struct optset optset_table[] = {
+static struct optset optset_table[] = {
{ "prefix", OPT_STRING, opt.prefix, sizeof(opt.prefix) },
{ "uid", OPT_INT, &opt.uid, 10 },
{ "gid", OPT_INT, &opt.gid, 10 },
};
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize this file server. Called at startup time.
*/
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(argc, argv)
+int main(argc, argv)
int argc;
char *argv[];
{
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(who_e)
+static void get_work(who_e)
endpoint_t *who_e;
{
/* Receive a request message from VFS. Return the request call number.
/*===========================================================================*
* send_reply *
*===========================================================================*/
-PRIVATE void send_reply(err, transid)
+static void send_reply(err, transid)
int err; /* resulting error code */
int transid;
{
/*===========================================================================*
* do_fstatfs *
*===========================================================================*/
-PUBLIC int do_fstatfs()
+int do_fstatfs()
{
/* Retrieve file system statistics.
*/
/*===========================================================================*
* do_statvfs *
*===========================================================================*/
-PUBLIC int do_statvfs()
+int do_statvfs()
{
/* Retrieve file system statistics.
*/
/*===========================================================================*
* do_readsuper *
*===========================================================================*/
-PUBLIC int do_readsuper()
+int do_readsuper()
{
/* Mount the file system.
*/
/*===========================================================================*
* do_unmount *
*===========================================================================*/
-PUBLIC int do_unmount()
+int do_unmount()
{
/* Unmount the file system.
*/
/*===========================================================================*
* normalize_name *
*===========================================================================*/
-PUBLIC void normalize_name(dst, src)
+void normalize_name(dst, src)
char dst[NAME_MAX+1];
char *src;
{
/*===========================================================================*
* compare_name *
*===========================================================================*/
-PUBLIC int compare_name(name1, name2)
+int compare_name(name1, name2)
char *name1;
char *name2;
{
/*===========================================================================*
* make_path *
*===========================================================================*/
-PUBLIC int make_path(path, ino)
+int make_path(path, ino)
char path[PATH_MAX];
struct inode *ino;
{
/*===========================================================================*
* push_path *
*===========================================================================*/
-PUBLIC int push_path(path, name)
+int push_path(path, name)
char path[PATH_MAX];
char *name;
{
/*===========================================================================*
* pop_path *
*===========================================================================*/
-PUBLIC void pop_path(path)
+void pop_path(path)
char path[PATH_MAX];
{
/* Remove the last component from a path.
/*===========================================================================*
* do_read *
*===========================================================================*/
-PUBLIC int do_read()
+int do_read()
{
/* Read data from a file.
*/
/*===========================================================================*
* do_getdents *
*===========================================================================*/
-PUBLIC int do_getdents()
+int do_getdents()
{
/* Retrieve directory entries.
*/
/*===========================================================================*
* get_mode *
*===========================================================================*/
-PUBLIC mode_t get_mode(ino, mode)
+mode_t get_mode(ino, mode)
struct inode *ino;
int mode;
{
/*===========================================================================*
* do_stat *
*===========================================================================*/
-PUBLIC int do_stat()
+int do_stat()
{
/* Retrieve inode status.
*/
/*===========================================================================*
* do_chmod *
*===========================================================================*/
-PUBLIC int do_chmod()
+int do_chmod()
{
/* Change file mode.
*/
/*===========================================================================*
* do_utime *
*===========================================================================*/
-PUBLIC int do_utime()
+int do_utime()
{
/* Set file times.
*/
#define _TABLE
#include "inc.h"
-PUBLIC int (*call_vec[])(void) = {
+int (*call_vec[])(void) = {
no_sys, /* 0 */
no_sys, /* 1 getnode */
do_putnode, /* 2 putnode */
/*===========================================================================*
* get_name *
*===========================================================================*/
-PUBLIC int get_name(grant, len, name)
+int get_name(grant, len, name)
cp_grant_id_t grant; /* memory grant for the path component */
size_t len; /* length of the name, including '\0' */
char name[NAME_MAX+1]; /* buffer in which store the result */
/*===========================================================================*
* do_noop *
*===========================================================================*/
-PUBLIC int do_noop()
+int do_noop()
{
/* Generic handler for no-op system calls.
*/
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys()
+int no_sys()
{
/* Generic handler for unimplemented system calls.
*/
/*===========================================================================*
* verify_path *
*===========================================================================*/
-PUBLIC int verify_path(path, ino, attr, stale)
+int verify_path(path, ino, attr, stale)
char path[PATH_MAX];
struct inode *ino;
struct hgfs_attr *attr;
/*===========================================================================*
* verify_inode *
*===========================================================================*/
-PUBLIC int verify_inode(ino, path, attr)
+int verify_inode(ino, path, attr)
struct inode *ino; /* inode to verify */
char path[PATH_MAX]; /* buffer in which to store the path */
struct hgfs_attr *attr; /* buffer for attributes, or NULL */
/*===========================================================================*
* verify_dentry *
*===========================================================================*/
-PUBLIC int verify_dentry(parent, name, path, res_ino)
+int verify_dentry(parent, name, path, res_ino)
struct inode *parent; /* parent inode: the inode to verify */
char name[NAME_MAX+1]; /* the given directory entry path component */
char path[PATH_MAX]; /* buffer to store the resulting path in */
#include "inc.h"
-FORWARD int write_file(struct inode *ino, u64_t *posp, size_t *countp,
+static int write_file(struct inode *ino, u64_t *posp, size_t *countp,
cp_grant_id_t *grantp);
/*===========================================================================*
* write_file *
*===========================================================================*/
-PRIVATE int write_file(ino, posp, countp, grantp)
+static int write_file(ino, posp, countp, grantp)
struct inode *ino;
u64_t *posp;
size_t *countp;
/*===========================================================================*
* do_write *
*===========================================================================*/
-PUBLIC int do_write()
+int do_write()
{
/* Write data to a file.
*/
/*===========================================================================*
* do_ftrunc *
*===========================================================================*/
-PUBLIC int do_ftrunc()
+int do_ftrunc()
{
/* Change file size or create file holes.
*/
#if BUF512_NR
DECLARE_TYPE(buf512, buf512_t, 512);
-PRIVATE acc_t *buf512_freelist;
+static acc_t *buf512_freelist;
DECLARE_STORAGE(buf512_t, buffers512, BUF512_NR);
-FORWARD void bf_512free ARGS(( acc_t *acc ));
+static void bf_512free ARGS(( acc_t *acc ));
#endif
#if BUF2K_NR
DECLARE_TYPE(buf2K, buf2K_t, (2*1024));
-PRIVATE acc_t *buf2K_freelist;
+static acc_t *buf2K_freelist;
DECLARE_STORAGE(buf2K_t, buffers2K, BUF2K_NR);
-FORWARD void bf_2Kfree ARGS(( acc_t *acc ));
+static void bf_2Kfree ARGS(( acc_t *acc ));
#endif
#if BUF32K_NR
DECLARE_TYPE(buf32K, buf32K_t, (32*1024));
-PRIVATE acc_t *buf32K_freelist;
+static acc_t *buf32K_freelist;
DECLARE_STORAGE(buf32K_t, buffers32K, BUF32K_NR);
-FORWARD void bf_32Kfree ARGS(( acc_t *acc ));
+static void bf_32Kfree ARGS(( acc_t *acc ));
#endif
-PRIVATE acc_t *acc_freelist;
+static acc_t *acc_freelist;
DECLARE_STORAGE(acc_t, accessors, ACC_NR);
-PRIVATE bf_freereq_t freereq[CLIENT_NR];
-PRIVATE size_t bf_buf_gran;
+static bf_freereq_t freereq[CLIENT_NR];
+static size_t bf_buf_gran;
-PUBLIC size_t bf_free_bufsize;
-PUBLIC acc_t *bf_temporary_acc;
-PUBLIC acc_t *bf_linkcheck_acc;
+size_t bf_free_bufsize;
+acc_t *bf_temporary_acc;
+acc_t *bf_linkcheck_acc;
#ifdef BUF_CONSISTENCY_CHECK
int inet_buf_debug;
unsigned buf_generation;
-PRIVATE bf_checkreq_t checkreq[CLIENT_NR];
+static bf_checkreq_t checkreq[CLIENT_NR];
#endif
#ifndef BUF_TRACK_ALLOC_FREE
-FORWARD acc_t *bf_small_memreq ARGS(( size_t size ));
+static acc_t *bf_small_memreq ARGS(( size_t size ));
#else
-FORWARD acc_t *_bf_small_memreq ARGS(( char *clnt_file, int clnt_line,
+static acc_t *_bf_small_memreq ARGS(( char *clnt_file, int clnt_line,
size_t size ));
#define bf_small_memreq(a) _bf_small_memreq(clnt_file, clnt_line, a)
#endif
-FORWARD void free_accs ARGS(( void ));
+static void free_accs ARGS(( void ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void count_free_bufs ARGS(( acc_t *list ));
-FORWARD int report_buffer ARGS(( buf_t *buf, char *label, int i ));
+static void count_free_bufs ARGS(( acc_t *list ));
+static int report_buffer ARGS(( buf_t *buf, char *label, int i ));
#endif
-PUBLIC void bf_init()
+void bf_init()
{
int i;
size_t buf_s;
}
#ifndef BUF_CONSISTENCY_CHECK
-PUBLIC void bf_logon(func)
+void bf_logon(func)
bf_freereq_t func;
#else
-PUBLIC void bf_logon(func, checkfunc)
+void bf_logon(func, checkfunc)
bf_freereq_t func;
bf_checkreq_t checkfunc;
#endif
*/
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_memreq(size)
+acc_t *bf_memreq(size)
#else
-PUBLIC acc_t *_bf_memreq(clnt_file, clnt_line, size)
+acc_t *_bf_memreq(clnt_file, clnt_line, size)
char *clnt_file;
int clnt_line;
#endif
*/
#ifndef BUF_TRACK_ALLOC_FREE
-PRIVATE acc_t *bf_small_memreq(size)
+static acc_t *bf_small_memreq(size)
#else
-PRIVATE acc_t *_bf_small_memreq(clnt_file, clnt_line, size)
+static acc_t *_bf_small_memreq(clnt_file, clnt_line, size)
char *clnt_file;
int clnt_line;
#endif
}
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC void bf_afree(acc)
+void bf_afree(acc)
#else
-PUBLIC void _bf_afree(clnt_file, clnt_line, acc)
+void _bf_afree(clnt_file, clnt_line, acc)
char *clnt_file;
int clnt_line;
#endif
}
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_dupacc(acc_ptr)
+acc_t *bf_dupacc(acc_ptr)
#else
-PUBLIC acc_t *_bf_dupacc(clnt_file, clnt_line, acc_ptr)
+acc_t *_bf_dupacc(clnt_file, clnt_line, acc_ptr)
char *clnt_file;
int clnt_line;
#endif
return new_acc;
}
-PUBLIC size_t bf_bufsize(acc_ptr)
+size_t bf_bufsize(acc_ptr)
register acc_t *acc_ptr;
{
register size_t size;
}
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_packIffLess(pack, min_len)
+acc_t *bf_packIffLess(pack, min_len)
#else
-PUBLIC acc_t *_bf_packIffLess(clnt_file, clnt_line, pack, min_len)
+acc_t *_bf_packIffLess(clnt_file, clnt_line, pack, min_len)
char *clnt_file;
int clnt_line;
#endif
}
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_pack(old_acc)
+acc_t *bf_pack(old_acc)
#else
-PUBLIC acc_t *_bf_pack(clnt_file, clnt_line, old_acc)
+acc_t *_bf_pack(clnt_file, clnt_line, old_acc)
char *clnt_file;
int clnt_line;
#endif
}
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_cut (data, offset, length)
+acc_t *bf_cut (data, offset, length)
#else
-PUBLIC acc_t *_bf_cut (clnt_file, clnt_line, data, offset, length)
+acc_t *_bf_cut (clnt_file, clnt_line, data, offset, length)
char *clnt_file;
int clnt_line;
#endif
}
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_delhead (data, offset)
+acc_t *bf_delhead (data, offset)
#else
-PUBLIC acc_t *_bf_delhead (clnt_file, clnt_line, data, offset)
+acc_t *_bf_delhead (clnt_file, clnt_line, data, offset)
char *clnt_file;
int clnt_line;
#endif
*/
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_append(data_first, data_second)
+acc_t *bf_append(data_first, data_second)
#else
-PUBLIC acc_t *_bf_append(clnt_file, clnt_line, data_first, data_second)
+acc_t *_bf_append(clnt_file, clnt_line, data_first, data_second)
char *clnt_file;
int clnt_line;
#endif
}
#if BUF512_NR
-PRIVATE void bf_512free(acc)
+static void bf_512free(acc)
acc_t *acc;
{
#ifdef BUF_CONSISTENCY_CHECK
}
#endif
#if BUF2K_NR
-PRIVATE void bf_2Kfree(acc)
+static void bf_2Kfree(acc)
acc_t *acc;
{
#ifdef BUF_CONSISTENCY_CHECK
}
#endif
#if BUF32K_NR
-PRIVATE void bf_32Kfree(acc)
+static void bf_32Kfree(acc)
acc_t *acc;
{
#ifdef BUF_CONSISTENCY_CHECK
#endif
#ifdef BUF_CONSISTENCY_CHECK
-PUBLIC int bf_consistency_check()
+int bf_consistency_check()
{
acc_t *acc;
int silent;
return !error;
}
-PRIVATE void count_free_bufs(list)
+static void count_free_bufs(list)
acc_t *list;
{
acc_t *acc;
}
}
-PRIVATE int report_buffer(buf, label, i)
+static int report_buffer(buf, label, i)
buf_t *buf;
char *label;
int i;
return 1;
}
-PUBLIC void bf_check_acc(acc)
+void bf_check_acc(acc)
acc_t *acc;
{
buf_t *buf;
}
}
-PUBLIC void _bf_mark_1acc(clnt_file, clnt_line, acc)
+void _bf_mark_1acc(clnt_file, clnt_line, acc)
char *clnt_file;
int clnt_line;
acc_t *acc;
acc->acc_alloc_line= clnt_line;
}
-PUBLIC void _bf_mark_acc(clnt_file, clnt_line, acc)
+void _bf_mark_acc(clnt_file, clnt_line, acc)
char *clnt_file;
int clnt_line;
acc_t *acc;
}
#endif
-PUBLIC int bf_linkcheck(acc)
+int bf_linkcheck(acc)
acc_t *acc;
{
int i;
return 1;
}
-PRIVATE void free_accs()
+static void free_accs()
{
int i, j;
}
#ifndef BUF_TRACK_ALLOC_FREE
-PUBLIC acc_t *bf_align(acc, size, alignment)
+acc_t *bf_align(acc, size, alignment)
#else
-PUBLIC acc_t *_bf_align(clnt_file, clnt_line, acc, size, alignment)
+acc_t *_bf_align(clnt_file, clnt_line, acc, size, alignment)
char *clnt_file;
int clnt_line;
#endif
THIS_FILE
-PUBLIC int clck_call_expire;
+int clck_call_expire;
-PRIVATE time_t curr_time;
-PRIVATE time_t prev_time;
-PRIVATE timer_t *timer_chain;
-PRIVATE time_t next_timeout;
+static time_t curr_time;
+static time_t prev_time;
+static timer_t *timer_chain;
+static time_t next_timeout;
-FORWARD void clck_fast_release(timer_t *timer);
-FORWARD void set_timer(void);
+static void clck_fast_release(timer_t *timer);
+static void set_timer(void);
-PUBLIC void clck_init()
+void clck_init()
{
clck_call_expire= 0;
curr_time= 0;
timer_chain= 0;
}
-PUBLIC time_t get_time()
+time_t get_time()
{
if (!curr_time)
{
return curr_time;
}
-PUBLIC void set_time (tim)
+void set_time (tim)
time_t tim;
{
if (!curr_time && tim >= prev_time)
}
}
-PUBLIC void reset_time()
+void reset_time()
{
prev_time= curr_time;
curr_time= 0;
}
-PUBLIC void clck_timer(timer, timeout, func, fd)
+void clck_timer(timer, timeout, func, fd)
timer_t *timer;
time_t timeout;
timer_func_t func;
set_timer();
}
-PUBLIC void clck_tick (mess)
+void clck_tick (mess)
message *mess;
{
next_timeout= 0;
set_timer();
}
-PRIVATE void clck_fast_release (timer)
+static void clck_fast_release (timer)
timer_t *timer;
{
timer_t *timer_index;
timer->tim_active= 0;
}
-PRIVATE void set_timer()
+static void set_timer()
{
time_t new_time;
time_t curr_time;
}
}
-PUBLIC void clck_untimer (timer)
+void clck_untimer (timer)
timer_t *timer;
{
clck_fast_release (timer);
set_timer();
}
-PUBLIC void clck_expire_timers()
+void clck_expire_timers()
{
time_t curr_time;
timer_t *timer_index;
#define ACS_VALID 2
#define ACS_UNREACHABLE 3
-PRIVATE struct arp_hash_ent
+static struct arp_hash_ent
{
arp_cache_t *ahe_row[ARP_HASH_WIDTH];
} arp_hash[ARP_HASH_NR];
-PRIVATE arp_port_t *arp_port_table;
-PRIVATE arp_cache_t *arp_cache;
-PRIVATE int arp_cache_nr;
+static arp_port_t *arp_port_table;
+static arp_cache_t *arp_cache;
+static int arp_cache_nr;
-FORWARD acc_t *arp_getdata ARGS(( int fd, size_t offset,
+static acc_t *arp_getdata ARGS(( int fd, size_t offset,
size_t count, int for_ioctl ));
-FORWARD int arp_putdata ARGS(( int fd, size_t offset,
+static int arp_putdata ARGS(( int fd, size_t offset,
acc_t *data, int for_ioctl ));
-FORWARD void arp_main ARGS(( arp_port_t *arp_port ));
-FORWARD void arp_timeout ARGS(( int ref, timer_t *timer ));
-FORWARD void setup_write ARGS(( arp_port_t *arp_port ));
-FORWARD void setup_read ARGS(( arp_port_t *arp_port ));
-FORWARD void do_reclist ARGS(( event_t *ev, ev_arg_t ev_arg ));
-FORWARD void process_arp_pkt ARGS(( arp_port_t *arp_port, acc_t *data ));
-FORWARD void client_reply ARGS(( arp_port_t *arp_port,
+static void arp_main ARGS(( arp_port_t *arp_port ));
+static void arp_timeout ARGS(( int ref, timer_t *timer ));
+static void setup_write ARGS(( arp_port_t *arp_port ));
+static void setup_read ARGS(( arp_port_t *arp_port ));
+static void do_reclist ARGS(( event_t *ev, ev_arg_t ev_arg ));
+static void process_arp_pkt ARGS(( arp_port_t *arp_port, acc_t *data ));
+static void client_reply ARGS(( arp_port_t *arp_port,
ipaddr_t ipaddr, ether_addr_t *ethaddr ));
-FORWARD arp_cache_t *find_cache_ent ARGS(( arp_port_t *arp_port,
+static arp_cache_t *find_cache_ent ARGS(( arp_port_t *arp_port,
ipaddr_t ipaddr ));
-FORWARD arp_cache_t *alloc_cache_ent ARGS(( int flags ));
-FORWARD void arp_buffree ARGS(( int priority ));
+static arp_cache_t *alloc_cache_ent ARGS(( int flags ));
+static void arp_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void arp_bufcheck ARGS(( void ));
+static void arp_bufcheck ARGS(( void ));
#endif
-PUBLIC void arp_prep()
+void arp_prep()
{
arp_port_table= alloc(eth_conf_nr * sizeof(arp_port_table[0]));
arp_cache= alloc(arp_cache_nr * sizeof(arp_cache[0]));
}
-PUBLIC void arp_init()
+void arp_init()
{
arp_port_t *arp_port;
arp_cache_t *cache;
#endif
}
-PRIVATE void arp_main(arp_port)
+static void arp_main(arp_port)
arp_port_t *arp_port;
{
int result;
}
}
-PRIVATE acc_t *arp_getdata (fd, offset, count, for_ioctl)
+static acc_t *arp_getdata (fd, offset, count, for_ioctl)
int fd;
size_t offset;
size_t count;
return 0;
}
-PRIVATE int arp_putdata (fd, offset, data, for_ioctl)
+static int arp_putdata (fd, offset, data, for_ioctl)
int fd;
size_t offset;
acc_t *data;
return EGENERIC;
}
-PRIVATE void setup_read(arp_port)
+static void setup_read(arp_port)
arp_port_t *arp_port;
{
int result;
}
}
-PRIVATE void setup_write(arp_port)
+static void setup_write(arp_port)
arp_port_t *arp_port;
{
int result;
}
}
-PRIVATE void do_reclist(ev, ev_arg)
+static void do_reclist(ev, ev_arg)
event_t *ev;
ev_arg_t ev_arg;
{
}
}
-PRIVATE void process_arp_pkt (arp_port, data)
+static void process_arp_pkt (arp_port, data)
arp_port_t *arp_port;
acc_t *data;
{
}
}
-PRIVATE void client_reply (arp_port, ipaddr, ethaddr)
+static void client_reply (arp_port, ipaddr, ethaddr)
arp_port_t *arp_port;
ipaddr_t ipaddr;
ether_addr_t *ethaddr;
(*arp_port->ap_arp_func)(arp_port->ap_ip_port, ipaddr, ethaddr);
}
-PRIVATE arp_cache_t *find_cache_ent (arp_port, ipaddr)
+static arp_cache_t *find_cache_ent (arp_port, ipaddr)
arp_port_t *arp_port;
ipaddr_t ipaddr;
{
return NULL;
}
-PRIVATE arp_cache_t *alloc_cache_ent(flags)
+static arp_cache_t *alloc_cache_ent(flags)
int flags;
{
arp_cache_t *cache, *old;
return old;
}
-PUBLIC void arp_set_ipaddr (eth_port, ipaddr)
+void arp_set_ipaddr (eth_port, ipaddr)
int eth_port;
ipaddr_t ipaddr;
{
arp_main(arp_port);
}
-PUBLIC int arp_set_cb(eth_port, ip_port, arp_func)
+int arp_set_cb(eth_port, ip_port, arp_func)
int eth_port;
int ip_port;
arp_func_t arp_func;
return NW_OK;
}
-PUBLIC int arp_ip_eth (eth_port, ipaddr, ethaddr)
+int arp_ip_eth (eth_port, ipaddr, ethaddr)
int eth_port;
ipaddr_t ipaddr;
ether_addr_t *ethaddr;
return NW_SUSPEND;
}
-PUBLIC int arp_ioctl (eth_port, fd, req, get_userdata, put_userdata)
+int arp_ioctl (eth_port, fd, req, get_userdata, put_userdata)
int eth_port;
int fd;
ioreq_t req;
return 0;
}
-PRIVATE void arp_timeout (ref, timer)
+static void arp_timeout (ref, timer)
int ref;
timer_t *timer;
{
arp_timeout, ref);
}
-PRIVATE void arp_buffree(priority)
+static void arp_buffree(priority)
int priority;
{
int i;
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void arp_bufcheck()
+static void arp_bufcheck()
{
int i;
arp_port_t *arp_port;
u16_t vh_vlan;
} vlan_hdr_t;
-FORWARD int eth_checkopt ARGS(( eth_fd_t *eth_fd ));
-FORWARD void hash_fd ARGS(( eth_fd_t *eth_fd ));
-FORWARD void unhash_fd ARGS(( eth_fd_t *eth_fd ));
-FORWARD void eth_buffree ARGS(( int priority ));
+static int eth_checkopt ARGS(( eth_fd_t *eth_fd ));
+static void hash_fd ARGS(( eth_fd_t *eth_fd ));
+static void unhash_fd ARGS(( eth_fd_t *eth_fd ));
+static void eth_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void eth_bufcheck ARGS(( void ));
+static void eth_bufcheck ARGS(( void ));
#endif
-FORWARD int eth_sel_read ARGS(( eth_fd_t * ));
-FORWARD void packet2user ARGS(( eth_fd_t *fd, acc_t *pack, time_t exp_time ));
-FORWARD void reply_thr_get ARGS(( eth_fd_t *eth_fd,
+static int eth_sel_read ARGS(( eth_fd_t * ));
+static void packet2user ARGS(( eth_fd_t *fd, acc_t *pack, time_t exp_time ));
+static void reply_thr_get ARGS(( eth_fd_t *eth_fd,
size_t result, int for_ioctl ));
-FORWARD void reply_thr_put ARGS(( eth_fd_t *eth_fd,
+static void reply_thr_put ARGS(( eth_fd_t *eth_fd,
size_t result, int for_ioctl ));
-FORWARD void do_rec_conf ARGS(( eth_port_t *eth_port ));
-FORWARD u32_t compute_rec_conf ARGS(( eth_port_t *eth_port ));
-FORWARD acc_t *insert_vlan_hdr ARGS(( eth_port_t *eth_port, acc_t *pack ));
+static void do_rec_conf ARGS(( eth_port_t *eth_port ));
+static u32_t compute_rec_conf ARGS(( eth_port_t *eth_port ));
+static acc_t *insert_vlan_hdr ARGS(( eth_port_t *eth_port, acc_t *pack ));
-PUBLIC eth_port_t *eth_port_table;
-PUBLIC int no_ethWritePort= 0;
+eth_port_t *eth_port_table;
+int no_ethWritePort= 0;
-PRIVATE eth_fd_t eth_fd_table[ETH_FD_NR];
-PRIVATE ether_addr_t broadcast= { { 255, 255, 255, 255, 255, 255 } };
+static eth_fd_t eth_fd_table[ETH_FD_NR];
+static ether_addr_t broadcast= { { 255, 255, 255, 255, 255, 255 } };
-PUBLIC void eth_prep()
+void eth_prep()
{
eth_port_table= alloc(eth_conf_nr * sizeof(eth_port_table[0]));
}
-PUBLIC void eth_init()
+void eth_init()
{
int i, j;
osdep_eth_init();
}
-PUBLIC int eth_open(port, srfd, get_userdata, put_userdata, put_pkt,
+int eth_open(port, srfd, get_userdata, put_userdata, put_pkt,
select_res)
int port, srfd;
get_userdata_t get_userdata;
return i;
}
-PUBLIC int eth_ioctl(fd, req)
+int eth_ioctl(fd, req)
int fd;
ioreq_t req;
{
return NW_OK;
}
-PUBLIC int eth_write(fd, count)
+int eth_write(fd, count)
int fd;
size_t count;
{
return NW_OK;
}
-PUBLIC int eth_send(fd, data, data_len)
+int eth_send(fd, data, data_len)
int fd;
acc_t *data;
size_t data_len;
return NW_OK;
}
-PUBLIC int eth_read (fd, count)
+int eth_read (fd, count)
int fd;
size_t count;
{
return NW_SUSPEND;
}
-PUBLIC int eth_cancel(fd, which_operation)
+int eth_cancel(fd, which_operation)
int fd;
int which_operation;
{
return NW_OK;
}
-PUBLIC int eth_select(fd, operations)
+int eth_select(fd, operations)
int fd;
unsigned operations;
{
return resops;
}
-PUBLIC void eth_close(fd)
+void eth_close(fd)
int fd;
{
eth_fd_t *eth_fd;
do_rec_conf(eth_port);
}
-PUBLIC void eth_loop_ev(ev, ev_arg)
+void eth_loop_ev(ev, ev_arg)
event_t *ev;
ev_arg_t ev_arg;
{
eth_restart_write(eth_port);
}
-PRIVATE int eth_checkopt (eth_fd)
+static int eth_checkopt (eth_fd)
eth_fd_t *eth_fd;
{
/* bug: we don't check access modes yet */
return NW_OK;
}
-PRIVATE void hash_fd(eth_fd)
+static void hash_fd(eth_fd)
eth_fd_t *eth_fd;
{
eth_port_t *eth_port;
}
}
-PRIVATE void unhash_fd(eth_fd)
+static void unhash_fd(eth_fd)
eth_fd_t *eth_fd;
{
eth_port_t *eth_port;
*eth_fd_p= curr->ef_type_next;
}
-PUBLIC void eth_restart_write(eth_port)
+void eth_restart_write(eth_port)
eth_port_t *eth_port;
{
eth_fd_t *eth_fd;
}
}
-PUBLIC void eth_arrive (eth_port, pack, pack_size)
+void eth_arrive (eth_port, pack, pack_size)
eth_port_t *eth_port;
acc_t *pack;
size_t pack_size;
}
}
-PUBLIC void eth_reg_vlan(eth_port, vlan_port)
+void eth_reg_vlan(eth_port, vlan_port)
eth_port_t *eth_port;
eth_port_t *vlan_port;
{
eth_port->etp_vlan_tab[h]= vlan_port;
}
-PUBLIC void eth_restart_ioctl(eth_port)
+void eth_restart_ioctl(eth_port)
eth_port_t *eth_port;
{
int i, r;
}
}
-PRIVATE int eth_sel_read (eth_fd)
+static int eth_sel_read (eth_fd)
eth_fd_t *eth_fd;
{
acc_t *tmp_acc, *next_acc;
return 0;
}
-PRIVATE void packet2user (eth_fd, pack, exp_time)
+static void packet2user (eth_fd, pack, exp_time)
eth_fd_t *eth_fd;
acc_t *pack;
time_t exp_time;
reply_thr_put(eth_fd, result, FALSE);
}
-PRIVATE void eth_buffree (priority)
+static void eth_buffree (priority)
int priority;
{
int i;
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void eth_bufcheck()
+static void eth_bufcheck()
{
int i;
eth_fd_t *eth_fd;
}
#endif
-PRIVATE void do_rec_conf(eth_port)
+static void do_rec_conf(eth_port)
eth_port_t *eth_port;
{
int i;
eth_set_rec_conf(eth_port, flags);
}
-PRIVATE u32_t compute_rec_conf(eth_port)
+static u32_t compute_rec_conf(eth_port)
eth_port_t *eth_port;
{
eth_fd_t *eth_fd;
return flags;
}
-PRIVATE void reply_thr_get (eth_fd, result, for_ioctl)
+static void reply_thr_get (eth_fd, result, for_ioctl)
eth_fd_t *eth_fd;
size_t result;
int for_ioctl;
assert (!data);
}
-PRIVATE void reply_thr_put (eth_fd, result, for_ioctl)
+static void reply_thr_put (eth_fd, result, for_ioctl)
eth_fd_t *eth_fd;
size_t result;
int for_ioctl;
assert(error == NW_OK);
}
-PRIVATE acc_t *insert_vlan_hdr(eth_port, pack)
+static acc_t *insert_vlan_hdr(eth_port, pack)
eth_port_t *eth_port;
acc_t *pack;
{
#define ICPS_MAIN 2
#define ICPS_ERROR 3
-PRIVATE icmp_port_t *icmp_port_table;
+static icmp_port_t *icmp_port_table;
-FORWARD void icmp_main ARGS(( icmp_port_t *icmp_port ));
-FORWARD acc_t *icmp_getdata ARGS(( int port, size_t offset,
+static void icmp_main ARGS(( icmp_port_t *icmp_port ));
+static acc_t *icmp_getdata ARGS(( int port, size_t offset,
size_t count, int for_ioctl ));
-FORWARD int icmp_putdata ARGS(( int port, size_t offset,
+static int icmp_putdata ARGS(( int port, size_t offset,
acc_t *data, int for_ioctl ));
-FORWARD void icmp_read ARGS(( icmp_port_t *icmp_port ));
-FORWARD void process_data ARGS(( icmp_port_t *icmp_port,
+static void icmp_read ARGS(( icmp_port_t *icmp_port ));
+static void process_data ARGS(( icmp_port_t *icmp_port,
acc_t *data ));
-FORWARD u16_t icmp_pack_oneCsum ARGS(( acc_t *ip_pack ));
-FORWARD void icmp_echo_request ARGS(( icmp_port_t *icmp_port,
+static u16_t icmp_pack_oneCsum ARGS(( acc_t *ip_pack ));
+static void icmp_echo_request ARGS(( icmp_port_t *icmp_port,
acc_t *ip_pack, int ip_hdr_len, ip_hdr_t *ip_hdr,
acc_t *icmp_pack, int icmp_len, icmp_hdr_t *icmp_hdr ));
-FORWARD void icmp_dst_unreach ARGS(( icmp_port_t *icmp_port,
+static void icmp_dst_unreach ARGS(( icmp_port_t *icmp_port,
acc_t *ip_pack, int ip_hdr_len, ip_hdr_t *ip_hdr,
acc_t *icmp_pack, int icmp_len, icmp_hdr_t *icmp_hdr ));
-FORWARD void icmp_time_exceeded ARGS(( icmp_port_t *icmp_port,
+static void icmp_time_exceeded ARGS(( icmp_port_t *icmp_port,
acc_t *ip_pack, int ip_hdr_len, ip_hdr_t *ip_hdr,
acc_t *icmp_pack, int icmp_len, icmp_hdr_t *icmp_hdr ));
-FORWARD void icmp_router_advertisement ARGS(( icmp_port_t *icmp_port,
+static void icmp_router_advertisement ARGS(( icmp_port_t *icmp_port,
acc_t *icmp_pack, int icmp_len, icmp_hdr_t *icmp_hdr ));
-FORWARD void icmp_redirect ARGS(( icmp_port_t *icmp_port,
+static void icmp_redirect ARGS(( icmp_port_t *icmp_port,
ip_hdr_t *ip_hdr, acc_t *icmp_pack, int icmp_len,
icmp_hdr_t *icmp_hdr ));
-FORWARD acc_t *make_repl_ip ARGS(( ip_hdr_t *ip_hdr,
+static acc_t *make_repl_ip ARGS(( ip_hdr_t *ip_hdr,
int ip_len ));
-FORWARD void enqueue_pack ARGS(( icmp_port_t *icmp_port,
+static void enqueue_pack ARGS(( icmp_port_t *icmp_port,
acc_t *reply_ip_hdr ));
-FORWARD int icmp_rate_limit ARGS(( icmp_port_t *icmp_port,
+static int icmp_rate_limit ARGS(( icmp_port_t *icmp_port,
acc_t *reply_ip_hdr ));
-FORWARD void icmp_write ARGS(( event_t *ev, ev_arg_t ev_arg ));
-FORWARD void icmp_buffree ARGS(( int priority ));
-FORWARD acc_t *icmp_err_pack ARGS(( acc_t *pack, icmp_hdr_t **icmp_hdr_pp ));
+static void icmp_write ARGS(( event_t *ev, ev_arg_t ev_arg ));
+static void icmp_buffree ARGS(( int priority ));
+static acc_t *icmp_err_pack ARGS(( acc_t *pack, icmp_hdr_t **icmp_hdr_pp ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void icmp_bufcheck ARGS(( void ));
+static void icmp_bufcheck ARGS(( void ));
#endif
-PUBLIC void icmp_prep()
+void icmp_prep()
{
icmp_port_table= alloc(ip_conf_nr * sizeof(icmp_port_table[0]));
}
-PUBLIC void icmp_init()
+void icmp_init()
{
int i;
icmp_port_t *icmp_port;
}
}
-PRIVATE void icmp_main(icmp_port)
+static void icmp_main(icmp_port)
icmp_port_t *icmp_port;
{
int result;
}
}
-PRIVATE acc_t *icmp_getdata(port, offset, count, for_ioctl)
+static acc_t *icmp_getdata(port, offset, count, for_ioctl)
int port;
size_t offset, count;
int for_ioctl;
return NULL;
}
-PRIVATE int icmp_putdata(port, offset, data, for_ioctl)
+static int icmp_putdata(port, offset, data, for_ioctl)
int port;
size_t offset;
acc_t *data;
}
}
-PRIVATE void icmp_read(icmp_port)
+static void icmp_read(icmp_port)
icmp_port_t *icmp_port;
{
int result;
}
}
-PUBLIC void icmp_snd_time_exceeded(port_nr, pack, code)
+void icmp_snd_time_exceeded(port_nr, pack, code)
int port_nr;
acc_t *pack;
int code;
enqueue_pack(icmp_port, pack);
}
-PUBLIC void icmp_snd_redirect(port_nr, pack, code, gw)
+void icmp_snd_redirect(port_nr, pack, code, gw)
int port_nr;
acc_t *pack;
int code;
enqueue_pack(icmp_port, pack);
}
-PUBLIC void icmp_snd_unreachable(port_nr, pack, code)
+void icmp_snd_unreachable(port_nr, pack, code)
int port_nr;
acc_t *pack;
int code;
enqueue_pack(icmp_port, pack);
}
-PUBLIC void icmp_snd_mtu(
+void icmp_snd_mtu(
int port_nr,
acc_t *pack,
u16_t mtu
enqueue_pack(icmp_port, pack);
}
-PRIVATE void process_data(icmp_port, data)
+static void process_data(icmp_port, data)
icmp_port_t *icmp_port;
acc_t *data;
{
bf_afree(icmp_data);
}
-PRIVATE void icmp_echo_request(icmp_port, ip_data, ip_len, ip_hdr,
+static void icmp_echo_request(icmp_port, ip_data, ip_len, ip_hdr,
icmp_data, icmp_len, icmp_hdr)
icmp_port_t *icmp_port;
acc_t *ip_data, *icmp_data;
enqueue_pack(icmp_port, repl_ip_hdr);
}
-PRIVATE u16_t icmp_pack_oneCsum(icmp_pack)
+static u16_t icmp_pack_oneCsum(icmp_pack)
acc_t *icmp_pack;
{
u16_t prev;
return prev;
}
-PRIVATE acc_t *make_repl_ip(ip_hdr, ip_len)
+static acc_t *make_repl_ip(ip_hdr, ip_len)
ip_hdr_t *ip_hdr;
int ip_len;
{
return repl;
}
-PRIVATE void enqueue_pack(icmp_port, reply_ip_hdr)
+static void enqueue_pack(icmp_port, reply_ip_hdr)
icmp_port_t *icmp_port;
acc_t *reply_ip_hdr;
{
}
}
-PRIVATE int icmp_rate_limit(icmp_port, reply_ip_hdr)
+static int icmp_rate_limit(icmp_port, reply_ip_hdr)
icmp_port_t *icmp_port;
acc_t *reply_ip_hdr;
{
return -1;
}
-PRIVATE void icmp_write(ev, ev_arg)
+static void icmp_write(ev, ev_arg)
event_t *ev;
ev_arg_t ev_arg;
{
icmp_port->icp_flags &= ~ICPF_WRITE_IP;
}
-PRIVATE void icmp_buffree(priority)
+static void icmp_buffree(priority)
int priority;
{
acc_t *tmp_acc;
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void icmp_bufcheck()
+static void icmp_bufcheck()
{
int i;
icmp_port_t *icmp_port;
}
#endif
-PRIVATE void icmp_dst_unreach(icmp_port, ip_pack, ip_hdr_len, ip_hdr, icmp_pack,
+static void icmp_dst_unreach(icmp_port, ip_pack, ip_hdr_len, ip_hdr, icmp_pack,
icmp_len, icmp_hdr)
icmp_port_t *icmp_port;
acc_t *ip_pack;
bf_afree(old_ip_pack);
}
-PRIVATE void icmp_time_exceeded(icmp_port, ip_pack, ip_hdr_len, ip_hdr,
+static void icmp_time_exceeded(icmp_port, ip_pack, ip_hdr_len, ip_hdr,
icmp_pack, icmp_len, icmp_hdr)
icmp_port_t *icmp_port;
acc_t *ip_pack;
bf_afree(old_ip_pack);
}
-PRIVATE void icmp_router_advertisement(icmp_port, icmp_pack, icmp_len, icmp_hdr)
+static void icmp_router_advertisement(icmp_port, icmp_pack, icmp_len, icmp_hdr)
icmp_port_t *icmp_port;
acc_t *icmp_pack;
int icmp_len;
}
}
-PRIVATE void icmp_redirect(icmp_port, ip_hdr, icmp_pack, icmp_len, icmp_hdr)
+static void icmp_redirect(icmp_port, ip_hdr, icmp_pack, icmp_len, icmp_hdr)
icmp_port_t *icmp_port;
ip_hdr_t *ip_hdr;
acc_t *icmp_pack;
bf_afree(old_ip_pack);
}
-PRIVATE acc_t *icmp_err_pack(pack, icmp_hdr_pp)
+static acc_t *icmp_err_pack(pack, icmp_hdr_pp)
acc_t *pack;
icmp_hdr_t **icmp_hdr_pp;
{
#include "inet.h"
#include "io.h"
-PUBLIC void writeIpAddr(addr)
+void writeIpAddr(addr)
ipaddr_t addr;
{
#define addrInBytes ((u8_t *)&addr)
#undef addrInBytes
}
-PUBLIC void writeEtherAddr(addr)
+void writeEtherAddr(addr)
ether_addr_t *addr;
{
#define addrInBytes ((u8_t *)addr->ea_addr)
THIS_FILE
-FORWARD void ip_close ARGS(( int fd ));
-FORWARD int ip_cancel ARGS(( int fd, int which_operation ));
-FORWARD int ip_select ARGS(( int fd, unsigned operations ));
+static void ip_close ARGS(( int fd ));
+static int ip_cancel ARGS(( int fd, int which_operation ));
+static int ip_select ARGS(( int fd, unsigned operations ));
-FORWARD void ip_buffree ARGS(( int priority ));
+static void ip_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void ip_bufcheck ARGS(( void ));
+static void ip_bufcheck ARGS(( void ));
#endif
-FORWARD void ip_bad_callback ARGS(( struct ip_port *ip_port ));
+static void ip_bad_callback ARGS(( struct ip_port *ip_port ));
-PUBLIC ip_port_t *ip_port_table;
-PUBLIC ip_fd_t ip_fd_table[IP_FD_NR];
-PUBLIC ip_ass_t ip_ass_table[IP_ASS_NR];
+ip_port_t *ip_port_table;
+ip_fd_t ip_fd_table[IP_FD_NR];
+ip_ass_t ip_ass_table[IP_ASS_NR];
-PUBLIC void ip_prep()
+void ip_prep()
{
ip_port_table= alloc(ip_conf_nr * sizeof(ip_port_table[0]));
icmp_prep();
}
-PUBLIC void ip_init()
+void ip_init()
{
int i, j, result;
ip_ass_t *ip_ass;
}
}
-PRIVATE int ip_cancel (fd, which_operation)
+static int ip_cancel (fd, which_operation)
int fd;
int which_operation;
{
return NW_OK;
}
-PRIVATE int ip_select(fd, operations)
+static int ip_select(fd, operations)
int fd;
unsigned operations;
{
return resops;
}
-PUBLIC int ip_open (port, srfd, get_userdata, put_userdata, put_pkt,
+int ip_open (port, srfd, get_userdata, put_userdata, put_pkt,
select_res)
int port;
int srfd;
return i;
}
-PRIVATE void ip_close (fd)
+static void ip_close (fd)
int fd;
{
ip_fd_t *ip_fd;
ip_fd->if_flags= IFF_EMPTY;
}
-PRIVATE void ip_buffree(priority)
+static void ip_buffree(priority)
int priority;
{
int i;
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void ip_bufcheck()
+static void ip_bufcheck()
{
int i;
ip_port_t *ip_port;
}
#endif /* BUF_CONSISTENCY_CHECK */
-PRIVATE void ip_bad_callback(ip_port)
+static void ip_bad_callback(ip_port)
struct ip_port *ip_port;
{
ip_panic(( "no callback filled in for port %d", ip_port->ip_port ));
ipaddr_t xh_ipaddr;
} xmit_hdr_t;
-PRIVATE ether_addr_t broadcast_ethaddr=
+static ether_addr_t broadcast_ethaddr=
{
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
};
-PRIVATE ether_addr_t ipmulticast_ethaddr=
+static ether_addr_t ipmulticast_ethaddr=
{
{ 0x01, 0x00, 0x5e, 0x00, 0x00, 0x00 }
};
-FORWARD void do_eth_read ARGS(( ip_port_t *port ));
-FORWARD acc_t *get_eth_data ARGS(( int fd, size_t offset,
+static void do_eth_read ARGS(( ip_port_t *port ));
+static acc_t *get_eth_data ARGS(( int fd, size_t offset,
size_t count, int for_ioctl ));
-FORWARD int put_eth_data ARGS(( int fd, size_t offset,
+static int put_eth_data ARGS(( int fd, size_t offset,
acc_t *data, int for_ioctl ));
-FORWARD void ipeth_main ARGS(( ip_port_t *port ));
-FORWARD void ipeth_set_ipaddr ARGS(( ip_port_t *port ));
-FORWARD void ipeth_restart_send ARGS(( ip_port_t *ip_port ));
-FORWARD int ipeth_send ARGS(( struct ip_port *ip_port, ipaddr_t dest,
+static void ipeth_main ARGS(( ip_port_t *port ));
+static void ipeth_set_ipaddr ARGS(( ip_port_t *port ));
+static void ipeth_restart_send ARGS(( ip_port_t *ip_port ));
+static int ipeth_send ARGS(( struct ip_port *ip_port, ipaddr_t dest,
acc_t *pack, int type ));
-FORWARD void ipeth_arp_reply ARGS(( int ip_port_nr, ipaddr_t ipaddr,
+static void ipeth_arp_reply ARGS(( int ip_port_nr, ipaddr_t ipaddr,
ether_addr_t *dst_ether_ptr ));
-FORWARD int ipeth_update_ttl ARGS(( time_t enq_time, time_t now,
+static int ipeth_update_ttl ARGS(( time_t enq_time, time_t now,
acc_t *eth_pack ));
-FORWARD void ip_eth_arrived ARGS(( int port, acc_t *pack,
+static void ip_eth_arrived ARGS(( int port, acc_t *pack,
size_t pack_size ));
-PUBLIC int ipeth_init(ip_port)
+int ipeth_init(ip_port)
ip_port_t *ip_port;
{
assert(BUF_S >= sizeof(xmit_hdr_t));
return 0;
}
-PRIVATE void ipeth_main(ip_port)
+static void ipeth_main(ip_port)
ip_port_t *ip_port;
{
int result;
}
}
-PRIVATE acc_t *get_eth_data (fd, offset, count, for_ioctl)
+static acc_t *get_eth_data (fd, offset, count, for_ioctl)
int fd;
size_t offset;
size_t count;
return 0;
}
-PRIVATE int put_eth_data (port, offset, data, for_ioctl)
+static int put_eth_data (port, offset, data, for_ioctl)
int port;
size_t offset;
acc_t *data;
return -1;
}
-PRIVATE void ipeth_set_ipaddr(ip_port)
+static void ipeth_set_ipaddr(ip_port)
ip_port_t *ip_port;
{
arp_set_ipaddr (ip_port->ip_dl.dl_eth.de_port, ip_port->ip_ipaddr);
ipeth_main(ip_port);
}
-PRIVATE int ipeth_send(ip_port, dest, pack, type)
+static int ipeth_send(ip_port, dest, pack, type)
struct ip_port *ip_port;
ipaddr_t dest;
acc_t *pack;
return NW_OK;
}
-PRIVATE void ipeth_restart_send(ip_port)
+static void ipeth_restart_send(ip_port)
ip_port_t *ip_port;
{
time_t now, enq_time;
}
-PRIVATE void ipeth_arp_reply(ip_port_nr, ipaddr, eth_addr)
+static void ipeth_arp_reply(ip_port_nr, ipaddr, eth_addr)
int ip_port_nr;
ipaddr_t ipaddr;
ether_addr_t *eth_addr;
ipeth_restart_send(ip_port);
}
-PRIVATE int ipeth_update_ttl(enq_time, now, eth_pack)
+static int ipeth_update_ttl(enq_time, now, eth_pack)
time_t enq_time;
time_t now;
acc_t *eth_pack;
return NW_OK;
}
-PRIVATE void do_eth_read(ip_port)
+static void do_eth_read(ip_port)
ip_port_t *ip_port;
{
int result;
}
}
-PRIVATE void ip_eth_arrived(port, pack, pack_size)
+static void ip_eth_arrived(port, pack, pack_size)
int port;
acc_t *pack;
size_t pack_size;
THIS_FILE
-FORWARD int ip_checkopt ARGS(( ip_fd_t *ip_fd ));
-FORWARD void reply_thr_get ARGS(( ip_fd_t *ip_fd, size_t
+static int ip_checkopt ARGS(( ip_fd_t *ip_fd ));
+static void reply_thr_get ARGS(( ip_fd_t *ip_fd, size_t
reply, int for_ioctl ));
-FORWARD void report_addr ARGS(( ip_port_t *ip_port ));
+static void report_addr ARGS(( ip_port_t *ip_port ));
-PUBLIC int ip_ioctl (fd, req)
+int ip_ioctl (fd, req)
int fd;
ioreq_t req;
{
(acc_t *)0, TRUE);
}
-PUBLIC void ip_hash_proto(ip_fd)
+void ip_hash_proto(ip_fd)
ip_fd_t *ip_fd;
{
ip_port_t *ip_port;
}
}
-PUBLIC void ip_unhash_proto(ip_fd)
+void ip_unhash_proto(ip_fd)
ip_fd_t *ip_fd;
{
ip_port_t *ip_port;
*ip_fd_p= curr->if_proto_next;
}
-PUBLIC int ip_setconf(ip_port_nr, ipconf)
+int ip_setconf(ip_port_nr, ipconf)
int ip_port_nr;
nwio_ipconf_t *ipconf;
{
return 0;
}
-PRIVATE int ip_checkopt (ip_fd)
+static int ip_checkopt (ip_fd)
ip_fd_t *ip_fd;
{
/* bug: we don't check access modes yet */
return NW_OK;
}
-PRIVATE void reply_thr_get(ip_fd, reply, for_ioctl)
+static void reply_thr_get(ip_fd, reply, for_ioctl)
ip_fd_t *ip_fd;
size_t reply;
int for_ioctl;
assert (!result);
}
-PRIVATE void report_addr(ip_port)
+static void report_addr(ip_port)
ip_port_t *ip_port;
{
int i, hdr_len;
THIS_FILE
-PUBLIC ipaddr_t ip_get_netmask (ipaddr_t hostaddr)
+ipaddr_t ip_get_netmask (ipaddr_t hostaddr)
{
return ip_netmask(ip_nettype(hostaddr));
}
-PUBLIC int ip_chk_hdropt (u8_t *opt, int optlen)
+int ip_chk_hdropt (u8_t *opt, int optlen)
{
int i, security_present= FALSE, lose_source_present= FALSE,
strict_source_present= FALSE, record_route_present= FALSE,
return NW_OK;
}
-PUBLIC void ip_print_frags(acc_t *acc)
+void ip_print_frags(acc_t *acc)
{
#if DEBUG
ip_hdr_t *ip_hdr;
#endif
}
-PUBLIC ipaddr_t ip_get_ifaddr(int port_nr)
+ipaddr_t ip_get_ifaddr(int port_nr)
{
assert(port_nr >= 0 && port_nr < ip_conf_nr);
return ip_port_table[port_nr].ip_ipaddr;
}
-PUBLIC nettype_t ip_nettype(ipaddr_t ipaddr)
+nettype_t ip_nettype(ipaddr_t ipaddr)
{
u8_t highbyte;
nettype_t nettype;
return nettype;
}
-PUBLIC ipaddr_t ip_netmask(nettype_t nettype)
+ipaddr_t ip_netmask(nettype_t nettype)
{
switch(nettype)
{
}
#if 0
-PUBLIC char *ip_nettoa(nettype_t nettype)
+char *ip_nettoa(nettype_t nettype)
{
switch(nettype)
{
THIS_FILE
-FORWARD void ipps_main ARGS(( ip_port_t *ip_port ));
-FORWARD void ipps_set_ipaddr ARGS(( ip_port_t *ip_port ));
-FORWARD int ipps_send ARGS(( struct ip_port *ip_port, ipaddr_t dest,
+static void ipps_main ARGS(( ip_port_t *ip_port ));
+static void ipps_set_ipaddr ARGS(( ip_port_t *ip_port ));
+static int ipps_send ARGS(( struct ip_port *ip_port, ipaddr_t dest,
acc_t *pack, int type ));
-PUBLIC int ipps_init(ip_port)
+int ipps_init(ip_port)
ip_port_t *ip_port;
{
int result;
return result;
}
-PUBLIC void ipps_get(ip_port_nr)
+void ipps_get(ip_port_nr)
int ip_port_nr;
{
int result;
}
}
-PUBLIC void ipps_put(ip_port_nr, nexthop, pack)
+void ipps_put(ip_port_nr, nexthop, pack)
int ip_port_nr;
ipaddr_t nexthop;
acc_t *pack;
ip_arrived(ip_port, pack);
}
-PRIVATE void ipps_main(ip_port)
+static void ipps_main(ip_port)
ip_port_t *ip_port;
{
/* nothing to do */
}
-PRIVATE void ipps_set_ipaddr(ip_port)
+static void ipps_set_ipaddr(ip_port)
ip_port_t *ip_port;
{
}
-PRIVATE int ipps_send(ip_port, dest, pack, type)
+static int ipps_send(ip_port, dest, pack, type)
struct ip_port *ip_port;
ipaddr_t dest;
acc_t *pack;
THIS_FILE
-FORWARD ip_ass_t *find_ass_ent ARGS(( ip_port_t *ip_port, u16_t id,
+static ip_ass_t *find_ass_ent ARGS(( ip_port_t *ip_port, u16_t id,
ipproto_t proto, ipaddr_t src, ipaddr_t dst ));
-FORWARD acc_t *merge_frags ARGS(( acc_t *first, acc_t *second ));
-FORWARD int ip_frag_chk ARGS(( acc_t *pack ));
-FORWARD acc_t *reassemble ARGS(( ip_port_t *ip_port, acc_t *pack,
+static acc_t *merge_frags ARGS(( acc_t *first, acc_t *second ));
+static int ip_frag_chk ARGS(( acc_t *pack ));
+static acc_t *reassemble ARGS(( ip_port_t *ip_port, acc_t *pack,
ip_hdr_t *ip_hdr ));
-FORWARD void route_packets ARGS(( event_t *ev, ev_arg_t ev_arg ));
-FORWARD int broadcast_dst ARGS(( ip_port_t *ip_port, ipaddr_t dest ));
+static void route_packets ARGS(( event_t *ev, ev_arg_t ev_arg ));
+static int broadcast_dst ARGS(( ip_port_t *ip_port, ipaddr_t dest ));
-PUBLIC int ip_read(int fd, size_t count)
+int ip_read(int fd, size_t count)
{
ip_fd_t *ip_fd;
acc_t *pack;
return NW_SUSPEND;
}
-PRIVATE acc_t *reassemble (ip_port, pack, pack_hdr)
+static acc_t *reassemble (ip_port, pack, pack_hdr)
ip_port_t *ip_port;
acc_t *pack;
ip_hdr_t *pack_hdr;
return NULL;
}
-PRIVATE acc_t *merge_frags (first, second)
+static acc_t *merge_frags (first, second)
acc_t *first, *second;
{
ip_hdr_t *first_hdr, *second_hdr;
return first;
}
-PRIVATE ip_ass_t *find_ass_ent ARGS(( ip_port_t *ip_port, u16_t id,
+static ip_ass_t *find_ass_ent ARGS(( ip_port_t *ip_port, u16_t id,
ipproto_t proto, ipaddr_t src, ipaddr_t dst ))
{
ip_ass_t *new_ass_ent, *tmp_ass_ent;
return new_ass_ent;
}
-PRIVATE int ip_frag_chk(pack)
+static int ip_frag_chk(pack)
acc_t *pack;
{
ip_hdr_t *ip_hdr;
return TRUE;
}
-PUBLIC int ip_sel_read (ip_fd_t *ip_fd)
+int ip_sel_read (ip_fd_t *ip_fd)
{
acc_t *pack;
return 0;
}
-PUBLIC void ip_packet2user (ip_fd, pack, exp_time, data_len)
+void ip_packet2user (ip_fd, pack, exp_time, data_len)
ip_fd_t *ip_fd;
acc_t *pack;
time_t exp_time;
assert (result >= 0);
}
-PUBLIC void ip_port_arrive (ip_port, pack, ip_hdr)
+void ip_port_arrive (ip_port, pack, ip_hdr)
ip_port_t *ip_port;
acc_t *pack;
ip_hdr_t *ip_hdr;
}
}
-PUBLIC void ip_arrived(ip_port, pack)
+void ip_arrived(ip_port, pack)
ip_port_t *ip_port;
acc_t *pack;
{
ev_enqueue(&ip_port->ip_routeq_event, route_packets, ev_arg);
}
-PUBLIC void ip_arrived_broadcast(ip_port, pack)
+void ip_arrived_broadcast(ip_port, pack)
ip_port_t *ip_port;
acc_t *pack;
{
ip_port_arrive (ip_port, pack, ip_hdr);
}
-PRIVATE void route_packets(ev, ev_arg)
+static void route_packets(ev, ev_arg)
event_t *ev;
ev_arg_t ev_arg;
{
}
}
-PRIVATE int broadcast_dst(ip_port, dest)
+static int broadcast_dst(ip_port, dest)
ip_port_t *ip_port;
ipaddr_t dest;
{
THIS_FILE
-FORWARD void error_reply ARGS(( ip_fd_t *fd, int error ));
+static void error_reply ARGS(( ip_fd_t *fd, int error ));
-PUBLIC int ip_write (fd, count)
+int ip_write (fd, count)
int fd;
size_t count;
{
return NW_OK;
}
-PUBLIC int ip_send(fd, data, data_len)
+int ip_send(fd, data, data_len)
int fd;
acc_t *data;
size_t data_len;
return r;
}
-PUBLIC void ip_hdr_chksum(ip_hdr, ip_hdr_len)
+void ip_hdr_chksum(ip_hdr, ip_hdr_len)
ip_hdr_t *ip_hdr;
int ip_hdr_len;
{
ip_hdr->ih_hdr_chk= ~oneC_sum (0, (u16_t *)ip_hdr, ip_hdr_len);
}
-PUBLIC acc_t *ip_split_pack (ip_port, ref_last, mtu)
+acc_t *ip_split_pack (ip_port, ref_last, mtu)
ip_port_t *ip_port;
acc_t **ref_last;
int mtu;
return first_pack;
}
-PRIVATE void error_reply (ip_fd, error)
+static void error_reply (ip_fd, error)
ip_fd_t *ip_fd;
int error;
{
oroute_t *orh_route;
} oroute_hash_t;
-PRIVATE oroute_t oroute_table[OROUTE_NR];
-PRIVATE oroute_t *oroute_head;
-PRIVATE int static_oroute_nr;
-PRIVATE oroute_hash_t oroute_hash_table[OROUTE_HASH_NR][OROUTE_HASH_ASS_NR];
+static oroute_t oroute_table[OROUTE_NR];
+static oroute_t *oroute_head;
+static int static_oroute_nr;
+static oroute_hash_t oroute_hash_table[OROUTE_HASH_NR][OROUTE_HASH_ASS_NR];
#define IROUTE_NR 512
#define IROUTE_HASH_ASS_NR 4
iroute_t *irh_route;
} iroute_hash_t;
-PRIVATE iroute_t iroute_table[IROUTE_NR];
-PRIVATE iroute_hash_t iroute_hash_table[IROUTE_HASH_NR][IROUTE_HASH_ASS_NR];
+static iroute_t iroute_table[IROUTE_NR];
+static iroute_hash_t iroute_hash_table[IROUTE_HASH_NR][IROUTE_HASH_ASS_NR];
-FORWARD oroute_t *oroute_find_ent ARGS(( int port_nr, ipaddr_t dest ));
-FORWARD void oroute_del ARGS(( oroute_t *oroute ));
-FORWARD oroute_t *sort_dists ARGS(( oroute_t *oroute ));
-FORWARD oroute_t *sort_gws ARGS(( oroute_t *oroute ));
-FORWARD void oroute_uncache_nw ARGS(( ipaddr_t dest, ipaddr_t netmask ));
-FORWARD void iroute_uncache_nw ARGS(( ipaddr_t dest, ipaddr_t netmask ));
+static oroute_t *oroute_find_ent ARGS(( int port_nr, ipaddr_t dest ));
+static void oroute_del ARGS(( oroute_t *oroute ));
+static oroute_t *sort_dists ARGS(( oroute_t *oroute ));
+static oroute_t *sort_gws ARGS(( oroute_t *oroute ));
+static void oroute_uncache_nw ARGS(( ipaddr_t dest, ipaddr_t netmask ));
+static void iroute_uncache_nw ARGS(( ipaddr_t dest, ipaddr_t netmask ));
-PUBLIC void ipr_init()
+void ipr_init()
{
int i;
oroute_t *oroute;
}
-PUBLIC iroute_t *iroute_frag(port_nr, dest)
+iroute_t *iroute_frag(port_nr, dest)
int port_nr;
ipaddr_t dest;
{
return bestroute;
}
-PUBLIC int oroute_frag(port_nr, dest, ttl, msgsize, nexthop)
+int oroute_frag(port_nr, dest, ttl, msgsize, nexthop)
int port_nr;
ipaddr_t dest;
int ttl;
}
-PUBLIC int ipr_add_oroute(port_nr, dest, subnetmask, gateway,
+int ipr_add_oroute(port_nr, dest, subnetmask, gateway,
timeout, dist, mtu, static_route, preference, oroute_p)
int port_nr;
ipaddr_t dest;
return NW_OK;
}
-PUBLIC int ipr_del_oroute(port_nr, dest, subnetmask, gateway, static_route)
+int ipr_del_oroute(port_nr, dest, subnetmask, gateway, static_route)
int port_nr;
ipaddr_t dest;
ipaddr_t subnetmask;
-PUBLIC void ipr_chk_otab(port_nr, addr, mask)
+void ipr_chk_otab(port_nr, addr, mask)
int port_nr;
ipaddr_t addr;
ipaddr_t mask;
}
-PUBLIC void ipr_gateway_down(port_nr, gateway, timeout)
+void ipr_gateway_down(port_nr, gateway, timeout)
int port_nr;
ipaddr_t gateway;
time_t timeout;
}
-PUBLIC void ipr_destunrch(port_nr, dest, netmask, timeout)
+void ipr_destunrch(port_nr, dest, netmask, timeout)
int port_nr;
ipaddr_t dest;
ipaddr_t netmask;
}
-PUBLIC void ipr_redirect(port_nr, dest, netmask, old_gateway, new_gateway,
+void ipr_redirect(port_nr, dest, netmask, old_gateway, new_gateway,
timeout)
int port_nr;
ipaddr_t dest;
}
-PUBLIC void ipr_ttl_exc(port_nr, dest, netmask, timeout)
+void ipr_ttl_exc(port_nr, dest, netmask, timeout)
int port_nr;
ipaddr_t dest;
ipaddr_t netmask;
assert(result == NW_OK);
}
-PUBLIC void ipr_mtu(
+void ipr_mtu(
int port_nr,
ipaddr_t dest,
u16_t mtu,
}
-PUBLIC int ipr_get_oroute(ent_no, route_ent)
+int ipr_get_oroute(ent_no, route_ent)
int ent_no;
nwio_route_t *route_ent;
{
}
-PRIVATE oroute_t *oroute_find_ent(port_nr, dest)
+static oroute_t *oroute_find_ent(port_nr, dest)
int port_nr;
ipaddr_t dest;
{
}
-PRIVATE void oroute_del(oroute)
+static void oroute_del(oroute)
oroute_t *oroute;
{
oroute_t *prev, *nw_route, *gw_route, *dist_route, *prev_route;
}
-PRIVATE oroute_t *sort_dists(oroute)
+static oroute_t *sort_dists(oroute)
oroute_t *oroute;
{
oroute_t *r, *prev, *best, *best_prev;
}
-PRIVATE oroute_t *sort_gws(oroute)
+static oroute_t *sort_gws(oroute)
oroute_t *oroute;
{
oroute_t *r, *prev, *best, *best_prev;
}
-PRIVATE void oroute_uncache_nw(dest, netmask)
+static void oroute_uncache_nw(dest, netmask)
ipaddr_t dest;
ipaddr_t netmask;
{
* Input routing
*/
-PUBLIC int ipr_get_iroute(ent_no, route_ent)
+int ipr_get_iroute(ent_no, route_ent)
int ent_no;
nwio_route_t *route_ent;
{
}
-PUBLIC int ipr_add_iroute(port_nr, dest, subnetmask, gateway,
+int ipr_add_iroute(port_nr, dest, subnetmask, gateway,
dist, mtu, static_route, iroute_p)
int port_nr;
ipaddr_t dest;
}
-PUBLIC int ipr_del_iroute(port_nr, dest, subnetmask, gateway, static_route)
+int ipr_del_iroute(port_nr, dest, subnetmask, gateway, static_route)
int port_nr;
ipaddr_t dest;
ipaddr_t subnetmask;
}
-PUBLIC void ipr_chk_itab(port_nr, addr, mask)
+void ipr_chk_itab(port_nr, addr, mask)
int port_nr;
ipaddr_t addr;
ipaddr_t mask;
}
-PRIVATE void iroute_uncache_nw(dest, netmask)
+static void iroute_uncache_nw(dest, netmask)
ipaddr_t dest;
ipaddr_t netmask;
{
#define PFF_PROMISC 4
#define PFF_NEXTHOP 8
-PRIVATE psip_port_t *psip_port_table;
-PRIVATE psip_fd_t psip_fd_table[PSIP_FD_NR];
+static psip_port_t *psip_port_table;
+static psip_fd_t psip_fd_table[PSIP_FD_NR];
-FORWARD int psip_open ARGS(( int port, int srfd,
+static int psip_open ARGS(( int port, int srfd,
get_userdata_t get_userdata, put_userdata_t put_userdata,
put_pkt_t pkt_pkt, select_res_t select_res ));
-FORWARD int psip_ioctl ARGS(( int fd, ioreq_t req ));
-FORWARD int psip_read ARGS(( int fd, size_t count ));
-FORWARD int psip_write ARGS(( int fd, size_t count ));
-FORWARD int psip_select ARGS(( int port_nr, unsigned operations ));
-FORWARD void psip_close ARGS(( int fd ));
-FORWARD int psip_cancel ARGS(( int fd, int which_operation ));
-FORWARD void promisc_restart_read ARGS(( psip_port_t *psip_port ));
-FORWARD int psip_setopt ARGS(( psip_fd_t *psip_fd, nwio_psipopt_t *newoptp ));
-FORWARD void psip_buffree ARGS(( int priority ));
-FORWARD void check_promisc ARGS(( psip_port_t *psip_port ));
+static int psip_ioctl ARGS(( int fd, ioreq_t req ));
+static int psip_read ARGS(( int fd, size_t count ));
+static int psip_write ARGS(( int fd, size_t count ));
+static int psip_select ARGS(( int port_nr, unsigned operations ));
+static void psip_close ARGS(( int fd ));
+static int psip_cancel ARGS(( int fd, int which_operation ));
+static void promisc_restart_read ARGS(( psip_port_t *psip_port ));
+static int psip_setopt ARGS(( psip_fd_t *psip_fd, nwio_psipopt_t *newoptp ));
+static void psip_buffree ARGS(( int priority ));
+static void check_promisc ARGS(( psip_port_t *psip_port ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void psip_bufcheck ARGS(( void ));
+static void psip_bufcheck ARGS(( void ));
#endif
-FORWARD void reply_thr_put ARGS(( psip_fd_t *psip_fd, int reply,
+static void reply_thr_put ARGS(( psip_fd_t *psip_fd, int reply,
int for_ioctl ));
-FORWARD void reply_thr_get ARGS(( psip_fd_t *psip_fd, int reply,
+static void reply_thr_get ARGS(( psip_fd_t *psip_fd, int reply,
int for_ioctl ));
-PUBLIC void psip_prep()
+void psip_prep()
{
psip_port_table= alloc(psip_conf_nr * sizeof(psip_port_table[0]));
}
-PUBLIC void psip_init()
+void psip_init()
{
int i;
psip_port_t *psip_port;
#endif
}
-PUBLIC int psip_enable(port_nr, ip_port_nr)
+int psip_enable(port_nr, ip_port_nr)
int port_nr;
int ip_port_nr;
{
return NW_OK;
}
-PUBLIC int psip_send(port_nr, dest, pack)
+int psip_send(port_nr, dest, pack)
int port_nr;
ipaddr_t dest;
acc_t *pack;
return NW_SUSPEND;
}
-PRIVATE int psip_open(port, srfd, get_userdata, put_userdata, put_pkt,
+static int psip_open(port, srfd, get_userdata, put_userdata, put_pkt,
select_res)
int port;
int srfd;
return i;
}
-PRIVATE int psip_ioctl(fd, req)
+static int psip_ioctl(fd, req)
int fd;
ioreq_t req;
{
return NW_OK;
}
-PRIVATE int psip_read(fd, count)
+static int psip_read(fd, count)
int fd;
size_t count;
{
return NW_OK;
}
-PRIVATE int psip_write(fd, count)
+static int psip_write(fd, count)
int fd;
size_t count;
{
return NW_OK;
}
-PRIVATE int psip_select(fd, operations)
+static int psip_select(fd, operations)
int fd;
unsigned operations;
{
return 0;
}
-PRIVATE void psip_close(fd)
+static void psip_close(fd)
int fd;
{
psip_port_t *psip_port;
}
-PRIVATE int psip_cancel(fd, which_operation)
+static int psip_cancel(fd, which_operation)
int fd;
int which_operation;
{
return NW_OK;
}
-PRIVATE void promisc_restart_read(psip_port)
+static void promisc_restart_read(psip_port)
psip_port_t *psip_port;
{
psip_fd_t *psip_fd, *prev, *next;
}
}
-PRIVATE int psip_setopt(psip_fd, newoptp)
+static int psip_setopt(psip_fd, newoptp)
psip_fd_t *psip_fd;
nwio_psipopt_t *newoptp;
{
return NW_OK;
}
-PRIVATE void check_promisc(psip_port)
+static void check_promisc(psip_port)
psip_port_t *psip_port;
{
int i;
}
}
-PRIVATE void psip_buffree (priority)
+static void psip_buffree (priority)
int priority;
{
int i;
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void psip_bufcheck()
+static void psip_bufcheck()
{
int i;
psip_port_t *psip_port;
reply_thr_put
*/
-PRIVATE void reply_thr_put(psip_fd, reply, for_ioctl)
+static void reply_thr_put(psip_fd, reply, for_ioctl)
psip_fd_t *psip_fd;
int reply;
int for_ioctl;
reply_thr_get
*/
-PRIVATE void reply_thr_get(psip_fd, reply, for_ioctl)
+static void reply_thr_get(psip_fd, reply, for_ioctl)
psip_fd_t *psip_fd;
int reply;
int for_ioctl;
#include "inet.h"
#include "rand256.h"
-PRIVATE u32_t base_bits[8];
+static u32_t base_bits[8];
-PUBLIC void init_rand256(bits)
+void init_rand256(bits)
u8_t bits[32];
{
memcpy(base_bits, bits, sizeof(base_bits));
}
-PUBLIC void rand256(bits)
+void rand256(bits)
u8_t bits[32];
{
u32_t a;
THIS_FILE
-PUBLIC tcp_port_t *tcp_port_table;
-PUBLIC tcp_fd_t tcp_fd_table[TCP_FD_NR];
-PUBLIC tcp_conn_t tcp_conn_table[TCP_CONN_NR];
-PUBLIC sr_cancel_t tcp_cancel_f;
-
-FORWARD void tcp_main ARGS(( tcp_port_t *port ));
-FORWARD int tcp_select ARGS(( int fd, unsigned operations ));
-FORWARD acc_t *tcp_get_data ARGS(( int fd, size_t offset,
+tcp_port_t *tcp_port_table;
+tcp_fd_t tcp_fd_table[TCP_FD_NR];
+tcp_conn_t tcp_conn_table[TCP_CONN_NR];
+sr_cancel_t tcp_cancel_f;
+
+static void tcp_main ARGS(( tcp_port_t *port ));
+static int tcp_select ARGS(( int fd, unsigned operations ));
+static acc_t *tcp_get_data ARGS(( int fd, size_t offset,
size_t count, int for_ioctl ));
-FORWARD int tcp_put_data ARGS(( int fd, size_t offset,
+static int tcp_put_data ARGS(( int fd, size_t offset,
acc_t *data, int for_ioctl ));
-FORWARD void tcp_put_pkt ARGS(( int fd, acc_t *data, size_t datalen ));
-FORWARD void read_ip_packets ARGS(( tcp_port_t *port ));
-FORWARD int tcp_setconf ARGS(( tcp_fd_t *tcp_fd ));
-FORWARD int tcp_setopt ARGS(( tcp_fd_t *tcp_fd ));
-FORWARD int tcp_connect ARGS(( tcp_fd_t *tcp_fd ));
-FORWARD int tcp_listen ARGS(( tcp_fd_t *tcp_fd, int do_listenq ));
-FORWARD int tcp_acceptto ARGS(( tcp_fd_t *tcp_fd ));
-FORWARD tcpport_t find_unused_port ARGS(( int fd ));
-FORWARD int is_unused_port ARGS(( tcpport_t port ));
-FORWARD int reply_thr_put ARGS(( tcp_fd_t *tcp_fd, int reply,
+static void tcp_put_pkt ARGS(( int fd, acc_t *data, size_t datalen ));
+static void read_ip_packets ARGS(( tcp_port_t *port ));
+static int tcp_setconf ARGS(( tcp_fd_t *tcp_fd ));
+static int tcp_setopt ARGS(( tcp_fd_t *tcp_fd ));
+static int tcp_connect ARGS(( tcp_fd_t *tcp_fd ));
+static int tcp_listen ARGS(( tcp_fd_t *tcp_fd, int do_listenq ));
+static int tcp_acceptto ARGS(( tcp_fd_t *tcp_fd ));
+static tcpport_t find_unused_port ARGS(( int fd ));
+static int is_unused_port ARGS(( tcpport_t port ));
+static int reply_thr_put ARGS(( tcp_fd_t *tcp_fd, int reply,
int for_ioctl ));
-FORWARD void reply_thr_get ARGS(( tcp_fd_t *tcp_fd, int reply,
+static void reply_thr_get ARGS(( tcp_fd_t *tcp_fd, int reply,
int for_ioctl ));
-FORWARD tcp_conn_t *find_conn_entry ARGS(( tcpport_t locport,
+static tcp_conn_t *find_conn_entry ARGS(( tcpport_t locport,
ipaddr_t locaddr, tcpport_t remport, ipaddr_t readaddr ));
-FORWARD tcp_conn_t *find_empty_conn ARGS(( void ));
-FORWARD tcp_conn_t *find_best_conn ARGS(( ip_hdr_t *ip_hdr,
+static tcp_conn_t *find_empty_conn ARGS(( void ));
+static tcp_conn_t *find_best_conn ARGS(( ip_hdr_t *ip_hdr,
tcp_hdr_t *tcp_hdr ));
-FORWARD tcp_conn_t *new_conn_for_queue ARGS(( tcp_fd_t *tcp_fd ));
-FORWARD int maybe_listen ARGS(( ipaddr_t locaddr, tcpport_t locport,
+static tcp_conn_t *new_conn_for_queue ARGS(( tcp_fd_t *tcp_fd ));
+static int maybe_listen ARGS(( ipaddr_t locaddr, tcpport_t locport,
ipaddr_t remaddr, tcpport_t remport ));
-FORWARD int tcp_su4connect ARGS(( tcp_fd_t *tcp_fd ));
-FORWARD void tcp_buffree ARGS(( int priority ));
+static int tcp_su4connect ARGS(( tcp_fd_t *tcp_fd ));
+static void tcp_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void tcp_bufcheck ARGS(( void ));
+static void tcp_bufcheck ARGS(( void ));
#endif
-FORWARD void tcp_setup_conn ARGS(( tcp_port_t *tcp_port,
+static void tcp_setup_conn ARGS(( tcp_port_t *tcp_port,
tcp_conn_t *tcp_conn ));
-FORWARD u32_t tcp_rand32 ARGS(( void ));
+static u32_t tcp_rand32 ARGS(( void ));
-PUBLIC void tcp_prep()
+void tcp_prep()
{
tcp_port_table= alloc(tcp_conf_nr * sizeof(tcp_port_table[0]));
}
-PUBLIC void tcp_init()
+void tcp_init()
{
int i, j, k, ifno;
tcp_fd_t *tcp_fd;
tcp_cancel_f= tcp_cancel;
}
-PRIVATE void tcp_main(tcp_port)
+static void tcp_main(tcp_port)
tcp_port_t *tcp_port;
{
int result, i;
}
}
-PRIVATE int tcp_select(fd, operations)
+static int tcp_select(fd, operations)
int fd;
unsigned operations;
{
return resops;
}
-PRIVATE acc_t *tcp_get_data (port, offset, count, for_ioctl)
+static acc_t *tcp_get_data (port, offset, count, for_ioctl)
int port;
size_t offset;
size_t count;
return NW_OK;
}
-PRIVATE int tcp_put_data (fd, offset, data, for_ioctl)
+static int tcp_put_data (fd, offset, data, for_ioctl)
int fd;
size_t offset;
acc_t *data;
tcp_put_pkt
*/
-PRIVATE void tcp_put_pkt(fd, data, datalen)
+static void tcp_put_pkt(fd, data, datalen)
int fd;
acc_t *data;
size_t datalen;
}
-PUBLIC int tcp_open (port, srfd, get_userdata, put_userdata, put_pkt,
+int tcp_open (port, srfd, get_userdata, put_userdata, put_pkt,
select_res)
int port;
int srfd;
/*
tcp_ioctl
*/
-PUBLIC int tcp_ioctl (fd, req)
+int tcp_ioctl (fd, req)
int fd;
ioreq_t req;
{
tcp_setconf
*/
-PRIVATE int tcp_setconf(tcp_fd)
+static int tcp_setconf(tcp_fd)
tcp_fd_t *tcp_fd;
{
nwio_tcpconf_t *tcpconf;
tcp_setopt
*/
-PRIVATE int tcp_setopt(tcp_fd)
+static int tcp_setopt(tcp_fd)
tcp_fd_t *tcp_fd;
{
nwio_tcpopt_t *tcpopt;
}
-PRIVATE tcpport_t find_unused_port(int fd)
+static tcpport_t find_unused_port(int fd)
{
tcpport_t port, nw_port;
return 0;
}
-PRIVATE int is_unused_port(tcpport_t port)
+static int is_unused_port(tcpport_t port)
{
int i;
tcp_fd_t *tcp_fd;
return TRUE;
}
-PRIVATE int reply_thr_put(tcp_fd, reply, for_ioctl)
+static int reply_thr_put(tcp_fd, reply, for_ioctl)
tcp_fd_t *tcp_fd;
int reply;
int for_ioctl;
(acc_t *)0, for_ioctl);
}
-PRIVATE void reply_thr_get(tcp_fd, reply, for_ioctl)
+static void reply_thr_get(tcp_fd, reply, for_ioctl)
tcp_fd_t *tcp_fd;
int reply;
int for_ioctl;
assert (!result);
}
-PUBLIC int tcp_su4listen(tcp_fd, tcp_conn, do_listenq)
+int tcp_su4listen(tcp_fd, tcp_conn, do_listenq)
tcp_fd_t *tcp_fd;
tcp_conn_t *tcp_conn;
int do_listenq;
user that are not used for a while.
*/
-PRIVATE tcp_conn_t *find_empty_conn()
+static tcp_conn_t *find_empty_conn()
{
int i;
tcp_conn_t *tcp_conn;
If a connection exists without mainuser it is closed.
*/
-PRIVATE tcp_conn_t *find_conn_entry(
+static tcp_conn_t *find_conn_entry(
tcpport_t locport,
ipaddr_t locaddr,
tcpport_t remport,
return NULL;
}
-PRIVATE void read_ip_packets(tcp_port)
+static void read_ip_packets(tcp_port)
tcp_port_t *tcp_port;
{
int result;
find_best_conn
*/
-PRIVATE tcp_conn_t *find_best_conn(ip_hdr, tcp_hdr)
+static tcp_conn_t *find_best_conn(ip_hdr, tcp_hdr)
ip_hdr_t *ip_hdr;
tcp_hdr_t *tcp_hdr;
{
/*
new_conn_for_queue
*/
-PRIVATE tcp_conn_t *new_conn_for_queue(tcp_fd)
+static tcp_conn_t *new_conn_for_queue(tcp_fd)
tcp_fd_t *tcp_fd;
{
int i;
/*
maybe_listen
*/
-PRIVATE int maybe_listen(
+static int maybe_listen(
ipaddr_t locaddr,
tcpport_t locport,
ipaddr_t remaddr,
}
-PUBLIC void tcp_reply_ioctl(tcp_fd, reply)
+void tcp_reply_ioctl(tcp_fd, reply)
tcp_fd_t *tcp_fd;
int reply;
{
reply_thr_get (tcp_fd, reply, TRUE);
}
-PUBLIC void tcp_reply_write(tcp_fd, reply)
+void tcp_reply_write(tcp_fd, reply)
tcp_fd_t *tcp_fd;
size_t reply;
{
reply_thr_get (tcp_fd, reply, FALSE);
}
-PUBLIC void tcp_reply_read(tcp_fd, reply)
+void tcp_reply_read(tcp_fd, reply)
tcp_fd_t *tcp_fd;
size_t reply;
{
reply_thr_put (tcp_fd, reply, FALSE);
}
-PUBLIC int tcp_write(fd, count)
+int tcp_write(fd, count)
int fd;
size_t count;
{
return NW_SUSPEND;
}
-PUBLIC int
+int
tcp_read(fd, count)
int fd;
size_t count;
*/
-PUBLIC void tcp_restart_connect(tcp_conn)
+void tcp_restart_connect(tcp_conn)
tcp_conn_t *tcp_conn;
{
tcp_fd_t *tcp_fd;
tcp_close
*/
-PUBLIC void tcp_close(fd)
+void tcp_close(fd)
int fd;
{
int i;
tcp_close_connection(tcp_conn, ENOTCONN);
}
-PUBLIC int tcp_cancel(fd, which_operation)
+int tcp_cancel(fd, which_operation)
int fd;
int which_operation;
{
tcp_connect
*/
-PRIVATE int tcp_connect(tcp_fd)
+static int tcp_connect(tcp_fd)
tcp_fd_t *tcp_fd;
{
tcp_conn_t *tcp_conn;
tcp_su4connect
*/
-PRIVATE int tcp_su4connect(tcp_fd)
+static int tcp_su4connect(tcp_fd)
tcp_fd_t *tcp_fd;
{
tcp_conn_t *tcp_conn;
tcp_listen
*/
-PRIVATE int tcp_listen(tcp_fd, do_listenq)
+static int tcp_listen(tcp_fd, do_listenq)
tcp_fd_t *tcp_fd;
int do_listenq;
{
tcp_acceptto
*/
-PRIVATE int tcp_acceptto(tcp_fd)
+static int tcp_acceptto(tcp_fd)
tcp_fd_t *tcp_fd;
{
int i, dst_nr;
}
-PRIVATE void tcp_buffree (priority)
+static void tcp_buffree (priority)
int priority;
{
int i;
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void tcp_bufcheck()
+static void tcp_bufcheck()
{
int i;
tcp_conn_t *tcp_conn;
}
#endif
-PUBLIC void tcp_notreach(tcp_conn, error)
+void tcp_notreach(tcp_conn, error)
tcp_conn_t *tcp_conn;
int error;
{
tcp_conn_write(tcp_conn, 1);
}
-FORWARD u32_t mtu_table[]=
+static u32_t mtu_table[]=
{ /* From RFC-1191 */
/* Plateau MTU Comments Reference */
/* ------ --- -------- --------- */
0, /* End of list */
};
-PUBLIC void tcp_mtu_exceeded(tcp_conn)
+void tcp_mtu_exceeded(tcp_conn)
tcp_conn_t *tcp_conn;
{
u16_t mtu;
tcp_conn_write(tcp_conn, 1);
}
-PUBLIC void tcp_mtu_incr(tcp_conn)
+void tcp_mtu_incr(tcp_conn)
tcp_conn_t *tcp_conn;
{
clock_t curr_time;
tcp_setup_conn
*/
-PRIVATE void tcp_setup_conn(tcp_port, tcp_conn)
+static void tcp_setup_conn(tcp_port, tcp_conn)
tcp_port_t *tcp_port;
tcp_conn_t *tcp_conn;
{
tcp_conn->tc_transmit_seq= 0;
}
-PRIVATE u32_t tcp_rand32()
+static u32_t tcp_rand32()
{
u8_t bits[RAND256_BUFSIZE];
THIS_FILE
#undef tcp_LEmod4G
-PUBLIC int tcp_LEmod4G(n1, n2)
+int tcp_LEmod4G(n1, n2)
u32_t n1;
u32_t n2;
{
}
#undef tcp_GEmod4G
-PUBLIC int tcp_GEmod4G(n1, n2)
+int tcp_GEmod4G(n1, n2)
u32_t n1;
u32_t n2;
{
}
#undef tcp_Lmod4G
-PUBLIC int tcp_Lmod4G(n1, n2)
+int tcp_Lmod4G(n1, n2)
u32_t n1;
u32_t n2;
{
}
#undef tcp_Gmod4G
-PUBLIC int tcp_Gmod4G(n1, n2)
+int tcp_Gmod4G(n1, n2)
u32_t n1;
u32_t n2;
{
return !!((u32_t)(n2-n1) & 0x80000000L);
}
-PUBLIC void tcp_extract_ipopt(tcp_conn, ip_hdr)
+void tcp_extract_ipopt(tcp_conn, ip_hdr)
tcp_conn_t *tcp_conn;
ip_hdr_t *ip_hdr;
{
DBLOCK(1, printf("ip_hdr options NOT supported (yet?)\n"));
}
-PUBLIC void tcp_extract_tcpopt(tcp_conn, tcp_hdr, mssp)
+void tcp_extract_tcpopt(tcp_conn, tcp_hdr, mssp)
tcp_conn_t *tcp_conn;
tcp_hdr_t *tcp_hdr;
size_t *mssp;
}
}
-PUBLIC u16_t tcp_pack_oneCsum(ip_hdr, tcp_pack)
+u16_t tcp_pack_oneCsum(ip_hdr, tcp_pack)
ip_hdr_t *ip_hdr;
acc_t *tcp_pack;
{
return sum;
}
-PUBLIC void tcp_get_ipopt(tcp_conn, ip_hdropt)
+void tcp_get_ipopt(tcp_conn, ip_hdropt)
tcp_conn_t *tcp_conn;
ip_hdropt_t *ip_hdropt;
{
return;
}
-PUBLIC void tcp_get_tcpopt(tcp_conn, tcp_hdropt)
+void tcp_get_tcpopt(tcp_conn, tcp_hdropt)
tcp_conn_t *tcp_conn;
tcp_hdropt_t *tcp_hdropt;
{
return;
}
-PUBLIC acc_t *tcp_make_header(tcp_conn, ref_ip_hdr, ref_tcp_hdr, data)
+acc_t *tcp_make_header(tcp_conn, ref_ip_hdr, ref_tcp_hdr, data)
tcp_conn_t *tcp_conn;
ip_hdr_t **ref_ip_hdr;
tcp_hdr_t **ref_tcp_hdr;
return hdr_acc;
}
-PUBLIC void tcp_print_state (tcp_conn)
+void tcp_print_state (tcp_conn)
tcp_conn_t *tcp_conn;
{
#if DEBUG
#endif
}
-PUBLIC int tcp_check_conn(tcp_conn)
+int tcp_check_conn(tcp_conn)
tcp_conn_t *tcp_conn;
{
int allright;
return allright;
}
-PUBLIC void tcp_print_pack(ip_hdr, tcp_hdr)
+void tcp_print_pack(ip_hdr, tcp_hdr)
ip_hdr_t *ip_hdr;
tcp_hdr_t *tcp_hdr;
{
printf(" <options %d>", tcp_hdr_len-TCP_MIN_HDR_SIZE);
}
-PUBLIC void tcp_print_conn(tcp_conn)
+void tcp_print_conn(tcp_conn)
tcp_conn_t *tcp_conn;
{
u32_t iss, irs;
THIS_FILE
-FORWARD void create_RST ARGS(( tcp_conn_t *tcp_conn,
+static void create_RST ARGS(( tcp_conn_t *tcp_conn,
ip_hdr_t *ip_hdr, tcp_hdr_t *tcp_hdr, int data_len ));
-FORWARD void process_data ARGS(( tcp_conn_t *tcp_conn,
+static void process_data ARGS(( tcp_conn_t *tcp_conn,
tcp_hdr_t *tcp_hdr, acc_t *tcp_data, int data_len ));
-FORWARD void process_advanced_data ARGS(( tcp_conn_t *tcp_conn,
+static void process_advanced_data ARGS(( tcp_conn_t *tcp_conn,
tcp_hdr_t *tcp_hdr, acc_t *tcp_data, int data_len ));
-PUBLIC void tcp_frag2conn(tcp_conn, ip_hdr, tcp_hdr, tcp_data, data_len)
+void tcp_frag2conn(tcp_conn, ip_hdr, tcp_hdr, tcp_data, data_len)
tcp_conn_t *tcp_conn;
ip_hdr_t *ip_hdr;
tcp_hdr_t *tcp_hdr;
}
-PRIVATE void
+static void
process_data(tcp_conn, tcp_hdr, tcp_data, data_len)
tcp_conn_t *tcp_conn;
tcp_hdr_t *tcp_hdr;
}
}
-PRIVATE void process_advanced_data(tcp_conn, tcp_hdr, tcp_data, data_len)
+static void process_advanced_data(tcp_conn, tcp_hdr, tcp_data, data_len)
tcp_conn_t *tcp_conn;
tcp_hdr_t *tcp_hdr;
acc_t *tcp_data;
tcp_conn->tc_adv_seq= adv_seq;
}
-PRIVATE void create_RST(tcp_conn, ip_hdr, tcp_hdr, data_len)
+static void create_RST(tcp_conn, ip_hdr, tcp_hdr, data_len)
tcp_conn_t *tcp_conn;
ip_hdr_t *ip_hdr;
tcp_hdr_t *tcp_hdr;
tcp_conn_write(tcp_conn, 1);
}
-PUBLIC void
+void
tcp_fd_read(tcp_conn, enq)
tcp_conn_t *tcp_conn;
int enq; /* Enqueue writes. */
}
}
-PUBLIC unsigned
+unsigned
tcp_sel_read(tcp_conn)
tcp_conn_t *tcp_conn;
{
return 1;
}
-PUBLIC void
+void
tcp_rsel_read(tcp_conn)
tcp_conn_t *tcp_conn;
{
printf("tcp_rsel_read: no select_res\n");
}
-PUBLIC void tcp_bytesavailable(tcp_fd, bytesp)
+void tcp_bytesavailable(tcp_fd, bytesp)
tcp_fd_t *tcp_fd;
int *bytesp;
{
THIS_FILE
-FORWARD acc_t *make_pack ARGS(( tcp_conn_t *tcp_conn ));
-FORWARD void tcp_send_timeout ARGS(( int conn, struct timer *timer ));
-FORWARD void do_snd_event ARGS(( event_t *ev, ev_arg_t arg ));
+static acc_t *make_pack ARGS(( tcp_conn_t *tcp_conn ));
+static void tcp_send_timeout ARGS(( int conn, struct timer *timer ));
+static void do_snd_event ARGS(( event_t *ev, ev_arg_t arg ));
-PUBLIC void tcp_conn_write (tcp_conn, enq)
+void tcp_conn_write (tcp_conn, enq)
tcp_conn_t *tcp_conn;
int enq; /* Writes need to be enqueued. */
{
}
}
-PRIVATE void do_snd_event(ev, arg)
+static void do_snd_event(ev, arg)
event_t *ev;
ev_arg_t arg;
{
tcp_port_write(tcp_port);
}
-PUBLIC void tcp_port_write(tcp_port)
+void tcp_port_write(tcp_port)
tcp_port_t *tcp_port;
{
tcp_conn_t *tcp_conn;
}
}
-PRIVATE acc_t *make_pack(tcp_conn)
+static acc_t *make_pack(tcp_conn)
tcp_conn_t *tcp_conn;
{
acc_t *pack2write, *tmp_pack, *tcp_pack;
tcp_release_retrans
*/
-PUBLIC void tcp_release_retrans(
+void tcp_release_retrans(
tcp_conn_t *tcp_conn,
u32_t seg_ack,
u16_t new_win
tcp_fast_retrans
*/
-PUBLIC void tcp_fast_retrans(tcp_conn)
+void tcp_fast_retrans(tcp_conn)
tcp_conn_t *tcp_conn;
{
u16_t mss, mss2;
}
#if 0
-PUBLIC void do_tcp_timeout(tcp_conn)
+void do_tcp_timeout(tcp_conn)
tcp_conn_t *tcp_conn;
{
tcp_send_timeout(tcp_conn-tcp_conn_table,
tcp_send_timeout
*/
-PRIVATE void tcp_send_timeout(conn, timer)
+static void tcp_send_timeout(conn, timer)
int conn;
struct timer *timer;
{
}
-PUBLIC void tcp_fd_write(tcp_conn)
+void tcp_fd_write(tcp_conn)
tcp_conn_t *tcp_conn;
{
tcp_fd_t *tcp_fd;
}
}
-PUBLIC unsigned tcp_sel_write(tcp_conn)
+unsigned tcp_sel_write(tcp_conn)
tcp_conn_t *tcp_conn;
{
tcp_fd_t *tcp_fd;
return 0;
}
-PUBLIC void
+void
tcp_rsel_write(tcp_conn)
tcp_conn_t *tcp_conn;
{
tcp_shutdown
*/
-PUBLIC void tcp_shutdown(tcp_conn)
+void tcp_shutdown(tcp_conn)
tcp_conn_t *tcp_conn;
{
switch (tcp_conn->tc_state)
tcp_set_send_timer(tcp_conn);
}
-PUBLIC void tcp_set_send_timer(tcp_conn)
+void tcp_set_send_timer(tcp_conn)
tcp_conn_t *tcp_conn;
{
clock_t curr_time;
*/
-PUBLIC void tcp_close_connection(tcp_conn, error)
+void tcp_close_connection(tcp_conn, error)
tcp_conn_t *tcp_conn;
int error;
{
THIS_FILE
-FORWARD void read_ip_packets ARGS(( udp_port_t *udp_port ));
-FORWARD void udp_buffree ARGS(( int priority ));
+static void read_ip_packets ARGS(( udp_port_t *udp_port ));
+static void udp_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void udp_bufcheck ARGS(( void ));
+static void udp_bufcheck ARGS(( void ));
#endif
-FORWARD void udp_main ARGS(( udp_port_t *udp_port ));
-FORWARD int udp_select ARGS(( int fd, unsigned operations ));
-FORWARD acc_t *udp_get_data ARGS(( int fd, size_t offset, size_t count,
+static void udp_main ARGS(( udp_port_t *udp_port ));
+static int udp_select ARGS(( int fd, unsigned operations ));
+static acc_t *udp_get_data ARGS(( int fd, size_t offset, size_t count,
int for_ioctl ));
-FORWARD int udp_put_data ARGS(( int fd, size_t offset, acc_t *data,
+static int udp_put_data ARGS(( int fd, size_t offset, acc_t *data,
int for_ioctl ));
-FORWARD int udp_peek ARGS(( udp_fd_t * ));
-FORWARD int udp_sel_read ARGS(( udp_fd_t * ));
-FORWARD void udp_restart_write_port ARGS(( udp_port_t *udp_port ));
-FORWARD void udp_ip_arrived ARGS(( int port, acc_t *pack, size_t pack_size ));
-FORWARD void reply_thr_put ARGS(( udp_fd_t *udp_fd, int reply,
+static int udp_peek ARGS(( udp_fd_t * ));
+static int udp_sel_read ARGS(( udp_fd_t * ));
+static void udp_restart_write_port ARGS(( udp_port_t *udp_port ));
+static void udp_ip_arrived ARGS(( int port, acc_t *pack, size_t pack_size ));
+static void reply_thr_put ARGS(( udp_fd_t *udp_fd, int reply,
int for_ioctl ));
-FORWARD void reply_thr_get ARGS(( udp_fd_t *udp_fd, int reply,
+static void reply_thr_get ARGS(( udp_fd_t *udp_fd, int reply,
int for_ioctl ));
-FORWARD int udp_setopt ARGS(( udp_fd_t *udp_fd ));
-FORWARD udpport_t find_unused_port ARGS(( int fd ));
-FORWARD int is_unused_port ARGS(( udpport_t port ));
-FORWARD int udp_packet2user ARGS(( udp_fd_t *udp_fd ));
-FORWARD void restart_write_fd ARGS(( udp_fd_t *udp_fd ));
-FORWARD u16_t pack_oneCsum ARGS(( acc_t *pack ));
-FORWARD void udp_rd_enqueue ARGS(( udp_fd_t *udp_fd, acc_t *pack,
+static int udp_setopt ARGS(( udp_fd_t *udp_fd ));
+static udpport_t find_unused_port ARGS(( int fd ));
+static int is_unused_port ARGS(( udpport_t port ));
+static int udp_packet2user ARGS(( udp_fd_t *udp_fd ));
+static void restart_write_fd ARGS(( udp_fd_t *udp_fd ));
+static u16_t pack_oneCsum ARGS(( acc_t *pack ));
+static void udp_rd_enqueue ARGS(( udp_fd_t *udp_fd, acc_t *pack,
clock_t exp_tim ));
-FORWARD void hash_fd ARGS(( udp_fd_t *udp_fd ));
-FORWARD void unhash_fd ARGS(( udp_fd_t *udp_fd ));
+static void hash_fd ARGS(( udp_fd_t *udp_fd ));
+static void unhash_fd ARGS(( udp_fd_t *udp_fd ));
-PUBLIC udp_port_t *udp_port_table;
-PUBLIC udp_fd_t udp_fd_table[UDP_FD_NR];
+udp_port_t *udp_port_table;
+udp_fd_t udp_fd_table[UDP_FD_NR];
-PUBLIC void udp_prep()
+void udp_prep()
{
udp_port_table= alloc(udp_conf_nr * sizeof(udp_port_table[0]));
}
-PUBLIC void udp_init()
+void udp_init()
{
udp_fd_t *udp_fd;
udp_port_t *udp_port;
}
}
-PUBLIC int udp_open (port, srfd, get_userdata, put_userdata, put_pkt,
+int udp_open (port, srfd, get_userdata, put_userdata, put_pkt,
select_res)
int port;
int srfd;
}
-PUBLIC int udp_ioctl (fd, req)
+int udp_ioctl (fd, req)
int fd;
ioreq_t req;
{
return result;
}
-PUBLIC int udp_read (fd, count)
+int udp_read (fd, count)
int fd;
size_t count;
{
return NW_SUSPEND;
}
-PRIVATE void udp_main(udp_port)
+static void udp_main(udp_port)
udp_port_t *udp_port;
{
udp_fd_t *udp_fd;
}
}
-PRIVATE int udp_select(fd, operations)
+static int udp_select(fd, operations)
int fd;
unsigned operations;
{
return resops;
}
-PRIVATE acc_t *udp_get_data (port, offset, count, for_ioctl)
+static acc_t *udp_get_data (port, offset, count, for_ioctl)
int port;
size_t offset;
size_t count;
return NULL;
}
-PRIVATE int udp_put_data (fd, offset, data, for_ioctl)
+static int udp_put_data (fd, offset, data, for_ioctl)
int fd;
size_t offset;
acc_t *data;
return NW_OK;
}
-PRIVATE int udp_setopt(udp_fd)
+static int udp_setopt(udp_fd)
udp_fd_t *udp_fd;
{
udp_fd_t *fd_ptr;
return NW_OK;
}
-PRIVATE udpport_t find_unused_port(int fd)
+static udpport_t find_unused_port(int fd)
{
udpport_t port, nw_port;
reply_thr_put
*/
-PRIVATE void reply_thr_put(udp_fd, reply, for_ioctl)
+static void reply_thr_put(udp_fd, reply, for_ioctl)
udp_fd_t *udp_fd;
int reply;
int for_ioctl;
reply_thr_get
*/
-PRIVATE void reply_thr_get(udp_fd, reply, for_ioctl)
+static void reply_thr_get(udp_fd, reply, for_ioctl)
udp_fd_t *udp_fd;
int reply;
int for_ioctl;
assert (!result);
}
-PRIVATE int is_unused_port(udpport_t port)
+static int is_unused_port(udpport_t port)
{
int i;
udp_fd_t *udp_fd;
return TRUE;
}
-PRIVATE void read_ip_packets(udp_port)
+static void read_ip_packets(udp_port)
udp_port_t *udp_port;
{
int result;
}
-PRIVATE int udp_peek (udp_fd)
+static int udp_peek (udp_fd)
udp_fd_t *udp_fd;
{
acc_t *pack, *tmp_acc, *next_acc;
return NW_SUSPEND;
}
-PRIVATE int udp_sel_read (udp_fd_t *udp_fd)
+static int udp_sel_read (udp_fd_t *udp_fd)
{
acc_t *tmp_acc, *next_acc;
return 0;
}
-PRIVATE int udp_packet2user (udp_fd)
+static int udp_packet2user (udp_fd)
udp_fd_t *udp_fd;
{
acc_t *pack, *tmp_pack;
return result;
}
-PRIVATE void udp_ip_arrived(port, pack, pack_size)
+static void udp_ip_arrived(port, pack, pack_size)
int port;
acc_t *pack;
size_t pack_size;
bf_afree(udp_acc);
}
-PUBLIC void udp_close(fd)
+void udp_close(fd)
int fd;
{
udp_fd_t *udp_fd;
udp_fd->uf_rdbuf_head= NULL;
}
-PUBLIC int udp_write(int fd, size_t count)
+int udp_write(int fd, size_t count)
{
udp_fd_t *udp_fd;
}
}
-PRIVATE void restart_write_fd(udp_fd)
+static void restart_write_fd(udp_fd)
udp_fd_t *udp_fd;
{
udp_port_t *udp_port;
reply_thr_get (udp_fd, udp_fd->uf_wr_count, FALSE);
}
-PRIVATE u16_t pack_oneCsum(pack)
+static u16_t pack_oneCsum(pack)
acc_t *pack;
{
u16_t prev;
return prev;
}
-PRIVATE void udp_restart_write_port(udp_port )
+static void udp_restart_write_port(udp_port )
udp_port_t *udp_port;
{
udp_fd_t *udp_fd;
}
}
-PUBLIC int udp_cancel(fd, which_operation)
+int udp_cancel(fd, which_operation)
int fd;
int which_operation;
{
return NW_OK;
}
-PRIVATE void udp_buffree (priority)
+static void udp_buffree (priority)
int priority;
{
int i;
}
}
-PRIVATE void udp_rd_enqueue(udp_fd, pack, exp_tim)
+static void udp_rd_enqueue(udp_fd, pack, exp_tim)
udp_fd_t *udp_fd;
acc_t *pack;
clock_t exp_tim;
}
}
-PRIVATE void hash_fd(udp_fd)
+static void hash_fd(udp_fd)
udp_fd_t *udp_fd;
{
udp_port_t *udp_port;
}
}
-PRIVATE void unhash_fd(udp_fd)
+static void unhash_fd(udp_fd)
udp_fd_t *udp_fd;
{
udp_port_t *udp_port;
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void udp_bufcheck()
+static void udp_bufcheck()
{
int i;
udp_port_t *udp_port;
u32_t system_hz;
#endif
-FORWARD void nw_conf(void);
-FORWARD void nw_init(void);
-FORWARD void ds_event(void);
+static void nw_conf(void);
+static void nw_init(void);
+static void ds_event(void);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
-PUBLIC int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
mq_t *mq;
int ipc_status;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the inet server. */
int r;
return(OK);
}
-PRIVATE void nw_conf()
+static void nw_conf()
{
read_conf();
eth_prep();
udp_prep();
}
-PRIVATE void nw_init()
+static void nw_init()
{
mq_init();
bf_init();
/*===========================================================================*
* ds_event *
*===========================================================================*/
-PRIVATE void ds_event()
+static void ds_event()
{
char key[DS_MAX_KEYLEN];
char *driver_prefix = "drv.net.";
printf("inet: ds_event: ds_check failed: %d\n", r);
}
-PUBLIC void panic0(file, line)
+void panic0(file, line)
char *file;
int line;
{
printf("panic at %s, %d: ", file, line);
}
-PUBLIC void inet_panic()
+void inet_panic()
{
printf("\ninet stacktrace: ");
util_stacktrace();
}
#if !NDEBUG
-PUBLIC void bad_assertion(file, line, what)
+void bad_assertion(file, line, what)
char *file;
int line;
char *what;
}
-PUBLIC void bad_compare(file, line, lhs, what, rhs)
+void bad_compare(file, line, lhs, what, rhs)
char *file;
int line;
int lhs;
THIS_FILE
-FORWARD void setup_read(eth_port_t *eth_port);
-FORWARD void read_int(eth_port_t *eth_port, int count);
-FORWARD void eth_issue_send(eth_port_t *eth_port);
-FORWARD void write_int(eth_port_t *eth_port);
-FORWARD void eth_restart(eth_port_t *eth_port, endpoint_t endpoint);
-FORWARD void send_getstat(eth_port_t *eth_port);
-
-PUBLIC void osdep_eth_init()
+static void setup_read(eth_port_t *eth_port);
+static void read_int(eth_port_t *eth_port, int count);
+static void eth_issue_send(eth_port_t *eth_port);
+static void write_int(eth_port_t *eth_port);
+static void eth_restart(eth_port_t *eth_port, endpoint_t endpoint);
+static void send_getstat(eth_port_t *eth_port);
+
+void osdep_eth_init()
{
int i, j, rport;
struct eth_conf *ecp;
}
}
-PUBLIC void eth_write_port(eth_port, pack)
+void eth_write_port(eth_port, pack)
eth_port_t *eth_port;
acc_t *pack;
{
eth_issue_send(eth_port);
}
-PUBLIC void eth_rec(message *m)
+void eth_rec(message *m)
{
int i, r, m_type, flags;
eth_port_t *loc_port, *vlan_port;
}
}
-PUBLIC void eth_check_driver(char *label, endpoint_t endpoint)
+void eth_check_driver(char *label, endpoint_t endpoint)
{
int i;
eth_port_t *loc_port;
}
}
-PUBLIC int eth_get_stat(eth_port, eth_stat)
+int eth_get_stat(eth_port, eth_stat)
eth_port_t *eth_port;
eth_stat_t *eth_stat;
{
return SUSPEND;
}
-PUBLIC void eth_set_rec_conf (eth_port, flags)
+void eth_set_rec_conf (eth_port, flags)
eth_port_t *eth_port;
u32_t flags;
{
}
}
-PRIVATE void eth_issue_send(eth_port)
+static void eth_issue_send(eth_port)
eth_port_t *eth_port;
{
int i, r, pack_size;
eth_port->etp_osdep.etp_state= OEPS_SEND_SENT;
}
-PRIVATE void write_int(eth_port_t *eth_port)
+static void write_int(eth_port_t *eth_port)
{
acc_t *pack;
int multicast;
eth_restart_write(eth_port);
}
-PRIVATE void read_int(eth_port, count)
+static void read_int(eth_port, count)
eth_port_t *eth_port;
int count;
{
setup_read(eth_port);
}
-PRIVATE void setup_read(eth_port)
+static void setup_read(eth_port)
eth_port_t *eth_port;
{
acc_t *pack, *pack_ptr;
}
-PRIVATE void send_getstat(eth_port)
+static void send_getstat(eth_port)
eth_port_t *eth_port;
{
int r;
#define MQ_SIZE 128
-PRIVATE mq_t mq_list[MQ_SIZE];
-PRIVATE mq_t *mq_freelist;
+static mq_t mq_list[MQ_SIZE];
+static mq_t *mq_freelist;
void mq_init()
{
#define QFF_EMPTY 0
#define QFF_INUSE 1
-PRIVATE qp_fd_t qp_fd_table[QP_FD_NR];
+static qp_fd_t qp_fd_table[QP_FD_NR];
-PRIVATE struct export_param_list inet_ex_list[]=
+static struct export_param_list inet_ex_list[]=
{
QP_VARIABLE(sr_fd_table),
QP_VARIABLE(ip_dev),
QP_END()
};
-PRIVATE struct export_params inet_ex_params= { inet_ex_list, NULL };
+static struct export_params inet_ex_params= { inet_ex_list, NULL };
-PRIVATE struct queryvars {
+static struct queryvars {
/* Input */
acc_t *param;
} *qvars;
-FORWARD int qp_open ARGS(( int port, int srfd,
+static int qp_open ARGS(( int port, int srfd,
get_userdata_t get_userdata, put_userdata_t put_userdata,
put_pkt_t put_pkt, select_res_t select_res ));
-FORWARD void qp_close ARGS(( int fd ));
-FORWARD int qp_read ARGS(( int fd, size_t count ));
-FORWARD int qp_write ARGS(( int fd, size_t count ));
-FORWARD int qp_ioctl ARGS(( int fd, ioreq_t req ));
-FORWARD int qp_cancel ARGS(( int fd, int which_operation ));
-FORWARD int qp_select ARGS(( int fd, unsigned operations ));
-FORWARD qp_fd_t *get_qp_fd ARGS(( int fd ));
-FORWARD int do_query ARGS(( qp_fd_t *qp_fd, acc_t *pkt, int count ));
-FORWARD int qp_getc ARGS(( void ));
-FORWARD void qp_putc ARGS(( struct queryvars *qv, int c ));
-FORWARD void qp_buffree ARGS(( int priority ));
+static void qp_close ARGS(( int fd ));
+static int qp_read ARGS(( int fd, size_t count ));
+static int qp_write ARGS(( int fd, size_t count ));
+static int qp_ioctl ARGS(( int fd, ioreq_t req ));
+static int qp_cancel ARGS(( int fd, int which_operation ));
+static int qp_select ARGS(( int fd, unsigned operations ));
+static qp_fd_t *get_qp_fd ARGS(( int fd ));
+static int do_query ARGS(( qp_fd_t *qp_fd, acc_t *pkt, int count ));
+static int qp_getc ARGS(( void ));
+static void qp_putc ARGS(( struct queryvars *qv, int c ));
+static void qp_buffree ARGS(( int priority ));
#ifdef BUF_CONSISTENCY_CHECK
-FORWARD void qp_bufcheck ARGS(( void ));
+static void qp_bufcheck ARGS(( void ));
#endif
-PUBLIC void qp_init()
+void qp_init()
{
int i;
qp_ioctl, qp_cancel, qp_select);
}
-PRIVATE int qp_open(port, srfd, get_userdata, put_userdata, put_pkt,
+static int qp_open(port, srfd, get_userdata, put_userdata, put_pkt,
select_res)
int port;
int srfd;
return i;
}
-PRIVATE void qp_close(fd)
+static void qp_close(fd)
int fd;
{
qp_fd_t *qp_fd;
}
}
-PRIVATE int qp_read(fd, count)
+static int qp_read(fd, count)
int fd;
size_t count;
{
return OK;
}
-PRIVATE int qp_write(fd, count)
+static int qp_write(fd, count)
int fd;
size_t count;
{
return OK;
}
-PRIVATE int qp_ioctl(fd, req)
+static int qp_ioctl(fd, req)
int fd;
ioreq_t req;
{
return OK;
}
-PRIVATE int qp_cancel(fd, which_operation)
+static int qp_cancel(fd, which_operation)
int fd;
int which_operation;
{
return OK;
}
-PRIVATE int qp_select(fd, operations)
+static int qp_select(fd, operations)
int fd;
unsigned operations;
{
return resops;
}
-PRIVATE qp_fd_t *get_qp_fd(fd)
+static qp_fd_t *get_qp_fd(fd)
int fd;
{
qp_fd_t *qp_fd;
return qp_fd;
}
-PRIVATE int do_query(qp_fd, pkt, count)
+static int do_query(qp_fd, pkt, count)
qp_fd_t *qp_fd;
acc_t *pkt;
int count;
return qv.fd_offset;
}
-PRIVATE int qp_getc()
+static int qp_getc()
{
/* Return one character of the names to search for. */
acc_t *pkt;
return c;
}
-PRIVATE void qp_putc(qv, c)
+static void qp_putc(qv, c)
struct queryvars *qv;
int c;
{
qv->outbuf_off= 0;
}
-PRIVATE void qp_buffree (priority)
+static void qp_buffree (priority)
int priority;
{
/* For the moment, we are not going to free anything */
}
#ifdef BUF_CONSISTENCY_CHECK
-PRIVATE void qp_bufcheck()
+static void qp_bufcheck()
{
int i;
qp_fd_t *qp_fd;
THIS_FILE
-PUBLIC sr_fd_t sr_fd_table[FD_NR];
-
-PRIVATE mq_t *repl_queue, *repl_queue_tail;
-PRIVATE struct vscp_vec s_cp_req[SCPVEC_NR];
-
-FORWARD int sr_open(message *m);
-FORWARD void sr_close(message *m);
-FORWARD int sr_rwio(mq_t *m);
-FORWARD int sr_restart_read(sr_fd_t *fdp);
-FORWARD int sr_restart_write(sr_fd_t *fdp);
-FORWARD int sr_restart_ioctl(sr_fd_t *fdp);
-FORWARD int sr_cancel(message *m);
-FORWARD int sr_select(message *m);
-FORWARD void sr_status(message *m);
-FORWARD void sr_reply_(mq_t *m, int reply, int is_revive);
-FORWARD sr_fd_t *sr_getchannel(int minor);
-FORWARD acc_t *sr_get_userdata(int fd, size_t offset, size_t count, int
+sr_fd_t sr_fd_table[FD_NR];
+
+static mq_t *repl_queue, *repl_queue_tail;
+static struct vscp_vec s_cp_req[SCPVEC_NR];
+
+static int sr_open(message *m);
+static void sr_close(message *m);
+static int sr_rwio(mq_t *m);
+static int sr_restart_read(sr_fd_t *fdp);
+static int sr_restart_write(sr_fd_t *fdp);
+static int sr_restart_ioctl(sr_fd_t *fdp);
+static int sr_cancel(message *m);
+static int sr_select(message *m);
+static void sr_status(message *m);
+static void sr_reply_(mq_t *m, int reply, int is_revive);
+static sr_fd_t *sr_getchannel(int minor);
+static acc_t *sr_get_userdata(int fd, size_t offset, size_t count, int
for_ioctl);
-FORWARD int sr_put_userdata(int fd, size_t offset, acc_t *data, int
+static int sr_put_userdata(int fd, size_t offset, acc_t *data, int
for_ioctl);
-FORWARD void sr_select_res(int fd, unsigned ops);
-FORWARD int sr_repl_queue(int proc, int ref, int operation);
-FORWARD int walk_queue(sr_fd_t *sr_fd, mq_t **q_head_ptr, mq_t
+static void sr_select_res(int fd, unsigned ops);
+static int sr_repl_queue(int proc, int ref, int operation);
+static int walk_queue(sr_fd_t *sr_fd, mq_t **q_head_ptr, mq_t
**q_tail_ptr, int type, int proc_nr, int ref, int first_flag);
-FORWARD void sr_event(event_t *evp, ev_arg_t arg);
-FORWARD int cp_u2b(endpoint_t proc, cp_grant_id_t gid, vir_bytes offset,
+static void sr_event(event_t *evp, ev_arg_t arg);
+static int cp_u2b(endpoint_t proc, cp_grant_id_t gid, vir_bytes offset,
acc_t **var_acc_ptr, int size);
-FORWARD int cp_b2u(acc_t *acc_ptr, endpoint_t proc, cp_grant_id_t gid,
+static int cp_b2u(acc_t *acc_ptr, endpoint_t proc, cp_grant_id_t gid,
vir_bytes offset);
-PUBLIC void sr_init()
+void sr_init()
{
int i;
repl_queue= NULL;
}
-PUBLIC void sr_rec(m)
+void sr_rec(m)
mq_t *m;
{
int result;
mq_free(m);
}
-PUBLIC void sr_add_minor(minor, port, openf, closef, readf, writef,
+void sr_add_minor(minor, port, openf, closef, readf, writef,
ioctlf, cancelf, selectf)
int minor;
int port;
sr_fd->srf_select= selectf;
}
-PRIVATE int sr_open(m)
+static int sr_open(m)
message *m;
{
sr_fd_t *sr_fd;
return i;
}
-PRIVATE void sr_close(m)
+static void sr_close(m)
message *m;
{
sr_fd_t *sr_fd;
sr_fd->srf_flags= SFF_FREE;
}
-PRIVATE int sr_rwio(m)
+static int sr_rwio(m)
mq_t *m;
{
sr_fd_t *sr_fd;
return r;
}
-PRIVATE int sr_restart_read(sr_fd)
+static int sr_restart_read(sr_fd)
sr_fd_t *sr_fd;
{
mq_t *mp;
return r;
}
-PRIVATE int sr_restart_write(sr_fd)
+static int sr_restart_write(sr_fd)
sr_fd_t *sr_fd;
{
mq_t *mp;
return r;
}
-PRIVATE int sr_restart_ioctl(sr_fd)
+static int sr_restart_ioctl(sr_fd)
sr_fd_t *sr_fd;
{
mq_t *mp;
return r;
}
-PRIVATE int sr_cancel(m)
+static int sr_cancel(m)
message *m;
{
sr_fd_t *sr_fd;
return result;
}
-PRIVATE int sr_select(m)
+static int sr_select(m)
message *m;
{
sr_fd_t *sr_fd;
return m_ops;
}
-PRIVATE void sr_status(m)
+static void sr_status(m)
message *m;
{
int fd, result;
ip_panic(("unable to send"));
}
-PRIVATE int walk_queue(sr_fd, q_head_ptr, q_tail_ptr, type, proc_nr, ref,
+static int walk_queue(sr_fd, q_head_ptr, q_tail_ptr, type, proc_nr, ref,
first_flag)
sr_fd_t *sr_fd;
mq_t **q_head_ptr;
return EAGAIN;
}
-PRIVATE sr_fd_t *sr_getchannel(minor)
+static sr_fd_t *sr_getchannel(minor)
int minor;
{
sr_fd_t *loc_fd;
return loc_fd;
}
-PRIVATE void sr_reply_(mq, status, is_revive)
+static void sr_reply_(mq, status, is_revive)
mq_t *mq;
int status;
int is_revive;
mq_free(mq);
}
-PRIVATE acc_t *sr_get_userdata (fd, offset, count, for_ioctl)
+static acc_t *sr_get_userdata (fd, offset, count, for_ioctl)
int fd;
size_t offset;
size_t count;
return result<0 ? NULL : acc;
}
-PRIVATE int sr_put_userdata (fd, offset, data, for_ioctl)
+static int sr_put_userdata (fd, offset, data, for_ioctl)
int fd;
size_t offset;
acc_t *data;
(int)(*head_ptr)->mq_mess.IO_GRANT, offset);
}
-PRIVATE void sr_select_res(int fd, unsigned ops)
+static void sr_select_res(int fd, unsigned ops)
{
sr_fd_t *sr_fd;
notify(sr_fd->srf_select_proc);
}
-PRIVATE void sr_event(evp, arg)
+static void sr_event(evp, arg)
event_t *evp;
ev_arg_t arg;
{
ip_panic(("sr_event: unknown event\n"));
}
-PRIVATE int cp_u2b(proc, gid, offset, var_acc_ptr, size)
+static int cp_u2b(proc, gid, offset, var_acc_ptr, size)
endpoint_t proc;
cp_grant_id_t gid;
vir_bytes offset;
return OK;
}
-PRIVATE int cp_b2u(acc_ptr, proc, gid, offset)
+static int cp_b2u(acc_ptr, proc, gid, offset)
acc_t *acc_ptr;
endpoint_t proc;
cp_grant_id_t gid;
return OK;
}
-PRIVATE int sr_repl_queue(proc, ref, operation)
+static int sr_repl_queue(proc, ref, operation)
int proc;
int ref;
int operation;
#include "inc.h"
-PUBLIC int identifier = 0x1234;
-PUBLIC endpoint_t who_e;
-PUBLIC int call_type;
-PUBLIC endpoint_t SELF_E;
+int identifier = 0x1234;
+endpoint_t who_e;
+int call_type;
+endpoint_t SELF_E;
-PRIVATE struct {
+static struct {
int type;
int (*func)(message *);
int reply; /* whether the reply action is passed through */
#define SIZE(a) (sizeof(a)/sizeof(a[0]))
-PRIVATE int verbose = 0;
+static int verbose = 0;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
-PUBLIC int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
message m;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the ipc server. */
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
struct semaphore sems[SEMMSL];
};
-PRIVATE struct sem_struct sem_list[SEMMNI];
-PRIVATE int sem_list_nr = 0;
+static struct sem_struct sem_list[SEMMNI];
+static int sem_list_nr = 0;
-PRIVATE struct sem_struct *sem_find_key(key_t key)
+static struct sem_struct *sem_find_key(key_t key)
{
int i;
if (key == IPC_PRIVATE)
return NULL;
}
-PRIVATE struct sem_struct *sem_find_id(int id)
+static struct sem_struct *sem_find_id(int id)
{
int i;
for (i = 0; i < sem_list_nr; i++)
/*===========================================================================*
* do_semget *
*===========================================================================*/
-PUBLIC int do_semget(message *m)
+int do_semget(message *m)
{
key_t key;
int nsems, flag, id;
return OK;
}
-PRIVATE void send_message_to_process(endpoint_t who, int ret, int ignore)
+static void send_message_to_process(endpoint_t who, int ret, int ignore)
{
message m;
sendnb(who, &m);
}
-PRIVATE void remove_semaphore(struct sem_struct *sem)
+static void remove_semaphore(struct sem_struct *sem)
{
int i, nr;
}
#if 0
-PRIVATE void show_semaphore(void)
+static void show_semaphore(void)
{
int i, j, k;
}
#endif
-PRIVATE void remove_process(endpoint_t pt)
+static void remove_process(endpoint_t pt)
{
int i;
}
}
-PRIVATE void update_one_semaphore(struct sem_struct *sem, int is_remove)
+static void update_one_semaphore(struct sem_struct *sem, int is_remove)
{
int i, j, nr;
struct semaphore *semaphore;
}
}
-PRIVATE void update_semaphores(void)
+static void update_semaphores(void)
{
int i;
/*===========================================================================*
* do_semctl *
*===========================================================================*/
-PUBLIC int do_semctl(message *m)
+int do_semctl(message *m)
{
int r, i;
long opt;
/*===========================================================================*
* do_semop *
*===========================================================================*/
-PUBLIC int do_semop(message *m)
+int do_semop(message *m)
{
int id, i, j, r;
struct sembuf *sops;
/*===========================================================================*
* is_sem_nil *
*===========================================================================*/
-PUBLIC int is_sem_nil(void)
+int is_sem_nil(void)
{
return (sem_list_nr == 0);
}
/*===========================================================================*
* sem_process_vm_notify *
*===========================================================================*/
-PUBLIC void sem_process_vm_notify(void)
+void sem_process_vm_notify(void)
{
endpoint_t pt;
int r;
vir_bytes page;
phys_bytes phys;
};
-PRIVATE struct shm_struct shm_list[MAX_SHM_NR];
-PRIVATE int shm_list_nr = 0;
+static struct shm_struct shm_list[MAX_SHM_NR];
+static int shm_list_nr = 0;
-PRIVATE struct shm_struct *shm_find_key(key_t key)
+static struct shm_struct *shm_find_key(key_t key)
{
int i;
if (key == IPC_PRIVATE)
return NULL;
}
-PRIVATE struct shm_struct *shm_find_id(int id)
+static struct shm_struct *shm_find_id(int id)
{
int i;
for (i = 0; i < shm_list_nr; i++)
/*===========================================================================*
* do_shmget *
*===========================================================================*/
-PUBLIC int do_shmget(message *m)
+int do_shmget(message *m)
{
struct shm_struct *shm;
long key, size, old_size;
/*===========================================================================*
* do_shmat *
*===========================================================================*/
-PUBLIC int do_shmat(message *m)
+int do_shmat(message *m)
{
int id, flag;
vir_bytes addr;
/*===========================================================================*
* update_refcount_and_destroy *
*===========================================================================*/
-PUBLIC void update_refcount_and_destroy(void)
+void update_refcount_and_destroy(void)
{
int i, j;
/*===========================================================================*
* do_shmdt *
*===========================================================================*/
-PUBLIC int do_shmdt(message *m)
+int do_shmdt(message *m)
{
vir_bytes addr;
phys_bytes paddr;
/*===========================================================================*
* do_shmctl *
*===========================================================================*/
-PUBLIC int do_shmctl(message *m)
+int do_shmctl(message *m)
{
int id = m->SHMCTL_ID;
int cmd = m->SHMCTL_CMD;
}
#if 0
-PRIVATE void list_shm_ds(void)
+static void list_shm_ds(void)
{
int i;
printf("key\tid\tpage\n");
/*===========================================================================*
* is_shm_nil *
*===========================================================================*/
-PUBLIC int is_shm_nil(void)
+int is_shm_nil(void)
{
return (shm_list_nr == 0);
}
#include "inc.h"
-PUBLIC int check_perm(struct ipc_perm *req, endpoint_t who, int mode)
+int check_perm(struct ipc_perm *req, endpoint_t who, int mode)
{
int req_mode;
int cur_mode;
/*===========================================================================*
* map_unmap_keys *
*===========================================================================*/
-PUBLIC void map_unmap_fkeys(map)
+void map_unmap_fkeys(map)
int map;
{
int fkeys, sfkeys;
*===========================================================================*/
#define pressed(k) ((F1<=(k)&&(k)<=F12 && bit_isset(m->FKEY_FKEYS,((k)-F1+1)))\
|| (SF1<=(k) && (k)<=SF12 && bit_isset(m->FKEY_SFKEYS, ((k)-SF1+1))))
-PUBLIC int do_fkey_pressed(m)
+int do_fkey_pressed(m)
message *m; /* notification message */
{
int s, h;
/*===========================================================================*
* key_name *
*===========================================================================*/
-PRIVATE char *key_name(int key)
+static char *key_name(int key)
{
static char name[15];
/*===========================================================================*
* mapping_dmp *
*===========================================================================*/
-PUBLIC void mapping_dmp(void)
+void mapping_dmp(void)
{
int h;
#define LINES 22
-PRIVATE struct data_store ds_store[NR_DS_KEYS];
+static struct data_store ds_store[NR_DS_KEYS];
-PUBLIC void data_store_dmp()
+void data_store_dmp()
{
struct data_store *p;
static int prev_i = 0;
#include "../vfs/dmap.h"
#include <minix/dmap.h>
-PUBLIC struct fproc fproc[NR_PROCS];
-PUBLIC struct dmap dmap[NR_DEVICES];
+struct fproc fproc[NR_PROCS];
+struct dmap dmap[NR_DEVICES];
/*===========================================================================*
* fproc_dmp *
*===========================================================================*/
-PUBLIC void fproc_dmp()
+void fproc_dmp()
{
struct fproc *fp;
int i, n=0;
/*===========================================================================*
* dmap_flags *
*===========================================================================*/
-PRIVATE char * dmap_flags(int flags)
+static char * dmap_flags(int flags)
{
static char fl[10];
strcpy(fl, "-----");
/*===========================================================================*
* dmap_style *
*===========================================================================*/
-PRIVATE char * dmap_style(int dev_style)
+static char * dmap_style(int dev_style)
{
static char str[16];
switch(dev_style) {
/*===========================================================================*
* dtab_dmp *
*===========================================================================*/
-PUBLIC void dtab_dmp()
+void dtab_dmp()
{
int i;
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
/* Declare some local dump procedures. */
-FORWARD char *proc_name(int proc_nr);
-FORWARD char *s_traps_str(int flags);
-FORWARD char *s_flags_str(int flags);
-FORWARD char *p_rts_flags_str(int flags);
-FORWARD char *boot_flags_str(int flags);
+static char *proc_name(int proc_nr);
+static char *s_traps_str(int flags);
+static char *s_flags_str(int flags);
+static char *p_rts_flags_str(int flags);
+static char *boot_flags_str(int flags);
/* Some global data that is shared among several dumping procedures.
* Note that the process table copy has the same name as in the kernel
* so that most macros and definitions from proc.h also apply here.
*/
-PUBLIC struct proc proc[NR_TASKS + NR_PROCS];
-PUBLIC struct priv priv[NR_SYS_PROCS];
-PUBLIC struct boot_image image[NR_BOOT_PROCS];
+struct proc proc[NR_TASKS + NR_PROCS];
+struct priv priv[NR_SYS_PROCS];
+struct boot_image image[NR_BOOT_PROCS];
/*===========================================================================*
* kmessages_dmp *
*===========================================================================*/
-PUBLIC void kmessages_dmp()
+void kmessages_dmp()
{
struct kmessages kmess; /* get copy of kernel messages */
char print_buf[_KMESS_BUF_SIZE+1]; /* this one is used to print */
/*===========================================================================*
* monparams_dmp *
*===========================================================================*/
-PUBLIC void monparams_dmp()
+void monparams_dmp()
{
char val[1024];
char *e;
/*===========================================================================*
* irqtab_dmp *
*===========================================================================*/
-PUBLIC void irqtab_dmp()
+void irqtab_dmp()
{
int i,r;
struct irq_hook irq_hooks[NR_IRQ_HOOKS];
/*===========================================================================*
* boot_flags_str *
*===========================================================================*/
-PRIVATE char *boot_flags_str(int flags)
+static char *boot_flags_str(int flags)
{
static char str[10];
str[0] = (flags & PROC_FULLVM) ? 'V' : '-';
/*===========================================================================*
* image_dmp *
*===========================================================================*/
-PUBLIC void image_dmp()
+void image_dmp()
{
int m, r;
struct boot_image *ip;
/*===========================================================================*
* kenv_dmp *
*===========================================================================*/
-PUBLIC void kenv_dmp()
+void kenv_dmp()
{
struct kinfo kinfo;
struct machine machine;
/*===========================================================================*
* s_flags_str *
*===========================================================================*/
-PRIVATE char *s_flags_str(int flags)
+static char *s_flags_str(int flags)
{
static char str[10];
str[0] = (flags & PREEMPTIBLE) ? 'P' : '-';
/*===========================================================================*
* s_traps_str *
*===========================================================================*/
-PRIVATE char *s_traps_str(int flags)
+static char *s_traps_str(int flags)
{
static char str[10];
str[0] = (flags & (1 << SEND)) ? 'S' : '-';
/*===========================================================================*
* privileges_dmp *
*===========================================================================*/
-PUBLIC void privileges_dmp()
+void privileges_dmp()
{
register struct proc *rp;
static struct proc *oldrp = BEG_PROC_ADDR;
/*===========================================================================*
* p_rts_flags_str *
*===========================================================================*/
-PRIVATE char *p_rts_flags_str(int flags)
+static char *p_rts_flags_str(int flags)
{
static char str[10];
str[0] = (flags & RTS_PROC_STOP) ? 's' : '-';
* proctab_dmp *
*===========================================================================*/
#if (CHIP == INTEL)
-PUBLIC void proctab_dmp()
+void proctab_dmp()
{
/* Proc table dump */
/*===========================================================================*
* procstack_dmp *
*===========================================================================*/
-PUBLIC void procstack_dmp()
+void procstack_dmp()
{
/* Proc table dump, with stack */
/*===========================================================================*
* memmap_dmp *
*===========================================================================*/
-PUBLIC void memmap_dmp()
+void memmap_dmp()
{
register struct proc *rp;
static struct proc *oldrp = proc;
/*===========================================================================*
* proc_name *
*===========================================================================*/
-PRIVATE char *proc_name(proc_nr)
+static char *proc_name(proc_nr)
int proc_nr;
{
struct proc *p;
#include <minix/config.h>
#include <minix/type.h>
-PUBLIC struct mproc mproc[NR_PROCS];
+struct mproc mproc[NR_PROCS];
/*===========================================================================*
* mproc_dmp *
*===========================================================================*/
-PRIVATE char *flags_str(int flags)
+static char *flags_str(int flags)
{
static char str[14];
str[0] = (flags & WAITING) ? 'W' : '-';
return str;
}
-PUBLIC void mproc_dmp()
+void mproc_dmp()
{
struct mproc *mp;
int i, n=0;
/*===========================================================================*
* sigaction_dmp *
*===========================================================================*/
-PUBLIC void sigaction_dmp()
+void sigaction_dmp()
{
struct mproc *mp;
int i, n=0;
#include "../rs/const.h"
#include "../rs/type.h"
-PUBLIC struct rprocpub rprocpub[NR_SYS_PROCS];
-PUBLIC struct rproc rproc[NR_SYS_PROCS];
+struct rprocpub rprocpub[NR_SYS_PROCS];
+struct rproc rproc[NR_SYS_PROCS];
-FORWARD char *s_flags_str(int flags, int sys_flags);
+static char *s_flags_str(int flags, int sys_flags);
/*===========================================================================*
* rproc_dmp *
*===========================================================================*/
-PUBLIC void rproc_dmp()
+void rproc_dmp()
{
struct rproc *rp;
struct rprocpub *rpub;
}
-PRIVATE char *s_flags_str(int flags, int sys_flags)
+static char *s_flags_str(int flags, int sys_flags)
{
static char str[10];
str[0] = (flags & RS_ACTIVE) ? 'A' : '-';
#define LINES 24
-PRIVATE void print_region(struct vm_region_info *vri, int *n)
+static void print_region(struct vm_region_info *vri, int *n)
{
static int vri_count, vri_prev_set;
static struct vm_region_info vri_prev;
(*n)++;
}
-PUBLIC void vm_dmp()
+void vm_dmp()
{
static struct proc proc[NR_TASKS + NR_PROCS];
static struct vm_region_info vri[LINES];
#include <minix/endpoint.h>
/* Allocate space for the global variables. */
-PRIVATE message m_in; /* the input message itself */
-PRIVATE message m_out; /* the output message used for reply */
-PRIVATE endpoint_t who_e; /* caller's proc number */
-PRIVATE int callnr; /* system call number */
+static message m_in; /* the input message itself */
+static message m_out; /* the output message used for reply */
+static endpoint_t who_e; /* caller's proc number */
+static int callnr; /* system call number */
extern int errno; /* error number set by system library */
/* Declare some local functions. */
-FORWARD void get_work(void);
-FORWARD void reply(int whom, int result);
+static void get_work(void);
+static void reply(int whom, int result);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* This is the main routine of this service. The main loop consists of
* three major activities: getting new work, processing the work, and
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the information server. */
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work()
+static void get_work()
{
int status = 0;
status = sef_receive(ANY, &m_in); /* this blocks until message arrives */
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(who, result)
+static void reply(who, result)
int who; /* destination */
int result; /* report result to replyee */
{
#include <dirent.h>
-PUBLIC struct buf {
+struct buf {
char b_data[_MAX_BLOCK_SIZE]; /* ordinary user data */
block_t b_blocknr; /* block number of its (minor) device */
char b_count; /* number of users of this buffer */
#include <minix/bdev.h>
#include "buf.h"
-FORWARD int read_block(struct buf *);
+static int read_block(struct buf *);
-PUBLIC struct buf *bp_to_pickup = buf; /* This is a pointer to the next node in the
+struct buf *bp_to_pickup = buf; /* This is a pointer to the next node in the
* buffer cache to pick up*/
/*===========================================================================*
* get_block *
*===========================================================================*/
-PUBLIC struct buf *get_block(block)
+struct buf *get_block(block)
register block_t block; /* which block is wanted? */
{
register struct buf *bp, *free_bp;
/*===========================================================================*
* put_block *
*===========================================================================*/
-PUBLIC void put_block(bp)
+void put_block(bp)
register struct buf *bp; /* pointer to the buffer to be released */
{
if (bp == NULL) return; /* it is easier to check here than in caller */
/*===========================================================================*
* read_block *
*===========================================================================*/
-PRIVATE int read_block(bp)
+static int read_block(bp)
register struct buf *bp; /* buffer pointer */
{
int r;
/*===========================================================================*
* fs_putnode *
*===========================================================================*/
-PUBLIC int fs_putnode()
+int fs_putnode()
{
/* Find the inode specified by the request message and decrease its counter. */
int count;
/*===========================================================================*
* release_dir_record *
*===========================================================================*/
-PUBLIC int release_dir_record(dir)
+int release_dir_record(dir)
struct dir_record *dir;
{
/* Release a dir record (decrement the counter) */
/*===========================================================================*
* get_free_dir_record *
*===========================================================================*/
-PUBLIC struct dir_record *get_free_dir_record(void)
+struct dir_record *get_free_dir_record(void)
{
/* Get a free dir record */
struct dir_record *dir;
/*===========================================================================*
* get_dir_record *
*===========================================================================*/
-PUBLIC struct dir_record *get_dir_record(id_dir_record)
+struct dir_record *get_dir_record(id_dir_record)
ino_t id_dir_record;
{
struct dir_record *dir = NULL;
/*===========================================================================*
* get_free_ext_attr *
*===========================================================================*/
-PUBLIC struct ext_attr_rec *get_free_ext_attr(void) {
+struct ext_attr_rec *get_free_ext_attr(void) {
/* Get a free extended attribute structure */
struct ext_attr_rec *dir;
for(dir = ext_attr_recs; dir < &ext_attr_recs[NR_ATTR_RECS]; dir++) {
/*===========================================================================*
* create_ext_attr *
*===========================================================================*/
-PUBLIC int create_ext_attr(struct ext_attr_rec *ext,char *buffer)
+int create_ext_attr(struct ext_attr_rec *ext,char *buffer)
{
/* Fill an extent structure from the data read on the device */
if (ext == NULL) return(EINVAL);
/*===========================================================================*
* create_ext_attr *
*===========================================================================*/
-PUBLIC int create_dir_record(dir,buffer,address)
+int create_dir_record(dir,buffer,address)
struct dir_record *dir;
char *buffer;
u32_t address;
/*===========================================================================*
* load_dir_record_from_disk *
*===========================================================================*/
-PUBLIC struct dir_record *load_dir_record_from_disk(address)
+struct dir_record *load_dir_record_from_disk(address)
u32_t address;
{
/* This function load a particular dir record from a specific address
#include "const.h"
-PUBLIC struct dir_record {
+struct dir_record {
u8_t length; /* The length of the record */
u8_t ext_attr_rec_length;
u32_t loc_extent_l; /* The same data (in this case loc_extent)is */
} dir_records[NR_DIR_RECORDS];
-PUBLIC struct ext_attr_rec {
+struct ext_attr_rec {
u32_t own_id;
u32_t group_id;
u16_t permissions;
#include "glo.h"
/* Declare some local functions. */
-FORWARD void get_work(message *m_in);
+static void get_work(message *m_in);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void) {
+int main(void) {
endpoint_t who_e;
int ind, error, transid;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the iso9660fs server. */
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(m_in)
+static void get_work(m_in)
message *m_in; /* pointer to message */
{
int s; /* receive status */
/*===========================================================================*
* reply *
*===========================================================================*/
-PUBLIC void reply(who, m_out)
+void reply(who, m_out)
int who;
message *m_out; /* report result */
{
/*===========================================================================*
* fs_sync *
*===========================================================================*/
-PUBLIC int fs_sync()
+int fs_sync()
{
/* Always mounted read only, so nothing to sync */
return(OK); /* sync() can't fail */
/*===========================================================================*
* fs_new_driver *
*===========================================================================*/
-PUBLIC int fs_new_driver(void)
+int fs_new_driver(void)
{
/* Set a new driver endpoint for this device. */
dev_t dev;
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
-PUBLIC int fs_readsuper() {
+int fs_readsuper() {
cp_grant_id_t label_gid;
size_t label_len;
/*===========================================================================*
* fs_mountpoint *
*===========================================================================*/
-PUBLIC int fs_mountpoint()
+int fs_mountpoint()
{
/* This function looks up the mount point, it checks the condition whether
* the partition can be mounted on the inode or not.
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
-PUBLIC int fs_unmount(void) {
+int fs_unmount(void) {
release_v_pri(&v_pri); /* Release the super block */
bdev_close(fs_dev);
unmountdone = TRUE;
#include "buf.h"
-FORWARD char *get_name(char *name, char string[NAME_MAX+1]);
-FORWARD int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
+static char *get_name(char *name, char string[NAME_MAX+1]);
+static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
dir_record **res_inop, size_t *offsetp);
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
-PUBLIC int fs_lookup() {
+int fs_lookup() {
cp_grant_id_t grant;
int r, len, flags;
size_t offset;
/*===========================================================================*
* search_dir *
*===========================================================================*/
-PUBLIC int search_dir(ldir_ptr,string,numb)
+int search_dir(ldir_ptr,string,numb)
register struct dir_record *ldir_ptr; /* dir record parent */
char string[NAME_MAX]; /* component to search for */
ino_t *numb; /* pointer to new dir record */
/*===========================================================================*
* parse_path *
*===========================================================================*/
-PRIVATE int parse_path(dir_ino, root_ino, flags, res_inop, offsetp)
+static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp)
ino_t dir_ino;
ino_t root_ino;
int flags;
/*===========================================================================*
* advance *
*===========================================================================*/
-PUBLIC int advance(dirp, string, resp)
+int advance(dirp, string, resp)
struct dir_record *dirp; /* inode for directory to be searched */
char string[NAME_MAX]; /* component name to look for */
struct dir_record **resp; /* resulting inode */
/*===========================================================================*
* get_name *
*===========================================================================*/
-PRIVATE char *get_name(path_name, string)
+static char *get_name(path_name, string)
char *path_name; /* path name to parse */
char string[NAME_MAX+1]; /* component extracted from 'old_name' */
{
/*===========================================================================*
* fs_access *
*===========================================================================*/
-PUBLIC int fs_access()
+int fs_access()
{
struct dir_record *rip;
int r = OK;
#endif
#include "buf.h"
-PRIVATE char getdents_buf[GETDENTS_BUFSIZ];
+static char getdents_buf[GETDENTS_BUFSIZ];
/*===========================================================================*
* fs_read *
*===========================================================================*/
-PUBLIC int fs_read(void) {
+int fs_read(void) {
int r, chunk, block_size;
int nrbytes;
cp_grant_id_t gid;
/*===========================================================================*
* fs_bread *
*===========================================================================*/
-PUBLIC int fs_bread(void)
+int fs_bread(void)
{
int r, rw_flag, chunk, block_size;
cp_grant_id_t gid;
/*===========================================================================*
* fs_getdents *
*===========================================================================*/
-PUBLIC int fs_getdents(void) {
+int fs_getdents(void) {
struct dir_record *dir;
ino_t ino;
cp_grant_id_t gid;
/*===========================================================================*
* read_chunk *
*===========================================================================*/
-PUBLIC int read_chunk(dir, position, off, chunk, left, gid, buf_off, block_size, completed)
+int read_chunk(dir, position, off, chunk, left, gid, buf_off, block_size, completed)
register struct dir_record *dir;/* pointer to inode for file to be rd/wr */
u64_t position; /* position within file to read or write */
unsigned off; /* off within the current block */
/*===========================================================================*
* stat_dir_record *
*===========================================================================*/
-PRIVATE int stat_dir_record(
+static int stat_dir_record(
register struct dir_record *dir, /* pointer to dir record to stat */
int pipe_pos, /* position in a pipe, supplied by fstat() */
endpoint_t who_e, /* Caller endpoint */
/*===========================================================================*
* fs_stat *
*===========================================================================*/
-PUBLIC int fs_stat()
+int fs_stat()
{
register int r; /* return value */
struct dir_record *dir;
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
-PUBLIC int fs_fstatfs()
+int fs_fstatfs()
{
struct statfs st;
int r;
/*===========================================================================*
* fs_statvfs *
*===========================================================================*/
-PUBLIC int fs_statvfs()
+int fs_statvfs()
{
struct statvfs st;
int r;
/* This function is called when the filesystem is umounted. It releases the
* super block. */
-PUBLIC int release_v_pri(v_pri)
+int release_v_pri(v_pri)
register struct iso9660_vd_pri *v_pri;
{
/* Release the root dir record */
/* This function fullfill the super block data structure using the information
* contained in the stream buf. Such stream is physically read from the device
* . */
-PUBLIC int create_v_pri(v_pri,buf,address)
+int create_v_pri(v_pri,buf,address)
register struct iso9660_vd_pri *v_pri;
register char* buf;
register unsigned long address;
/* This function reads from a ISO9660 filesystem (in the device dev) the
* super block and saves it in v_pri. */
-PUBLIC int read_vds(
+int read_vds(
register struct iso9660_vd_pri *v_pri,
register dev_t dev
)
#define ROOT_INO_NR 1
/* Structure for the primary volume descriptor */
-PUBLIC struct iso9660_vd_pri {
+struct iso9660_vd_pri {
u8_t vd_type;
char standard_id[ISO9660_SIZE_STANDARD_ID];
u8_t vd_version;
#include "inc.h"
-PUBLIC int (*fs_call_vec[])(void) = {
+int (*fs_call_vec[])(void) = {
no_sys, /* 0: not used */
no_sys, /* 1: not used */
fs_putnode, /* 2 */
/*===========================================================================*
* do_noop *
*===========================================================================*/
-PUBLIC int do_noop(void)
+int do_noop(void)
{
/* Do not do anything. */
return(OK);
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys(void)
+int no_sys(void)
{
/* Somebody has used an illegal system call number */
return(EINVAL);
#include "super.h"
#include "inode.h"
-FORWARD void rm_lru(struct buf *bp);
-FORWARD void read_block(struct buf *);
+static void rm_lru(struct buf *bp);
+static void read_block(struct buf *);
-PRIVATE int vmcache = 0; /* are we using vm's secondary cache? (initially not) */
+static int vmcache = 0; /* are we using vm's secondary cache? (initially not) */
-PRIVATE block_t super_start = 0, super_end = 0;
+static block_t super_start = 0, super_end = 0;
/*===========================================================================*
* get_block *
*===========================================================================*/
-PUBLIC struct buf *get_block(
+struct buf *get_block(
register dev_t dev, /* on which device is the block? */
register block_t block, /* which block is wanted? */
int only_search /* if NO_READ, don't read, else act normal */
/*===========================================================================*
* put_block *
*===========================================================================*/
-PUBLIC void put_block(bp, block_type)
+void put_block(bp, block_type)
register struct buf *bp; /* pointer to the buffer to be released */
int block_type; /* INODE_BLOCK, DIRECTORY_BLOCK, or whatever */
{
/*===========================================================================*
* alloc_zone *
*===========================================================================*/
-PUBLIC zone_t alloc_zone(
+zone_t alloc_zone(
dev_t dev, /* device where zone wanted */
zone_t z /* try to allocate new zone near this one */
)
/*===========================================================================*
* free_zone *
*===========================================================================*/
-PUBLIC void free_zone(
+void free_zone(
dev_t dev, /* device where zone located */
zone_t numb /* zone to be returned */
)
/*===========================================================================*
* read_block *
*===========================================================================*/
-PRIVATE void read_block(bp)
+static void read_block(bp)
register struct buf *bp; /* buffer pointer */
{
/* Read or write a disk block. This is the only routine in which actual disk
/*===========================================================================*
* invalidate *
*===========================================================================*/
-PUBLIC void invalidate(
+void invalidate(
dev_t device /* device whose blocks are to be purged */
)
{
/*===========================================================================*
* flushall *
*===========================================================================*/
-PUBLIC void flushall(
+void flushall(
dev_t dev /* device to flush */
)
{
/*===========================================================================*
* rw_scattered *
*===========================================================================*/
-PUBLIC void rw_scattered(
+void rw_scattered(
dev_t dev, /* major-minor device number */
struct buf **bufq, /* pointer to array of buffers */
int bufqsize, /* number of buffers */
/*===========================================================================*
* rm_lru *
*===========================================================================*/
-PRIVATE void rm_lru(bp)
+static void rm_lru(bp)
struct buf *bp;
{
/* Remove a block from its LRU chain. */
/*===========================================================================*
* cache_resize *
*===========================================================================*/
-PRIVATE void cache_resize(unsigned int blocksize, unsigned int bufs)
+static void cache_resize(unsigned int blocksize, unsigned int bufs)
{
struct buf *bp;
struct inode *rip;
/*===========================================================================*
* bufs_heuristic *
*===========================================================================*/
-PRIVATE int bufs_heuristic(struct super_block *sp)
+static int bufs_heuristic(struct super_block *sp)
{
u32_t btotal, bfree, bused;
/*===========================================================================*
* set_blocksize *
*===========================================================================*/
-PUBLIC void set_blocksize(struct super_block *sp)
+void set_blocksize(struct super_block *sp)
{
int bufs;
/*===========================================================================*
* buf_pool *
*===========================================================================*/
-PUBLIC void buf_pool(int new_nr_bufs)
+void buf_pool(int new_nr_bufs)
{
/* Initialize the buffer pool. */
register struct buf *bp;
#include "super.h"
#include <minix/vfsif.h>
-FORWARD void addhash_inode(struct inode *node);
+static void addhash_inode(struct inode *node);
-FORWARD void free_inode(dev_t dev, ino_t numb);
-FORWARD void new_icopy(struct inode *rip, d2_inode *dip, int direction,
+static void free_inode(dev_t dev, ino_t numb);
+static void new_icopy(struct inode *rip, d2_inode *dip, int direction,
int norm);
-FORWARD void old_icopy(struct inode *rip, d1_inode *dip, int direction,
+static void old_icopy(struct inode *rip, d1_inode *dip, int direction,
int norm);
-FORWARD void unhash_inode(struct inode *node);
-FORWARD void wipe_inode(struct inode *rip);
+static void unhash_inode(struct inode *node);
+static void wipe_inode(struct inode *rip);
/*===========================================================================*
* fs_putnode *
*===========================================================================*/
-PUBLIC int fs_putnode(void)
+int fs_putnode(void)
{
/* Find the inode specified by the request message and decrease its counter.*/
/*===========================================================================*
* init_inode_cache *
*===========================================================================*/
-PUBLIC void init_inode_cache()
+void init_inode_cache()
{
struct inode *rip;
struct inodelist *rlp;
/*===========================================================================*
* addhash_inode *
*===========================================================================*/
-PRIVATE void addhash_inode(struct inode *node)
+static void addhash_inode(struct inode *node)
{
int hashi = (int) (node->i_num & INODE_HASH_MASK);
/*===========================================================================*
* unhash_inode *
*===========================================================================*/
-PRIVATE void unhash_inode(struct inode *node)
+static void unhash_inode(struct inode *node)
{
/* remove from hash table */
LIST_REMOVE(node, i_hash);
/*===========================================================================*
* get_inode *
*===========================================================================*/
-PUBLIC struct inode *get_inode(
+struct inode *get_inode(
dev_t dev, /* device on which inode resides */
ino_t numb /* inode number */
)
/*===========================================================================*
* find_inode *
*===========================================================================*/
-PUBLIC struct inode *find_inode(
+struct inode *find_inode(
dev_t dev, /* device on which inode resides */
ino_t numb /* inode number */
)
/*===========================================================================*
* put_inode *
*===========================================================================*/
-PUBLIC void put_inode(rip)
+void put_inode(rip)
register struct inode *rip; /* pointer to inode to be released */
{
/* The caller is no longer using this inode. If no one else is using it either
/*===========================================================================*
* alloc_inode *
*===========================================================================*/
-PUBLIC struct inode *alloc_inode(dev_t dev, mode_t bits)
+struct inode *alloc_inode(dev_t dev, mode_t bits)
{
/* Allocate a free inode on 'dev', and return a pointer to it. */
/*===========================================================================*
* wipe_inode *
*===========================================================================*/
-PRIVATE void wipe_inode(rip)
+static void wipe_inode(rip)
register struct inode *rip; /* the inode to be erased */
{
/* Erase some fields in the inode. This function is called from alloc_inode()
/*===========================================================================*
* free_inode *
*===========================================================================*/
-PRIVATE void free_inode(
+static void free_inode(
dev_t dev, /* on which device is the inode? */
ino_t inumb /* number of the inode to be freed */
)
/*===========================================================================*
* update_times *
*===========================================================================*/
-PUBLIC void update_times(rip)
+void update_times(rip)
register struct inode *rip; /* pointer to inode to be read/written */
{
/* Various system calls are required by the standard to update atime, ctime,
/*===========================================================================*
* rw_inode *
*===========================================================================*/
-PUBLIC void rw_inode(rip, rw_flag)
+void rw_inode(rip, rw_flag)
register struct inode *rip; /* pointer to inode to be read/written */
int rw_flag; /* READING or WRITING */
{
/*===========================================================================*
* old_icopy *
*===========================================================================*/
-PRIVATE void old_icopy(rip, dip, direction, norm)
+static void old_icopy(rip, dip, direction, norm)
register struct inode *rip; /* pointer to the in-core inode struct */
register d1_inode *dip; /* pointer to the d1_inode inode struct */
int direction; /* READING (from disk) or WRITING (to disk) */
/*===========================================================================*
* new_icopy *
*===========================================================================*/
-PRIVATE void new_icopy(rip, dip, direction, norm)
+static void new_icopy(rip, dip, direction, norm)
register struct inode *rip; /* pointer to the in-core inode struct */
register d2_inode *dip; /* pointer to the d2_inode struct */
int direction; /* READING (from disk) or WRITING (to disk) */
/*===========================================================================*
* dup_inode *
*===========================================================================*/
-PUBLIC void dup_inode(ip)
+void dup_inode(ip)
struct inode *ip; /* The inode to be duplicated. */
{
/* This routine is a simplified form of get_inode() for the case where
#define SAME 1000
-FORWARD int freesp_inode(struct inode *rip, off_t st, off_t end);
-FORWARD int remove_dir(struct inode *rldirp, struct inode *rip, char
+static int freesp_inode(struct inode *rip, off_t st, off_t end);
+static int remove_dir(struct inode *rldirp, struct inode *rip, char
dir_name[MFS_NAME_MAX]);
-FORWARD int unlink_file(struct inode *dirp, struct inode *rip, char
+static int unlink_file(struct inode *dirp, struct inode *rip, char
file_name[MFS_NAME_MAX]);
-FORWARD off_t nextblock(off_t pos, int zone_size);
-FORWARD void zerozone_half(struct inode *rip, off_t pos, int half, int
+static off_t nextblock(off_t pos, int zone_size);
+static void zerozone_half(struct inode *rip, off_t pos, int half, int
zone_size);
-FORWARD void zerozone_range(struct inode *rip, off_t pos, off_t len);
+static void zerozone_range(struct inode *rip, off_t pos, off_t len);
/* Args to zerozone_half() */
#define FIRST_HALF 0
/*===========================================================================*
* fs_link *
*===========================================================================*/
-PUBLIC int fs_link()
+int fs_link()
{
/* Perform the link(name1, name2) system call. */
/*===========================================================================*
* fs_unlink *
*===========================================================================*/
-PUBLIC int fs_unlink()
+int fs_unlink()
{
/* Perform the unlink(name) or rmdir(name) system call. The code for these two
* is almost the same. They differ only in some condition testing. Unlink()
/*===========================================================================*
* fs_rdlink *
*===========================================================================*/
-PUBLIC int fs_rdlink()
+int fs_rdlink()
{
block_t b; /* block containing link text */
struct buf *bp; /* buffer containing link text */
/*===========================================================================*
* remove_dir *
*===========================================================================*/
-PRIVATE int remove_dir(rldirp, rip, dir_name)
+static int remove_dir(rldirp, rip, dir_name)
struct inode *rldirp; /* parent directory */
struct inode *rip; /* directory to be removed */
char dir_name[MFS_NAME_MAX]; /* name of directory to be removed */
/*===========================================================================*
* unlink_file *
*===========================================================================*/
-PRIVATE int unlink_file(dirp, rip, file_name)
+static int unlink_file(dirp, rip, file_name)
struct inode *dirp; /* parent directory of file */
struct inode *rip; /* inode of file, may be NULL too. */
char file_name[MFS_NAME_MAX]; /* name of file to be removed */
/*===========================================================================*
* fs_rename *
*===========================================================================*/
-PUBLIC int fs_rename()
+int fs_rename()
{
/* Perform the rename(name1, name2) system call. */
struct inode *old_dirp, *old_ip; /* ptrs to old dir, file inodes */
/*===========================================================================*
* fs_ftrunc *
*===========================================================================*/
-PUBLIC int fs_ftrunc(void)
+int fs_ftrunc(void)
{
struct inode *rip;
off_t start, end;
/*===========================================================================*
* truncate_inode *
*===========================================================================*/
-PUBLIC int truncate_inode(rip, newsize)
+int truncate_inode(rip, newsize)
register struct inode *rip; /* pointer to inode to be truncated */
off_t newsize; /* inode must become this size */
{
/*===========================================================================*
* freesp_inode *
*===========================================================================*/
-PRIVATE int freesp_inode(rip, start, end)
+static int freesp_inode(rip, start, end)
register struct inode *rip; /* pointer to inode to be partly freed */
off_t start, end; /* range of bytes to free (end uninclusive) */
{
/*===========================================================================*
* nextblock *
*===========================================================================*/
-PRIVATE off_t nextblock(pos, zone_size)
+static off_t nextblock(pos, zone_size)
off_t pos;
int zone_size;
{
/*===========================================================================*
* zerozone_half *
*===========================================================================*/
-PRIVATE void zerozone_half(rip, pos, half, zone_size)
+static void zerozone_half(rip, pos, half, zone_size)
struct inode *rip;
off_t pos;
int half;
/*===========================================================================*
* zerozone_range *
*===========================================================================*/
-PRIVATE void zerozone_range(rip, pos, len)
+static void zerozone_range(rip, pos, len)
struct inode *rip;
off_t pos;
off_t len;
/* Declare some local functions. */
-FORWARD void get_work(message *m_in);
-FORWARD void reply(endpoint_t who, message *m_out);
+static void get_work(message *m_in);
+static void reply(endpoint_t who, message *m_out);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
/* This is the main routine of this service. The main loop consists of
* three major activities: getting new work, processing the work, and
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the Minix file server. */
int i;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(m_in)
+static void get_work(m_in)
message *m_in; /* pointer to message */
{
int r, srcok = 0;
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(
+static void reply(
endpoint_t who,
message *m_out /* report result */
)
/*===========================================================================*
* cch_check *
*===========================================================================*/
-PRIVATE void cch_check(void)
+static void cch_check(void)
{
int i;
/*===========================================================================*
* fs_sync *
*===========================================================================*/
-PUBLIC int fs_sync()
+int fs_sync()
{
/* Perform the sync() system call. Flush all the tables.
* The order in which the various tables are flushed is critical. The
/*===========================================================================*
* fs_flush *
*===========================================================================*/
-PUBLIC int fs_flush()
+int fs_flush()
{
/* Flush the blocks of a device from the cache after writing any dirty blocks
* to disk.
/*===========================================================================*
* fs_new_driver *
*===========================================================================*/
-PUBLIC int fs_new_driver(void)
+int fs_new_driver(void)
{
/* Set a new driver endpoint for this device. */
dev_t dev;
#include <minix/vfsif.h>
#include <minix/bdev.h>
-PRIVATE int cleanmount = 1;
+static int cleanmount = 1;
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
-PUBLIC int fs_readsuper()
+int fs_readsuper()
{
/* This function reads the superblock of the partition, gets the root inode
* and sends back the details of them. Note, that the FS process does not
/*===========================================================================*
* fs_mountpoint *
*===========================================================================*/
-PUBLIC int fs_mountpoint()
+int fs_mountpoint()
{
/* This function looks up the mount point, it checks the condition whether
* the partition can be mounted on the inode or not.
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
-PUBLIC int fs_unmount()
+int fs_unmount()
{
/* Unmount a file system by device number. */
int count;
#include "super.h"
#include <minix/vfsif.h>
-FORWARD struct inode *new_node(struct inode *ldirp, char *string, mode_t
+static struct inode *new_node(struct inode *ldirp, char *string, mode_t
bits, zone_t z0);
/*===========================================================================*
* fs_create *
*===========================================================================*/
-PUBLIC int fs_create()
+int fs_create()
{
size_t len;
int r;
/*===========================================================================*
* fs_mknod *
*===========================================================================*/
-PUBLIC int fs_mknod()
+int fs_mknod()
{
struct inode *ip, *ldirp;
char lastc[MFS_NAME_MAX];
/*===========================================================================*
* fs_mkdir *
*===========================================================================*/
-PUBLIC int fs_mkdir()
+int fs_mkdir()
{
int r1, r2; /* status codes */
ino_t dot, dotdot; /* inode numbers for . and .. */
/*===========================================================================*
* fs_slink *
*===========================================================================*/
-PUBLIC int fs_slink()
+int fs_slink()
{
phys_bytes len;
struct inode *sip; /* inode containing symbolic link */
/*===========================================================================*
* new_node *
*===========================================================================*/
-PRIVATE struct inode *new_node(struct inode *ldirp,
+static struct inode *new_node(struct inode *ldirp,
char *string, mode_t bits, zone_t z0)
{
/* New_node() is called by fs_open(), fs_mknod(), and fs_mkdir().
/*===========================================================================*
* fs_inhibread *
*===========================================================================*/
-PUBLIC int fs_inhibread()
+int fs_inhibread()
{
struct inode *rip;
#include <minix/libminixfs.h>
-PUBLIC char dot1[2] = "."; /* used for search_dir to bypass the access */
-PUBLIC char dot2[3] = ".."; /* permissions for . and .. */
+char dot1[2] = "."; /* used for search_dir to bypass the access */
+char dot2[3] = ".."; /* permissions for . and .. */
-FORWARD char *get_name(char *name, char string[MFS_NAME_MAX+1]);
-FORWARD int ltraverse(struct inode *rip, char *suffix);
-FORWARD int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
+static char *get_name(char *name, char string[MFS_NAME_MAX+1]);
+static int ltraverse(struct inode *rip, char *suffix);
+static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
inode **res_inop, size_t *offsetp, int *symlinkp);
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
-PUBLIC int fs_lookup()
+int fs_lookup()
{
cp_grant_id_t grant;
int r, r1, flags, symlinks;
/*===========================================================================*
* parse_path *
*===========================================================================*/
-PRIVATE int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
+static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
ino_t dir_ino;
ino_t root_ino;
int flags;
/*===========================================================================*
* ltraverse *
*===========================================================================*/
-PRIVATE int ltraverse(rip, suffix)
+static int ltraverse(rip, suffix)
register struct inode *rip; /* symbolic link */
char *suffix; /* current remaining path. Has to point in the
* user_path buffer
/*===========================================================================*
* advance *
*===========================================================================*/
-PUBLIC struct inode *advance(dirp, string, chk_perm)
+struct inode *advance(dirp, string, chk_perm)
struct inode *dirp; /* inode for directory to be searched */
char string[MFS_NAME_MAX]; /* component name to look for */
int chk_perm; /* check permissions when string is looked up*/
/*===========================================================================*
* get_name *
*===========================================================================*/
-PRIVATE char *get_name(path_name, string)
+static char *get_name(path_name, string)
char *path_name; /* path name to parse */
char string[MFS_NAME_MAX+1]; /* component extracted from 'old_name' */
{
/*===========================================================================*
* search_dir *
*===========================================================================*/
-PUBLIC int search_dir(ldir_ptr, string, numb, flag, check_permissions)
+int search_dir(ldir_ptr, string, numb, flag, check_permissions)
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
char string[MFS_NAME_MAX]; /* component to search for */
ino_t *numb; /* pointer to inode number */
#include "super.h"
#include <minix/vfsif.h>
-FORWARD int in_group(gid_t grp);
+static int in_group(gid_t grp);
/*===========================================================================*
* fs_chmod *
*===========================================================================*/
-PUBLIC int fs_chmod()
+int fs_chmod()
{
/* Perform the chmod(name, mode) system call. */
/*===========================================================================*
* fs_chown *
*===========================================================================*/
-PUBLIC int fs_chown()
+int fs_chown()
{
register struct inode *rip;
register int r;
/*===========================================================================*
* forbidden *
*===========================================================================*/
-PUBLIC int forbidden(register struct inode *rip, mode_t access_desired)
+int forbidden(register struct inode *rip, mode_t access_desired)
{
/* Given a pointer to an inode, 'rip', and the access desired, determine
* if the access is allowed, and if not why not. The routine looks up the
/*===========================================================================*
* in_group *
*===========================================================================*/
-PRIVATE int in_group(gid_t grp)
+static int in_group(gid_t grp)
{
int i;
/*===========================================================================*
* read_only *
*===========================================================================*/
-PUBLIC int read_only(ip)
+int read_only(ip)
struct inode *ip; /* ptr to inode whose file sys is to be cked */
{
/* Check to see if the file system on which the inode 'ip' resides is mounted
#include <assert.h>
-FORWARD struct buf *rahead(struct inode *rip, block_t baseblock, u64_t
+static struct buf *rahead(struct inode *rip, block_t baseblock, u64_t
position, unsigned bytes_ahead);
-FORWARD int rw_chunk(struct inode *rip, u64_t position, unsigned off,
+static int rw_chunk(struct inode *rip, u64_t position, unsigned off,
size_t chunk, unsigned left, int rw_flag, cp_grant_id_t gid, unsigned
buf_off, unsigned int block_size, int *completed);
-PRIVATE char getdents_buf[GETDENTS_BUFSIZ];
+static char getdents_buf[GETDENTS_BUFSIZ];
/*===========================================================================*
* fs_readwrite *
*===========================================================================*/
-PUBLIC int fs_readwrite(void)
+int fs_readwrite(void)
{
int r, rw_flag, block_spec;
int regular;
/*===========================================================================*
* fs_breadwrite *
*===========================================================================*/
-PUBLIC int fs_breadwrite(void)
+int fs_breadwrite(void)
{
int r, rw_flag, completed;
cp_grant_id_t gid;
/*===========================================================================*
* rw_chunk *
*===========================================================================*/
-PRIVATE int rw_chunk(rip, position, off, chunk, left, rw_flag, gid,
+static int rw_chunk(rip, position, off, chunk, left, rw_flag, gid,
buf_off, block_size, completed)
register struct inode *rip; /* pointer to inode for file to be rd/wr */
u64_t position; /* position within file to read or write */
/*===========================================================================*
* read_map *
*===========================================================================*/
-PUBLIC block_t read_map(rip, position)
+block_t read_map(rip, position)
register struct inode *rip; /* ptr to inode to map from */
off_t position; /* position in file whose blk wanted */
{
/*===========================================================================*
* rd_indir *
*===========================================================================*/
-PUBLIC zone_t rd_indir(bp, index)
+zone_t rd_indir(bp, index)
struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */
{
/*===========================================================================*
* rahead *
*===========================================================================*/
-PRIVATE struct buf *rahead(rip, baseblock, position, bytes_ahead)
+static struct buf *rahead(rip, baseblock, position, bytes_ahead)
register struct inode *rip; /* pointer to inode for file to be read */
block_t baseblock; /* block at current position */
u64_t position; /* position within file */
/*===========================================================================*
* fs_getdents *
*===========================================================================*/
-PUBLIC int fs_getdents(void)
+int fs_getdents(void)
{
register struct inode *rip;
int o, r, done;
/*===========================================================================*
* estimate_blocks *
*===========================================================================*/
-PRIVATE blkcnt_t estimate_blocks(struct inode *rip)
+static blkcnt_t estimate_blocks(struct inode *rip)
{
/* Return the number of 512-byte blocks used by this file. This includes space
* used by data zones and indirect blocks (actually also zones). Reading in all
/*===========================================================================*
* stat_inode *
*===========================================================================*/
-PRIVATE int stat_inode(
+static int stat_inode(
register struct inode *rip, /* pointer to inode to stat */
endpoint_t who_e, /* Caller endpoint */
cp_grant_id_t gid /* grant for the stat buf */
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
-PUBLIC int fs_fstatfs()
+int fs_fstatfs()
{
struct statfs st;
struct inode *rip;
/*===========================================================================*
* fs_statvfs *
*===========================================================================*/
-PUBLIC int fs_statvfs()
+int fs_statvfs()
{
struct statvfs st;
struct super_block *sp;
/*===========================================================================*
* fs_stat *
*===========================================================================*/
-PUBLIC int fs_stat()
+int fs_stat()
{
register int r; /* return value */
register struct inode *rip; /* target inode */
/*===========================================================================*
* count_free_bits *
*===========================================================================*/
-PUBLIC bit_t count_free_bits(sp, map)
+bit_t count_free_bits(sp, map)
struct super_block *sp; /* the filesystem to allocate from */
int map; /* IMAP (inode map) or ZMAP (zone map) */
{
/*===========================================================================*
* blockstats *
*===========================================================================*/
-PUBLIC void blockstats(u32_t *blocks, u32_t *free, u32_t *used)
+void blockstats(u32_t *blocks, u32_t *free, u32_t *used)
{
struct super_block *sp;
int scale;
/*===========================================================================*
* alloc_bit *
*===========================================================================*/
-PUBLIC bit_t alloc_bit(sp, map, origin)
+bit_t alloc_bit(sp, map, origin)
struct super_block *sp; /* the filesystem to allocate from */
int map; /* IMAP (inode map) or ZMAP (zone map) */
bit_t origin; /* number of bit to start searching at */
/*===========================================================================*
* free_bit *
*===========================================================================*/
-PUBLIC void free_bit(sp, map, bit_returned)
+void free_bit(sp, map, bit_returned)
struct super_block *sp; /* the filesystem to operate on */
int map; /* IMAP (inode map) or ZMAP (zone map) */
bit_t bit_returned; /* number of bit to insert into the map */
/*===========================================================================*
* get_super *
*===========================================================================*/
-PUBLIC struct super_block *get_super(
+struct super_block *get_super(
dev_t dev /* device number whose super_block is sought */
)
{
/*===========================================================================*
* get_block_size *
*===========================================================================*/
-PUBLIC unsigned int get_block_size(dev_t dev)
+unsigned int get_block_size(dev_t dev)
{
if (dev == NO_DEV)
panic("request for block size of NO_DEV");
/*===========================================================================*
* rw_super *
*===========================================================================*/
-PRIVATE int rw_super(struct super_block *sp, int writing)
+static int rw_super(struct super_block *sp, int writing)
{
/* Read/write a superblock. */
int r;
/*===========================================================================*
* read_super *
*===========================================================================*/
-PUBLIC int read_super(struct super_block *sp)
+int read_super(struct super_block *sp)
{
unsigned int magic;
block_t offset;
/*===========================================================================*
* write_super *
*===========================================================================*/
-PUBLIC int write_super(struct super_block *sp)
+int write_super(struct super_block *sp)
{
if(sp->s_rd_only)
panic("can't write superblock of readonly filesystem");
#include "buf.h"
#include "super.h"
-PUBLIC int (*fs_call_vec[])(void) = {
+int (*fs_call_vec[])(void) = {
no_sys, /* 0 not used */
no_sys, /* 1 */ /* Was: fs_getnode */
fs_putnode, /* 2 */
/*===========================================================================*
* fs_utime *
*===========================================================================*/
-PUBLIC int fs_utime()
+int fs_utime()
{
register struct inode *rip;
register int r;
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys()
+int no_sys()
{
/* Somebody has used an illegal system call number */
printf("no_sys: invalid call %d\n", req_nr);
/*===========================================================================*
* conv2 *
*===========================================================================*/
-PUBLIC unsigned conv2(norm, w)
+unsigned conv2(norm, w)
int norm; /* TRUE if no swap, FALSE for byte swap */
int w; /* promotion of 16-bit word to be swapped */
{
/*===========================================================================*
* conv4 *
*===========================================================================*/
-PUBLIC long conv4(norm, x)
+long conv4(norm, x)
int norm; /* TRUE if no swap, FALSE for byte swap */
long x; /* 32-bit long to be byte swapped */
{
/*===========================================================================*
* clock_time *
*===========================================================================*/
-PUBLIC time_t clock_time()
+time_t clock_time()
{
/* This routine returns the time in seconds since 1.1.1970. MINIX is an
* astrophysically naive system that assumes the earth rotates at a constant
/*===========================================================================*
* mfs_min *
*===========================================================================*/
-PUBLIC int min(unsigned int l, unsigned int r)
+int min(unsigned int l, unsigned int r)
{
if(r >= l) return(l);
/*===========================================================================*
* mfs_nul *
*===========================================================================*/
-PUBLIC void mfs_nul_f(char *file, int line, char *str, unsigned int len,
+void mfs_nul_f(char *file, int line, char *str, unsigned int len,
unsigned int maxlen)
{
if(len < maxlen && str[len-1] != '\0') {
/*===========================================================================*
* sanity_check *
*===========================================================================*/
-PUBLIC void sanitycheck(char *file, int line)
+void sanitycheck(char *file, int line)
{
MYASSERT(SELF_E > 0);
if(superblock.s_dev != NO_DEV) {
#include "super.h"
-FORWARD void wr_indir(struct buf *bp, int index, zone_t zone);
-FORWARD int empty_indir(struct buf *, struct super_block *);
+static void wr_indir(struct buf *bp, int index, zone_t zone);
+static int empty_indir(struct buf *, struct super_block *);
/*===========================================================================*
* write_map *
*===========================================================================*/
-PUBLIC int write_map(rip, position, new_zone, op)
+int write_map(rip, position, new_zone, op)
struct inode *rip; /* pointer to inode to be changed */
off_t position; /* file address to be mapped */
zone_t new_zone; /* zone # to be inserted */
/*===========================================================================*
* wr_indir *
*===========================================================================*/
-PRIVATE void wr_indir(bp, index, zone)
+static void wr_indir(bp, index, zone)
struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */
zone_t zone; /* zone to write */
/*===========================================================================*
* empty_indir *
*===========================================================================*/
-PRIVATE int empty_indir(bp, sb)
+static int empty_indir(bp, sb)
struct buf *bp; /* pointer to indirect block */
struct super_block *sb; /* superblock of device block resides on */
{
/*===========================================================================*
* clear_zone *
*===========================================================================*/
-PUBLIC void clear_zone(rip, pos, flag)
+void clear_zone(rip, pos, flag)
register struct inode *rip; /* inode to clear */
off_t pos; /* points to block to clear */
int flag; /* 1 if called by new_block, 0 otherwise */
/*===========================================================================*
* new_block *
*===========================================================================*/
-PUBLIC struct buf *new_block(rip, position)
+struct buf *new_block(rip, position)
register struct inode *rip; /* pointer to inode */
off_t position; /* file pointer */
{
/*===========================================================================*
* zero_block *
*===========================================================================*/
-PUBLIC void zero_block(bp)
+void zero_block(bp)
register struct buf *bp; /* pointer to buffer to zero */
{
/* Zero a block. */
#include <stdlib.h>
#include <string.h>
-FORWARD struct buf *new_block(dev_t dev, ino_t inum);
+static struct buf *new_block(dev_t dev, ino_t inum);
/*===========================================================================*
* buf_pool *
*===========================================================================*/
-PUBLIC void buf_pool(void)
+void buf_pool(void)
{
/* Initialize the buffer pool. */
/*===========================================================================*
* get_block *
*===========================================================================*/
-PUBLIC struct buf *get_block(dev_t dev, ino_t inum)
+struct buf *get_block(dev_t dev, ino_t inum)
{
struct buf *bp = front;
/*===========================================================================*
* new_block *
*===========================================================================*/
-PRIVATE struct buf *new_block(dev_t dev, ino_t inum)
+static struct buf *new_block(dev_t dev, ino_t inum)
{
/* Allocate a new buffer and add it to the double linked buffer list */
struct buf *bp;
/*===========================================================================*
* put_block *
*===========================================================================*/
-PUBLIC void put_block(dev_t dev, ino_t inum)
+void put_block(dev_t dev, ino_t inum)
{
struct buf *bp;
#include "glo.h"
#include "uds.h"
-FORWARD int uds_perform_read(int minor, endpoint_t m_source, size_t
+static int uds_perform_read(int minor, endpoint_t m_source, size_t
size, int pretend);
-FORWARD int uds_perform_write(int minor, endpoint_t m_source, size_t
+static int uds_perform_write(int minor, endpoint_t m_source, size_t
size, int pretend);
-PUBLIC int uds_open(message *dev_m_in, message *dev_m_out)
+int uds_open(message *dev_m_in, message *dev_m_out)
{
message fs_m_in, fs_m_out;
struct ucred ucred;
return minor;
}
-PUBLIC int uds_close(message *dev_m_in, message *dev_m_out)
+int uds_close(message *dev_m_in, message *dev_m_out)
{
int minor;
message fs_m_in, fs_m_out;
return OK;
}
-PUBLIC int uds_select(message *dev_m_in, message *dev_m_out)
+int uds_select(message *dev_m_in, message *dev_m_out)
{
int i, bytes;
int minor;
return uds_fd_table[minor].sel_ops_out;
}
-PRIVATE int uds_perform_read(int minor, endpoint_t m_source,
+static int uds_perform_read(int minor, endpoint_t m_source,
size_t size, int pretend)
{
int rc;
return fs_m_out.RES_NBYTES; /* return number of bytes read */
}
-PRIVATE int uds_perform_write(int minor, endpoint_t m_source,
+static int uds_perform_write(int minor, endpoint_t m_source,
size_t size, int pretend)
{
int rc, peer, i;
return fs_m_out.RES_NBYTES; /* return number of bytes written */
}
-PUBLIC int uds_read(message *dev_m_in, message *dev_m_out)
+int uds_read(message *dev_m_in, message *dev_m_out)
{
int bytes;
int minor;
return bytes;
}
-PUBLIC int uds_write(message *dev_m_in, message *dev_m_out)
+int uds_write(message *dev_m_in, message *dev_m_out)
{
int bytes;
int minor;
return bytes;
}
-PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out)
+int uds_ioctl(message *dev_m_in, message *dev_m_out)
{
int rc, minor;
return rc;
}
-PUBLIC int uds_unsuspend(endpoint_t m_source, int minor)
+int uds_unsuspend(endpoint_t m_source, int minor)
{
int r = OK, bytes;
message m_out;
return(r);
}
-PUBLIC int uds_cancel(message *dev_m_in, message *dev_m_out)
+int uds_cancel(message *dev_m_in, message *dev_m_out)
{
int i, j;
int minor;
#include "inode.h"
#include <minix/vfsif.h>
-FORWARD void addhash_inode(struct inode * const node);
-FORWARD void unhash_inode(struct inode * const node);
+static void addhash_inode(struct inode * const node);
+static void unhash_inode(struct inode * const node);
/*===========================================================================*
* fs_putnode *
*===========================================================================*/
-PUBLIC int fs_putnode(message *fs_m_in, message *fs_m_out)
+int fs_putnode(message *fs_m_in, message *fs_m_out)
{
/* Find the inode specified by the request message and decrease its counter.*/
/*===========================================================================*
* init_inode_cache *
*===========================================================================*/
-PUBLIC void init_inode_cache()
+void init_inode_cache()
{
struct inode *rip;
struct inodelist *rlp;
/*===========================================================================*
* addhash_inode *
*===========================================================================*/
-PRIVATE void addhash_inode(struct inode * const node)
+static void addhash_inode(struct inode * const node)
{
int hashi = (int) (node->i_num & INODE_HASH_MASK);
/*===========================================================================*
* unhash_inode *
*===========================================================================*/
-PRIVATE void unhash_inode(struct inode * const node)
+static void unhash_inode(struct inode * const node)
{
/* remove from hash table */
LIST_REMOVE(node, i_hash);
/*===========================================================================*
* get_inode *
*===========================================================================*/
-PUBLIC struct inode *get_inode(
+struct inode *get_inode(
dev_t dev, /* device on which inode resides */
ino_t numb /* inode number */
)
/*===========================================================================*
* find_inode *
*===========================================================================*/
-PUBLIC struct inode *find_inode(numb)
+struct inode *find_inode(numb)
ino_t numb; /* inode number */
{
/* Find the inode specified by the inode and device number.
/*===========================================================================*
* put_inode *
*===========================================================================*/
-PUBLIC void put_inode(rip)
+void put_inode(rip)
struct inode *rip; /* pointer to inode to be released */
{
/* The caller is no longer using this inode. If no one else is using it either
/*===========================================================================*
* alloc_inode *
*===========================================================================*/
-PUBLIC struct inode *alloc_inode(dev_t dev, mode_t bits)
+struct inode *alloc_inode(dev_t dev, mode_t bits)
{
/* Allocate a free inode on 'dev', and return a pointer to it. */
/*===========================================================================*
* wipe_inode *
*===========================================================================*/
-PUBLIC void wipe_inode(rip)
+void wipe_inode(rip)
struct inode *rip; /* the inode to be erased */
{
/* Erase some fields in the inode. This function is called from alloc_inode()
/*===========================================================================*
* free_inode *
*===========================================================================*/
-PUBLIC void free_inode(rip)
+void free_inode(rip)
struct inode *rip;
{
/* Return an inode to the pool of unallocated inodes. */
/*===========================================================================*
* update_times *
*===========================================================================*/
-PUBLIC void update_times(rip)
+void update_times(rip)
struct inode *rip; /* pointer to inode to be read/written */
{
/* Various system calls are required by the standard to update atime, ctime,
/*===========================================================================*
* fs_ftrunc *
*===========================================================================*/
-PUBLIC int fs_ftrunc(message *fs_m_in, message *fs_m_out)
+int fs_ftrunc(message *fs_m_in, message *fs_m_out)
{
struct inode *rip;
off_t start, end;
/*===========================================================================*
* truncate_inode *
*===========================================================================*/
-PUBLIC int truncate_inode(rip, newsize)
+int truncate_inode(rip, newsize)
register struct inode *rip; /* pointer to inode to be truncated */
off_t newsize; /* inode must become this size */
{
#include "inode.h"
#include "uds.h"
-FORWARD void get_work(message *m_in);
+static void get_work(message *m_in);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
/* This is the main routine of this service. The main loop consists of
* three major activities: getting new work, processing the work, and
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the pipe file server. */
int i;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(m_in)
+static void get_work(m_in)
message *m_in; /* pointer to message */
{
int r, srcok = 0, status;
/*===========================================================================*
* reply *
*===========================================================================*/
-PUBLIC void reply(who, m_out)
+void reply(who, m_out)
endpoint_t who;
message *m_out; /* report result */
{
/*===========================================================================*
* fs_sync *
*===========================================================================*/
-PUBLIC int fs_sync(message *fs_m_in, message *fs_m_out)
+int fs_sync(message *fs_m_in, message *fs_m_out)
{
/* Perform the sync() system call. No-op on this FS. */
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
-PUBLIC int fs_unmount(message *fs_m_in, message *fs_m_out)
+int fs_unmount(message *fs_m_in, message *fs_m_out)
{
/* Unmount Pipe File Server. */
/*===========================================================================*
* fs_newnode *
*===========================================================================*/
-PUBLIC int fs_newnode(message *fs_m_in, message *fs_m_out)
+int fs_newnode(message *fs_m_in, message *fs_m_out)
{
register int r = OK;
mode_t bits;
/*===========================================================================*
* fs_readwrite *
*===========================================================================*/
-PUBLIC int fs_readwrite(message *fs_m_in, message *fs_m_out)
+int fs_readwrite(message *fs_m_in, message *fs_m_out)
{
int r, rw_flag;
struct buf *bp;
/*===========================================================================*
* stat_inode *
*===========================================================================*/
-PRIVATE int stat_inode(
+static int stat_inode(
register struct inode *rip, /* pointer to inode to stat */
endpoint_t who_e, /* Caller endpoint */
cp_grant_id_t gid /* grant for the stat buf */
/*===========================================================================*
* fs_stat *
*===========================================================================*/
-PUBLIC int fs_stat(message *fs_m_in, message *fs_m_out)
+int fs_stat(message *fs_m_in, message *fs_m_out)
{
register int r; /* return value */
register struct inode *rip; /* target inode */
/*===========================================================================*
* alloc_bit *
*===========================================================================*/
-PUBLIC bit_t alloc_bit(void)
+bit_t alloc_bit(void)
{
/* Allocate a bit from a bit map and return its bit number. */
bitchunk_t *wptr, *wlim;
/*===========================================================================*
* free_bit *
*===========================================================================*/
-PUBLIC void free_bit(bit_returned)
+void free_bit(bit_returned)
bit_t bit_returned; /* number of bit to insert into the inode map*/
{
bitchunk_t *k, mask;
#include "uds.h"
/* File System Handlers (pfs) */
-PUBLIC int (*fs_call_vec[])(message *fs_m_in, message *fs_m_out) = {
+int (*fs_call_vec[])(message *fs_m_in, message *fs_m_out) = {
no_sys, /* 0 not used */
no_sys, /* 1 */
};
/* Device Handlers (/dev/uds) */
-PUBLIC int (*dev_call_vec[])(message *dev_m_in, message *dev_m_out) = {
+int (*dev_call_vec[])(message *dev_m_in, message *dev_m_out) = {
uds_cancel, /* 0 CANCEL */
no_sys, /* 1 */
uds_fd_t uds_fd_table[NR_FDS];
/* initialize the descriptor table */
-PUBLIC void uds_init(void)
+void uds_init(void)
{
/*
* Setting everything to NULL implicitly sets the
}
/* check the permissions of a socket file */
-PRIVATE int check_perms(int minor, struct sockaddr_un *addr)
+static int check_perms(int minor, struct sockaddr_un *addr)
{
int rc;
message vfs_m;
return vfs_m.m_type; /* return reply code OK, ELOOP, etc. */
}
-PRIVATE filp_id_t verify_fd(endpoint_t ep, int fd)
+static filp_id_t verify_fd(endpoint_t ep, int fd)
{
int rc;
message vfs_m;
return vfs_m.ADDRESS;
}
-PRIVATE int set_filp(filp_id_t sfilp)
+static int set_filp(filp_id_t sfilp)
{
int rc;
message vfs_m;
return vfs_m.m_type; /* return reply code OK, ELOOP, etc. */
}
-PRIVATE int copy_filp(endpoint_t to_ep, filp_id_t cfilp)
+static int copy_filp(endpoint_t to_ep, filp_id_t cfilp)
{
int rc;
message vfs_m;
return vfs_m.m_type;
}
-PRIVATE int put_filp(filp_id_t pfilp)
+static int put_filp(filp_id_t pfilp)
{
int rc;
message vfs_m;
return vfs_m.m_type; /* return reply code OK, ELOOP, etc. */
}
-PRIVATE int cancel_fd(endpoint_t ep, int fd)
+static int cancel_fd(endpoint_t ep, int fd)
{
int rc;
message vfs_m;
return vfs_m.m_type; /* return reply code OK, ELOOP, etc. */
}
-PUBLIC int perform_connection(message *dev_m_in, message *dev_m_out,
+int perform_connection(message *dev_m_in, message *dev_m_out,
struct sockaddr_un *addr, int minorx, int minory)
{
/* there are several places were a connection is established. */
}
-PUBLIC int do_accept(message *dev_m_in, message *dev_m_out)
+int do_accept(message *dev_m_in, message *dev_m_out)
{
int minor;
int minorparent; /* minor number of parent (server) */
return OK;
}
-PUBLIC int do_connect(message *dev_m_in, message *dev_m_out)
+int do_connect(message *dev_m_in, message *dev_m_out)
{
int minor;
struct sockaddr_un addr;
return SUSPEND;
}
-PUBLIC int do_listen(message *dev_m_in, message *dev_m_out)
+int do_listen(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
return OK;
}
-PUBLIC int do_socket(message *dev_m_in, message *dev_m_out)
+int do_socket(message *dev_m_in, message *dev_m_out)
{
int rc;
int minor;
}
}
-PUBLIC int do_bind(message *dev_m_in, message *dev_m_out)
+int do_bind(message *dev_m_in, message *dev_m_out)
{
int minor;
struct sockaddr_un addr;
return OK;
}
-PUBLIC int do_getsockname(message *dev_m_in, message *dev_m_out)
+int do_getsockname(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
return rc ? EIO : OK;
}
-PUBLIC int do_getpeername(message *dev_m_in, message *dev_m_out)
+int do_getpeername(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
}
}
-PUBLIC int do_shutdown(message *dev_m_in, message *dev_m_out)
+int do_shutdown(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc, how;
return OK;
}
-PUBLIC int do_socketpair_old(message *dev_m_in, message *dev_m_out)
+int do_socketpair_old(message *dev_m_in, message *dev_m_out)
{
int rc;
short minorin;
return perform_connection(dev_m_in, dev_m_out, &addr, minorx, minory);
}
-PUBLIC int do_socketpair(message *dev_m_in, message *dev_m_out)
+int do_socketpair(message *dev_m_in, message *dev_m_out)
{
int rc;
dev_t minorin;
return perform_connection(dev_m_in, dev_m_out, &addr, minorx, minory);
}
-PUBLIC int do_getsockopt_sotype(message *dev_m_in, message *dev_m_out)
+int do_getsockopt_sotype(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
return rc ? EIO : OK;
}
-PUBLIC int do_getsockopt_peercred(message *dev_m_in, message *dev_m_out)
+int do_getsockopt_peercred(message *dev_m_in, message *dev_m_out)
{
int minor;
int peer_minor;
return rc ? EIO : OK;
}
-PUBLIC int do_getsockopt_peercred_old(message *dev_m_in, message *dev_m_out)
+int do_getsockopt_peercred_old(message *dev_m_in, message *dev_m_out)
{
int minor;
int peer_minor;
}
-PUBLIC int do_sendto(message *dev_m_in, message *dev_m_out)
+int do_sendto(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
return OK;
}
-PUBLIC int do_recvfrom(message *dev_m_in, message *dev_m_out)
+int do_recvfrom(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
return OK;
}
-PRIVATE int send_fds(int minor, struct ancillary *data)
+static int send_fds(int minor, struct ancillary *data)
{
int rc, i, j;
return OK;
}
-PUBLIC int clear_fds(int minor, struct ancillary *data)
+int clear_fds(int minor, struct ancillary *data)
{
/* This function calls put_filp() for all of the FDs in data.
* This is used when a Unix Domain Socket is closed and there
return OK;
}
-PRIVATE int recv_fds(int minor, struct ancillary *data,
+static int recv_fds(int minor, struct ancillary *data,
struct msg_control *msg_ctrl)
{
int rc, i, j;
return OK;
}
-PRIVATE int recv_cred(int minor, struct ancillary *data,
+static int recv_cred(int minor, struct ancillary *data,
struct msg_control *msg_ctrl)
{
struct msghdr msghdr;
return OK;
}
-PUBLIC int do_sendmsg(message *dev_m_in, message *dev_m_out)
+int do_sendmsg(message *dev_m_in, message *dev_m_out)
{
int minor, peer, rc, i;
struct msg_control msg_ctrl;
return send_fds(minor, &uds_fd_table[peer].ancillary_data);
}
-PUBLIC int do_recvmsg(message *dev_m_in, message *dev_m_out)
+int do_recvmsg(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys(message *pfs_m_in, message *pfs_m_out)
+int no_sys(message *pfs_m_in, message *pfs_m_out)
{
/* Somebody has used an illegal system call number */
printf("no_sys: invalid call 0x%x to pfs\n", req_nr);
/*===========================================================================*
* clock_time *
*===========================================================================*/
-PUBLIC time_t clock_time()
+time_t clock_time()
{
/* This routine returns the time in seconds since 1.1.1970. MINIX is an
* astrophysically naive system that assumes the earth rotates at a constant
#define US 1000000 /* shortcut for microseconds per second */
-FORWARD clock_t ticks_from_timeval(struct timeval *tv);
-FORWARD void timeval_from_ticks(struct timeval *tv, clock_t ticks);
-FORWARD int is_sane_timeval(struct timeval *tv);
-FORWARD void getset_vtimer(struct mproc *mp, int nwhich, struct
+static clock_t ticks_from_timeval(struct timeval *tv);
+static void timeval_from_ticks(struct timeval *tv, clock_t ticks);
+static int is_sane_timeval(struct timeval *tv);
+static void getset_vtimer(struct mproc *mp, int nwhich, struct
itimerval *value, struct itimerval *ovalue);
-FORWARD void get_realtimer(struct mproc *mp, struct itimerval *value);
-FORWARD void set_realtimer(struct mproc *mp, struct itimerval *value);
-FORWARD void cause_sigalrm(struct timer *tp);
+static void get_realtimer(struct mproc *mp, struct itimerval *value);
+static void set_realtimer(struct mproc *mp, struct itimerval *value);
+static void cause_sigalrm(struct timer *tp);
/*===========================================================================*
* ticks_from_timeval *
*===========================================================================*/
-PRIVATE clock_t ticks_from_timeval(tv)
+static clock_t ticks_from_timeval(tv)
struct timeval *tv;
{
clock_t ticks;
/*===========================================================================*
* timeval_from_ticks *
*===========================================================================*/
-PRIVATE void timeval_from_ticks(tv, ticks)
+static void timeval_from_ticks(tv, ticks)
struct timeval *tv;
clock_t ticks;
{
/*===========================================================================*
* is_sane_timeval *
*===========================================================================*/
-PRIVATE int is_sane_timeval(tv)
+static int is_sane_timeval(tv)
struct timeval *tv;
{
/* This imposes a reasonable time value range for setitimer. */
/*===========================================================================*
* do_itimer *
*===========================================================================*/
-PUBLIC int do_itimer()
+int do_itimer()
{
struct itimerval ovalue, value; /* old and new interval timers */
int setval, getval; /* set and/or retrieve the values? */
/*===========================================================================*
* do_alarm *
*===========================================================================*/
-PUBLIC int do_alarm()
+int do_alarm()
{
struct itimerval value, ovalue;
int remaining; /* previous time left in seconds */
/*===========================================================================*
* getset_vtimer *
*===========================================================================*/
-PRIVATE void getset_vtimer(rmp, which, value, ovalue)
+static void getset_vtimer(rmp, which, value, ovalue)
struct mproc *rmp;
int which;
struct itimerval *value;
/*===========================================================================*
* check_vtimer *
*===========================================================================*/
-PUBLIC void check_vtimer(proc_nr, sig)
+void check_vtimer(proc_nr, sig)
int proc_nr;
int sig;
{
/*===========================================================================*
* get_realtimer *
*===========================================================================*/
-PRIVATE void get_realtimer(rmp, value)
+static void get_realtimer(rmp, value)
struct mproc *rmp;
struct itimerval *value;
{
/*===========================================================================*
* set_realtimer *
*===========================================================================*/
-PRIVATE void set_realtimer(rmp, value)
+static void set_realtimer(rmp, value)
struct mproc *rmp;
struct itimerval *value;
{
/*===========================================================================*
* set_alarm *
*===========================================================================*/
-PUBLIC void set_alarm(rmp, ticks)
+void set_alarm(rmp, ticks)
struct mproc *rmp; /* process that wants the alarm */
clock_t ticks; /* how many ticks delay before the signal */
{
/*===========================================================================*
* cause_sigalrm *
*===========================================================================*/
-PRIVATE void cause_sigalrm(tp)
+static void cause_sigalrm(tp)
struct timer *tp;
{
int proc_nr_n;
/*===========================================================================*
* do_brk *
*===========================================================================*/
-PUBLIC int do_brk()
+int do_brk()
{
int r;
/* Entry point to brk(addr) system call. */
/*===========================================================================*
* do_exec *
*===========================================================================*/
-PUBLIC int do_exec()
+int do_exec()
{
message m;
/*===========================================================================*
* do_exec_newmem *
*===========================================================================*/
-PUBLIC int do_exec_newmem()
+int do_exec_newmem()
{
int proc_e, proc_n, allow_setuid;
char *ptr;
/*===========================================================================*
* do_execrestart *
*===========================================================================*/
-PUBLIC int do_execrestart()
+int do_execrestart()
{
int proc_e, proc_n, result;
struct mproc *rmp;
/*===========================================================================*
* exec_restart *
*===========================================================================*/
-PUBLIC void exec_restart(rmp, result, pc)
+void exec_restart(rmp, result, pc)
struct mproc *rmp;
int result;
vir_bytes pc;
#define LAST_FEW 2 /* last few slots reserved for superuser */
-FORWARD void zombify(struct mproc *rmp);
-FORWARD void check_parent(struct mproc *child, int try_cleanup);
-FORWARD void tell_parent(struct mproc *child);
-FORWARD void tell_tracer(struct mproc *child);
-FORWARD void tracer_died(struct mproc *child);
-FORWARD void cleanup(register struct mproc *rmp);
+static void zombify(struct mproc *rmp);
+static void check_parent(struct mproc *child, int try_cleanup);
+static void tell_parent(struct mproc *child);
+static void tell_tracer(struct mproc *child);
+static void tracer_died(struct mproc *child);
+static void cleanup(register struct mproc *rmp);
/*===========================================================================*
* do_fork *
*===========================================================================*/
-PUBLIC int do_fork()
+int do_fork()
{
/* The process pointed to by 'mp' has forked. Create a child process. */
register struct mproc *rmp; /* pointer to parent */
/*===========================================================================*
* do_srv_fork *
*===========================================================================*/
-PUBLIC int do_srv_fork()
+int do_srv_fork()
{
/* The process pointed to by 'mp' has forked. Create a child process. */
register struct mproc *rmp; /* pointer to parent */
/*===========================================================================*
* do_exit *
*===========================================================================*/
-PUBLIC int do_exit()
+int do_exit()
{
/* Perform the exit(status) system call. The real work is done by exit_proc(),
* which is also called when a process is killed by a signal. System processes
/*===========================================================================*
* exit_proc *
*===========================================================================*/
-PUBLIC void exit_proc(rmp, exit_status, dump_core)
+void exit_proc(rmp, exit_status, dump_core)
register struct mproc *rmp; /* pointer to the process to be terminated */
int exit_status; /* the process' exit status (for parent) */
int dump_core; /* flag indicating whether to dump core */
/*===========================================================================*
* exit_restart *
*===========================================================================*/
-PUBLIC void exit_restart(rmp, dump_core)
+void exit_restart(rmp, dump_core)
struct mproc *rmp; /* pointer to the process being terminated */
int dump_core; /* flag indicating whether to dump core */
{
/*===========================================================================*
* do_waitpid *
*===========================================================================*/
-PUBLIC int do_waitpid()
+int do_waitpid()
{
/* A process wants to wait for a child to terminate. If a child is already
* waiting, go clean it up and let this WAIT call terminate. Otherwise,
/*===========================================================================*
* wait_test *
*===========================================================================*/
-PUBLIC int wait_test(rmp, child)
+int wait_test(rmp, child)
struct mproc *rmp; /* process that may be waiting */
struct mproc *child; /* process that may be waited for */
{
/*===========================================================================*
* zombify *
*===========================================================================*/
-PRIVATE void zombify(rmp)
+static void zombify(rmp)
struct mproc *rmp;
{
/* Zombify a process. First check if the exiting process is traced by a process
/*===========================================================================*
* check_parent *
*===========================================================================*/
-PRIVATE void check_parent(child, try_cleanup)
+static void check_parent(child, try_cleanup)
struct mproc *child; /* tells which process is exiting */
int try_cleanup; /* clean up the child when done? */
{
/*===========================================================================*
* tell_parent *
*===========================================================================*/
-PRIVATE void tell_parent(child)
+static void tell_parent(child)
register struct mproc *child; /* tells which process is exiting */
{
int exitstatus, mp_parent;
/*===========================================================================*
* tell_tracer *
*===========================================================================*/
-PRIVATE void tell_tracer(child)
+static void tell_tracer(child)
struct mproc *child; /* tells which process is exiting */
{
int exitstatus, mp_tracer;
/*===========================================================================*
* tracer_died *
*===========================================================================*/
-PRIVATE void tracer_died(child)
+static void tracer_died(child)
struct mproc *child; /* process being traced */
{
/* The process that was tracing the given child, has died for some reason.
/*===========================================================================*
* cleanup *
*===========================================================================*/
-PRIVATE void cleanup(rmp)
+static void cleanup(rmp)
register struct mproc *rmp; /* tells which process is exiting */
{
/* Release the process table entry and reinitialize some field. */
/*===========================================================================*
* do_get *
*===========================================================================*/
-PUBLIC int do_get()
+int do_get()
{
/* Handle GETUID, GETGID, GETGROUPS, GETGROUPS_O, GETPID, GETPGRP, GETSID,
ISSETUGID.
/*===========================================================================*
* do_set *
*===========================================================================*/
-PUBLIC int do_set()
+int do_set()
{
/* Handle SETUID, SETEUID, SETGID, SETEGID, SETSID. These calls have in common
* that, if successful, they will be forwarded to VFS as well.
EXTERN unsigned long calls_stats[NCALLS];
#endif
-FORWARD void sendreply(void);
-FORWARD int get_nice_value(int queue);
-FORWARD void handle_vfs_reply(void);
+static void sendreply(void);
+static int get_nice_value(int queue);
+static void handle_vfs_reply(void);
#define click_to_round_k(n) \
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD int sef_cb_signal_manager(endpoint_t target, int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static int sef_cb_signal_manager(endpoint_t target, int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main()
+int main()
{
/* Main routine of the process manager. */
int result;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the process manager.
* Memory use info is collected from the boot monitor, the kernel, and
/*===========================================================================*
* sef_cb_signal_manager *
*===========================================================================*/
-PRIVATE int sef_cb_signal_manager(endpoint_t target, int signo)
+static int sef_cb_signal_manager(endpoint_t target, int signo)
{
/* Process signal on behalf of the kernel. */
int r;
/*===========================================================================*
* setreply *
*===========================================================================*/
-PUBLIC void setreply(proc_nr, result)
+void setreply(proc_nr, result)
int proc_nr; /* process to reply to */
int result; /* result of call (usually OK or error #) */
{
/*===========================================================================*
* sendreply *
*===========================================================================*/
-PRIVATE void sendreply()
+static void sendreply()
{
int proc_nr;
int s;
/*===========================================================================*
* get_nice_value *
*===========================================================================*/
-PRIVATE int get_nice_value(queue)
+static int get_nice_value(queue)
int queue; /* store mem chunks here */
{
/* Processes in the boot image have a priority assigned. The PM doesn't know
/*===========================================================================*
* handle_vfs_reply *
*===========================================================================*/
-PRIVATE void handle_vfs_reply()
+static void handle_vfs_reply()
{
struct mproc *rmp;
endpoint_t proc_e;
/*===========================================================================*
* do_setmcontext *
*===========================================================================*/
-PUBLIC int do_setmcontext()
+int do_setmcontext()
{
return sys_setmcontext(who_e, (mcontext_t *) m_in.m1_p1);
}
/*===========================================================================*
* do_getmcontext *
*===========================================================================*/
-PUBLIC int do_getmcontext()
+int do_getmcontext()
{
return sys_getmcontext(who_e, (mcontext_t *) m_in.m1_p1);
}
#include "param.h"
#include "kernel/proc.h"
-PUBLIC struct utsname uts_val = {
+struct utsname uts_val = {
"Minix", /* system name */
"noname", /* node/network name */
OS_RELEASE, /* O.S. release (e.g. 1.5) */
#endif
};
-PRIVATE char *uts_tbl[] = {
+static char *uts_tbl[] = {
uts_val.arch,
NULL, /* No kernel architecture */
uts_val.machine,
};
#if ENABLE_SYSCALL_STATS
-PUBLIC unsigned long calls_stats[NCALLS];
+unsigned long calls_stats[NCALLS];
#endif
/*===========================================================================*
* do_sysuname *
*===========================================================================*/
-PUBLIC int do_sysuname()
+int do_sysuname()
{
/* Set or get uname strings. */
/*===========================================================================*
* do_getsysinfo *
*===========================================================================*/
-PUBLIC int do_getsysinfo()
+int do_getsysinfo()
{
vir_bytes src_addr, dst_addr;
size_t len;
/*===========================================================================*
* do_getprocnr *
*===========================================================================*/
-PUBLIC int do_getprocnr()
+int do_getprocnr()
{
register struct mproc *rmp;
static char search_key[PROC_NAME_LEN+1];
/*===========================================================================*
* do_getepinfo *
*===========================================================================*/
-PUBLIC int do_getepinfo()
+int do_getepinfo()
{
register struct mproc *rmp;
endpoint_t ep;
/*===========================================================================*
* do_getepinfo_o *
*===========================================================================*/
-PUBLIC int do_getepinfo_o()
+int do_getepinfo_o()
{
register struct mproc *rmp;
endpoint_t ep;
/*===========================================================================*
* do_reboot *
*===========================================================================*/
-PUBLIC int do_reboot()
+int do_reboot()
{
message m;
/*===========================================================================*
* do_getsetpriority *
*===========================================================================*/
-PUBLIC int do_getsetpriority()
+int do_getsetpriority()
{
int r, arg_which, arg_who, arg_pri;
struct mproc *rmp;
/*===========================================================================*
* do_svrctl *
*===========================================================================*/
-PUBLIC int do_svrctl()
+int do_svrctl()
{
int s, req;
vir_bytes ptr;
*===========================================================================*/
extern char *_brksize;
-PUBLIC int brk(brk_addr)
+int brk(brk_addr)
#ifdef __NBSD_LIBC
void *brk_addr;
#else
#include "param.h"
#if SPROFILE || CPROFILE
-FORWARD int check_addrs(int info_size);
+static int check_addrs(int info_size);
#endif
/*===========================================================================*
* do_sprofile *
*===========================================================================*/
-PUBLIC int do_sprofile(void)
+int do_sprofile(void)
{
#if SPROFILE
/*===========================================================================*
* do_cprofile *
*===========================================================================*/
-PUBLIC int do_cprofile(void)
+int do_cprofile(void)
{
#if CPROFILE
/*===========================================================================*
* check_addrs *
*===========================================================================*/
-PRIVATE int check_addrs(info_size)
+static int check_addrs(info_size)
int info_size;
{
int r;
/*===========================================================================*
* init_scheduling *
*===========================================================================*/
-PUBLIC void sched_init(void)
+void sched_init(void)
{
struct mproc *trmp;
endpoint_t parent_e;
/*===========================================================================*
* sched_start_user *
*===========================================================================*/
-PUBLIC int sched_start_user(endpoint_t ep, struct mproc *rmp)
+int sched_start_user(endpoint_t ep, struct mproc *rmp)
{
unsigned maxprio;
endpoint_t inherit_from;
/*===========================================================================*
* sched_nice *
*===========================================================================*/
-PUBLIC int sched_nice(struct mproc *rmp, int nice)
+int sched_nice(struct mproc *rmp, int nice)
{
int rv;
message m;
#include "mproc.h"
#include "param.h"
-FORWARD void unpause(struct mproc *rmp);
-FORWARD int sig_send(struct mproc *rmp, int signo);
-FORWARD void sig_proc_exit(struct mproc *rmp, int signo);
+static void unpause(struct mproc *rmp);
+static int sig_send(struct mproc *rmp, int signo);
+static void sig_proc_exit(struct mproc *rmp, int signo);
/*===========================================================================*
* do_sigaction *
*===========================================================================*/
-PUBLIC int do_sigaction()
+int do_sigaction()
{
int r;
struct sigaction svec;
/*===========================================================================*
* do_sigpending *
*===========================================================================*/
-PUBLIC int do_sigpending()
+int do_sigpending()
{
mp->mp_reply.reply_mask = (long) mp->mp_sigpending;
return OK;
/*===========================================================================*
* do_sigprocmask *
*===========================================================================*/
-PUBLIC int do_sigprocmask()
+int do_sigprocmask()
{
/* Note that the library interface passes the actual mask in sigmask_set,
* not a pointer to the mask, in order to save a copy. Similarly,
/*===========================================================================*
* do_sigsuspend *
*===========================================================================*/
-PUBLIC int do_sigsuspend()
+int do_sigsuspend()
{
mp->mp_sigmask2 = mp->mp_sigmask; /* save the old mask */
mp->mp_sigmask = (sigset_t) m_in.sig_set;
/*===========================================================================*
* do_sigreturn *
*===========================================================================*/
-PUBLIC int do_sigreturn()
+int do_sigreturn()
{
/* A user signal handler is done. Restore context and check for
* pending unblocked signals.
/*===========================================================================*
* do_kill *
*===========================================================================*/
-PUBLIC int do_kill()
+int do_kill()
{
/* Perform the kill(pid, signo) system call. */
/*===========================================================================*
* do_srv_kill *
*===========================================================================*/
-PUBLIC int do_srv_kill()
+int do_srv_kill()
{
/* Perform the srv_kill(pid, signo) system call. */
/*===========================================================================*
* process_ksig *
*===========================================================================*/
-PUBLIC int process_ksig(endpoint_t proc_nr_e, int signo)
+int process_ksig(endpoint_t proc_nr_e, int signo)
{
register struct mproc *rmp;
int proc_nr;
/*===========================================================================*
* do_pause *
*===========================================================================*/
-PUBLIC int do_pause()
+int do_pause()
{
/* Perform the pause() system call. */
/*===========================================================================*
* sig_proc *
*===========================================================================*/
-PUBLIC void sig_proc(rmp, signo, trace, ksig)
+void sig_proc(rmp, signo, trace, ksig)
register struct mproc *rmp; /* pointer to the process to be signaled */
int signo; /* signal to send to process (1 to _NSIG-1) */
int trace; /* pass signal to tracer first? */
/*===========================================================================*
* sig_proc_exit *
*===========================================================================*/
-PRIVATE void sig_proc_exit(rmp, signo)
+static void sig_proc_exit(rmp, signo)
struct mproc *rmp; /* process that must exit */
int signo; /* signal that caused termination */
{
/*===========================================================================*
* check_sig *
*===========================================================================*/
-PUBLIC int check_sig(proc_id, signo, ksig)
+int check_sig(proc_id, signo, ksig)
pid_t proc_id; /* pid of proc to sig, or 0 or -1, or -pgrp */
int signo; /* signal to send to process (0 to _NSIG-1) */
int ksig; /* non-zero means signal comes from kernel */
/*===========================================================================*
* check_pending *
*===========================================================================*/
-PUBLIC void check_pending(rmp)
+void check_pending(rmp)
register struct mproc *rmp;
{
/* Check to see if any pending signals have been unblocked. Deliver as many
/*===========================================================================*
* restart_sigs *
*===========================================================================*/
-PUBLIC void restart_sigs(rmp)
+void restart_sigs(rmp)
struct mproc *rmp;
{
/* VFS has replied to a request from us; do signal-related work.
/*===========================================================================*
* unpause *
*===========================================================================*/
-PRIVATE void unpause(rmp)
+static void unpause(rmp)
struct mproc *rmp; /* which process */
{
/* A signal is to be sent to a process. If that process is hanging on a
/*===========================================================================*
* sig_send *
*===========================================================================*/
-PRIVATE int sig_send(rmp, signo)
+static int sig_send(rmp, signo)
struct mproc *rmp; /* what process to spawn a signal handler in */
int signo; /* signal to send to process (1 to _NSIG-1) */
{
/*===========================================================================*
* vm_notify_sig_wrapper *
*===========================================================================*/
-PUBLIC void vm_notify_sig_wrapper(endpoint_t ep)
+void vm_notify_sig_wrapper(endpoint_t ep)
{
/* get IPC's endpoint,
* the reason that we directly get the endpoint
/*===========================================================================*
* do_time *
*===========================================================================*/
-PUBLIC int do_time()
+int do_time()
{
/* Perform the time(tp) system call. This returns the time in seconds since
* 1.1.1970. MINIX is an astrophysically naive system that assumes the earth
/*===========================================================================*
* do_stime *
*===========================================================================*/
-PUBLIC int do_stime()
+int do_stime()
{
/* Perform the stime(tp) system call. Retrieve the system's uptime (ticks
* since boot) and pass the new time in seconds at system boot to the kernel.
/*===========================================================================*
* do_times *
*===========================================================================*/
-PUBLIC int do_times()
+int do_times()
{
/* Perform the times(buffer) system call. */
register struct mproc *rmp = mp;
/*===========================================================================*
* do_trace *
*===========================================================================*/
-PUBLIC int do_trace()
+int do_trace()
{
register struct mproc *child;
struct ptrace_range pr;
/*===========================================================================*
* stop_proc *
*===========================================================================*/
-PUBLIC void stop_proc(rmp, signo)
+void stop_proc(rmp, signo)
register struct mproc *rmp;
int signo;
{
/*===========================================================================*
* get_free_pid *
*===========================================================================*/
-PUBLIC pid_t get_free_pid()
+pid_t get_free_pid()
{
static pid_t next_pid = INIT_PID + 1; /* next pid to be assigned */
register struct mproc *rmp; /* check process table */
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys()
+int no_sys()
{
/* A system call number not implemented by PM has been requested. */
return(ENOSYS);
/*===========================================================================*
* find_param *
*===========================================================================*/
-PUBLIC char *find_param(name)
+char *find_param(name)
const char *name;
{
register const char *namep;
/*===========================================================================*
* find_proc *
*===========================================================================*/
-PUBLIC struct mproc *find_proc(lpid)
+struct mproc *find_proc(lpid)
pid_t lpid;
{
register struct mproc *rmp;
/*===========================================================================*
* nice_to_priority *
*===========================================================================*/
-PUBLIC int nice_to_priority(int nice, unsigned* new_q)
+int nice_to_priority(int nice, unsigned* new_q)
{
if (nice < PRIO_MIN || nice > PRIO_MAX) return(EINVAL);
/*===========================================================================*
* pm_isokendpt *
*===========================================================================*/
-PUBLIC int pm_isokendpt(int endpoint, int *proc)
+int pm_isokendpt(int endpoint, int *proc)
{
*proc = _ENDPOINT_P(endpoint);
if(*proc < -NR_TASKS || *proc >= NR_PROCS)
/*===========================================================================*
* tell_vfs *
*===========================================================================*/
-PUBLIC void tell_vfs(rmp, m_ptr)
+void tell_vfs(rmp, m_ptr)
struct mproc *rmp;
message *m_ptr;
{
#define BUF_SIZE 4096
-PRIVATE char buf[BUF_SIZE + 1];
-PRIVATE size_t off, left, used;
-PRIVATE off_t skip;
+static char buf[BUF_SIZE + 1];
+static size_t off, left, used;
+static off_t skip;
/*===========================================================================*
* buf_init *
*===========================================================================*/
-PUBLIC void buf_init(off_t start, size_t len)
+void buf_init(off_t start, size_t len)
{
/* Initialize the buffer for fresh use. The first 'start' bytes of the
* produced output are to be skipped. After that, up to a total of
/*===========================================================================*
* buf_printf *
*===========================================================================*/
-PUBLIC void buf_printf(char *fmt, ...)
+void buf_printf(char *fmt, ...)
{
/* Add formatted text to the end of the buffer.
*/
/*===========================================================================*
* buf_append *
*===========================================================================*/
-PUBLIC void buf_append(char *data, size_t len)
+void buf_append(char *data, size_t len)
{
/* Add arbitrary data to the end of the buffer.
*/
/*===========================================================================*
* buf_get *
*===========================================================================*/
-PUBLIC size_t buf_get(char **ptr)
+size_t buf_get(char **ptr)
{
/* Return the buffer's starting address and the length of the used
* part, not counting the trailing null character for the latter.
#define CONFIG_MAX_CPUS 1
#endif
-PRIVATE const char * x86_flag[] = {
+static const char * x86_flag[] = {
"fpu",
"vme",
"de",
"",
};
-PRIVATE void print_cpu_flags(u32_t * flags)
+static void print_cpu_flags(u32_t * flags)
{
int i, j;
buf_printf("\n");
}
-PRIVATE void print_cpu(struct cpu_info * cpu_info, unsigned id)
+static void print_cpu(struct cpu_info * cpu_info, unsigned id)
{
buf_printf("%-16s: %d\n", "processor", id);
buf_printf("\n");
}
-PUBLIC void root_cpuinfo(void)
+void root_cpuinfo(void)
{
struct cpu_info cpu_info[CONFIG_MAX_CPUS];
struct machine machine;
#include "inc.h"
#include "cpuinfo.h"
-FORWARD void init_hook(void);
+static void init_hook(void);
/* The hook functions that will be called by VTreeFS. */
-PRIVATE struct fs_hooks hooks = {
+static struct fs_hooks hooks = {
init_hook,
NULL, /* cleanup_hook */
lookup_hook,
/*===========================================================================*
* construct_tree *
*===========================================================================*/
-PRIVATE void construct_tree(struct inode *dir, struct file *files)
+static void construct_tree(struct inode *dir, struct file *files)
{
/* Construct a tree of static files from a null-terminated array of
* file structures, recursively creating directories which have their
/*===========================================================================*
* init_hook *
*===========================================================================*/
-PRIVATE void init_hook(void)
+static void init_hook(void)
{
/* Initialization hook. Generate the static part of the tree.
*/
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* ProcFS entry point.
*/
#include <minix/vm.h>
#define S_FRAME_SIZE 4096 /* use malloc if larger than this */
-PRIVATE char s_frame[S_FRAME_SIZE]; /* static storage for process frame */
-PRIVATE char *frame; /* pointer to process frame buffer */
+static char s_frame[S_FRAME_SIZE]; /* static storage for process frame */
+static char *frame; /* pointer to process frame buffer */
-FORWARD void pid_psinfo(int slot);
-FORWARD void pid_cmdline(int slot);
-FORWARD void pid_environ(int slot);
-FORWARD void pid_map(int slot);
+static void pid_psinfo(int slot);
+static void pid_cmdline(int slot);
+static void pid_environ(int slot);
+static void pid_map(int slot);
/* The files that are dynamically created in each PID directory. The data field
* contains each file's read function. Subdirectories are not yet supported.
*/
-PUBLIC struct file pid_files[] = {
+struct file pid_files[] = {
{ "psinfo", REG_ALL_MODE, (data_t) pid_psinfo },
{ "cmdline", REG_ALL_MODE, (data_t) pid_cmdline },
{ "environ", REG_ALL_MODE, (data_t) pid_environ },
/*===========================================================================*
* is_zombie *
*===========================================================================*/
-PRIVATE int is_zombie(int slot)
+static int is_zombie(int slot)
{
/* Is the given slot a zombie process?
*/
/*===========================================================================*
* pid_psinfo *
*===========================================================================*/
-PRIVATE void pid_psinfo(int i)
+static void pid_psinfo(int i)
{
/* Print information used by ps(1) and top(1).
*/
/*===========================================================================*
* put_frame *
*===========================================================================*/
-PRIVATE void put_frame(void)
+static void put_frame(void)
{
/* If we allocated memory dynamically during a call to get_frame(),
* free it up here.
/*===========================================================================*
* get_frame *
*===========================================================================*/
-PRIVATE int get_frame(int slot, vir_bytes *basep, vir_bytes *sizep,
+static int get_frame(int slot, vir_bytes *basep, vir_bytes *sizep,
size_t *nargsp)
{
/* Get the execution frame from the top of the given process's stack.
/*===========================================================================*
* pid_cmdline *
*===========================================================================*/
-PRIVATE void pid_cmdline(int slot)
+static void pid_cmdline(int slot)
{
/* Dump the process's command line as it is contained in the process
* itself. Each argument is terminated with a null character.
/*===========================================================================*
* pid_environ *
*===========================================================================*/
-PRIVATE void pid_environ(int slot)
+static void pid_environ(int slot)
{
/* Dump the process's initial environment as it is contained in the
* process itself. Each entry is terminated with a null character.
/*===========================================================================*
* dump_regions *
*===========================================================================*/
-PRIVATE int dump_regions(int slot)
+static int dump_regions(int slot)
{
/* Print the virtual memory regions of a process.
*/
/*===========================================================================*
* dump_segments *
*===========================================================================*/
-PRIVATE void dump_segments(int slot)
+static void dump_segments(int slot)
{
/* Print the memory segments of a process.
*/
/*===========================================================================*
* pid_map *
*===========================================================================*/
-PRIVATE void pid_map(int slot)
+static void pid_map(int slot)
{
/* Print a memory map of the process. Obtain the information from VM if
* possible; otherwise fall back on segments from the kernel.
#include <minix/dmap.h>
#include "cpuinfo.h"
-FORWARD void root_hz(void);
-FORWARD void root_uptime(void);
-FORWARD void root_loadavg(void);
-FORWARD void root_kinfo(void);
-FORWARD void root_meminfo(void);
-FORWARD void root_pci(void);
-FORWARD void root_dmap(void);
+static void root_hz(void);
+static void root_uptime(void);
+static void root_loadavg(void);
+static void root_kinfo(void);
+static void root_meminfo(void);
+static void root_pci(void);
+static void root_dmap(void);
struct file root_files[] = {
{ "hz", REG_ALL_MODE, (data_t) root_hz },
/*===========================================================================*
* root_hz *
*===========================================================================*/
-PRIVATE void root_hz(void)
+static void root_hz(void)
{
/* Print the system clock frequency.
*/
/*===========================================================================*
* root_loadavg *
*===========================================================================*/
-PRIVATE void root_loadavg(void)
+static void root_loadavg(void)
{
/* Print load averages.
*/
/*===========================================================================*
* root_uptime *
*===========================================================================*/
-PRIVATE void root_uptime(void)
+static void root_uptime(void)
{
/* Print the current uptime.
*/
/*===========================================================================*
* root_kinfo *
*===========================================================================*/
-PRIVATE void root_kinfo(void)
+static void root_kinfo(void)
{
/* Print general kernel information.
*/
/*===========================================================================*
* root_meminfo *
*===========================================================================*/
-PRIVATE void root_meminfo(void)
+static void root_meminfo(void)
{
/* Print general memory information.
*/
/*===========================================================================*
* root_pci *
*===========================================================================*/
-PRIVATE void root_pci(void)
+static void root_pci(void)
{
/* Print information about PCI devices present in the system.
*/
/*===========================================================================*
* root_dmap *
*===========================================================================*/
-PRIVATE void root_dmap(void)
+static void root_dmap(void)
{
struct dmap dmap[NR_DEVICES];
int i;
#include "inc.h"
-PUBLIC struct proc proc[NR_PROCS + NR_TASKS];
-PUBLIC struct mproc mproc[NR_PROCS];
-PUBLIC struct fproc fproc[NR_PROCS];
+struct proc proc[NR_PROCS + NR_TASKS];
+struct mproc mproc[NR_PROCS];
+struct fproc fproc[NR_PROCS];
-PRIVATE int nr_pid_entries;
+static int nr_pid_entries;
/*===========================================================================*
* slot_in_use *
*===========================================================================*/
-PRIVATE int slot_in_use(int slot)
+static int slot_in_use(int slot)
{
/* Return whether the given slot is in use by a process.
*/
/*===========================================================================*
* check_owner *
*===========================================================================*/
-PRIVATE int check_owner(struct inode *node, int slot)
+static int check_owner(struct inode *node, int slot)
{
/* Check if the owner user and group ID of the inode are still in sync
* the current effective user and group ID of the given process.
/*===========================================================================*
* make_stat *
*===========================================================================*/
-PRIVATE void make_stat(struct inode_stat *stat, int slot, int index)
+static void make_stat(struct inode_stat *stat, int slot, int index)
{
/* Fill in an inode_stat structure for the given process slot and
* per-pid file index (or NO_INDEX for the process subdirectory root).
/*===========================================================================*
* dir_is_pid *
*===========================================================================*/
-PRIVATE int dir_is_pid(struct inode *node)
+static int dir_is_pid(struct inode *node)
{
/* Return whether the given node is a PID directory.
*/
/*===========================================================================*
* update_proc_table *
*===========================================================================*/
-PRIVATE int update_proc_table(void)
+static int update_proc_table(void)
{
/* Get the process table from the kernel.
* Check the magic number in the table entries.
/*===========================================================================*
* update_mproc_table *
*===========================================================================*/
-PRIVATE int update_mproc_table(void)
+static int update_mproc_table(void)
{
/* Get the process table from PM.
* Check the magic number in the table entries.
/*===========================================================================*
* update_fproc_table *
*===========================================================================*/
-PRIVATE int update_fproc_table(void)
+static int update_fproc_table(void)
{
/* Get the process table from VFS.
*/
/*===========================================================================*
* update_tables *
*===========================================================================*/
-PRIVATE int update_tables(void)
+static int update_tables(void)
{
/* Get the process tables from the kernel, PM, and VFS.
*/
/*===========================================================================*
* init_tree *
*===========================================================================*/
-PUBLIC int init_tree(void)
+int init_tree(void)
{
/* Initialize this module, before VTreeFS is started. As part of the
* process, check if we're not compiled against a kernel different from
/*===========================================================================*
* out_of_inodes *
*===========================================================================*/
-PRIVATE void out_of_inodes(void)
+static void out_of_inodes(void)
{
/* Out of inodes - the NR_INODES value is set too low. We can not do
* much, but we might be able to continue with degraded functionality,
/*===========================================================================*
* construct_pid_dirs *
*===========================================================================*/
-PRIVATE void construct_pid_dirs(void)
+static void construct_pid_dirs(void)
{
/* Regenerate the set of PID directories in the root directory of the
* file system. Add new directories and delete old directories as
/*===========================================================================*
* make_one_pid_entry *
*===========================================================================*/
-PRIVATE void make_one_pid_entry(struct inode *parent, char *name, int slot)
+static void make_one_pid_entry(struct inode *parent, char *name, int slot)
{
/* Construct one file in a PID directory, if a file with the given name
* should exist at all.
/*===========================================================================*
* make_all_pid_entries *
*===========================================================================*/
-PRIVATE void make_all_pid_entries(struct inode *parent, int slot)
+static void make_all_pid_entries(struct inode *parent, int slot)
{
/* Construct all files in a PID directory.
*/
/*===========================================================================*
* construct_pid_entries *
*===========================================================================*/
-PRIVATE void construct_pid_entries(struct inode *parent, char *name)
+static void construct_pid_entries(struct inode *parent, char *name)
{
/* Construct one requested file entry, or all file entries, in a PID
* directory.
/*===========================================================================*
* pid_read *
*===========================================================================*/
-PRIVATE void pid_read(struct inode *node)
+static void pid_read(struct inode *node)
{
/* Data is requested from one of the files in a PID directory. Call the
* function that is responsible for generating the data for that file.
/*===========================================================================*
* pid_link *
*===========================================================================*/
-PRIVATE int pid_link(struct inode *UNUSED(node), char *ptr, int UNUSED(max))
+static int pid_link(struct inode *UNUSED(node), char *ptr, int UNUSED(max))
{
/* The contents of a symbolic link in a PID directory are requested.
* This function is a placeholder for future use.
/*===========================================================================*
* lookup_hook *
*===========================================================================*/
-PUBLIC int lookup_hook(struct inode *parent, char *name,
+int lookup_hook(struct inode *parent, char *name,
cbdata_t UNUSED(cbdata))
{
/* Path name resolution hook, for a specific parent and name pair.
/*===========================================================================*
* getdents_hook *
*===========================================================================*/
-PUBLIC int getdents_hook(struct inode *node, cbdata_t UNUSED(cbdata))
+int getdents_hook(struct inode *node, cbdata_t UNUSED(cbdata))
{
/* Directory entry retrieval hook, for potentially all files in a
* directory. Make sure that all files that are supposed to be
/*===========================================================================*
* read_hook *
*===========================================================================*/
-PUBLIC int read_hook(struct inode *node, off_t off, char **ptr,
+int read_hook(struct inode *node, off_t off, char **ptr,
size_t *len, cbdata_t cbdata)
{
/* Regular file read hook. Call the appropriate callback function to
/*===========================================================================*
* rdlink_hook *
*===========================================================================*/
-PUBLIC int rdlink_hook(struct inode *node, char *ptr, size_t max,
+int rdlink_hook(struct inode *node, char *ptr, size_t max,
cbdata_t UNUSED(cbdata))
{
/* Symbolic link resolution hook. Not used yet.
/*===========================================================================*
* procfs_getloadavg *
*===========================================================================*/
-PUBLIC int procfs_getloadavg(struct load *loadavg, int nelem)
+int procfs_getloadavg(struct load *loadavg, int nelem)
{
/* Retrieve system load average information.
*/
};
/* Initialization errors. */
-PRIVATE struct errentry init_errlist[] = {
+static struct errentry init_errlist[] = {
{ ENOSYS, "service does not support the requested initialization type" }
};
-PRIVATE const int init_nerr = sizeof(init_errlist) / sizeof(init_errlist[0]);
+static const int init_nerr = sizeof(init_errlist) / sizeof(init_errlist[0]);
/* Live update errors. */
-PRIVATE struct errentry lu_errlist[] = {
+static struct errentry lu_errlist[] = {
{ ENOSYS, "service does not support live update" },
{ EINVAL, "service does not support the required state" },
{ EBUSY, "service is not able to prepare for the update now" },
{ EGENERIC, "generic error occurred while preparing for the update" }
};
-PRIVATE const int lu_nerr = sizeof(lu_errlist) / sizeof(lu_errlist[0]);
+static const int lu_nerr = sizeof(lu_errlist) / sizeof(lu_errlist[0]);
/*===========================================================================*
* rs_strerror *
*===========================================================================*/
-PRIVATE char * rs_strerror(int errnum, struct errentry *errlist, const int nerr)
+static char * rs_strerror(int errnum, struct errentry *errlist, const int nerr)
{
int i;
/*===========================================================================*
* init_strerror *
*===========================================================================*/
-PUBLIC char * init_strerror(int errnum)
+char * init_strerror(int errnum)
{
return rs_strerror(errnum, init_errlist, init_nerr);
}
/*===========================================================================*
* lu_strerror *
*===========================================================================*/
-PUBLIC char * lu_strerror(int errnum)
+char * lu_strerror(int errnum)
{
return rs_strerror(errnum, lu_errlist, lu_nerr);
}
#include "kernel/proc.h"
/* Declare some local functions. */
-FORWARD void boot_image_info_lookup( endpoint_t endpoint, struct
+static void boot_image_info_lookup( endpoint_t endpoint, struct
boot_image *image, struct boot_image **ip, struct boot_image_priv **pp,
struct boot_image_sys **sp, struct boot_image_dev **dp);
-FORWARD void catch_boot_init_ready(endpoint_t endpoint);
-FORWARD void get_work(message *m_ptr, int *status_ptr);
+static void catch_boot_init_ready(endpoint_t endpoint);
+static void get_work(message *m_ptr, int *status_ptr);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
-FORWARD int sef_cb_signal_manager(endpoint_t target, int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
+static int sef_cb_signal_manager(endpoint_t target, int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* This is the main routine of this service. The main loop consists of
* three major activities: getting new work, processing the work, and
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_response(do_init_ready);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the reincarnation server. */
struct boot_image *ip;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Check for known signals, ignore anything else. */
switch(signo) {
/*===========================================================================*
* sef_cb_signal_manager *
*===========================================================================*/
-PRIVATE int sef_cb_signal_manager(endpoint_t target, int signo)
+static int sef_cb_signal_manager(endpoint_t target, int signo)
{
/* Process system signal on behalf of the kernel. */
int target_p;
/*===========================================================================*
* boot_image_info_lookup *
*===========================================================================*/
-PRIVATE void boot_image_info_lookup(endpoint, image, ip, pp, sp, dp)
+static void boot_image_info_lookup(endpoint, image, ip, pp, sp, dp)
endpoint_t endpoint;
struct boot_image *image;
struct boot_image **ip;
/*===========================================================================*
* catch_boot_init_ready *
*===========================================================================*/
-PRIVATE void catch_boot_init_ready(endpoint)
+static void catch_boot_init_ready(endpoint)
endpoint_t endpoint;
{
/* Block and catch an init ready message from the given source. */
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(m_ptr, status_ptr)
+static void get_work(m_ptr, status_ptr)
message *m_ptr; /* pointer to message */
int *status_ptr; /* pointer to status */
{
/*===========================================================================*
* caller_is_root *
*===========================================================================*/
-PRIVATE int caller_is_root(endpoint)
+static int caller_is_root(endpoint)
endpoint_t endpoint; /* caller endpoint */
{
uid_t euid;
/*===========================================================================*
* caller_can_control *
*===========================================================================*/
-PRIVATE int caller_can_control(endpoint, target_rp)
+static int caller_can_control(endpoint, target_rp)
endpoint_t endpoint;
struct rproc *target_rp;
{
/*===========================================================================*
* check_call_permission *
*===========================================================================*/
-PUBLIC int check_call_permission(caller, call, rp)
+int check_call_permission(caller, call, rp)
endpoint_t caller;
int call;
struct rproc *rp;
/*===========================================================================*
* copy_rs_start *
*===========================================================================*/
-PUBLIC int copy_rs_start(src_e, src_rs_start, dst_rs_start)
+int copy_rs_start(src_e, src_rs_start, dst_rs_start)
endpoint_t src_e;
char *src_rs_start;
struct rs_start *dst_rs_start;
/*===========================================================================*
* copy_label *
*===========================================================================*/
-PUBLIC int copy_label(src_e, src_label, src_len, dst_label, dst_len)
+int copy_label(src_e, src_label, src_len, dst_label, dst_len)
endpoint_t src_e;
char *src_label;
size_t src_len;
/*===========================================================================*
* build_cmd_dep *
*===========================================================================*/
-PUBLIC void build_cmd_dep(struct rproc *rp)
+void build_cmd_dep(struct rproc *rp)
{
struct rprocpub *rpub;
int arg_count;
/*===========================================================================*
* srv_fork *
*===========================================================================*/
-PUBLIC pid_t srv_fork(uid_t reuid, gid_t regid)
+pid_t srv_fork(uid_t reuid, gid_t regid)
{
message m;
/*===========================================================================*
* srv_kill *
*===========================================================================*/
-PUBLIC int srv_kill(pid_t pid, int sig)
+int srv_kill(pid_t pid, int sig)
{
message m;
/*===========================================================================*
* srv_update *
*===========================================================================*/
-PUBLIC int srv_update(endpoint_t src_e, endpoint_t dst_e)
+int srv_update(endpoint_t src_e, endpoint_t dst_e)
{
int r;
/*===========================================================================*
* update_period *
*===========================================================================*/
-PUBLIC void update_period(message *m_ptr)
+void update_period(message *m_ptr)
{
clock_t now = m_ptr->NOTIFY_TIMESTAMP;
short has_update_timed_out;
/*===========================================================================*
* end_update *
*===========================================================================*/
-PUBLIC void end_update(int result, int reply_flag)
+void end_update(int result, int reply_flag)
{
/* End the update process. There are two possibilities:
* 1) the update succeeded. In that case, cleanup the old version and mark the
/*===========================================================================*
* kill_service_debug *
*===========================================================================*/
-PUBLIC int kill_service_debug(file, line, rp, errstr, err)
+int kill_service_debug(file, line, rp, errstr, err)
char *file;
int line;
struct rproc *rp;
/*===========================================================================*
* crash_service_debug *
*===========================================================================*/
-PUBLIC int crash_service_debug(file, line, rp)
+int crash_service_debug(file, line, rp)
char *file;
int line;
struct rproc *rp;
/*===========================================================================*
* cleanup_service_debug *
*===========================================================================*/
-PUBLIC void cleanup_service_debug(file, line, rp)
+void cleanup_service_debug(file, line, rp)
char *file;
int line;
struct rproc *rp;
/*===========================================================================*
* create_service *
*===========================================================================*/
-PUBLIC int create_service(rp)
+int create_service(rp)
struct rproc *rp;
{
/* Create the given system service. */
/*===========================================================================*
* clone_service *
*===========================================================================*/
-PUBLIC int clone_service(rp, instance_flag)
+int clone_service(rp, instance_flag)
struct rproc *rp;
int instance_flag;
{
/*===========================================================================*
* publish_service *
*===========================================================================*/
-PUBLIC int publish_service(rp)
+int publish_service(rp)
struct rproc *rp; /* pointer to service slot */
{
/* Publish a service. */
/*===========================================================================*
* unpublish_service *
*===========================================================================*/
-PUBLIC int unpublish_service(rp)
+int unpublish_service(rp)
struct rproc *rp; /* pointer to service slot */
{
/* Unpublish a service. */
/*===========================================================================*
* run_service *
*===========================================================================*/
-PUBLIC int run_service(rp, init_type)
+int run_service(rp, init_type)
struct rproc *rp;
int init_type;
{
/*===========================================================================*
* start_service *
*===========================================================================*/
-PUBLIC int start_service(rp)
+int start_service(rp)
struct rproc *rp;
{
/* Start a system service. */
/*===========================================================================*
* stop_service *
*===========================================================================*/
-PUBLIC void stop_service(struct rproc *rp,int how)
+void stop_service(struct rproc *rp,int how)
{
struct rprocpub *rpub;
int signo;
/*===========================================================================*
* update_service *
*===========================================================================*/
-PUBLIC int update_service(src_rpp, dst_rpp, swap_flag)
+int update_service(src_rpp, dst_rpp, swap_flag)
struct rproc **src_rpp;
struct rproc **dst_rpp;
int swap_flag;
/*===========================================================================*
* activate_service *
*===========================================================================*/
-PUBLIC void activate_service(struct rproc *rp, struct rproc *ex_rp)
+void activate_service(struct rproc *rp, struct rproc *ex_rp)
{
/* Activate a service instance and deactivate another one if requested. */
/*===========================================================================*
* reincarnate_service *
*===========================================================================*/
-PUBLIC void reincarnate_service(struct rproc *rp)
+void reincarnate_service(struct rproc *rp)
{
/* Restart a service as if it were never started before. */
struct rprocpub *rpub;
/*===========================================================================*
* terminate_service *
*===========================================================================*/
-PUBLIC void terminate_service(struct rproc *rp)
+void terminate_service(struct rproc *rp)
{
/* Handle a termination event for a system service. */
struct rproc **rps;
/*===========================================================================*
* run_script *
*===========================================================================*/
-PRIVATE int run_script(struct rproc *rp)
+static int run_script(struct rproc *rp)
{
int r, endpoint;
pid_t pid;
/*===========================================================================*
* restart_service *
*===========================================================================*/
-PUBLIC void restart_service(struct rproc *rp)
+void restart_service(struct rproc *rp)
{
/* Restart service via a recovery script or directly. */
struct rproc *replica_rp;
/*===========================================================================*
* inherit_service_defaults *
*===========================================================================*/
-PUBLIC void inherit_service_defaults(def_rp, rp)
+void inherit_service_defaults(def_rp, rp)
struct rproc *def_rp;
struct rproc *rp;
{
/*===========================================================================*
* get_service_instances *
*===========================================================================*/
-PUBLIC void get_service_instances(rp, rps, length)
+void get_service_instances(rp, rps, length)
struct rproc *rp;
struct rproc ***rps;
int *length;
/*===========================================================================*
* share_exec *
*===========================================================================*/
-PUBLIC void share_exec(rp_dst, rp_src)
+void share_exec(rp_dst, rp_src)
struct rproc *rp_dst, *rp_src;
{
struct rprocpub *rpub_src;
/*===========================================================================*
* read_exec *
*===========================================================================*/
-PUBLIC int read_exec(rp)
+int read_exec(rp)
struct rproc *rp;
{
int e, r, fd;
/*===========================================================================*
* free_exec *
*===========================================================================*/
-PUBLIC void free_exec(rp)
+void free_exec(rp)
struct rproc *rp;
{
/* Free an exec image. */
/*===========================================================================*
* edit_slot *
*===========================================================================*/
-PUBLIC int edit_slot(rp, rs_start, source)
+int edit_slot(rp, rs_start, source)
struct rproc *rp;
struct rs_start *rs_start;
endpoint_t source;
/*===========================================================================*
* init_slot *
*===========================================================================*/
-PUBLIC int init_slot(rp, rs_start, source)
+int init_slot(rp, rs_start, source)
struct rproc *rp;
struct rs_start *rs_start;
endpoint_t source;
/*===========================================================================*
* clone_slot *
*===========================================================================*/
-PUBLIC int clone_slot(rp, clone_rpp)
+int clone_slot(rp, clone_rpp)
struct rproc *rp;
struct rproc **clone_rpp;
{
/*===========================================================================*
* swap_slot_pointer *
*===========================================================================*/
-PRIVATE void swap_slot_pointer(struct rproc **rpp, struct rproc *src_rp,
+static void swap_slot_pointer(struct rproc **rpp, struct rproc *src_rp,
struct rproc *dst_rp)
{
if(*rpp == src_rp) {
/*===========================================================================*
* swap_slot *
*===========================================================================*/
-PUBLIC void swap_slot(src_rpp, dst_rpp)
+void swap_slot(src_rpp, dst_rpp)
struct rproc **src_rpp;
struct rproc **dst_rpp;
{
/*===========================================================================*
* lookup_slot_by_label *
*===========================================================================*/
-PUBLIC struct rproc* lookup_slot_by_label(char *label)
+struct rproc* lookup_slot_by_label(char *label)
{
/* Lookup a service slot matching the given label. */
int slot_nr;
/*===========================================================================*
* lookup_slot_by_pid *
*===========================================================================*/
-PUBLIC struct rproc* lookup_slot_by_pid(pid_t pid)
+struct rproc* lookup_slot_by_pid(pid_t pid)
{
/* Lookup a service slot matching the given pid. */
int slot_nr;
/*===========================================================================*
* lookup_slot_by_dev_nr *
*===========================================================================*/
-PUBLIC struct rproc* lookup_slot_by_dev_nr(dev_t dev_nr)
+struct rproc* lookup_slot_by_dev_nr(dev_t dev_nr)
{
/* Lookup a service slot matching the given device number. */
int slot_nr;
/*===========================================================================*
* lookup_slot_by_flags *
*===========================================================================*/
-PUBLIC struct rproc* lookup_slot_by_flags(int flags)
+struct rproc* lookup_slot_by_flags(int flags)
{
/* Lookup a service slot matching the given flags. */
int slot_nr;
/*===========================================================================*
* alloc_slot *
*===========================================================================*/
-PUBLIC int alloc_slot(rpp)
+int alloc_slot(rpp)
struct rproc **rpp;
{
/* Alloc a new system service slot. */
/*===========================================================================*
* free_slot *
*===========================================================================*/
-PUBLIC void free_slot(rp)
+void free_slot(rp)
struct rproc *rp;
{
/* Free a system service slot. */
/*===========================================================================*
* get_next_name *
*===========================================================================*/
-PRIVATE char *get_next_name(ptr, name, caller_label)
+static char *get_next_name(ptr, name, caller_label)
char *ptr;
char *name;
char *caller_label;
/*===========================================================================*
* add_forward_ipc *
*===========================================================================*/
-PUBLIC void add_forward_ipc(rp, privp)
+void add_forward_ipc(rp, privp)
struct rproc *rp;
struct priv *privp;
{
/*===========================================================================*
* add_backward_ipc *
*===========================================================================*/
-PUBLIC void add_backward_ipc(rp, privp)
+void add_backward_ipc(rp, privp)
struct rproc *rp;
struct priv *privp;
{
/*===========================================================================*
* init_privs *
*===========================================================================*/
-PUBLIC void init_privs(rp, privp)
+void init_privs(rp, privp)
struct rproc *rp;
struct priv *privp;
{
#undef minix_munmap
#undef minix_munmap_text
-PUBLIC int unmap_ok = 0;
+int unmap_ok = 0;
/*===========================================================================*
* minix_munmap *
*===========================================================================*/
-PUBLIC int minix_munmap(void *addrstart, vir_bytes len)
+int minix_munmap(void *addrstart, vir_bytes len)
{
if(!unmap_ok)
return ENOSYS;
/*===========================================================================*
* minix_munmap_text *
*===========================================================================*/
-PUBLIC int minix_munmap_text(void *addrstart, vir_bytes len)
+int minix_munmap_text(void *addrstart, vir_bytes len)
{
if(!unmap_ok)
return ENOSYS;
#include "kernel/proc.h"
-FORWARD int check_request(struct rs_start *rs_start);
+static int check_request(struct rs_start *rs_start);
/*===========================================================================*
* do_up *
*===========================================================================*/
-PUBLIC int do_up(m_ptr)
+int do_up(m_ptr)
message *m_ptr; /* request message pointer */
{
/* A request was made to start a new system service. */
/*===========================================================================*
* do_down *
*===========================================================================*/
-PUBLIC int do_down(message *m_ptr)
+int do_down(message *m_ptr)
{
register struct rproc *rp;
register struct rprocpub *rpub;
/*===========================================================================*
* do_restart *
*===========================================================================*/
-PUBLIC int do_restart(message *m_ptr)
+int do_restart(message *m_ptr)
{
struct rproc *rp;
int s, r;
/*===========================================================================*
* do_clone *
*===========================================================================*/
-PUBLIC int do_clone(message *m_ptr)
+int do_clone(message *m_ptr)
{
struct rproc *rp;
struct rprocpub *rpub;
/*===========================================================================*
* do_edit *
*===========================================================================*/
-PUBLIC int do_edit(message *m_ptr)
+int do_edit(message *m_ptr)
{
struct rproc *rp;
struct rprocpub *rpub;
/*===========================================================================*
* do_refresh *
*===========================================================================*/
-PUBLIC int do_refresh(message *m_ptr)
+int do_refresh(message *m_ptr)
{
register struct rproc *rp;
register struct rprocpub *rpub;
/*===========================================================================*
* do_shutdown *
*===========================================================================*/
-PUBLIC int do_shutdown(message *m_ptr)
+int do_shutdown(message *m_ptr)
{
int slot_nr;
struct rproc *rp;
/*===========================================================================*
* do_init_ready *
*===========================================================================*/
-PUBLIC int do_init_ready(message *m_ptr)
+int do_init_ready(message *m_ptr)
{
int who_p;
message m;
/*===========================================================================*
* do_update *
*===========================================================================*/
-PUBLIC int do_update(message *m_ptr)
+int do_update(message *m_ptr)
{
struct rproc *rp;
struct rproc *new_rp;
/*===========================================================================*
* do_upd_ready *
*===========================================================================*/
-PUBLIC int do_upd_ready(message *m_ptr)
+int do_upd_ready(message *m_ptr)
{
struct rproc *rp, *old_rp, *new_rp;
int who_p;
/*===========================================================================*
* do_period *
*===========================================================================*/
-PUBLIC void do_period(m_ptr)
+void do_period(m_ptr)
message *m_ptr;
{
register struct rproc *rp;
/*===========================================================================*
* do_sigchld *
*===========================================================================*/
-PUBLIC void do_sigchld()
+void do_sigchld()
{
/* PM informed us that there are dead children to cleanup. Go get them. */
pid_t pid;
/*===========================================================================*
* do_getsysinfo *
*===========================================================================*/
-PUBLIC int do_getsysinfo(m_ptr)
+int do_getsysinfo(m_ptr)
message *m_ptr;
{
vir_bytes src_addr, dst_addr;
/*===========================================================================*
* do_lookup *
*===========================================================================*/
-PUBLIC int do_lookup(m_ptr)
+int do_lookup(m_ptr)
message *m_ptr;
{
static char namebuf[100];
/*===========================================================================*
* check_request *
*===========================================================================*/
-PRIVATE int check_request(struct rs_start *rs_start)
+static int check_request(struct rs_start *rs_start)
{
/* Verify scheduling parameters */
if (rs_start->rss_scheduler != KERNEL &&
* reflects the order boot system services are made runnable and initialized
* at boot time.
*/
-PUBLIC struct boot_image_priv boot_image_priv_table[] = {
+struct boot_image_priv boot_image_priv_table[] = {
/*endpoint, label, flags, */
{RS_PROC_NR, "rs", RSYS_F },
{VM_PROC_NR, "vm", VM_F },
};
/* Definition of the boot image sys table. */
-PUBLIC struct boot_image_sys boot_image_sys_table[] = {
+struct boot_image_sys boot_image_sys_table[] = {
/*endpoint, flags */
{ RS_PROC_NR, SRVR_SF },
{ VM_PROC_NR, VM_SF },
};
/* Definition of the boot image dev table. */
-PUBLIC struct boot_image_dev boot_image_dev_table[] = {
+struct boot_image_dev boot_image_dev_table[] = {
/*endpoint, flags, dev_nr, dev_style, dev_style2 */
{ TTY_PROC_NR, SRV_DF, TTY_MAJOR, STYLE_TTY, STYLE_CTTY },
{ MEM_PROC_NR, SRV_DF, MEMORY_MAJOR, STYLE_DEV, STYLE_NDEV },
/*===========================================================================*
* init_service *
*===========================================================================*/
-PUBLIC int init_service(rp, type)
+int init_service(rp, type)
struct rproc *rp; /* pointer to process slot */
int type; /* type of initialization */
{
/*===========================================================================*
* fill_send_mask *
*===========================================================================*/
-PUBLIC void fill_send_mask(send_mask, set_bits)
+void fill_send_mask(send_mask, set_bits)
sys_map_t *send_mask; /* the send mask to fill in */
int set_bits; /* TRUE sets all bits, FALSE clears all bits */
{
/*===========================================================================*
* fill_call_mask *
*===========================================================================*/
-PUBLIC void fill_call_mask(calls, tot_nr_calls, call_mask, call_base, is_init)
+void fill_call_mask(calls, tot_nr_calls, call_mask, call_base, is_init)
int *calls; /* the unordered set of calls */
int tot_nr_calls; /* the total number of calls */
bitchunk_t *call_mask; /* the call mask to fill in */
/*===========================================================================*
* srv_to_string *
*===========================================================================*/
-PUBLIC char* srv_to_string(rp)
+char* srv_to_string(rp)
struct rproc *rp; /* pointer to process slot */
{
struct rprocpub *rpub;
/*===========================================================================*
* reply *
*===========================================================================*/
-PUBLIC void reply(who, rp, m_ptr)
+void reply(who, rp, m_ptr)
endpoint_t who; /* replyee */
struct rproc *rp; /* replyee slot (if any) */
message *m_ptr; /* reply message */
/*===========================================================================*
* late_reply *
*===========================================================================*/
-PUBLIC void late_reply(rp, code)
+void late_reply(rp, code)
struct rproc *rp; /* pointer to process slot */
int code; /* status code */
{
/*===========================================================================*
* rs_isokendpt *
*===========================================================================*/
-PUBLIC int rs_isokendpt(endpoint_t endpoint, int *proc)
+int rs_isokendpt(endpoint_t endpoint, int *proc)
{
*proc = _ENDPOINT_P(endpoint);
if(*proc < -NR_TASKS || *proc >= NR_PROCS)
/*===========================================================================*
* sched_init_proc *
*===========================================================================*/
-PUBLIC int sched_init_proc(struct rproc *rp)
+int sched_init_proc(struct rproc *rp)
{
int s;
int is_usr_proc;
/*===========================================================================*
* update_sig_mgrs *
*===========================================================================*/
-PUBLIC int update_sig_mgrs(struct rproc *rp, endpoint_t sig_mgr,
+int update_sig_mgrs(struct rproc *rp, endpoint_t sig_mgr,
endpoint_t bak_sig_mgr)
{
int r;
#include "schedproc.h"
/* Declare some local functions. */
-FORWARD void reply(endpoint_t whom, message *m_ptr);
-FORWARD void sef_local_startup(void);
+static void reply(endpoint_t whom, message *m_ptr);
+static void sef_local_startup(void);
-PUBLIC struct machine machine; /* machine info */
+struct machine machine; /* machine info */
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* Main routine of the scheduler. */
message m_in; /* the incoming message itself is kept here. */
/*===========================================================================*
* reply *
*===========================================================================*/
-PRIVATE void reply(endpoint_t who_e, message *m_ptr)
+static void reply(endpoint_t who_e, message *m_ptr)
{
int s = send(who_e, m_ptr); /* send the message */
if (OK != s)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* No init callbacks for now. */
/* No live update support for now. */
#include <machine/archtypes.h>
#include "kernel/proc.h" /* for queue constants */
-PRIVATE timer_t sched_timer;
-PRIVATE unsigned balance_timeout;
+static timer_t sched_timer;
+static unsigned balance_timeout;
#define BALANCE_TIMEOUT 5 /* how often to balance queues in seconds */
-FORWARD int schedule_process(struct schedproc * rmp, unsigned flags);
-FORWARD void balance_queues(struct timer *tp);
+static int schedule_process(struct schedproc * rmp, unsigned flags);
+static void balance_queues(struct timer *tp);
#define SCHEDULE_CHANGE_PRIO 0x1
#define SCHEDULE_CHANGE_QUANTUM 0x2
/* processes created by RS are sysytem processes */
#define is_system_proc(p) ((p)->parent == RS_PROC_NR)
-PRIVATE unsigned cpu_proc[CONFIG_MAX_CPUS];
+static unsigned cpu_proc[CONFIG_MAX_CPUS];
-PRIVATE void pick_cpu(struct schedproc * proc)
+static void pick_cpu(struct schedproc * proc)
{
#ifdef CONFIG_SMP
unsigned cpu, c;
* do_noquantum *
*===========================================================================*/
-PUBLIC int do_noquantum(message *m_ptr)
+int do_noquantum(message *m_ptr)
{
register struct schedproc *rmp;
int rv, proc_nr_n;
/*===========================================================================*
* do_stop_scheduling *
*===========================================================================*/
-PUBLIC int do_stop_scheduling(message *m_ptr)
+int do_stop_scheduling(message *m_ptr)
{
register struct schedproc *rmp;
int proc_nr_n;
/*===========================================================================*
* do_start_scheduling *
*===========================================================================*/
-PUBLIC int do_start_scheduling(message *m_ptr)
+int do_start_scheduling(message *m_ptr)
{
register struct schedproc *rmp;
int rv, proc_nr_n, parent_nr_n;
/*===========================================================================*
* do_nice *
*===========================================================================*/
-PUBLIC int do_nice(message *m_ptr)
+int do_nice(message *m_ptr)
{
struct schedproc *rmp;
int rv;
/*===========================================================================*
* schedule_process *
*===========================================================================*/
-PRIVATE int schedule_process(struct schedproc * rmp, unsigned flags)
+static int schedule_process(struct schedproc * rmp, unsigned flags)
{
int err;
int new_prio, new_quantum, new_cpu;
* start_scheduling *
*===========================================================================*/
-PUBLIC void init_scheduling(void)
+void init_scheduling(void)
{
balance_timeout = BALANCE_TIMEOUT * sys_hz();
init_timer(&sched_timer);
* quantum. This function will find all proccesses that have been bumped down,
* and pulls them back up. This default policy will soon be changed.
*/
-PRIVATE void balance_queues(struct timer *tp)
+static void balance_queues(struct timer *tp)
{
struct schedproc *rmp;
int proc_nr;
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys(int who_e, int call_nr)
+int no_sys(int who_e, int call_nr)
{
/* A system call number not implemented by PM has been requested. */
printf("SCHED: in no_sys, call nr %d from %d\n", call_nr, who_e);
/*===========================================================================*
* sched_isokendpt *
*===========================================================================*/
-PUBLIC int sched_isokendpt(int endpoint, int *proc)
+int sched_isokendpt(int endpoint, int *proc)
{
*proc = _ENDPOINT_P(endpoint);
if (*proc < 0)
/*===========================================================================*
* sched_isemtyendpt *
*===========================================================================*/
-PUBLIC int sched_isemtyendpt(int endpoint, int *proc)
+int sched_isemtyendpt(int endpoint, int *proc)
{
*proc = _ENDPOINT_P(endpoint);
if (*proc < 0)
/*===========================================================================*
* accept_message *
*===========================================================================*/
-PUBLIC int accept_message(message *m_ptr)
+int accept_message(message *m_ptr)
{
/* accept all messages from PM and RS */
switch (m_ptr->m_source) {
#include <minix/vfsif.h>
#include <assert.h>
-FORWARD int sendmsg(struct vmnt *vmp, struct fproc *rfp);
-FORWARD int queuemsg(struct vmnt *vmp);
+static int sendmsg(struct vmnt *vmp, struct fproc *rfp);
+static int queuemsg(struct vmnt *vmp);
/*===========================================================================*
* sendmsg *
*===========================================================================*/
-PRIVATE int sendmsg(vmp, rfp)
+static int sendmsg(vmp, rfp)
struct vmnt *vmp;
struct fproc *rfp;
{
/*===========================================================================*
* send_work *
*===========================================================================*/
-PUBLIC void send_work(void)
+void send_work(void)
{
/* Try to send out as many requests as possible */
struct vmnt *vmp;
/*===========================================================================*
* fs_cancel *
*===========================================================================*/
-PUBLIC void fs_cancel(struct vmnt *vmp)
+void fs_cancel(struct vmnt *vmp)
{
/* Cancel all pending requests for this vmp */
struct worker_thread *worker;
/*===========================================================================*
* fs_sendmore *
*===========================================================================*/
-PUBLIC void fs_sendmore(struct vmnt *vmp)
+void fs_sendmore(struct vmnt *vmp)
{
struct worker_thread *worker;
/*===========================================================================*
* fs_sendrec *
*===========================================================================*/
-PUBLIC int fs_sendrec(endpoint_t fs_e, message *reqmp)
+int fs_sendrec(endpoint_t fs_e, message *reqmp)
{
struct vmnt *vmp;
int r;
/*===========================================================================*
* queuemsg *
*===========================================================================*/
-PRIVATE int queuemsg(struct vmnt *vmp)
+static int queuemsg(struct vmnt *vmp)
{
/* Put request on queue for vmnt */
/* Include ELF headers */
#include <sys/elf_core.h>
-FORWARD void fill_elf_header(Elf32_Ehdr *elf_header, int phnum);
-FORWARD void fill_prog_header(Elf32_Phdr *prog_header, Elf32_Word
+static void fill_elf_header(Elf32_Ehdr *elf_header, int phnum);
+static void fill_prog_header(Elf32_Phdr *prog_header, Elf32_Word
p_type, Elf32_Off p_offset, Elf32_Addr p_vaddr, Elf32_Word p_flags,
Elf32_Word p_filesz, Elf32_Word p_memsz);
-FORWARD int get_memory_regions(Elf32_Phdr phdrs[]);
-FORWARD void fill_note_segment_and_entries_hdrs(Elf32_Phdr phdrs[],
+static int get_memory_regions(Elf32_Phdr phdrs[]);
+static void fill_note_segment_and_entries_hdrs(Elf32_Phdr phdrs[],
Elf32_Nhdr nhdrs[]);
-FORWARD void adjust_offsets(Elf32_Phdr phdrs[], int phnum);
-FORWARD void dump_elf_header(struct filp *f, Elf32_Ehdr elf_header);
-FORWARD void dump_notes(struct filp *f, Elf32_Nhdr nhdrs[], int csig,
+static void adjust_offsets(Elf32_Phdr phdrs[], int phnum);
+static void dump_elf_header(struct filp *f, Elf32_Ehdr elf_header);
+static void dump_notes(struct filp *f, Elf32_Nhdr nhdrs[], int csig,
char *proc_name);
-FORWARD void dump_program_headers(struct filp *f, Elf_Phdr phdrs[], int
+static void dump_program_headers(struct filp *f, Elf_Phdr phdrs[], int
phnum);
-FORWARD void dump_segments(struct filp *f, Elf32_Phdr phdrs[], int
+static void dump_segments(struct filp *f, Elf32_Phdr phdrs[], int
phnum);
-FORWARD void write_buf(struct filp *f, char *buf, size_t size);
+static void write_buf(struct filp *f, char *buf, size_t size);
/*===========================================================================*
* write_elf_core_file *
*===========================================================================*/
-PUBLIC void write_elf_core_file(struct filp *f, int csig, char *proc_name)
+void write_elf_core_file(struct filp *f, int csig, char *proc_name)
{
/* First, fill in all the required headers, second, adjust the offsets,
* third, dump everything into the core file
/*===========================================================================*
* fill_elf_header *
*===========================================================================*/
-PRIVATE void fill_elf_header (Elf_Ehdr *elf_header, int phnum)
+static void fill_elf_header (Elf_Ehdr *elf_header, int phnum)
{
memset((void *) elf_header, 0, sizeof(Elf_Ehdr));
/*===========================================================================*
* fill_prog_header *
*===========================================================================*/
-PRIVATE void fill_prog_header (Elf_Phdr *prog_header, Elf_Word p_type,
+static void fill_prog_header (Elf_Phdr *prog_header, Elf_Word p_type,
Elf_Off p_offset, Elf_Addr p_vaddr, Elf_Word p_flags,
Elf_Word p_filesz, Elf_Word p_memsz)
{
/*===========================================================================*
* fill_note_segment_and_entries_hdrs *
*===========================================================================*/
-PRIVATE void fill_note_segment_and_entries_hdrs(Elf_Phdr phdrs[],
+static void fill_note_segment_and_entries_hdrs(Elf_Phdr phdrs[],
Elf_Nhdr nhdrs[])
{
int filesize;
/*===========================================================================*
* adjust_offset *
*===========================================================================*/
-PRIVATE void adjust_offsets(Elf_Phdr phdrs[], int phnum)
+static void adjust_offsets(Elf_Phdr phdrs[], int phnum)
{
int i;
long offset = sizeof(Elf_Ehdr) + phnum * sizeof(Elf_Phdr);
/*===========================================================================*
* write_buf *
*===========================================================================*/
-PRIVATE void write_buf(struct filp *f, char *buf, size_t size)
+static void write_buf(struct filp *f, char *buf, size_t size)
{
read_write(WRITING, f, buf, size, VFS_PROC_NR);
}
/*===========================================================================*
* get_memory_regions *
*===========================================================================*/
-PRIVATE int get_memory_regions(Elf_Phdr phdrs[])
+static int get_memory_regions(Elf_Phdr phdrs[])
{
/* Print the virtual memory regions of a process. */
/*===========================================================================*
* dump_notes *
*===========================================================================*/
-PRIVATE void dump_notes(struct filp *f, Elf_Nhdr nhdrs[], int csig,
+static void dump_notes(struct filp *f, Elf_Nhdr nhdrs[], int csig,
char *proc_name)
{
char *note_name = ELF_NOTE_MINIX_ELFCORE_NAME "\0";
/*===========================================================================*
* dump_elf_header *
*===========================================================================*/
-PRIVATE void dump_elf_header(struct filp *f, Elf_Ehdr elf_header)
+static void dump_elf_header(struct filp *f, Elf_Ehdr elf_header)
{
write_buf(f, (char *) &elf_header, sizeof(Elf_Ehdr));
}
/*===========================================================================*
* dump_program_headers *
*===========================================================================*/
-PRIVATE void dump_program_headers(struct filp *f, Elf_Phdr phdrs[], int phnum)
+static void dump_program_headers(struct filp *f, Elf_Phdr phdrs[], int phnum)
{
int i;
/*===========================================================================*
* dump_segments *
*===========================================================================*/
-PRIVATE void dump_segments(struct filp *f, Elf_Phdr phdrs[], int phnum)
+static void dump_segments(struct filp *f, Elf_Phdr phdrs[], int phnum)
{
int i;
vir_bytes len;
#include "vmnt.h"
#include "param.h"
-FORWARD void restart_reopen(int major);
-FORWARD int safe_io_conversion(endpoint_t, cp_grant_id_t *, int *,
+static void restart_reopen(int major);
+static int safe_io_conversion(endpoint_t, cp_grant_id_t *, int *,
endpoint_t *, void **, size_t, u32_t *);
-PRIVATE int dummyproc;
+static int dummyproc;
/*===========================================================================*
* dev_open *
*===========================================================================*/
-PUBLIC int dev_open(
+int dev_open(
dev_t dev, /* device to open */
endpoint_t proc_e, /* process to open for */
int flags /* mode bits and flags */
/*===========================================================================*
* dev_reopen *
*===========================================================================*/
-PUBLIC int dev_reopen(
+int dev_reopen(
dev_t dev, /* device to open */
int filp_no, /* filp to reopen for */
int flags /* mode bits and flags */
/*===========================================================================*
* dev_close *
*===========================================================================*/
-PUBLIC int dev_close(
+int dev_close(
dev_t dev, /* device to close */
int filp_no
)
/*===========================================================================*
* dev_open *
*===========================================================================*/
-PUBLIC int bdev_open(dev_t dev, int access)
+int bdev_open(dev_t dev, int access)
{
/* Open a block device. */
int major;
/*===========================================================================*
* bdev_close *
*===========================================================================*/
-PUBLIC int bdev_close(dev_t dev)
+int bdev_close(dev_t dev)
{
/* Close a block device. */
int major;
/*===========================================================================*
* bdev_ioctl *
*===========================================================================*/
-PRIVATE int bdev_ioctl(dev_t dev, endpoint_t proc_e, int req, void *buf)
+static int bdev_ioctl(dev_t dev, endpoint_t proc_e, int req, void *buf)
{
/* Perform an I/O control operation on a block device. */
struct dmap *dp;
/*===========================================================================*
* dev_status *
*===========================================================================*/
-PUBLIC void dev_status(message *m)
+void dev_status(message *m)
{
/* A device sent us a notification it has something for us. Retrieve it. */
/*===========================================================================*
* safe_io_conversion *
*===========================================================================*/
-PRIVATE int safe_io_conversion(driver, gid, op, io_ept, buf, bytes, pos_lo)
+static int safe_io_conversion(driver, gid, op, io_ept, buf, bytes, pos_lo)
endpoint_t driver;
cp_grant_id_t *gid;
int *op;
return(0);
}
-PRIVATE int cancel_nblock(struct dmap * dp,
+static int cancel_nblock(struct dmap * dp,
int minor,
int call,
endpoint_t ioproc,
/*===========================================================================*
* dev_io *
*===========================================================================*/
-PUBLIC int dev_io(
+int dev_io(
int op, /* DEV_READ, DEV_WRITE, DEV_IOCTL, etc. */
dev_t dev, /* major-minor device number */
int proc_e, /* in whose address space is buf? */
/*===========================================================================*
* gen_opcl *
*===========================================================================*/
-PUBLIC int gen_opcl(
+int gen_opcl(
int op, /* operation, (B)DEV_OPEN or (B)DEV_CLOSE */
dev_t dev, /* device to open or close */
endpoint_t proc_e, /* process to open/close for */
/*===========================================================================*
* tty_opcl *
*===========================================================================*/
-PUBLIC int tty_opcl(
+int tty_opcl(
int op, /* operation, DEV_OPEN or DEV_CLOSE */
dev_t dev, /* device to open or close */
endpoint_t proc_e, /* process to open/close for */
/*===========================================================================*
* ctty_opcl *
*===========================================================================*/
-PUBLIC int ctty_opcl(
+int ctty_opcl(
int op, /* operation, DEV_OPEN or DEV_CLOSE */
dev_t UNUSED(dev), /* device to open or close */
endpoint_t UNUSED(proc_e), /* process to open/close for */
/*===========================================================================*
* pm_setsid *
*===========================================================================*/
-PUBLIC void pm_setsid(proc_e)
+void pm_setsid(proc_e)
int proc_e;
{
/* Perform the VFS side of the SETSID call, i.e. get rid of the controlling
/*===========================================================================*
* do_ioctl *
*===========================================================================*/
-PUBLIC int do_ioctl()
+int do_ioctl()
{
/* Perform the ioctl(ls_fd, request, argx) system call (uses m2 fmt). */
/*===========================================================================*
* gen_io *
*===========================================================================*/
-PUBLIC int gen_io(driver_e, mess_ptr)
+int gen_io(driver_e, mess_ptr)
endpoint_t driver_e; /* which endpoint to call */
message *mess_ptr; /* pointer to message for task */
{
/*===========================================================================*
* asyn_io *
*===========================================================================*/
-PUBLIC int asyn_io(task_nr, mess_ptr)
+int asyn_io(task_nr, mess_ptr)
int task_nr; /* which task to call */
message *mess_ptr; /* pointer to message for task */
{
/*===========================================================================*
* ctty_io *
*===========================================================================*/
-PUBLIC int ctty_io(
+int ctty_io(
endpoint_t UNUSED(task_nr), /* not used - for compatibility with dmap_t */
message *mess_ptr /* pointer to message for task */
)
/*===========================================================================*
* no_dev *
*===========================================================================*/
-PUBLIC int no_dev(
+int no_dev(
int UNUSED(op), /* operation, DEV_OPEN or DEV_CLOSE */
dev_t UNUSED(dev), /* device to open or close */
int UNUSED(proc), /* process to open/close for */
/*===========================================================================*
* no_dev_io *
*===========================================================================*/
-PUBLIC int no_dev_io(endpoint_t UNUSED(proc), message *UNUSED(m))
+int no_dev_io(endpoint_t UNUSED(proc), message *UNUSED(m))
{
/* Called when doing i/o on a nonexistent device. */
printf("VFS: I/O on unmapped device number\n");
/*===========================================================================*
* clone_opcl *
*===========================================================================*/
-PUBLIC int clone_opcl(
+int clone_opcl(
int op, /* operation, DEV_OPEN or DEV_CLOSE */
dev_t dev, /* device to open or close */
int proc_e, /* process to open/close for */
/*===========================================================================*
* bdev_up *
*===========================================================================*/
-PUBLIC void bdev_up(int maj)
+void bdev_up(int maj)
{
/* A new block device driver has been mapped in. This may affect both mounted
* file systems and open block-special files.
/*===========================================================================*
* cdev_up *
*===========================================================================*/
-PUBLIC void cdev_up(int maj)
+void cdev_up(int maj)
{
/* A new character device driver has been mapped in.
*/
/*===========================================================================*
* open_reply *
*===========================================================================*/
-PUBLIC void open_reply(void)
+void open_reply(void)
{
struct fproc *rfp;
endpoint_t proc_e;
/*===========================================================================*
* restart_reopen *
*===========================================================================*/
-PRIVATE void restart_reopen(maj)
+static void restart_reopen(maj)
int maj;
{
int n, r, minor_dev, major_dev, fd_nr;
/*===========================================================================*
* reopen_reply *
*===========================================================================*/
-PUBLIC void reopen_reply()
+void reopen_reply()
{
endpoint_t driver_e;
int filp_no, status, maj;
/*===========================================================================*
* do_mapdriver *
*===========================================================================*/
-PUBLIC int do_mapdriver()
+int do_mapdriver()
{
/* Create a device->driver mapping. RS will tell us which major is driven by
* this driver, what type of device it is (regular, TTY, asynchronous, clone,
/*===========================================================================*
* map_driver *
*===========================================================================*/
-PUBLIC int map_driver(label, major, proc_nr_e, style, flags)
+int map_driver(label, major, proc_nr_e, style, flags)
const char *label; /* name of the driver */
int major; /* major number of the device */
endpoint_t proc_nr_e; /* process number of the driver */
/*===========================================================================*
* dmap_unmap_by_endpt *
*===========================================================================*/
-PUBLIC void dmap_unmap_by_endpt(endpoint_t proc_e)
+void dmap_unmap_by_endpt(endpoint_t proc_e)
{
/* Lookup driver in dmap table by endpoint and unmap it */
int major, r;
/*===========================================================================*
* map_service *
*===========================================================================*/
-PUBLIC int map_service(struct rprocpub *rpub)
+int map_service(struct rprocpub *rpub)
{
/* Map a new service by storing its device driver properties. */
int r;
/*===========================================================================*
* init_dmap *
*===========================================================================*/
-PUBLIC void init_dmap()
+void init_dmap()
{
/* Initialize the table with empty device <-> driver mappings. */
int i;
/*===========================================================================*
* dmap_driver_match *
*===========================================================================*/
-PUBLIC int dmap_driver_match(endpoint_t proc, int major)
+int dmap_driver_match(endpoint_t proc, int major)
{
if (major < 0 || major >= NR_DEVICES) return(0);
if (dmap[major].dmap_driver != NONE && dmap[major].dmap_driver == proc)
/*===========================================================================*
* dmap_endpt_up *
*===========================================================================*/
-PUBLIC void dmap_endpt_up(endpoint_t proc_e, int is_blk)
+void dmap_endpt_up(endpoint_t proc_e, int is_blk)
{
/* A device driver with endpoint proc_e has been restarted. Go tell everyone
* that might be blocking on it that this device is 'up'.
/*===========================================================================*
* get_dmap *
*===========================================================================*/
-PUBLIC struct dmap *get_dmap(endpoint_t proc_e)
+struct dmap *get_dmap(endpoint_t proc_e)
{
/* See if 'proc_e' endpoint belongs to a valid dmap entry. If so, return a
* pointer */
#include <libexec.h>
#include "exec.h"
-FORWARD void lock_exec(void);
-FORWARD void unlock_exec(void);
-FORWARD int exec_newmem(int proc_e, vir_bytes text_addr, vir_bytes
+static void lock_exec(void);
+static void unlock_exec(void);
+static int exec_newmem(int proc_e, vir_bytes text_addr, vir_bytes
text_bytes, vir_bytes data_addr, vir_bytes data_bytes, vir_bytes
tot_bytes, vir_bytes frame_len, int sep_id, int is_elf, dev_t st_dev,
ino_t st_ino, time_t ctime, char *progname, int new_uid, int new_gid,
vir_bytes *stack_topp, int *load_textp, int *setugidp);
-FORWARD int is_script(const char *exec_hdr, size_t exec_len);
-FORWARD int patch_stack(struct vnode *vp, char stack[ARG_MAX], vir_bytes
+static int is_script(const char *exec_hdr, size_t exec_len);
+static int patch_stack(struct vnode *vp, char stack[ARG_MAX], vir_bytes
*stk_bytes, char path[PATH_MAX]);
-FORWARD int insert_arg(char stack[ARG_MAX], vir_bytes *stk_bytes, char
+static int insert_arg(char stack[ARG_MAX], vir_bytes *stk_bytes, char
*arg, int replace);
-FORWARD void patch_ptr(char stack[ARG_MAX], vir_bytes base);
-FORWARD void clo_exec(struct fproc *rfp);
-FORWARD int read_seg(struct vnode *vp, off_t off, int proc_e, int seg,
+static void patch_ptr(char stack[ARG_MAX], vir_bytes base);
+static void clo_exec(struct fproc *rfp);
+static int read_seg(struct vnode *vp, off_t off, int proc_e, int seg,
vir_bytes seg_addr, phys_bytes seg_bytes);
-FORWARD int load_aout(struct exec_info *execi);
-FORWARD int load_elf(struct exec_info *execi);
-FORWARD int map_header(char **exec_hdr, const struct vnode *vp);
+static int load_aout(struct exec_info *execi);
+static int load_elf(struct exec_info *execi);
+static int map_header(char **exec_hdr, const struct vnode *vp);
#define PTRSIZE sizeof(char *) /* Size of pointers in argv[] and envp[]. */
int (*load_object)(struct exec_info *);
};
-PRIVATE const struct exec_loaders exec_loaders[] = {
+static const struct exec_loaders exec_loaders[] = {
{ load_aout },
{ load_elf },
{ NULL }
};
-PRIVATE char hdr[PAGE_SIZE]; /* Assume that header is not larger than a page */
+static char hdr[PAGE_SIZE]; /* Assume that header is not larger than a page */
/*===========================================================================*
* lock_exec *
*===========================================================================*/
-PRIVATE void lock_exec(void)
+static void lock_exec(void)
{
message org_m_in;
struct fproc *org_fp;
/*===========================================================================*
* unlock_exec *
*===========================================================================*/
-PRIVATE void unlock_exec(void)
+static void unlock_exec(void)
{
if (mutex_unlock(&exec_lock) != 0)
panic("Could not release lock on exec");
/*===========================================================================*
* pm_exec *
*===========================================================================*/
-PUBLIC int pm_exec(int proc_e, char *path, vir_bytes path_len, char *frame,
+int pm_exec(int proc_e, char *path, vir_bytes path_len, char *frame,
vir_bytes frame_len, vir_bytes *pc)
{
/* Perform the execve(name, argv, envp) call. The user library builds a
/*===========================================================================*
* load_aout *
*===========================================================================*/
-PRIVATE int load_aout(struct exec_info *execi)
+static int load_aout(struct exec_info *execi)
{
int r;
struct vnode *vp;
/*===========================================================================*
* load_elf *
*===========================================================================*/
-PRIVATE int load_elf(struct exec_info *execi)
+static int load_elf(struct exec_info *execi)
{
int r;
struct vnode *vp;
/*===========================================================================*
* exec_newmem *
*===========================================================================*/
-PRIVATE int exec_newmem(
+static int exec_newmem(
int proc_e,
vir_bytes text_addr,
vir_bytes text_bytes,
/*===========================================================================*
* is_script *
*===========================================================================*/
-PRIVATE int is_script(const char *exec_hdr, size_t exec_len)
+static int is_script(const char *exec_hdr, size_t exec_len)
{
/* Is Interpreted script? */
assert(exec_hdr != NULL);
/*===========================================================================*
* patch_stack *
*===========================================================================*/
-PRIVATE int patch_stack(vp, stack, stk_bytes, path)
+static int patch_stack(vp, stack, stk_bytes, path)
struct vnode *vp; /* pointer for open script file */
char stack[ARG_MAX]; /* pointer to stack image within VFS */
vir_bytes *stk_bytes; /* size of initial stack */
/*===========================================================================*
* insert_arg *
*===========================================================================*/
-PRIVATE int insert_arg(
+static int insert_arg(
char stack[ARG_MAX], /* pointer to stack image within PM */
vir_bytes *stk_bytes, /* size of initial stack */
char *arg, /* argument to prepend/replace as new argv[0] */
/*===========================================================================*
* patch_ptr *
*===========================================================================*/
-PRIVATE void patch_ptr(
+static void patch_ptr(
char stack[ARG_MAX], /* pointer to stack image within PM */
vir_bytes base /* virtual address of stack base inside user */
)
/*===========================================================================*
* read_seg *
*===========================================================================*/
-PRIVATE int read_seg(
+static int read_seg(
struct vnode *vp, /* inode descriptor to read from */
off_t off, /* offset in file */
int proc_e, /* process number (endpoint) */
/*===========================================================================*
* clo_exec *
*===========================================================================*/
-PRIVATE void clo_exec(struct fproc *rfp)
+static void clo_exec(struct fproc *rfp)
{
/* Files can be marked with the FD_CLOEXEC bit (in fp->fp_cloexec).
*/
/*===========================================================================*
* map_header *
*===========================================================================*/
-PRIVATE int map_header(char **exec_hdr, const struct vnode *vp)
+static int map_header(char **exec_hdr, const struct vnode *vp)
{
int r;
u64_t new_pos;
#include "vnode.h"
-FORWARD filp_id_t verify_fd(endpoint_t ep, int fd);
+static filp_id_t verify_fd(endpoint_t ep, int fd);
#if LOCK_DEBUG
/*===========================================================================*
* check_filp_locks *
*===========================================================================*/
-PUBLIC void check_filp_locks_by_me(void)
+void check_filp_locks_by_me(void)
{
/* Check whether this thread still has filp locks held */
struct filp *f;
/*===========================================================================*
* check_filp_locks *
*===========================================================================*/
-PUBLIC void check_filp_locks(void)
+void check_filp_locks(void)
{
struct filp *f;
int r, count = 0;
/*===========================================================================*
* init_filps *
*===========================================================================*/
-PUBLIC void init_filps(void)
+void init_filps(void)
{
/* Initialize filps */
struct filp *f;
/*===========================================================================*
* get_fd *
*===========================================================================*/
-PUBLIC int get_fd(int start, mode_t bits, int *k, struct filp **fpt)
+int get_fd(int start, mode_t bits, int *k, struct filp **fpt)
{
/* Look for a free file descriptor and a free filp slot. Fill in the mode word
* in the latter, but don't claim either one yet, since the open() or creat()
/*===========================================================================*
* get_filp *
*===========================================================================*/
-PUBLIC struct filp *get_filp(fild, locktype)
+struct filp *get_filp(fild, locktype)
int fild; /* file descriptor */
tll_access_t locktype;
{
/*===========================================================================*
* get_filp2 *
*===========================================================================*/
-PUBLIC struct filp *get_filp2(rfp, fild, locktype)
+struct filp *get_filp2(rfp, fild, locktype)
register struct fproc *rfp;
int fild; /* file descriptor */
tll_access_t locktype;
/*===========================================================================*
* find_filp *
*===========================================================================*/
-PUBLIC struct filp *find_filp(struct vnode *vp, mode_t bits)
+struct filp *find_filp(struct vnode *vp, mode_t bits)
{
/* Find a filp slot that refers to the vnode 'vp' in a way as described
* by the mode bit 'bits'. Used for determining whether somebody is still
/*===========================================================================*
* invalidate_filp *
*===========================================================================*/
-PUBLIC int invalidate_filp(struct filp *rfilp)
+int invalidate_filp(struct filp *rfilp)
{
/* Invalidate filp. fp_filp_inuse is not cleared, so filp can't be reused
until it is closed first. */
/*===========================================================================*
* invalidate_filp_by_endpt *
*===========================================================================*/
-PUBLIC void invalidate_filp_by_endpt(endpoint_t proc_e)
+void invalidate_filp_by_endpt(endpoint_t proc_e)
{
struct filp *f;
/*===========================================================================*
* lock_filp *
*===========================================================================*/
-PUBLIC void lock_filp(filp, locktype)
+void lock_filp(filp, locktype)
struct filp *filp;
tll_access_t locktype;
{
/*===========================================================================*
* unlock_filp *
*===========================================================================*/
-PUBLIC void unlock_filp(filp)
+void unlock_filp(filp)
struct filp *filp;
{
/* If this filp holds a soft lock on the vnode, we must be the owner */
/*===========================================================================*
* unlock_filps *
*===========================================================================*/
-PUBLIC void unlock_filps(filp1, filp2)
+void unlock_filps(filp1, filp2)
struct filp *filp1;
struct filp *filp2;
{
/*===========================================================================*
* verify_fd *
*===========================================================================*/
-PRIVATE filp_id_t verify_fd(ep, fd)
+static filp_id_t verify_fd(ep, fd)
endpoint_t ep;
int fd;
{
/*===========================================================================*
* do_verify_fd *
*===========================================================================*/
-PUBLIC int do_verify_fd(void)
+int do_verify_fd(void)
{
struct filp *rfilp;
rfilp = (struct filp *) verify_fd(m_in.USER_ENDPT, m_in.COUNT);
/*===========================================================================*
* set_filp *
*===========================================================================*/
-PUBLIC int set_filp(sfilp)
+int set_filp(sfilp)
filp_id_t sfilp;
{
if (sfilp == NULL) return(EINVAL);
/*===========================================================================*
* do_set_filp *
*===========================================================================*/
-PUBLIC int do_set_filp(void)
+int do_set_filp(void)
{
return set_filp((filp_id_t) m_in.ADDRESS);
}
/*===========================================================================*
* copy_filp *
*===========================================================================*/
-PUBLIC int copy_filp(to_ep, cfilp)
+int copy_filp(to_ep, cfilp)
endpoint_t to_ep;
filp_id_t cfilp;
{
/*===========================================================================*
* do_copy_filp *
*===========================================================================*/
-PUBLIC int do_copy_filp(void)
+int do_copy_filp(void)
{
return copy_filp(m_in.USER_ENDPT, (filp_id_t) m_in.ADDRESS);
}
/*===========================================================================*
* put_filp *
*===========================================================================*/
-PUBLIC int put_filp(pfilp)
+int put_filp(pfilp)
filp_id_t pfilp;
{
if (pfilp == NULL) {
/*===========================================================================*
* do_put_filp *
*===========================================================================*/
-PUBLIC int do_put_filp(void)
+int do_put_filp(void)
{
return put_filp((filp_id_t) m_in.ADDRESS);
}
/*===========================================================================*
* cancel_fd *
*===========================================================================*/
-PUBLIC int cancel_fd(ep, fd)
+int cancel_fd(ep, fd)
endpoint_t ep;
int fd;
{
/*===========================================================================*
* do_cancel_fd *
*===========================================================================*/
-PUBLIC int do_cancel_fd(void)
+int do_cancel_fd(void)
{
return cancel_fd(m_in.USER_ENDPT, m_in.COUNT);
}
/*===========================================================================*
* close_filp *
*===========================================================================*/
-PUBLIC void close_filp(f)
+void close_filp(f)
struct filp *f;
{
/* Close a file. Will also unlock filp when done */
#define MAX_DEPTH 1
/* global variables stack */
-PRIVATE struct {
+static struct {
struct fproc *g_fp; /* pointer to caller process */
message g_m_in; /* request message */
message g_m_out; /* reply message */
char g_user_fullpath[PATH_MAX]; /* path to look up */
} globals[MAX_DEPTH];
-PRIVATE int depth = 0; /* current globals stack level */
+static int depth = 0; /* current globals stack level */
-FORWARD int push_globals(void);
-FORWARD void pop_globals(void);
-FORWARD void set_globals(message *m);
+static int push_globals(void);
+static void pop_globals(void);
+static void set_globals(message *m);
/*===========================================================================*
* push_globals *
*===========================================================================*/
-PRIVATE int push_globals()
+static int push_globals()
{
/* Save the global variables of the current call onto the globals stack.
*/
/*===========================================================================*
* pop_globals *
*===========================================================================*/
-PRIVATE void pop_globals()
+static void pop_globals()
{
/* Restore the global variables of a call from the globals stack.
*/
/*===========================================================================*
* set_globals *
*===========================================================================*/
-PRIVATE void set_globals(m)
+static void set_globals(m)
message *m; /* request message */
{
/* Initialize global variables based on a request message.
/*===========================================================================*
* nested_fs_call *
*===========================================================================*/
-PUBLIC void nested_fs_call(m)
+void nested_fs_call(m)
message *m; /* request/reply message pointer */
{
/* Handle a nested call from a file system server.
/*===========================================================================*
* do_gcov_flush *
*===========================================================================*/
-PUBLIC int do_gcov_flush()
+int do_gcov_flush()
{
/* A userland tool has requested the gcov data from another
* process (possibly vfs itself). Grant the target process
/*===========================================================================*
* do_link *
*===========================================================================*/
-PUBLIC int do_link()
+int do_link()
{
/* Perform the link(name1, name2) system call. */
int r = OK;
/*===========================================================================*
* do_unlink *
*===========================================================================*/
-PUBLIC int do_unlink()
+int do_unlink()
{
/* Perform the unlink(name) or rmdir(name) system call. The code for these two
* is almost the same. They differ only in some condition testing. Unlink()
/*===========================================================================*
* do_rename *
*===========================================================================*/
-PUBLIC int do_rename()
+int do_rename()
{
/* Perform the rename(name1, name2) system call. */
int r = OK, r1;
/*===========================================================================*
* do_truncate *
*===========================================================================*/
-PUBLIC int do_truncate()
+int do_truncate()
{
/* truncate_vnode() does the actual work of do_truncate() and do_ftruncate().
* do_truncate() and do_ftruncate() have to get hold of the inode, either
/*===========================================================================*
* do_ftruncate *
*===========================================================================*/
-PUBLIC int do_ftruncate()
+int do_ftruncate()
{
/* As with do_truncate(), truncate_vnode() does the actual work. */
struct filp *rfilp;
/*===========================================================================*
* truncate_vnode *
*===========================================================================*/
-PUBLIC int truncate_vnode(vp, newsize)
+int truncate_vnode(vp, newsize)
struct vnode *vp;
off_t newsize;
{
/*===========================================================================*
* do_slink *
*===========================================================================*/
-PUBLIC int do_slink()
+int do_slink()
{
/* Perform the symlink(name1, name2) system call. */
int r;
/*===========================================================================*
* rdlink_direct *
*===========================================================================*/
-PUBLIC int rdlink_direct(orig_path, link_path, rfp)
+int rdlink_direct(orig_path, link_path, rfp)
char *orig_path;
char link_path[PATH_MAX]; /* should have length PATH_MAX */
struct fproc *rfp;
/*===========================================================================*
* do_rdlink *
*===========================================================================*/
-PUBLIC int do_rdlink()
+int do_rdlink()
{
/* Perform the readlink(name, buf, bufsize) system call. */
int r, copylen;
/*===========================================================================*
* lock_op *
*===========================================================================*/
-PUBLIC int lock_op(f, req)
+int lock_op(f, req)
struct filp *f;
int req; /* either F_SETLK or F_SETLKW */
{
/*===========================================================================*
* lock_revive *
*===========================================================================*/
-PUBLIC void lock_revive()
+void lock_revive()
{
/* Go find all the processes that are waiting for any kind of lock and
* revive them all. The ones that are still blocked will block again when
#endif
/* Thread related prototypes */
-FORWARD void thread_cleanup_f(struct fproc *rfp, char *f, int l);
+static void thread_cleanup_f(struct fproc *rfp, char *f, int l);
#define thread_cleanup(x) thread_cleanup_f(x, __FILE__, __LINE__)
-FORWARD void *do_async_dev_result(void *arg);
-FORWARD void *do_control_msgs(void *arg);
-FORWARD void *do_fs_reply(struct job *job);
-FORWARD void *do_work(void *arg);
-FORWARD void *do_pm(void *arg);
-FORWARD void *do_init_root(void *arg);
-FORWARD void handle_work(void *(*func)(void *arg));
-
-FORWARD void get_work(void);
-FORWARD void lock_pm(void);
-FORWARD void unlock_pm(void);
-FORWARD void service_pm(void);
-FORWARD void service_pm_postponed(void);
-FORWARD int unblock(struct fproc *rfp);
+static void *do_async_dev_result(void *arg);
+static void *do_control_msgs(void *arg);
+static void *do_fs_reply(struct job *job);
+static void *do_work(void *arg);
+static void *do_pm(void *arg);
+static void *do_init_root(void *arg);
+static void handle_work(void *(*func)(void *arg));
+
+static void get_work(void);
+static void lock_pm(void);
+static void unlock_pm(void);
+static void service_pm(void);
+static void service_pm_postponed(void);
+static int unblock(struct fproc *rfp);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-PRIVATE mutex_t pm_lock;
-PRIVATE endpoint_t receive_from;
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static mutex_t pm_lock;
+static endpoint_t receive_from;
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
/* This is the main program of the file system. The main loop consists of
* three major activities: getting new work, processing the work, and sending
/*===========================================================================*
* handle_work *
*===========================================================================*/
-PRIVATE void handle_work(void *(*func)(void *arg))
+static void handle_work(void *(*func)(void *arg))
{
/* Handle asynchronous device replies and new system calls. If the originating
* endpoint is an FS endpoint, take extra care not to get in deadlock. */
/*===========================================================================*
* do_async_dev_result *
*===========================================================================*/
-PRIVATE void *do_async_dev_result(void *arg)
+static void *do_async_dev_result(void *arg)
{
endpoint_t endpt;
struct job my_job;
/*===========================================================================*
* do_control_msgs *
*===========================================================================*/
-PRIVATE void *do_control_msgs(void *arg)
+static void *do_control_msgs(void *arg)
{
struct job my_job;
/*===========================================================================*
* do_fs_reply *
*===========================================================================*/
-PRIVATE void *do_fs_reply(struct job *job)
+static void *do_fs_reply(struct job *job)
{
struct vmnt *vmp;
struct fproc *rfp;
/*===========================================================================*
* lock_pm *
*===========================================================================*/
-PRIVATE void lock_pm(void)
+static void lock_pm(void)
{
message org_m_in;
struct fproc *org_fp;
/*===========================================================================*
* unlock_pm *
*===========================================================================*/
-PRIVATE void unlock_pm(void)
+static void unlock_pm(void)
{
if (mutex_unlock(&pm_lock) != 0)
panic("Could not release lock on pm");
/*===========================================================================*
* do_pm *
*===========================================================================*/
-PRIVATE void *do_pm(void *arg)
+static void *do_pm(void *arg)
{
struct job my_job;
struct fproc *rfp;
/*===========================================================================*
* do_pending_pipe *
*===========================================================================*/
-PRIVATE void *do_pending_pipe(void *arg)
+static void *do_pending_pipe(void *arg)
{
int r, op;
struct job my_job;
/*===========================================================================*
* do_dummy *
*===========================================================================*/
-PUBLIC void *do_dummy(void *arg)
+void *do_dummy(void *arg)
{
struct job my_job;
int r;
/*===========================================================================*
* do_work *
*===========================================================================*/
-PRIVATE void *do_work(void *arg)
+static void *do_work(void *arg)
{
int error;
struct job my_job;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *info)
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *info)
{
/* Initialize the virtual file server. */
int s, i;
/*===========================================================================*
* do_init_root *
*===========================================================================*/
-PRIVATE void *do_init_root(void *arg)
+static void *do_init_root(void *arg)
{
struct fproc *rfp;
struct job my_job;
/*===========================================================================*
* lock_proc *
*===========================================================================*/
-PUBLIC void lock_proc(struct fproc *rfp, int force_lock)
+void lock_proc(struct fproc *rfp, int force_lock)
{
int r;
message org_m_in;
/*===========================================================================*
* unlock_proc *
*===========================================================================*/
-PUBLIC void unlock_proc(struct fproc *rfp)
+void unlock_proc(struct fproc *rfp)
{
int r;
/*===========================================================================*
* thread_cleanup *
*===========================================================================*/
-PRIVATE void thread_cleanup_f(struct fproc *rfp, char *f, int l)
+static void thread_cleanup_f(struct fproc *rfp, char *f, int l)
{
/* Clean up worker thread. Skip parts if this thread is not associated
* with a particular process (i.e., rfp is NULL) */
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work()
+static void get_work()
{
/* Normally wait for new input. However, if 'reviving' is
* nonzero, a suspended process must be awakened.
/*===========================================================================*
* reply *
*===========================================================================*/
-PUBLIC void reply(whom, result)
+void reply(whom, result)
int whom; /* process to reply to */
int result; /* result of the call (usually OK or error #) */
{
/*===========================================================================*
* service_pm_postponed *
*===========================================================================*/
-PRIVATE void service_pm_postponed(void)
+static void service_pm_postponed(void)
{
int r;
vir_bytes pc;
/*===========================================================================*
* service_pm *
*===========================================================================*/
-PRIVATE void service_pm()
+static void service_pm()
{
int r, slot;
/*===========================================================================*
* unblock *
*===========================================================================*/
-PRIVATE int unblock(rfp)
+static int unblock(rfp)
struct fproc *rfp;
{
int blocked_on;
#define CORE_MODE 0777 /* mode to use on core image files */
#if ENABLE_SYSCALL_STATS
-PUBLIC unsigned long calls_stats[NCALLS];
+unsigned long calls_stats[NCALLS];
#endif
-FORWARD void free_proc(struct fproc *freed, int flags);
+static void free_proc(struct fproc *freed, int flags);
/*
-FORWARD int dumpcore(int proc_e, struct mem_map *seg_ptr);
-FORWARD int write_bytes(struct inode *rip, off_t off, char *buf, size_t
+static int dumpcore(int proc_e, struct mem_map *seg_ptr);
+static int write_bytes(struct inode *rip, off_t off, char *buf, size_t
bytes);
-FORWARD int write_seg(struct inode *rip, off_t off, int proc_e, int seg,
+static int write_seg(struct inode *rip, off_t off, int proc_e, int seg,
off_t seg_off, phys_bytes seg_bytes);
*/
/*===========================================================================*
* do_getsysinfo *
*===========================================================================*/
-PUBLIC int do_getsysinfo()
+int do_getsysinfo()
{
vir_bytes src_addr, dst_addr;
size_t len;
/*===========================================================================*
* do_dup *
*===========================================================================*/
-PUBLIC int do_dup()
+int do_dup()
{
/* Perform the dup(fd) or dup2(fd,fd2) system call. These system calls are
* obsolete. In fact, it is not even possible to invoke them using the
/*===========================================================================*
* do_fcntl *
*===========================================================================*/
-PUBLIC int do_fcntl()
+int do_fcntl()
{
/* Perform the fcntl(fd, request, ...) system call. */
/*===========================================================================*
* do_sync *
*===========================================================================*/
-PUBLIC int do_sync()
+int do_sync()
{
struct vmnt *vmp;
int r = OK;
/*===========================================================================*
* do_fsync *
*===========================================================================*/
-PUBLIC int do_fsync()
+int do_fsync()
{
/* Perform the fsync() system call. */
struct filp *rfilp;
/*===========================================================================*
* pm_reboot *
*===========================================================================*/
-PUBLIC void pm_reboot()
+void pm_reboot()
{
/* Perform the VFS side of the reboot call. */
int i;
/*===========================================================================*
* pm_fork *
*===========================================================================*/
-PUBLIC void pm_fork(pproc, cproc, cpid)
+void pm_fork(pproc, cproc, cpid)
int pproc; /* Parent process */
int cproc; /* Child process */
int cpid; /* Child process id */
/*===========================================================================*
* free_proc *
*===========================================================================*/
-PRIVATE void free_proc(struct fproc *exiter, int flags)
+static void free_proc(struct fproc *exiter, int flags)
{
int i;
register struct fproc *rfp;
/*===========================================================================*
* pm_exit *
*===========================================================================*/
-PUBLIC void pm_exit(proc)
+void pm_exit(proc)
int proc;
{
/* Perform the file system portion of the exit(status) system call. */
/*===========================================================================*
* pm_setgid *
*===========================================================================*/
-PUBLIC void pm_setgid(proc_e, egid, rgid)
+void pm_setgid(proc_e, egid, rgid)
int proc_e;
int egid;
int rgid;
/*===========================================================================*
* pm_setgroups *
*===========================================================================*/
-PUBLIC void pm_setgroups(proc_e, ngroups, groups)
+void pm_setgroups(proc_e, ngroups, groups)
int proc_e;
int ngroups;
gid_t *groups;
/*===========================================================================*
* pm_setuid *
*===========================================================================*/
-PUBLIC void pm_setuid(proc_e, euid, ruid)
+void pm_setuid(proc_e, euid, ruid)
int proc_e;
int euid;
int ruid;
/*===========================================================================*
* do_svrctl *
*===========================================================================*/
-PUBLIC int do_svrctl()
+int do_svrctl()
{
switch (m_in.svrctl_req) {
/* No control request implemented yet. */
/*===========================================================================*
* pm_dumpcore *
*===========================================================================*/
-PUBLIC int pm_dumpcore(endpoint_t proc_e, int csig, vir_bytes exe_name)
+int pm_dumpcore(endpoint_t proc_e, int csig, vir_bytes exe_name)
{
int slot, r, core_fd;
struct filp *f;
/*===========================================================================*
* ds_event *
*===========================================================================*/
-PUBLIC void ds_event(void)
+void ds_event(void)
{
char key[DS_MAX_KEYLEN];
char *blkdrv_prefix = "drv.blk.";
#include "param.h"
/* Allow the root to be replaced before the first 'real' mount. */
-PRIVATE int have_root = 0;
+static int have_root = 0;
/* Bitmap of in-use "none" pseudo devices. */
-PRIVATE bitchunk_t nonedev[BITMAP_CHUNKS(NR_NONEDEVS)] = { 0 };
+static bitchunk_t nonedev[BITMAP_CHUNKS(NR_NONEDEVS)] = { 0 };
#define alloc_nonedev(dev) SET_BIT(nonedev, minor(dev) - 1)
#define free_nonedev(dev) UNSET_BIT(nonedev, minor(dev) - 1)
-FORWARD dev_t name_to_dev(int allow_mountpt, char path[PATH_MAX]);
-FORWARD dev_t find_free_nonedev(void);
-FORWARD void update_bspec(dev_t dev, endpoint_t fs_e, int send_drv_e);
+static dev_t name_to_dev(int allow_mountpt, char path[PATH_MAX]);
+static dev_t find_free_nonedev(void);
+static void update_bspec(dev_t dev, endpoint_t fs_e, int send_drv_e);
/*===========================================================================*
* update_bspec *
*===========================================================================*/
-PRIVATE void update_bspec(dev_t dev, endpoint_t fs_e, int send_drv_e)
+static void update_bspec(dev_t dev, endpoint_t fs_e, int send_drv_e)
{
/* Update all block special files for a certain device, to use a new FS endpt
* to route raw block I/O requests through.
/*===========================================================================*
* do_fsready *
*===========================================================================*/
-PUBLIC int do_fsready()
+int do_fsready()
{
/* deprecated */
return(SUSPEND);
/*===========================================================================*
* do_mount *
*===========================================================================*/
-PUBLIC int do_mount()
+int do_mount()
{
/* Perform the mount(name, mfile, mount_flags) system call. */
endpoint_t fs_e;
/*===========================================================================*
* mount_fs *
*===========================================================================*/
-PUBLIC int mount_fs(
+int mount_fs(
dev_t dev,
char mountpoint[PATH_MAX],
endpoint_t fs_e,
/*===========================================================================*
* mount_pfs *
*===========================================================================*/
-PUBLIC void mount_pfs(void)
+void mount_pfs(void)
{
/* Mount the Pipe File Server. It's not really mounted onto the file system,
but it's necessary it has a vmnt entry to make locking easier */
/*===========================================================================*
* do_umount *
*===========================================================================*/
-PUBLIC int do_umount(void)
+int do_umount(void)
{
/* Perform the umount(name) system call. */
char label[LABEL_MAX];
/*===========================================================================*
* unmount *
*===========================================================================*/
-PUBLIC int unmount(
+int unmount(
dev_t dev, /* block-special device */
char *label /* buffer to retrieve label, or NULL */
)
/*===========================================================================*
* unmount_all *
*===========================================================================*/
-PUBLIC void unmount_all(void)
+void unmount_all(void)
{
/* Unmount all filesystems. File systems are mounted on other file systems,
* so you have to pull off the loose bits repeatedly to get it all undone.
/*===========================================================================*
* name_to_dev *
*===========================================================================*/
-PRIVATE dev_t name_to_dev(int allow_mountpt, char path[PATH_MAX])
+static dev_t name_to_dev(int allow_mountpt, char path[PATH_MAX])
{
/* Convert the block special file in 'user_fullpath' to a device number.
* If the given path is not a block special file, but 'allow_mountpt' is set
/*===========================================================================*
* is_nonedev *
*===========================================================================*/
-PUBLIC int is_nonedev(dev_t dev)
+int is_nonedev(dev_t dev)
{
/* Return whether the given device is a "none" pseudo device.
*/
/*===========================================================================*
* find_free_nonedev *
*===========================================================================*/
-PRIVATE dev_t find_free_nonedev(void)
+static dev_t find_free_nonedev(void)
{
/* Find a free "none" pseudo device. Do not allocate it yet.
*/
#include "vmnt.h"
#include "path.h"
-PUBLIC char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0};
+char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0};
-FORWARD struct vnode *new_node(struct lookup *resolve, int oflags,
+static struct vnode *new_node(struct lookup *resolve, int oflags,
mode_t bits);
-FORWARD int pipe_open(struct vnode *vp, mode_t bits, int oflags);
+static int pipe_open(struct vnode *vp, mode_t bits, int oflags);
/*===========================================================================*
* do_creat *
*===========================================================================*/
-PUBLIC int do_creat()
+int do_creat()
{
/* Perform the creat(name, mode) system call. */
int r;
/*===========================================================================*
* do_open *
*===========================================================================*/
-PUBLIC int do_open()
+int do_open()
{
/* Perform the open(name, flags,...) system call. */
int create_mode = 0; /* is really mode_t but this gives problems */
/*===========================================================================*
* common_open *
*===========================================================================*/
-PUBLIC int common_open(char path[PATH_MAX], int oflags, mode_t omode)
+int common_open(char path[PATH_MAX], int oflags, mode_t omode)
{
/* Common code from do_creat and do_open. */
int b, r, exist = TRUE, major_dev;
/*===========================================================================*
* new_node *
*===========================================================================*/
-PRIVATE struct vnode *new_node(struct lookup *resolve, int oflags, mode_t bits)
+static struct vnode *new_node(struct lookup *resolve, int oflags, mode_t bits)
{
/* Try to create a new inode and return a pointer to it. If the inode already
exists, return a pointer to it as well, but set err_code accordingly.
/*===========================================================================*
* pipe_open *
*===========================================================================*/
-PRIVATE int pipe_open(struct vnode *vp, mode_t bits, int oflags)
+static int pipe_open(struct vnode *vp, mode_t bits, int oflags)
{
/* This function is called from common_open. It checks if
* there is at least one reader/writer pair for the pipe, if not
/*===========================================================================*
* do_mknod *
*===========================================================================*/
-PUBLIC int do_mknod()
+int do_mknod()
{
/* Perform the mknod(name, mode, addr) system call. */
register mode_t bits, mode_bits;
/*===========================================================================*
* do_mkdir *
*===========================================================================*/
-PUBLIC int do_mkdir()
+int do_mkdir()
{
/* Perform the mkdir(name, mode) system call. */
mode_t bits; /* mode bits for the new inode */
/*===========================================================================*
* do_lseek *
*===========================================================================*/
-PUBLIC int do_lseek()
+int do_lseek()
{
/* Perform the lseek(ls_fd, offset, whence) system call. */
register struct filp *rfilp;
/*===========================================================================*
* do_llseek *
*===========================================================================*/
-PUBLIC int do_llseek()
+int do_llseek()
{
/* Perform the llseek(ls_fd, offset, whence) system call. */
register struct filp *rfilp;
/*===========================================================================*
* do_close *
*===========================================================================*/
-PUBLIC int do_close()
+int do_close()
{
/* Perform the close(fd) system call. */
/*===========================================================================*
* close_fd *
*===========================================================================*/
-PUBLIC int close_fd(rfp, fd_nr)
+int close_fd(rfp, fd_nr)
struct fproc *rfp;
int fd_nr;
{
/*===========================================================================*
* close_reply *
*===========================================================================*/
-PUBLIC void close_reply()
+void close_reply()
{
/* No need to do anything */
}
*/
#define DO_POSIX_PATHNAME_RES 0
-FORWARD int lookup(struct vnode *dirp, struct lookup *resolve,
+static int lookup(struct vnode *dirp, struct lookup *resolve,
node_details_t *node, struct fproc *rfp);
-FORWARD int check_perms(endpoint_t ep, cp_grant_id_t io_gr, size_t
+static int check_perms(endpoint_t ep, cp_grant_id_t io_gr, size_t
pathlen);
/*===========================================================================*
* advance *
*===========================================================================*/
-PUBLIC struct vnode *advance(dirp, resolve, rfp)
+struct vnode *advance(dirp, resolve, rfp)
struct vnode *dirp;
struct lookup *resolve;
struct fproc *rfp;
/*===========================================================================*
* eat_path *
*===========================================================================*/
-PUBLIC struct vnode *eat_path(resolve, rfp)
+struct vnode *eat_path(resolve, rfp)
struct lookup *resolve;
struct fproc *rfp;
{
/*===========================================================================*
* last_dir *
*===========================================================================*/
-PUBLIC struct vnode *last_dir(resolve, rfp)
+struct vnode *last_dir(resolve, rfp)
struct lookup *resolve;
struct fproc *rfp;
{
/*===========================================================================*
* lookup *
*===========================================================================*/
-PRIVATE int lookup(start_node, resolve, result_node, rfp)
+static int lookup(start_node, resolve, result_node, rfp)
struct vnode *start_node;
struct lookup *resolve;
node_details_t *result_node;
/*===========================================================================*
* lookup_init *
*===========================================================================*/
-PUBLIC void lookup_init(resolve, path, flags, vmp, vp)
+void lookup_init(resolve, path, flags, vmp, vp)
struct lookup *resolve;
char *path;
int flags;
/*===========================================================================*
* get_name *
*===========================================================================*/
-PUBLIC int get_name(dirp, entry, ename)
+int get_name(dirp, entry, ename)
struct vnode *dirp;
struct vnode *entry;
char ename[NAME_MAX + 1];
/*===========================================================================*
* canonical_path *
*===========================================================================*/
-PUBLIC int canonical_path(orig_path, rfp)
+int canonical_path(orig_path, rfp)
char orig_path[PATH_MAX];
struct fproc *rfp;
{
/*===========================================================================*
* check_perms *
*===========================================================================*/
-PRIVATE int check_perms(ep, io_gr, pathlen)
+static int check_perms(ep, io_gr, pathlen)
endpoint_t ep;
cp_grant_id_t io_gr;
size_t pathlen;
/*===========================================================================*
* do_check_perms *
*===========================================================================*/
-PUBLIC int do_check_perms(void)
+int do_check_perms(void)
{
return check_perms(m_in.USER_ENDPT, (cp_grant_id_t) m_in.IO_GRANT,
(size_t) m_in.COUNT);
/*===========================================================================*
* do_pipe *
*===========================================================================*/
-PUBLIC int do_pipe()
+int do_pipe()
{
/* Perform the pipe(fil_des) system call. */
/*===========================================================================*
* map_vnode *
*===========================================================================*/
-PUBLIC int map_vnode(vp, map_to_fs_e)
+int map_vnode(vp, map_to_fs_e)
struct vnode *vp;
endpoint_t map_to_fs_e;
{
/*===========================================================================*
* pipe_check *
*===========================================================================*/
-PUBLIC int pipe_check(vp, rw_flag, oflags, bytes, position, notouch)
+int pipe_check(vp, rw_flag, oflags, bytes, position, notouch)
register struct vnode *vp; /* the inode of the pipe */
int rw_flag; /* READING or WRITING */
int oflags; /* flags set by open or fcntl */
/*===========================================================================*
* suspend *
*===========================================================================*/
-PUBLIC void suspend(int why)
+void suspend(int why)
{
/* Take measures to suspend the processing of the present system call.
* Store the parameters to be used upon resuming in the process table.
/*===========================================================================*
* wait_for *
*===========================================================================*/
-PUBLIC void wait_for(endpoint_t who)
+void wait_for(endpoint_t who)
{
if(who == NONE || who == ANY)
panic("suspend on NONE or ANY");
/*===========================================================================*
* pipe_suspend *
*===========================================================================*/
-PUBLIC void pipe_suspend(filp, buf, size)
+void pipe_suspend(filp, buf, size)
struct filp *filp;
char *buf;
size_t size;
/*===========================================================================*
* unsuspend_by_endpt *
*===========================================================================*/
-PUBLIC void unsuspend_by_endpt(endpoint_t proc_e)
+void unsuspend_by_endpt(endpoint_t proc_e)
{
/* Revive processes waiting for drivers (SUSPENDed) that have disappeared with
* return code EAGAIN.
/*===========================================================================*
* release *
*===========================================================================*/
-PUBLIC void release(vp, op, count)
+void release(vp, op, count)
register struct vnode *vp; /* inode of pipe */
int op; /* READ, WRITE, OPEN or CREAT */
int count; /* max number of processes to release */
/*===========================================================================*
* revive *
*===========================================================================*/
-PUBLIC void revive(proc_nr_e, returned)
+void revive(proc_nr_e, returned)
int proc_nr_e; /* process to revive */
int returned; /* if hanging on task, how many bytes read */
{
/*===========================================================================*
* unpause *
*===========================================================================*/
-PUBLIC void unpause(endpoint_t proc_e)
+void unpause(endpoint_t proc_e)
{
/* A signal has been sent to a user who is paused on the file system.
* Abort the system call with the EINTR error message.
/*===========================================================================*
* check_pipe *
*===========================================================================*/
-PUBLIC int check_pipe(void)
+int check_pipe(void)
{
/* Integrity check; verify that susp_count equals what the fproc table thinks
* is suspended on a pipe */
/*===========================================================================*
* do_chmod *
*===========================================================================*/
-PUBLIC int do_chmod()
+int do_chmod()
{
/* Perform the chmod(name, mode) and fchmod(fd, mode) system calls. */
/*===========================================================================*
* do_chown *
*===========================================================================*/
-PUBLIC int do_chown()
+int do_chown()
{
/* Perform the chown(path, owner, group) and fchmod(fd, owner, group) system
* calls. */
/*===========================================================================*
* do_umask *
*===========================================================================*/
-PUBLIC int do_umask()
+int do_umask()
{
/* Perform the umask(co_mode) system call. */
register mode_t r;
/*===========================================================================*
* do_access *
*===========================================================================*/
-PUBLIC int do_access()
+int do_access()
{
/* Perform the access(name, mode) system call. */
int r;
/*===========================================================================*
* forbidden *
*===========================================================================*/
-PUBLIC int forbidden(struct fproc *rfp, struct vnode *vp, mode_t access_desired)
+int forbidden(struct fproc *rfp, struct vnode *vp, mode_t access_desired)
{
/* Given a pointer to an vnode, 'vp', and the access desired, determine
* if the access is allowed, and if not why not. The routine looks up the
/*===========================================================================*
* read_only *
*===========================================================================*/
-PUBLIC int read_only(vp)
+int read_only(vp)
struct vnode *vp; /* ptr to inode whose file sys is to be cked */
{
/* Check to see if the file system on which the inode 'ip' resides is mounted
/*===========================================================================*
* do_read *
*===========================================================================*/
-PUBLIC int do_read()
+int do_read()
{
return(do_read_write(READING));
}
/*===========================================================================*
* lock_bsf *
*===========================================================================*/
-PUBLIC void lock_bsf(void)
+void lock_bsf(void)
{
message org_m_in;
struct fproc *org_fp;
/*===========================================================================*
* unlock_bsf *
*===========================================================================*/
-PUBLIC void unlock_bsf(void)
+void unlock_bsf(void)
{
if (mutex_unlock(&bsf_lock) != 0)
panic("failed to unlock block special file lock");
/*===========================================================================*
* do_read_write *
*===========================================================================*/
-PUBLIC int do_read_write(rw_flag)
+int do_read_write(rw_flag)
int rw_flag; /* READING or WRITING */
{
/* Perform read(fd, buffer, nbytes) or write(fd, buffer, nbytes) call. */
/*===========================================================================*
* read_write *
*===========================================================================*/
-PUBLIC int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
+int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
endpoint_t for_e)
{
register struct vnode *vp;
/*===========================================================================*
* do_getdents *
*===========================================================================*/
-PUBLIC int do_getdents()
+int do_getdents()
{
/* Perform the getdents(fd, buf, size) system call. */
int r = OK;
/*===========================================================================*
* rw_pipe *
*===========================================================================*/
-PUBLIC int rw_pipe(rw_flag, usr_e, f, buf, req_size)
+int rw_pipe(rw_flag, usr_e, f, buf, req_size)
int rw_flag; /* READING or WRITING */
endpoint_t usr_e;
struct filp *f;
/*===========================================================================*
* req_breadwrite *
*===========================================================================*/
-PUBLIC int req_breadwrite(
+int req_breadwrite(
endpoint_t fs_e,
endpoint_t user_e,
dev_t dev,
/*===========================================================================*
* req_chmod *
*===========================================================================*/
-PUBLIC int req_chmod(
+int req_chmod(
int fs_e,
ino_t inode_nr,
mode_t rmode,
/*===========================================================================*
* req_chown *
*===========================================================================*/
-PUBLIC int req_chown(
+int req_chown(
endpoint_t fs_e,
ino_t inode_nr,
uid_t newuid,
/*===========================================================================*
* req_create *
*===========================================================================*/
-PUBLIC int req_create(
+int req_create(
int fs_e,
ino_t inode_nr,
int omode,
/*===========================================================================*
* req_flush *
*===========================================================================*/
-PUBLIC int req_flush(endpoint_t fs_e, dev_t dev)
+int req_flush(endpoint_t fs_e, dev_t dev)
{
message m;
/*===========================================================================*
* req_fstatfs *
*===========================================================================*/
-PUBLIC int req_fstatfs(int fs_e, int proc_e, char *buf)
+int req_fstatfs(int fs_e, int proc_e, char *buf)
{
int r;
cp_grant_id_t grant_id;
/*===========================================================================*
* req_statvfs *
*===========================================================================*/
-PUBLIC int req_statvfs(int fs_e, int proc_e, char *buf)
+int req_statvfs(int fs_e, int proc_e, char *buf)
{
int r;
cp_grant_id_t grant_id;
/*===========================================================================*
* req_ftrunc *
*===========================================================================*/
-PUBLIC int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
+int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
{
message m;
/*===========================================================================*
* req_getdents *
*===========================================================================*/
-PUBLIC int req_getdents(
+int req_getdents(
endpoint_t fs_e,
ino_t inode_nr,
u64_t pos,
/*===========================================================================*
* req_inhibread *
*===========================================================================*/
-PUBLIC int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
+int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
{
message m;
/*===========================================================================*
* req_link *
*===========================================================================*/
-PUBLIC int req_link(
+int req_link(
endpoint_t fs_e,
ino_t link_parent,
char *lastc,
/*===========================================================================*
* req_lookup *
*===========================================================================*/
-PUBLIC int req_lookup(
+int req_lookup(
endpoint_t fs_e,
ino_t dir_ino,
ino_t root_ino,
/*===========================================================================*
* req_mkdir *
*===========================================================================*/
-PUBLIC int req_mkdir(
+int req_mkdir(
endpoint_t fs_e,
ino_t inode_nr,
char *lastc,
/*===========================================================================*
* req_mknod *
*===========================================================================*/
-PUBLIC int req_mknod(
+int req_mknod(
endpoint_t fs_e,
ino_t inode_nr,
char *lastc,
/*===========================================================================*
* req_mountpoint *
*===========================================================================*/
-PUBLIC int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
+int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
{
message m;
/*===========================================================================*
* req_newnode *
*===========================================================================*/
-PUBLIC int req_newnode(
+int req_newnode(
endpoint_t fs_e,
uid_t uid,
gid_t gid,
/*===========================================================================*
* req_newdriver *
*===========================================================================*/
-PUBLIC int req_newdriver(
+int req_newdriver(
endpoint_t fs_e,
dev_t dev,
char *label
/*===========================================================================*
* req_putnode *
*===========================================================================*/
-PUBLIC int req_putnode(fs_e, inode_nr, count)
+int req_putnode(fs_e, inode_nr, count)
int fs_e;
ino_t inode_nr;
int count;
/*===========================================================================*
* req_rdlink *
*===========================================================================*/
-PUBLIC int req_rdlink(fs_e, inode_nr, proc_e, buf, len, direct)
+int req_rdlink(fs_e, inode_nr, proc_e, buf, len, direct)
endpoint_t fs_e;
ino_t inode_nr;
endpoint_t proc_e;
/*===========================================================================*
* req_readsuper *
*===========================================================================*/
-PUBLIC int req_readsuper(
+int req_readsuper(
endpoint_t fs_e,
char *label,
dev_t dev,
/*===========================================================================*
* req_readwrite *
*===========================================================================*/
-PUBLIC int req_readwrite(fs_e, inode_nr, pos, rw_flag, user_e,
+int req_readwrite(fs_e, inode_nr, pos, rw_flag, user_e,
user_addr, num_of_bytes, new_posp, cum_iop)
endpoint_t fs_e;
ino_t inode_nr;
/*===========================================================================*
* req_rename *
*===========================================================================*/
-PUBLIC int req_rename(fs_e, old_dir, old_name, new_dir, new_name)
+int req_rename(fs_e, old_dir, old_name, new_dir, new_name)
endpoint_t fs_e;
ino_t old_dir;
char *old_name;
/*===========================================================================*
* req_rmdir *
*===========================================================================*/
-PUBLIC int req_rmdir(fs_e, inode_nr, lastc)
+int req_rmdir(fs_e, inode_nr, lastc)
endpoint_t fs_e;
ino_t inode_nr;
char *lastc;
/*===========================================================================*
* req_slink *
*===========================================================================*/
-PUBLIC int req_slink(
+int req_slink(
endpoint_t fs_e,
ino_t inode_nr,
char *lastc,
/*===========================================================================*
* req_stat *
*===========================================================================*/
-PUBLIC int req_stat(fs_e, inode_nr, proc_e, buf, pos, stat_version)
+int req_stat(fs_e, inode_nr, proc_e, buf, pos, stat_version)
int fs_e;
ino_t inode_nr;
int proc_e;
/*===========================================================================*
* req_sync *
*===========================================================================*/
-PUBLIC int req_sync(fs_e)
+int req_sync(fs_e)
endpoint_t fs_e;
{
message m;
/*===========================================================================*
* req_unlink *
*===========================================================================*/
-PUBLIC int req_unlink(fs_e, inode_nr, lastc)
+int req_unlink(fs_e, inode_nr, lastc)
endpoint_t fs_e;
ino_t inode_nr;
char *lastc;
/*===========================================================================*
* req_unmount *
*===========================================================================*/
-PUBLIC int req_unmount(fs_e)
+int req_unmount(fs_e)
endpoint_t fs_e;
{
message m;
/*===========================================================================*
* req_utime *
*===========================================================================*/
-PUBLIC int req_utime(fs_e, inode_nr, actime, modtime)
+int req_utime(fs_e, inode_nr, actime, modtime)
endpoint_t fs_e;
ino_t inode_nr;
time_t actime;
#define FROM_PROC 0
#define TO_PROC 1
-PRIVATE struct selectentry {
+static struct selectentry {
struct fproc *requestor; /* slot is free iff this is NULL */
endpoint_t req_endpt;
fd_set readfds, writefds, errorfds;
timer_t timer; /* if expiry > 0 */
} selecttab[MAXSELECTS];
-FORWARD int copy_fdsets(struct selectentry *se, int nfds, int
+static int copy_fdsets(struct selectentry *se, int nfds, int
direction);
-FORWARD int do_select_request(struct selectentry *se, int fd, int *ops);
-FORWARD void filp_status(struct filp *fp, int status);
-FORWARD int is_deferred(struct selectentry *se);
-FORWARD void restart_proc(struct selectentry *se);
-FORWARD void ops2tab(int ops, int fd, struct selectentry *e);
-FORWARD int is_regular_file(struct filp *f);
-FORWARD int is_pipe(struct filp *f);
-FORWARD int is_supported_major(struct filp *f);
-FORWARD void select_lock_filp(struct filp *f, int ops);
-FORWARD int select_request_async(struct filp *f, int *ops, int block);
-FORWARD int select_request_file(struct filp *f, int *ops, int block);
-FORWARD int select_request_major(struct filp *f, int *ops, int block);
-FORWARD int select_request_pipe(struct filp *f, int *ops, int block);
-FORWARD int select_request_sync(struct filp *f, int *ops, int block);
-FORWARD void select_cancel_all(struct selectentry *e);
-FORWARD void select_cancel_filp(struct filp *f);
-FORWARD void select_return(struct selectentry *);
-FORWARD void select_restart_filps(void);
-FORWARD int tab2ops(int fd, struct selectentry *e);
-FORWARD void wipe_select(struct selectentry *s);
-
-PRIVATE struct fdtype {
+static int do_select_request(struct selectentry *se, int fd, int *ops);
+static void filp_status(struct filp *fp, int status);
+static int is_deferred(struct selectentry *se);
+static void restart_proc(struct selectentry *se);
+static void ops2tab(int ops, int fd, struct selectentry *e);
+static int is_regular_file(struct filp *f);
+static int is_pipe(struct filp *f);
+static int is_supported_major(struct filp *f);
+static void select_lock_filp(struct filp *f, int ops);
+static int select_request_async(struct filp *f, int *ops, int block);
+static int select_request_file(struct filp *f, int *ops, int block);
+static int select_request_major(struct filp *f, int *ops, int block);
+static int select_request_pipe(struct filp *f, int *ops, int block);
+static int select_request_sync(struct filp *f, int *ops, int block);
+static void select_cancel_all(struct selectentry *e);
+static void select_cancel_filp(struct filp *f);
+static void select_return(struct selectentry *);
+static void select_restart_filps(void);
+static int tab2ops(int fd, struct selectentry *e);
+static void wipe_select(struct selectentry *s);
+
+static struct fdtype {
int (*select_request)(struct filp *, int *ops, int block);
int (*type_match)(struct filp *f);
} fdtypes[] = {
{ select_request_pipe, is_pipe },
};
#define SEL_FDS (sizeof(fdtypes) / sizeof(fdtypes[0]))
-PRIVATE int select_majors[] = { /* List of majors that support selecting on */
+static int select_majors[] = { /* List of majors that support selecting on */
TTY_MAJOR,
INET_MAJOR,
UDS_MAJOR,
/*===========================================================================*
* do_select *
*===========================================================================*/
-PUBLIC int do_select(void)
+int do_select(void)
{
/* Implement the select(nfds, readfds, writefds, errorfds, timeout) system
* call. First we copy the arguments and verify their sanity. Then we check
/*===========================================================================*
* is_deferred *
*===========================================================================*/
-PRIVATE int is_deferred(struct selectentry *se)
+static int is_deferred(struct selectentry *se)
{
/* Find out whether this select has pending initial replies */
/*===========================================================================*
* is_regular_file *
*===========================================================================*/
-PRIVATE int is_regular_file(struct filp *f)
+static int is_regular_file(struct filp *f)
{
return(f && f->filp_vno && (f->filp_vno->v_mode & I_TYPE) == I_REGULAR);
}
/*===========================================================================*
* is_pipe *
*===========================================================================*/
-PRIVATE int is_pipe(struct filp *f)
+static int is_pipe(struct filp *f)
{
/* Recognize either anonymous pipe or named pipe (FIFO) */
return(f && f->filp_vno && (f->filp_vno->v_mode & I_TYPE) == I_NAMED_PIPE);
/*===========================================================================*
* is_supported_major *
*===========================================================================*/
-PRIVATE int is_supported_major(struct filp *f)
+static int is_supported_major(struct filp *f)
{
/* See if this filp is a handle on a device on which we support select() */
int m;
/*===========================================================================*
* select_request_async *
*===========================================================================*/
-PRIVATE int select_request_async(struct filp *f, int *ops, int block)
+static int select_request_async(struct filp *f, int *ops, int block)
{
int r, rops, major;
struct dmap *dp;
/*===========================================================================*
* select_request_file *
*===========================================================================*/
-PRIVATE int select_request_file(struct filp *UNUSED(f), int *UNUSED(ops),
+static int select_request_file(struct filp *UNUSED(f), int *UNUSED(ops),
int UNUSED(block))
{
/* Files are always ready, so output *ops is input *ops */
/*===========================================================================*
* select_request_major *
*===========================================================================*/
-PRIVATE int select_request_major(struct filp *f, int *ops, int block)
+static int select_request_major(struct filp *f, int *ops, int block)
{
int major, r;
/*===========================================================================*
* select_request_sync *
*===========================================================================*/
-PRIVATE int select_request_sync(struct filp *f, int *ops, int block)
+static int select_request_sync(struct filp *f, int *ops, int block)
{
int rops;
/*===========================================================================*
* select_request_pipe *
*===========================================================================*/
-PRIVATE int select_request_pipe(struct filp *f, int *ops, int block)
+static int select_request_pipe(struct filp *f, int *ops, int block)
{
int orig_ops, r = 0, err;
/*===========================================================================*
* tab2ops *
*===========================================================================*/
-PRIVATE int tab2ops(int fd, struct selectentry *e)
+static int tab2ops(int fd, struct selectentry *e)
{
int ops = 0;
if (FD_ISSET(fd, &e->readfds)) ops |= SEL_RD;
/*===========================================================================*
* ops2tab *
*===========================================================================*/
-PRIVATE void ops2tab(int ops, int fd, struct selectentry *e)
+static void ops2tab(int ops, int fd, struct selectentry *e)
{
if ((ops & SEL_RD) && e->vir_readfds && FD_ISSET(fd, &e->readfds) &&
!FD_ISSET(fd, &e->ready_readfds)) {
/*===========================================================================*
* copy_fdsets *
*===========================================================================*/
-PRIVATE int copy_fdsets(struct selectentry *se, int nfds, int direction)
+static int copy_fdsets(struct selectentry *se, int nfds, int direction)
{
int r;
size_t fd_setsize;
/*===========================================================================*
* select_cancel_all *
*===========================================================================*/
-PRIVATE void select_cancel_all(struct selectentry *se)
+static void select_cancel_all(struct selectentry *se)
{
/* Cancel select. Decrease select usage and cancel timer */
/*===========================================================================*
* select_cancel_filp *
*===========================================================================*/
-PRIVATE void select_cancel_filp(struct filp *f)
+static void select_cancel_filp(struct filp *f)
{
/* Reduce number of select users of this filp */
/*===========================================================================*
* select_return *
*===========================================================================*/
-PRIVATE void select_return(struct selectentry *se)
+static void select_return(struct selectentry *se)
{
int r, r1;
/*===========================================================================*
* select_callback *
*===========================================================================*/
-PUBLIC void select_callback(struct filp *f, int status)
+void select_callback(struct filp *f, int status)
{
filp_status(f, status);
}
/*===========================================================================*
* init_select *
*===========================================================================*/
-PUBLIC void init_select(void)
+void init_select(void)
{
int s;
/*===========================================================================*
* select_forget *
*===========================================================================*/
-PUBLIC void select_forget(endpoint_t proc_e)
+void select_forget(endpoint_t proc_e)
{
/* Something has happened (e.g. signal delivered that interrupts select()).
* Totally forget about the select(). */
/*===========================================================================*
* select_timeout_check *
*===========================================================================*/
-PUBLIC void select_timeout_check(timer_t *timer)
+void select_timeout_check(timer_t *timer)
{
int s;
struct selectentry *se;
/*===========================================================================*
* select_unsuspend_by_endpt *
*===========================================================================*/
-PUBLIC void select_unsuspend_by_endpt(endpoint_t proc_e)
+void select_unsuspend_by_endpt(endpoint_t proc_e)
{
/* Revive blocked processes when a driver has disappeared */
/*===========================================================================*
* select_reply1 *
*===========================================================================*/
-PUBLIC void select_reply1(driver_e, minor, status)
+void select_reply1(driver_e, minor, status)
endpoint_t driver_e;
int minor;
int status;
/*===========================================================================*
* select_reply2 *
*===========================================================================*/
-PUBLIC void select_reply2(driver_e, minor, status)
+void select_reply2(driver_e, minor, status)
endpoint_t driver_e;
int minor;
int status;
/*===========================================================================*
* select_restart_filps *
*===========================================================================*/
-PRIVATE void select_restart_filps()
+static void select_restart_filps()
{
int fd, slot;
struct filp *f;
/*===========================================================================*
* do_select_request *
*===========================================================================*/
-PRIVATE int do_select_request(se, fd, ops)
+static int do_select_request(se, fd, ops)
struct selectentry *se;
int fd;
int *ops;
/*===========================================================================*
* filp_status *
*===========================================================================*/
-PRIVATE void filp_status(f, status)
+static void filp_status(f, status)
struct filp *f;
int status;
{
/*===========================================================================*
* restart_proc *
*===========================================================================*/
-PRIVATE void restart_proc(se)
+static void restart_proc(se)
struct selectentry *se;
{
/* Tell process about select results (if any) unless there are still results
/*===========================================================================*
* wipe_select *
*===========================================================================*/
-PRIVATE void wipe_select(struct selectentry *se)
+static void wipe_select(struct selectentry *se)
{
se->nfds = 0;
se->nreadyfds = 0;
/*===========================================================================*
* select_lock_filp *
*===========================================================================*/
-PRIVATE void select_lock_filp(struct filp *f, int ops)
+static void select_lock_filp(struct filp *f, int ops)
{
/* Lock a filp and vnode based on which operations are requested */
tll_access_t locktype;;
#include "vnode.h"
#include "vmnt.h"
-FORWARD int change(struct vnode **iip, char *name_ptr, int len);
-FORWARD int change_into(struct vnode **iip, struct vnode *vp);
+static int change(struct vnode **iip, char *name_ptr, int len);
+static int change_into(struct vnode **iip, struct vnode *vp);
/*===========================================================================*
* do_fchdir *
*===========================================================================*/
-PUBLIC int do_fchdir()
+int do_fchdir()
{
/* Change directory on already-opened fd. */
struct filp *rfilp;
/*===========================================================================*
* do_chdir *
*===========================================================================*/
-PUBLIC int do_chdir()
+int do_chdir()
{
/* Perform the chdir(name) system call. */
/*===========================================================================*
* do_chroot *
*===========================================================================*/
-PUBLIC int do_chroot()
+int do_chroot()
{
/* Perform the chroot(name) system call. */
/*===========================================================================*
* change *
*===========================================================================*/
-PRIVATE int change(iip, name_ptr, len)
+static int change(iip, name_ptr, len)
struct vnode **iip; /* pointer to the inode pointer for the dir */
char *name_ptr; /* pointer to the directory name to change to */
int len; /* length of the directory name string */
/*===========================================================================*
* change_into *
*===========================================================================*/
-PRIVATE int change_into(iip, vp)
+static int change_into(iip, vp)
struct vnode **iip; /* pointer to the inode pointer for the dir */
struct vnode *vp; /* this is what the inode has to become */
{
/*===========================================================================*
* do_stat *
*===========================================================================*/
-PUBLIC int do_stat()
+int do_stat()
{
/* Perform the stat(name, buf) system call. */
int r;
/*===========================================================================*
* do_fstat *
*===========================================================================*/
-PUBLIC int do_fstat()
+int do_fstat()
{
/* Perform the fstat(fd, buf) system call. */
register struct filp *rfilp;
/*===========================================================================*
* do_fstatfs *
*===========================================================================*/
-PUBLIC int do_fstatfs()
+int do_fstatfs()
{
/* Perform the fstatfs(fd, buf) system call. */
struct filp *rfilp;
/*===========================================================================*
* do_statvfs *
*===========================================================================*/
-PUBLIC int do_statvfs()
+int do_statvfs()
{
/* Perform the stat(name, buf) system call. */
int r;
/*===========================================================================*
* do_fstatvfs *
*===========================================================================*/
-PUBLIC int do_fstatvfs()
+int do_fstatvfs()
{
/* Perform the fstat(fd, buf) system call. */
register struct filp *rfilp;
/*===========================================================================*
* do_lstat *
*===========================================================================*/
-PUBLIC int do_lstat()
+int do_lstat()
{
/* Perform the lstat(name, buf) system call. */
struct vnode *vp;
#include "vnode.h"
#include "vmnt.h"
-PUBLIC int (*call_vec[])(void) = {
+int (*call_vec[])(void) = {
no_sys, /* 0 = unused */
no_sys, /* 1 = (exit) */
no_sys, /* 2 = (fork) */
/* This should not fail with "array size is negative": */
extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1];
-PUBLIC int (*pfs_call_vec[])(void) = {
+int (*pfs_call_vec[])(void) = {
no_sys, /* 0 */
do_check_perms, /* 1 */
/*===========================================================================*
* do_utime *
*===========================================================================*/
-PUBLIC int do_utime()
+int do_utime()
{
/* Perform the utime(name, timep) system call. */
register int len;
#include "threads.h"
#include <assert.h>
-FORWARD int tll_append(tll_t *tllp, tll_access_t locktype);
+static int tll_append(tll_t *tllp, tll_access_t locktype);
-PRIVATE int tll_append(tll_t *tllp, tll_access_t locktype)
+static int tll_append(tll_t *tllp, tll_access_t locktype)
{
struct worker_thread *queue;
return(OK);
}
-PUBLIC void tll_downgrade(tll_t *tllp)
+void tll_downgrade(tll_t *tllp)
{
/* Downgrade three-level-lock tll from write-only to read-serialized, or from
* read-serialized to read-only. Caveat: as we can't know whether the next
assert(tllp->t_owner == NULL);
}
-PUBLIC void tll_init(tll_t *tllp)
+void tll_init(tll_t *tllp)
{
/* Initialize three-level-lock tll */
assert(tllp != NULL);
tllp->t_owner = NULL;
}
-PUBLIC int tll_islocked(tll_t *tllp)
+int tll_islocked(tll_t *tllp)
{
return(tllp->t_current != TLL_NONE);
}
-PUBLIC int tll_locked_by_me(tll_t *tllp)
+int tll_locked_by_me(tll_t *tllp)
{
assert(self != NULL);
return(tllp->t_owner == self && !(tllp->t_status & TLL_PEND));
}
-PUBLIC int tll_lock(tll_t *tllp, tll_access_t locktype)
+int tll_lock(tll_t *tllp, tll_access_t locktype)
{
/* Try to lock three-level-lock tll with type locktype */
return(OK);
}
-PUBLIC int tll_haspendinglock(tll_t *tllp)
+int tll_haspendinglock(tll_t *tllp)
{
/* Is someone trying to obtain a lock? */
assert(tllp != NULL);
return(tllp->t_write != NULL || tllp->t_serial != NULL);
}
-PUBLIC int tll_unlock(tll_t *tllp)
+int tll_unlock(tll_t *tllp)
{
/* Unlock a previously locked three-level-lock tll */
int signal_owner = 0;
return(OK);
}
-PUBLIC void tll_upgrade(tll_t *tllp)
+void tll_upgrade(tll_t *tllp)
{
/* Upgrade three-level-lock tll from read-serialized to write-only */
/*===========================================================================*
* fetch_name *
*===========================================================================*/
-PUBLIC int fetch_name(path, len, flag, dest)
+int fetch_name(path, len, flag, dest)
char *path; /* pointer to the path in user space */
int len; /* path length, including 0 byte */
int flag; /* M3 means path may be in message */
/*===========================================================================*
* no_sys *
*===========================================================================*/
-PUBLIC int no_sys()
+int no_sys()
{
/* Somebody has used an illegal system call number */
return(ENOSYS);
/*===========================================================================*
* isokendpt_f *
*===========================================================================*/
-PUBLIC int isokendpt_f(char *file, int line, endpoint_t endpoint, int *proc, int fatal)
+int isokendpt_f(char *file, int line, endpoint_t endpoint, int *proc, int fatal)
{
int failed = 0;
endpoint_t ke;
/*===========================================================================*
* clock_time *
*===========================================================================*/
-PUBLIC time_t clock_time()
+time_t clock_time()
{
/* This routine returns the time in seconds since 1.1.1970. MINIX is an
* astrophysically naive system that assumes the earth rotates at a constant
/*===========================================================================*
* in_group *
*===========================================================================*/
-PUBLIC int in_group(struct fproc *rfp, gid_t grp)
+int in_group(struct fproc *rfp, gid_t grp)
{
int i;
#include <assert.h>
#include "fproc.h"
-FORWARD int is_vmnt_locked(struct vmnt *vmp);
-FORWARD void clear_vmnt(struct vmnt *vmp);
+static int is_vmnt_locked(struct vmnt *vmp);
+static void clear_vmnt(struct vmnt *vmp);
/* Is vmp pointer reasonable? */
#define SANEVMP(v) ((((v) >= &vmnt[0] && (v) < &vmnt[NR_MNTS])))
/*===========================================================================*
* check_vmnt_locks_by_me *
*===========================================================================*/
-PUBLIC void check_vmnt_locks_by_me(struct fproc *rfp)
+void check_vmnt_locks_by_me(struct fproc *rfp)
{
/* Check whether this thread still has locks held on vmnts */
struct vmnt *vmp;
/*===========================================================================*
* check_vmnt_locks *
*===========================================================================*/
-PUBLIC void check_vmnt_locks()
+void check_vmnt_locks()
{
struct vmnt *vmp;
int count = 0;
/*===========================================================================*
* mark_vmnt_free *
*===========================================================================*/
-PUBLIC void mark_vmnt_free(struct vmnt *vmp)
+void mark_vmnt_free(struct vmnt *vmp)
{
ASSERTVMP(vmp);
/*===========================================================================*
* clear_vmnt *
*===========================================================================*/
-PRIVATE void clear_vmnt(struct vmnt *vmp)
+static void clear_vmnt(struct vmnt *vmp)
{
/* Reset vmp to initial parameters */
ASSERTVMP(vmp);
/*===========================================================================*
* get_free_vmnt *
*===========================================================================*/
-PUBLIC struct vmnt *get_free_vmnt(void)
+struct vmnt *get_free_vmnt(void)
{
struct vmnt *vmp;
/*===========================================================================*
* find_vmnt *
*===========================================================================*/
-PUBLIC struct vmnt *find_vmnt(endpoint_t fs_e)
+struct vmnt *find_vmnt(endpoint_t fs_e)
{
/* Find the vmnt belonging to an FS with endpoint 'fs_e' iff it's in use */
struct vmnt *vp;
/*===========================================================================*
* init_vmnts *
*===========================================================================*/
-PUBLIC void init_vmnts(void)
+void init_vmnts(void)
{
/* Initialize vmnt table */
struct vmnt *vmp;
/*===========================================================================*
* is_vmnt_locked *
*===========================================================================*/
-PRIVATE int is_vmnt_locked(struct vmnt *vmp)
+static int is_vmnt_locked(struct vmnt *vmp)
{
ASSERTVMP(vmp);
return(tll_islocked(&vmp->m_lock) || tll_haspendinglock(&vmp->m_lock));
/*===========================================================================*
* lock_vmnt *
*===========================================================================*/
-PUBLIC int lock_vmnt(struct vmnt *vmp, tll_access_t locktype)
+int lock_vmnt(struct vmnt *vmp, tll_access_t locktype)
{
int r;
tll_access_t initial_locktype;
/*===========================================================================*
* vmnt_unmap_by_endpoint *
*===========================================================================*/
-PUBLIC void vmnt_unmap_by_endpt(endpoint_t proc_e)
+void vmnt_unmap_by_endpt(endpoint_t proc_e)
{
struct vmnt *vmp;
/*===========================================================================*
* unlock_vmnt *
*===========================================================================*/
-PUBLIC void unlock_vmnt(struct vmnt *vmp)
+void unlock_vmnt(struct vmnt *vmp)
{
ASSERTVMP(vmp);
/*===========================================================================*
* check_vnode_locks_by_me *
*===========================================================================*/
-PUBLIC void check_vnode_locks_by_me(struct fproc *rfp)
+void check_vnode_locks_by_me(struct fproc *rfp)
{
/* Check whether this thread still has locks held on vnodes */
struct vnode *vp;
/*===========================================================================*
* check_vnode_locks *
*===========================================================================*/
-PUBLIC void check_vnode_locks()
+void check_vnode_locks()
{
struct vnode *vp;
int count = 0;
/*===========================================================================*
* get_free_vnode *
*===========================================================================*/
-PUBLIC struct vnode *get_free_vnode()
+struct vnode *get_free_vnode()
{
/* Find a free vnode slot in the vnode table (it's not actually allocated) */
struct vnode *vp;
/*===========================================================================*
* find_vnode *
*===========================================================================*/
-PUBLIC struct vnode *find_vnode(int fs_e, int ino)
+struct vnode *find_vnode(int fs_e, int ino)
{
/* Find a specified (FS endpoint and inode number) vnode in the
* vnode table */
/*===========================================================================*
* is_vnode_locked *
*===========================================================================*/
-PUBLIC int is_vnode_locked(struct vnode *vp)
+int is_vnode_locked(struct vnode *vp)
{
/* Find out whether a thread holds a lock on this vnode or is trying to obtain
* a lock. */
/*===========================================================================*
* init_vnodes *
*===========================================================================*/
-PUBLIC void init_vnodes(void)
+void init_vnodes(void)
{
struct vnode *vp;
/*===========================================================================*
* lock_vnode *
*===========================================================================*/
-PUBLIC int lock_vnode(struct vnode *vp, tll_access_t locktype)
+int lock_vnode(struct vnode *vp, tll_access_t locktype)
{
int r;
/*===========================================================================*
* unlock_vnode *
*===========================================================================*/
-PUBLIC void unlock_vnode(struct vnode *vp)
+void unlock_vnode(struct vnode *vp)
{
#if LOCK_DEBUG
int i;
/*===========================================================================*
* dup_vnode *
*===========================================================================*/
-PUBLIC void dup_vnode(struct vnode *vp)
+void dup_vnode(struct vnode *vp)
{
/* dup_vnode() is called to increment the vnode and therefore the
* referred inode's counter.
/*===========================================================================*
* put_vnode *
*===========================================================================*/
-PUBLIC void put_vnode(struct vnode *vp)
+void put_vnode(struct vnode *vp)
{
/* Decrease vnode's usage counter and decrease inode's usage counter in the
* corresponding FS process. Decreasing the fs_count each time we decrease the
/*===========================================================================*
* vnode_clean_refs *
*===========================================================================*/
-PUBLIC void vnode_clean_refs(struct vnode *vp)
+void vnode_clean_refs(struct vnode *vp)
{
/* Tell the underlying FS to drop all reference but one. */
/*===========================================================================*
* check_vrefs *
*===========================================================================*/
-PUBLIC int check_vrefs()
+int check_vrefs()
{
int i, bad;
int ispipe_flag, ispipe_mode;
#include "job.h"
#include <assert.h>
-FORWARD void append_job(struct job *job, void *(*func)(void *arg));
-FORWARD void get_work(struct worker_thread *worker);
-FORWARD void *worker_main(void *arg);
-FORWARD void worker_sleep(struct worker_thread *worker);
-FORWARD void worker_wake(struct worker_thread *worker);
-FORWARD int worker_waiting_for(struct worker_thread *worker, endpoint_t
+static void append_job(struct job *job, void *(*func)(void *arg));
+static void get_work(struct worker_thread *worker);
+static void *worker_main(void *arg);
+static void worker_sleep(struct worker_thread *worker);
+static void worker_wake(struct worker_thread *worker);
+static int worker_waiting_for(struct worker_thread *worker, endpoint_t
proc_e);
-PRIVATE int init = 0;
-PRIVATE mthread_attr_t tattr;
+static int init = 0;
+static mthread_attr_t tattr;
#ifdef MKCOVERAGE
# define TH_STACKSIZE (10 * 1024)
/*===========================================================================*
* worker_init *
*===========================================================================*/
-PUBLIC void worker_init(struct worker_thread *wp)
+void worker_init(struct worker_thread *wp)
{
/* Initialize worker thread */
if (!init) {
/*===========================================================================*
* get_work *
*===========================================================================*/
-PRIVATE void get_work(struct worker_thread *worker)
+static void get_work(struct worker_thread *worker)
{
/* Find new work to do. Work can be 'queued', 'pending', or absent. In the
* latter case wait for new work to come in. */
/*===========================================================================*
* worker_available *
*===========================================================================*/
-PUBLIC int worker_available(void)
+int worker_available(void)
{
int busy, i;
/*===========================================================================*
* worker_main *
*===========================================================================*/
-PRIVATE void *worker_main(void *arg)
+static void *worker_main(void *arg)
{
/* Worker thread main loop */
struct worker_thread *me;
/*===========================================================================*
* dl_worker_start *
*===========================================================================*/
-PUBLIC void dl_worker_start(void *(*func)(void *arg))
+void dl_worker_start(void *(*func)(void *arg))
{
/* Start the deadlock resolving worker. This worker is reserved to run in case
* all other workers are busy and we have to have an additional worker to come
/*===========================================================================*
* sys_worker_start *
*===========================================================================*/
-PUBLIC void sys_worker_start(void *(*func)(void *arg))
+void sys_worker_start(void *(*func)(void *arg))
{
/* Carry out work for the system (i.e., kernel or PM). If this thread is idle
* do it right away, else create new job and append it to the queue. */
/*===========================================================================*
* append_job *
*===========================================================================*/
-PRIVATE void append_job(struct job *job, void *(*func)(void *arg))
+static void append_job(struct job *job, void *(*func)(void *arg))
{
/* Append a job */
/*===========================================================================*
* worker_start *
*===========================================================================*/
-PUBLIC void worker_start(void *(*func)(void *arg))
+void worker_start(void *(*func)(void *arg))
{
/* Find an available worker or wait for one */
int i;
/*===========================================================================*
* worker_sleep *
*===========================================================================*/
-PRIVATE void worker_sleep(struct worker_thread *worker)
+static void worker_sleep(struct worker_thread *worker)
{
ASSERTW(worker);
assert(self == worker);
/*===========================================================================*
* worker_wake *
*===========================================================================*/
-PRIVATE void worker_wake(struct worker_thread *worker)
+static void worker_wake(struct worker_thread *worker)
{
/* Signal a worker to wake up */
ASSERTW(worker);
/*===========================================================================*
* worker_wait *
*===========================================================================*/
-PUBLIC void worker_wait(void)
+void worker_wait(void)
{
struct worker_thread *worker;
/*===========================================================================*
* worker_signal *
*===========================================================================*/
-PUBLIC void worker_signal(struct worker_thread *worker)
+void worker_signal(struct worker_thread *worker)
{
ASSERTW(worker); /* Make sure we have a valid thread */
worker_wake(worker);
/*===========================================================================*
* worker_stop *
*===========================================================================*/
-PUBLIC void worker_stop(struct worker_thread *worker)
+void worker_stop(struct worker_thread *worker)
{
ASSERTW(worker); /* Make sure we have a valid thread */
if (worker->w_job.j_fp)
/*===========================================================================*
* worker_stop_by_endpt *
*===========================================================================*/
-PUBLIC void worker_stop_by_endpt(endpoint_t proc_e)
+void worker_stop_by_endpt(endpoint_t proc_e)
{
struct worker_thread *worker;
int i;
/*===========================================================================*
* worker_self *
*===========================================================================*/
-PUBLIC struct worker_thread *worker_self(void)
+struct worker_thread *worker_self(void)
{
struct worker_thread *worker;
worker = worker_get(mthread_self());
/*===========================================================================*
* worker_get *
*===========================================================================*/
-PUBLIC struct worker_thread *worker_get(thread_t worker_tid)
+struct worker_thread *worker_get(thread_t worker_tid)
{
int i;
struct worker_thread *worker;
/*===========================================================================*
* worker_getjob *
*===========================================================================*/
-PUBLIC struct job *worker_getjob(thread_t worker_tid)
+struct job *worker_getjob(thread_t worker_tid)
{
struct worker_thread *worker;
/*===========================================================================*
* worker_waiting_for *
*===========================================================================*/
-PRIVATE int worker_waiting_for(struct worker_thread *worker, endpoint_t proc_e)
+static int worker_waiting_for(struct worker_thread *worker, endpoint_t proc_e)
{
ASSERTW(worker); /* Make sure we have a valid thread */
/*===========================================================================*
* do_write *
*===========================================================================*/
-PUBLIC int do_write()
+int do_write()
{
/* Perform the write(fd, buffer, nbytes) system call. */
return(do_read_write(WRITING));
addr_avl addravl;
/* Used for sanity check. */
-PRIVATE phys_bytes mem_low, mem_high;
+static phys_bytes mem_low, mem_high;
struct hole {
struct hole *h_next; /* pointer to next entry on the list */
#define _NR_HOLES (_NR_PROCS*2) /* No. of memory holes maintained by VM */
-PRIVATE struct hole hole[_NR_HOLES];
+static struct hole hole[_NR_HOLES];
-PRIVATE struct hole *hole_head; /* pointer to first hole */
-PRIVATE struct hole *free_slots;/* ptr to list of unused table slots */
+static struct hole *hole_head; /* pointer to first hole */
+static struct hole *free_slots;/* ptr to list of unused table slots */
-FORWARD void del_slot(struct hole *prev_ptr, struct hole *hp);
-FORWARD void merge(struct hole *hp);
-FORWARD void free_pages(phys_bytes addr, int pages);
-FORWARD phys_bytes alloc_pages(int pages, int flags, phys_bytes *ret);
+static void del_slot(struct hole *prev_ptr, struct hole *hp);
+static void merge(struct hole *hp);
+static void free_pages(phys_bytes addr, int pages);
+static phys_bytes alloc_pages(int pages, int flags, phys_bytes *ret);
#if SANITYCHECKS
-FORWARD void holes_sanity_f(char *fn, int line);
+static void holes_sanity_f(char *fn, int line);
#define CHECKHOLES holes_sanity_f(__FILE__, __LINE__)
#define PAGESPERGB (1024*1024*1024/VM_PAGE_SIZE) /* 1GB of memory */
#define MAXPAGES (2*PAGESPERGB)
#define CHUNKS BITMAP_CHUNKS(MAXPAGES)
-PRIVATE bitchunk_t pagemap[CHUNKS];
+static bitchunk_t pagemap[CHUNKS];
#else
#define CHECKHOLES
/*===========================================================================*
* holes_sanity_f *
*===========================================================================*/
-PRIVATE void holes_sanity_f(file, line)
+static void holes_sanity_f(file, line)
char *file;
int line;
{
/*===========================================================================*
* alloc_mem *
*===========================================================================*/
-PUBLIC phys_clicks alloc_mem(phys_clicks clicks, u32_t memflags)
+phys_clicks alloc_mem(phys_clicks clicks, u32_t memflags)
{
/* Allocate a block of memory from the free list using first fit. The block
* consists of a sequence of contiguous bytes, whose length in clicks is
/*===========================================================================*
* free_mem *
*===========================================================================*/
-PUBLIC void free_mem(phys_clicks base, phys_clicks clicks)
+void free_mem(phys_clicks base, phys_clicks clicks)
{
/* Return a block of free memory to the hole list. The parameters tell where
* the block starts in physical memory and how big it is. The block is added
/*===========================================================================*
* del_slot *
*===========================================================================*/
-PRIVATE void del_slot(prev_ptr, hp)
+static void del_slot(prev_ptr, hp)
/* pointer to hole entry just ahead of 'hp' */
register struct hole *prev_ptr;
/* pointer to hole entry to be removed */
/*===========================================================================*
* merge *
*===========================================================================*/
-PRIVATE void merge(hp)
+static void merge(hp)
register struct hole *hp; /* ptr to hole to merge with its successors */
{
/* Check for contiguous holes and merge any found. Contiguous holes can occur
/*===========================================================================*
* mem_init *
*===========================================================================*/
-PUBLIC void mem_init(chunks)
+void mem_init(chunks)
struct memory *chunks; /* list of free memory chunks */
{
/* Initialize hole lists. There are two lists: 'hole_head' points to a linked
}
#if SANITYCHECKS
-PRIVATE void sanitycheck(void)
+static void sanitycheck(void)
{
pagerange_t *p, *prevp = NULL;
addr_iter iter;
}
#endif
-PUBLIC void memstats(int *nodes, int *pages, int *largest)
+void memstats(int *nodes, int *pages, int *largest)
{
pagerange_t *p;
addr_iter iter;
/*===========================================================================*
* alloc_pages *
*===========================================================================*/
-PRIVATE PUBLIC phys_bytes alloc_pages(int pages, int memflags, phys_bytes *len)
+static phys_bytes alloc_pages(int pages, int memflags, phys_bytes *len)
{
addr_iter iter;
pagerange_t *pr;
/*===========================================================================*
* free_pages *
*===========================================================================*/
-PRIVATE void free_pages(phys_bytes pageno, int npages)
+static void free_pages(phys_bytes pageno, int npages)
{
pagerange_t *pr, *p;
addr_iter iter;
#define NR_DMA 16
-PRIVATE struct dmatab
+static struct dmatab
{
int dt_flags;
endpoint_t dt_proc;
/*===========================================================================*
* do_adddma *
*===========================================================================*/
-PUBLIC int do_adddma(message *msg)
+int do_adddma(message *msg)
{
endpoint_t target_proc_e;
int i, proc_n;
/*===========================================================================*
* do_deldma *
*===========================================================================*/
-PUBLIC int do_deldma(message *msg)
+int do_deldma(message *msg)
{
endpoint_t target_proc_e;
int i, j;
/*===========================================================================*
* do_getdma *
*===========================================================================*/
-PUBLIC int do_getdma(message *msg)
+int do_getdma(message *msg)
{
int i;
/*===========================================================================*
* release_dma *
*===========================================================================*/
-PUBLIC void release_dma(struct vmproc *vmp)
+void release_dma(struct vmproc *vmp)
{
#if 0
int i, found_one;
/* Free PDE slots we tell kernel about */
#define FREE_PDES 2
-PRIVATE int first_free_pde = -1;
+static int first_free_pde = -1;
/* PDE used to map in kernel, kernel physical address. */
-PRIVATE int id_map_high_pde = -1, pagedir_pde = -1;
-PRIVATE u32_t global_bit = 0, pagedir_pde_val;
+static int id_map_high_pde = -1, pagedir_pde = -1;
+static u32_t global_bit = 0, pagedir_pde_val;
-PRIVATE int proc_pde = 0;
+static int proc_pde = 0;
/* 4MB page size available in hardware? */
-PRIVATE int bigpage_ok = 0;
+static int bigpage_ok = 0;
/* Our process table entry. */
struct vmproc *vmprocess = &vmproc[VM_PROC_NR];
*/
#define SPAREPAGES 25
int missing_spares = SPAREPAGES;
-PRIVATE struct {
+static struct {
void *page;
phys_bytes phys;
} sparepages[SPAREPAGES];
#define MAX_KERNMAPPINGS 10
-PRIVATE struct {
+static struct {
phys_bytes phys_addr; /* Physical addr. */
phys_bytes len; /* Length in bytes. */
vir_bytes lin_addr; /* Offset in page table. */
#define STATIC_SPAREPAGES 10
-PRIVATE char static_sparepages[I386_PAGE_SIZE*STATIC_SPAREPAGES + I386_PAGE_SIZE];
+static char static_sparepages[I386_PAGE_SIZE*STATIC_SPAREPAGES + I386_PAGE_SIZE];
#if SANITYCHECKS
/*===========================================================================*
* pt_sanitycheck *
*===========================================================================*/
-PUBLIC void pt_sanitycheck(pt_t *pt, char *file, int line)
+void pt_sanitycheck(pt_t *pt, char *file, int line)
{
/* Basic pt sanity check. */
int i;
/*===========================================================================*
* findhole *
*===========================================================================*/
-PRIVATE u32_t findhole(pt_t *pt, u32_t vmin, u32_t vmax)
+static u32_t findhole(pt_t *pt, u32_t vmin, u32_t vmax)
{
/* Find a space in the virtual address space of pageteble 'pt',
* between page-aligned BYTE offsets vmin and vmax, to fit
/*===========================================================================*
* vm_freepages *
*===========================================================================*/
-PRIVATE void vm_freepages(vir_bytes vir, vir_bytes phys, int pages, int reason)
+static void vm_freepages(vir_bytes vir, vir_bytes phys, int pages, int reason)
{
assert(reason >= 0 && reason < VMP_CATEGORIES);
if(vir >= vmprocess->vm_stacktop) {
/*===========================================================================*
* vm_getsparepage *
*===========================================================================*/
-PRIVATE void *vm_getsparepage(phys_bytes *phys)
+static void *vm_getsparepage(phys_bytes *phys)
{
int s;
assert(missing_spares >= 0 && missing_spares <= SPAREPAGES);
/*===========================================================================*
* vm_checkspares *
*===========================================================================*/
-PRIVATE void *vm_checkspares(void)
+static void *vm_checkspares(void)
{
int s, n = 0;
static int total = 0, worst = 0;
/*===========================================================================*
* vm_allocpage *
*===========================================================================*/
-PUBLIC void *vm_allocpage(phys_bytes *phys, int reason)
+void *vm_allocpage(phys_bytes *phys, int reason)
{
/* Allocate a page for use by VM itself. */
phys_bytes newpage;
/*===========================================================================*
* vm_pagelock *
*===========================================================================*/
-PUBLIC void vm_pagelock(void *vir, int lockflag)
+void vm_pagelock(void *vir, int lockflag)
{
/* Mark a page allocated by vm_allocpage() unwritable, i.e. only for VM. */
vir_bytes m;
/*===========================================================================*
* vm_addrok *
*===========================================================================*/
-PUBLIC int vm_addrok(void *vir, int writeflag)
+int vm_addrok(void *vir, int writeflag)
{
/* Mark a page allocated by vm_allocpage() unwritable, i.e. only for VM. */
pt_t *pt = &vmprocess->vm_pt;
/*===========================================================================*
* pt_ptalloc *
*===========================================================================*/
-PRIVATE int pt_ptalloc(pt_t *pt, int pde, u32_t flags)
+static int pt_ptalloc(pt_t *pt, int pde, u32_t flags)
{
/* Allocate a page table and write its address into the page directory. */
int i;
/*===========================================================================*
* pt_ptalloc_in_range *
*===========================================================================*/
-PUBLIC int pt_ptalloc_in_range(pt_t *pt, vir_bytes start, vir_bytes end,
+int pt_ptalloc_in_range(pt_t *pt, vir_bytes start, vir_bytes end,
u32_t flags, int verify)
{
/* Allocate all the page tables in the range specified. */
return OK;
}
-PRIVATE char *ptestr(u32_t pte)
+static char *ptestr(u32_t pte)
{
#define FLAG(constant, name) { \
if(pte & (constant)) { strcat(str, name); strcat(str, " "); } \
/*===========================================================================*
* pt_map_in_range *
*===========================================================================*/
-PUBLIC int pt_map_in_range(struct vmproc *src_vmp, struct vmproc *dst_vmp,
+int pt_map_in_range(struct vmproc *src_vmp, struct vmproc *dst_vmp,
vir_bytes start, vir_bytes end)
{
/* Transfer all the mappings from the pt of the source process to the pt of
/*===========================================================================*
* pt_ptmap *
*===========================================================================*/
-PUBLIC int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
+int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
{
/* Transfer mappings to page dir and page tables from source process and
* destination process. Make sure all the mappings are above the stack, not
return OK;
}
-PUBLIC void pt_clearmapcache(void)
+void pt_clearmapcache(void)
{
int f;
/* Make sure kernel will invalidate tlb when using current
/*===========================================================================*
* pt_writemap *
*===========================================================================*/
-PUBLIC int pt_writemap(struct vmproc * vmp,
+int pt_writemap(struct vmproc * vmp,
pt_t *pt,
vir_bytes v,
phys_bytes physaddr,
/*===========================================================================*
* pt_checkrange *
*===========================================================================*/
-PUBLIC int pt_checkrange(pt_t *pt, vir_bytes v, size_t bytes,
+int pt_checkrange(pt_t *pt, vir_bytes v, size_t bytes,
int write)
{
int p, pages;
/*===========================================================================*
* pt_new *
*===========================================================================*/
-PUBLIC int pt_new(pt_t *pt)
+int pt_new(pt_t *pt)
{
/* Allocate a pagetable root. On i386, allocate a page-aligned page directory
* and set them to 0 (indicating no page tables are allocated). Lookup
/*===========================================================================*
* pt_init *
*===========================================================================*/
-PUBLIC void pt_init(phys_bytes usedlimit)
+void pt_init(phys_bytes usedlimit)
{
/* By default, the kernel gives us a data segment with pre-allocated
* memory that then can't grow. We want to be able to allocate memory
/*===========================================================================*
* pt_init_mem *
*===========================================================================*/
-PUBLIC void pt_init_mem()
+void pt_init_mem()
{
/* Architecture-specific memory initialization. Make sure all the pages
* shared with the kernel and VM's page tables are mapped above the stack,
/*===========================================================================*
* pt_bind *
*===========================================================================*/
-PUBLIC int pt_bind(pt_t *pt, struct vmproc *who)
+int pt_bind(pt_t *pt, struct vmproc *who)
{
int slot;
u32_t phys;
/*===========================================================================*
* pt_free *
*===========================================================================*/
-PUBLIC void pt_free(pt_t *pt)
+void pt_free(pt_t *pt)
{
/* Free memory associated with this pagetable. */
int i;
/*===========================================================================*
* pt_mapkernel *
*===========================================================================*/
-PUBLIC int pt_mapkernel(pt_t *pt)
+int pt_mapkernel(pt_t *pt)
{
int i;
/*===========================================================================*
* pt_cycle *
*===========================================================================*/
-PUBLIC void pt_cycle(void)
+void pt_cycle(void)
{
vm_checkspares();
}
/*===========================================================================*
* arch_map2vir *
*===========================================================================*/
-PUBLIC vir_bytes arch_map2vir(struct vmproc *vmp, vir_bytes addr)
+vir_bytes arch_map2vir(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
vir_bytes datastart = CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys);
/*===========================================================================*
* arch_map2str *
*===========================================================================*/
-PUBLIC char *arch_map2str(struct vmproc *vmp, vir_bytes addr)
+char *arch_map2str(struct vmproc *vmp, vir_bytes addr)
{
static char bufstr[100];
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
/*===========================================================================*
* arch_map2info *
*===========================================================================*/
-PUBLIC vir_bytes arch_map2info(struct vmproc *vmp, vir_bytes addr, int *seg,
+vir_bytes arch_map2info(struct vmproc *vmp, vir_bytes addr, int *seg,
int *prot)
{
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
/*===========================================================================*
* arch_addrok *
*===========================================================================*/
-PUBLIC vir_bytes arch_addrok(struct vmproc *vmp, vir_bytes addr)
+vir_bytes arch_addrok(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
vir_bytes textend = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys +
/*===========================================================================*
* arch_vir2map *
*===========================================================================*/
-PUBLIC vir_bytes arch_vir2map(struct vmproc *vmp, vir_bytes addr)
+vir_bytes arch_vir2map(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes datasegbase = CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys -
vmp->vm_arch.vm_seg[D].mem_vir);
/*===========================================================================*
* arch_vir2map_text *
*===========================================================================*/
-PUBLIC vir_bytes arch_vir2map_text(struct vmproc *vmp, vir_bytes addr)
+vir_bytes arch_vir2map_text(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes textsegbase = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys -
vmp->vm_arch.vm_seg[T].mem_vir);
/*===========================================================================*
* do_brk *
*===========================================================================*/
-PUBLIC int do_brk(message *msg)
+int do_brk(message *msg)
{
/* Perform the brk(addr) system call.
* The parameter, 'addr' is the new virtual address in D space.
/*===========================================================================*
* adjust *
*===========================================================================*/
-PUBLIC int adjust(rmp, data_clicks, sp)
+int adjust(rmp, data_clicks, sp)
struct vmproc *rmp; /* whose memory is being adjusted? */
vir_clicks data_clicks; /* how big is data segment to become? */
vir_bytes sp; /* new value of sp */
/*===========================================================================*
* real_brk *
*===========================================================================*/
-PUBLIC int real_brk(vmp, v)
+int real_brk(vmp, v)
struct vmproc *vmp;
vir_bytes v;
{
#include "memory.h"
-FORWARD int new_mem(struct vmproc *vmp, vir_bytes text_addr, vir_bytes
+static int new_mem(struct vmproc *vmp, vir_bytes text_addr, vir_bytes
text_bytes, vir_bytes data_addr, vir_bytes data_bytes, vir_bytes
stk_bytes, phys_bytes tot_bytes, vir_bytes *stack_top, int is_elf);
/*===========================================================================*
* exec_newmem *
*===========================================================================*/
-PUBLIC int do_exec_newmem(message *msg)
+int do_exec_newmem(message *msg)
{
int r, proc_e, proc_n;
vir_bytes stack_top;
/*===========================================================================*
* new_mem *
*===========================================================================*/
-PRIVATE int new_mem(
+static int new_mem(
struct vmproc *rmp, /* process to get a new memory map */
vir_bytes text_addr, /* text segement load address */
vir_bytes text_bytes, /* text segment size in bytes */
/*===========================================================================*
* find_kernel_top *
*===========================================================================*/
-PUBLIC phys_bytes find_kernel_top(void)
+phys_bytes find_kernel_top(void)
{
/* Find out where the kernel is, so we know where to start mapping
* user processes.
/*===========================================================================*
* proc_new *
*===========================================================================*/
-PUBLIC int proc_new(struct vmproc *vmp,
+int proc_new(struct vmproc *vmp,
phys_bytes vstart, /* where to start the process in page table */
phys_bytes text_addr, /* address at which to load code */
phys_bytes text_bytes, /* how much code, in bytes but page aligned */
#include "util.h"
#include "sanitycheck.h"
-PUBLIC void free_proc(struct vmproc *vmp)
+void free_proc(struct vmproc *vmp)
{
map_free_proc(vmp);
if(vmp->vm_flags & VMF_HASPT) {
#endif
}
-PUBLIC void clear_proc(struct vmproc *vmp)
+void clear_proc(struct vmproc *vmp)
{
region_init(&vmp->vm_regions_avl);
vmp->vm_region_top = 0;
/*===========================================================================*
* do_exit *
*===========================================================================*/
-PUBLIC int do_exit(message *msg)
+int do_exit(message *msg)
{
int proc;
struct vmproc *vmp;
/*===========================================================================*
* do_willexit *
*===========================================================================*/
-PUBLIC int do_willexit(message *msg)
+int do_willexit(message *msg)
{
int proc;
struct vmproc *vmp;
/*===========================================================================*
* do_fork *
*===========================================================================*/
-PUBLIC int do_fork(message *msg)
+int do_fork(message *msg)
{
int r, proc, childproc, fullvm;
struct vmproc *vmp, *vmc;
(c) < VM_RQ_BASE + ELEMENTS(vm_calls)) ? \
((c) - VM_RQ_BASE) : -1)
-FORWARD int map_service(struct rprocpub *rpub);
-FORWARD int vm_acl_ok(endpoint_t caller, int call);
+static int map_service(struct rprocpub *rpub);
+static int vm_acl_ok(endpoint_t caller, int call);
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
-FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
-FORWARD void sef_cb_signal_handler(int signo);
+static void sef_local_startup(void);
+static int sef_cb_init_fresh(int type, sef_init_info_t *info);
+static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC int main(void)
+int main(void)
{
message msg;
int result, who_e, rcv_sts;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the vm server. */
int s, i;
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
-PRIVATE void sef_cb_signal_handler(int signo)
+static void sef_cb_signal_handler(int signo)
{
/* Check for known kernel signals, ignore anything else. */
switch(signo) {
/*===========================================================================*
* map_service *
*===========================================================================*/
-PRIVATE int map_service(rpub)
+static int map_service(rpub)
struct rprocpub *rpub;
{
/* Map a new service by initializing its call mask. */
/*===========================================================================*
* vm_acl_ok *
*===========================================================================*/
-PRIVATE int vm_acl_ok(endpoint_t caller, int call)
+static int vm_acl_ok(endpoint_t caller, int call)
{
int n, r;
/*===========================================================================*
* do_mmap *
*===========================================================================*/
-PUBLIC int do_mmap(message *m)
+int do_mmap(message *m)
{
int r, n;
struct vmproc *vmp;
/*===========================================================================*
* map_perm_check *
*===========================================================================*/
-PUBLIC int map_perm_check(endpoint_t caller, endpoint_t target,
+int map_perm_check(endpoint_t caller, endpoint_t target,
phys_bytes physaddr, phys_bytes len)
{
int r;
/*===========================================================================*
* do_map_phys *
*===========================================================================*/
-PUBLIC int do_map_phys(message *m)
+int do_map_phys(message *m)
{
int r, n;
struct vmproc *vmp;
/*===========================================================================*
* do_unmap_phys *
*===========================================================================*/
-PUBLIC int do_unmap_phys(message *m)
+int do_unmap_phys(message *m)
{
int r, n;
struct vmproc *vmp;
/*===========================================================================*
* do_remap *
*===========================================================================*/
-PUBLIC int do_remap(message *m)
+int do_remap(message *m)
{
int dn, sn;
vir_bytes da, sa, startv;
/*===========================================================================*
* do_shared_unmap *
*===========================================================================*/
-PUBLIC int do_shared_unmap(message *m)
+int do_shared_unmap(message *m)
{
int r, n;
struct vmproc *vmp;
/*===========================================================================*
* do_get_phys *
*===========================================================================*/
-PUBLIC int do_get_phys(message *m)
+int do_get_phys(message *m)
{
int r, n;
struct vmproc *vmp;
/*===========================================================================*
* do_get_refcount *
*===========================================================================*/
-PUBLIC int do_get_refcount(message *m)
+int do_get_refcount(message *m)
{
int r, n;
struct vmproc *vmp;
/*===========================================================================*
* do_munmap *
*===========================================================================*/
-PUBLIC int do_munmap(message *m)
+int do_munmap(message *m)
{
int r, n;
struct vmproc *vmp;
/*===========================================================================*
* munmap_lin (used for overrides for VM) *
*===========================================================================*/
-PRIVATE int munmap_lin(vir_bytes addr, size_t len)
+static int munmap_lin(vir_bytes addr, size_t len)
{
if(addr % VM_PAGE_SIZE) {
printf("munmap_lin: offset not page aligned\n");
/*===========================================================================*
* munmap (override for VM) *
*===========================================================================*/
-PUBLIC int minix_munmap(void *addr, size_t len)
+int minix_munmap(void *addr, size_t len)
{
vir_bytes laddr;
if(!unmap_ok)
/*===========================================================================*
* munmap_text (override for VM) *
*===========================================================================*/
-PUBLIC int minix_munmap_text(void *addr, size_t len)
+int minix_munmap_text(void *addr, size_t len)
{
vir_bytes laddr;
if(!unmap_ok)
/*===========================================================================*
* do_pagefaults *
*===========================================================================*/
-PUBLIC void do_pagefaults(message *m)
+void do_pagefaults(message *m)
{
endpoint_t ep = m->m_source;
u32_t addr = m->VPF_ADDR;
/*===========================================================================*
* do_memory *
*===========================================================================*/
-PUBLIC void do_memory(void)
+void do_memory(void)
{
endpoint_t who, who_s, requestor;
vir_bytes mem, mem_s;
/*===========================================================================*
* do_query_exit *
*===========================================================================*/
-PUBLIC int do_query_exit(message *m)
+int do_query_exit(message *m)
{
int i, nr;
endpoint_t ep = NONE;
/*===========================================================================*
* do_notify_sig *
*===========================================================================*/
-PUBLIC int do_notify_sig(message *m)
+int do_notify_sig(message *m)
{
int i, avails = 0;
endpoint_t ep = m->VM_NOTIFY_SIG_ENDPOINT;
/*===========================================================================*
* do_watch_exit *
*===========================================================================*/
-PUBLIC int do_watch_exit(message *m)
+int do_watch_exit(message *m)
{
endpoint_t e = m->VM_WE_EP;
struct vmproc *vmp;
/*===========================================================================*
* init_query_exit *
*===========================================================================*/
-PUBLIC void init_query_exit(void)
+void init_query_exit(void)
{
int i;
#include "memlist.h"
/* LRU list. */
-PRIVATE yielded_t *lru_youngest = NULL, *lru_oldest = NULL;
+static yielded_t *lru_youngest = NULL, *lru_oldest = NULL;
/* Should a physblock be mapped writable? */
#define WRITABLE(r, pb) \
(((r)->flags & (VR_DIRECT | VR_SHARED)) || \
(pb)->refcount == 1))
-FORWARD int map_new_physblock(struct vmproc *vmp, struct vir_region
+static int map_new_physblock(struct vmproc *vmp, struct vir_region
*region, vir_bytes offset, vir_bytes length, phys_bytes what, u32_t
allocflags, int written);
-FORWARD int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
+static int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
struct phys_region *pr);
-FORWARD phys_bytes freeyieldednode(yielded_t *node, int freemem);
+static phys_bytes freeyieldednode(yielded_t *node, int freemem);
-FORWARD struct vir_region *map_copy_region(struct vmproc *vmp, struct
+static struct vir_region *map_copy_region(struct vmproc *vmp, struct
vir_region *vr);
-FORWARD struct phys_region *map_clone_ph_block(struct vmproc *vmp,
+static struct phys_region *map_clone_ph_block(struct vmproc *vmp,
struct vir_region *region, struct phys_region *ph, physr_iter *iter);
#if SANITYCHECKS
-FORWARD void lrucheck(void);
+static void lrucheck(void);
#endif
/* hash table of yielded blocks */
#define YIELD_HASHSIZE 65536
-PRIVATE yielded_avl vm_yielded_blocks[YIELD_HASHSIZE];
+static yielded_avl vm_yielded_blocks[YIELD_HASHSIZE];
-PRIVATE int avl_inited = 0;
+static int avl_inited = 0;
-PUBLIC void map_region_init(void)
+void map_region_init(void)
{
int h;
assert(!avl_inited);
avl_inited = 1;
}
-PRIVATE yielded_avl *get_yielded_avl(block_id_t id)
+static yielded_avl *get_yielded_avl(block_id_t id)
{
u32_t h;
return &vm_yielded_blocks[h];
}
-PRIVATE char *map_name(struct vir_region *vr)
+static char *map_name(struct vir_region *vr)
{
static char name[100];
char *typename, *tag;
return name;
}
-PUBLIC void map_printregion(struct vmproc *vmp, struct vir_region *vr)
+void map_printregion(struct vmproc *vmp, struct vir_region *vr)
{
physr_iter iter;
struct phys_region *ph;
/*===========================================================================*
* map_printmap *
*===========================================================================*/
-PUBLIC void map_printmap(vmp)
+void map_printmap(vmp)
struct vmproc *vmp;
{
struct vir_region *vr;
}
}
-PRIVATE struct vir_region *getnextvr(struct vir_region *vr)
+static struct vir_region *getnextvr(struct vir_region *vr)
{
struct vir_region *nextvr;
region_iter v_iter;
/*===========================================================================*
* map_sanitycheck_pt *
*===========================================================================*/
-PRIVATE int map_sanitycheck_pt(struct vmproc *vmp,
+static int map_sanitycheck_pt(struct vmproc *vmp,
struct vir_region *vr, struct phys_region *pr)
{
struct phys_block *pb = pr->ph;
/*===========================================================================*
* map_sanitycheck *
*===========================================================================*/
-PUBLIC void map_sanitycheck(char *file, int line)
+void map_sanitycheck(char *file, int line)
{
struct vmproc *vmp;
#define LRUCHECK lrucheck()
-PRIVATE void lrucheck(void)
+static void lrucheck(void)
{
yielded_t *list;
/*=========================================================================*
* map_ph_writept *
*=========================================================================*/
-PRIVATE int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
+static int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
struct phys_region *pr)
{
int rw;
/*===========================================================================*
* region_find_slot_range *
*===========================================================================*/
-PRIVATE vir_bytes region_find_slot_range(struct vmproc *vmp,
+static vir_bytes region_find_slot_range(struct vmproc *vmp,
vir_bytes minv, vir_bytes maxv, vir_bytes length)
{
struct vir_region *firstregion;
/*===========================================================================*
* region_find_slot *
*===========================================================================*/
-PRIVATE vir_bytes region_find_slot(struct vmproc *vmp,
+static vir_bytes region_find_slot(struct vmproc *vmp,
vir_bytes minv, vir_bytes maxv, vir_bytes length)
{
vir_bytes v, hint = vmp->vm_region_top;
/*===========================================================================*
* map_page_region *
*===========================================================================*/
-PUBLIC struct vir_region *map_page_region(vmp, minv, maxv, length,
+struct vir_region *map_page_region(vmp, minv, maxv, length,
what, flags, mapflags)
struct vmproc *vmp;
vir_bytes minv;
/*===========================================================================*
* pb_unreferenced *
*===========================================================================*/
-PUBLIC void pb_unreferenced(struct vir_region *region, struct phys_region *pr)
+void pb_unreferenced(struct vir_region *region, struct phys_region *pr)
{
struct phys_block *pb;
}
}
-PRIVATE struct phys_region *reset_physr_iter(struct vir_region *region,
+static struct phys_region *reset_physr_iter(struct vir_region *region,
physr_iter *iter, vir_bytes offset)
{
struct phys_region *ph;
/*===========================================================================*
* map_subfree *
*===========================================================================*/
-PRIVATE int map_subfree(struct vmproc *vmp,
+static int map_subfree(struct vmproc *vmp,
struct vir_region *region, vir_bytes len)
{
struct phys_region *pr;
/*===========================================================================*
* map_free *
*===========================================================================*/
-PRIVATE int map_free(struct vmproc *vmp, struct vir_region *region)
+static int map_free(struct vmproc *vmp, struct vir_region *region)
{
int r;
/*===========================================================================*
* yielded_block_cmp *
*===========================================================================*/
-PUBLIC int yielded_block_cmp(struct block_id *id1, struct block_id *id2)
+int yielded_block_cmp(struct block_id *id1, struct block_id *id2)
{
if(id1->owner < id2->owner)
return -1;
/*===========================================================================*
* free_yielded_proc *
*===========================================================================*/
-PRIVATE vir_bytes free_yielded_proc(struct vmproc *vmp)
+static vir_bytes free_yielded_proc(struct vmproc *vmp)
{
vir_bytes total = 0;
int h;
}
-PRIVATE phys_bytes freeyieldednode(yielded_t *node, int freemem)
+static phys_bytes freeyieldednode(yielded_t *node, int freemem)
{
yielded_t *older, *younger, *removed;
vir_bytes len;
/*========================================================================*
* free_yielded *
*========================================================================*/
-PUBLIC vir_bytes free_yielded(vir_bytes max_bytes)
+vir_bytes free_yielded(vir_bytes max_bytes)
{
/* PRIVATE yielded_t *lru_youngest = NULL, *lru_oldest = NULL; */
/*========================================================================*
* map_free_proc *
*========================================================================*/
-PUBLIC int map_free_proc(vmp)
+int map_free_proc(vmp)
struct vmproc *vmp;
{
struct vir_region *r;
/*===========================================================================*
* map_lookup *
*===========================================================================*/
-PUBLIC struct vir_region *map_lookup(vmp, offset)
+struct vir_region *map_lookup(vmp, offset)
struct vmproc *vmp;
vir_bytes offset;
{
return NULL;
}
-PRIVATE u32_t vrallocflags(u32_t flags)
+static u32_t vrallocflags(u32_t flags)
{
u32_t allocflags = 0;
/*===========================================================================*
* map_new_physblock *
*===========================================================================*/
-PRIVATE int map_new_physblock(vmp, region, start_offset, length,
+static int map_new_physblock(vmp, region, start_offset, length,
what_mem, allocflags, written)
struct vmproc *vmp;
struct vir_region *region;
/*===========================================================================*
* map_clone_ph_block *
*===========================================================================*/
-PRIVATE struct phys_region *map_clone_ph_block(vmp, region, ph, iter)
+static struct phys_region *map_clone_ph_block(vmp, region, ph, iter)
struct vmproc *vmp;
struct vir_region *region;
struct phys_region *ph;
/*===========================================================================*
* map_pf *
*===========================================================================*/
-PUBLIC int map_pf(vmp, region, offset, write)
+int map_pf(vmp, region, offset, write)
struct vmproc *vmp;
struct vir_region *region;
vir_bytes offset;
/*===========================================================================*
* map_pin_memory *
*===========================================================================*/
-PUBLIC int map_pin_memory(struct vmproc *vmp)
+int map_pin_memory(struct vmproc *vmp)
{
struct vir_region *vr;
int r;
/*===========================================================================*
* map_handle_memory *
*===========================================================================*/
-PUBLIC int map_handle_memory(vmp, region, offset, length, write)
+int map_handle_memory(vmp, region, offset, length, write)
struct vmproc *vmp;
struct vir_region *region;
vir_bytes offset, length;
/*===========================================================================*
* map_copy_region *
*===========================================================================*/
-PRIVATE struct vir_region *map_copy_region(struct vmproc *vmp, struct vir_region *vr)
+static struct vir_region *map_copy_region(struct vmproc *vmp, struct vir_region *vr)
{
/* map_copy_region creates a complete copy of the vir_region
* data structure, linking in the same phys_blocks directly,
/*===========================================================================*
* copy_abs2region *
*===========================================================================*/
-PUBLIC int copy_abs2region(phys_bytes abs, struct vir_region *destregion,
+int copy_abs2region(phys_bytes abs, struct vir_region *destregion,
phys_bytes offset, phys_bytes len)
{
/*=========================================================================*
* map_writept *
*=========================================================================*/
-PUBLIC int map_writept(struct vmproc *vmp)
+int map_writept(struct vmproc *vmp)
{
struct vir_region *vr;
struct phys_region *ph;
/*========================================================================*
* map_proc_copy *
*========================================================================*/
-PUBLIC int map_proc_copy(dst, src)
+int map_proc_copy(dst, src)
struct vmproc *dst;
struct vmproc *src;
{
/*========================================================================*
* map_proc_copy_from *
*========================================================================*/
-PUBLIC int map_proc_copy_from(dst, src, start_src_vr)
+int map_proc_copy_from(dst, src, start_src_vr)
struct vmproc *dst;
struct vmproc *src;
struct vir_region *start_src_vr;
/*========================================================================*
* map_proc_kernel *
*========================================================================*/
-PUBLIC struct vir_region *map_proc_kernel(struct vmproc *vmp)
+struct vir_region *map_proc_kernel(struct vmproc *vmp)
{
struct vir_region *vr;
/*========================================================================*
* map_region_extend *
*========================================================================*/
-PUBLIC int map_region_extend(struct vmproc *vmp, struct vir_region *vr,
+int map_region_extend(struct vmproc *vmp, struct vir_region *vr,
vir_bytes delta)
{
vir_bytes end;
/*========================================================================*
* map_region_shrink *
*========================================================================*/
-PUBLIC int map_region_shrink(struct vir_region *vr, vir_bytes delta)
+int map_region_shrink(struct vir_region *vr, vir_bytes delta)
{
assert(vr);
assert(vr->flags & VR_ANON);
return OK;
}
-PUBLIC struct vir_region *map_region_lookup_tag(vmp, tag)
+struct vir_region *map_region_lookup_tag(vmp, tag)
struct vmproc *vmp;
u32_t tag;
{
return NULL;
}
-PUBLIC void map_region_set_tag(struct vir_region *vr, u32_t tag)
+void map_region_set_tag(struct vir_region *vr, u32_t tag)
{
USE(vr, vr->tag = tag;);
}
-PUBLIC u32_t map_region_get_tag(struct vir_region *vr)
+u32_t map_region_get_tag(struct vir_region *vr)
{
return vr->tag;
}
/*========================================================================*
* map_unmap_region *
*========================================================================*/
-PUBLIC int map_unmap_region(struct vmproc *vmp, struct vir_region *r,
+int map_unmap_region(struct vmproc *vmp, struct vir_region *r,
vir_bytes len)
{
/* Shrink the region by 'len' bytes, from the start. Unreference
/*========================================================================*
* map_remap *
*========================================================================*/
-PUBLIC int map_remap(struct vmproc *dvmp, vir_bytes da, size_t size,
+int map_remap(struct vmproc *dvmp, vir_bytes da, size_t size,
struct vir_region *region, vir_bytes *r, int readonly)
{
struct vir_region *vr;
/*========================================================================*
* map_get_phys *
*========================================================================*/
-PUBLIC int map_get_phys(struct vmproc *vmp, vir_bytes addr, phys_bytes *r)
+int map_get_phys(struct vmproc *vmp, vir_bytes addr, phys_bytes *r)
{
struct vir_region *vr;
struct phys_region *ph;
/*========================================================================*
* map_get_ref *
*========================================================================*/
-PUBLIC int map_get_ref(struct vmproc *vmp, vir_bytes addr, u8_t *cnt)
+int map_get_ref(struct vmproc *vmp, vir_bytes addr, u8_t *cnt)
{
struct vir_region *vr;
struct phys_region *ph;
/*========================================================================*
* get_stats_info *
*========================================================================*/
-PUBLIC void get_stats_info(struct vm_stats_info *vsi)
+void get_stats_info(struct vm_stats_info *vsi)
{
yielded_t *yb;
/*========================================================================*
* get_usage_info *
*========================================================================*/
-PUBLIC void get_usage_info(struct vmproc *vmp, struct vm_usage_info *vui)
+void get_usage_info(struct vmproc *vmp, struct vm_usage_info *vui)
{
struct vir_region *vr;
physr_iter iter;
/*===========================================================================*
* get_region_info *
*===========================================================================*/
-PUBLIC int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
+int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
int max, vir_bytes *nextp)
{
struct vir_region *vr;
/*========================================================================*
* regionprintstats *
*========================================================================*/
-PUBLIC void printregionstats(struct vmproc *vmp)
+void printregionstats(struct vmproc *vmp)
{
struct vir_region *vr;
struct phys_region *pr;
/*===========================================================================*
* do_map_memory *
*===========================================================================*/
-PRIVATE int do_map_memory(struct vmproc *vms, struct vmproc *vmd,
+static int do_map_memory(struct vmproc *vms, struct vmproc *vmd,
struct vir_region *vrs, struct vir_region *vrd,
vir_bytes offset_s, vir_bytes offset_d,
vir_bytes length, int flag)
/*===========================================================================*
* unmap_memory *
*===========================================================================*/
-PUBLIC int unmap_memory(endpoint_t sour, endpoint_t dest,
+int unmap_memory(endpoint_t sour, endpoint_t dest,
vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag)
{
struct vmproc *vmd;
/*===========================================================================*
* split_phys *
*===========================================================================*/
-PRIVATE int split_phys(struct phys_region *pr, vir_bytes point)
+static int split_phys(struct phys_region *pr, vir_bytes point)
{
struct phys_region *newpr, *q, *prev = NULL;
struct phys_block *newpb;
/*===========================================================================*
* clean_phys_regions *
*===========================================================================*/
-PRIVATE void clean_phys_regions(struct vir_region *region,
+static void clean_phys_regions(struct vir_region *region,
vir_bytes offset, vir_bytes length)
{
/* Consider @offset as the start address and @offset+length as the end address.
/*===========================================================================*
* rm_phys_regions *
*===========================================================================*/
-PRIVATE void rm_phys_regions(struct vir_region *region,
+static void rm_phys_regions(struct vir_region *region,
vir_bytes begin, vir_bytes length)
{
/* Remove all phys regions between @begin and @begin+length.
/*===========================================================================*
* map_memory *
*===========================================================================*/
-PUBLIC int map_memory(endpoint_t sour, endpoint_t dest,
+int map_memory(endpoint_t sour, endpoint_t dest,
vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag)
{
/* This is the entry point. This function will be called by handle_memory() when
/*===========================================================================*
* get_clean_phys_region *
*===========================================================================*/
-PRIVATE struct phys_region *
+static struct phys_region *
get_clean_phys_region(struct vmproc *vmp, vir_bytes vaddr, vir_bytes length,
struct vir_region **ret_region)
{
return ph;
}
-PRIVATE int getblock(struct vmproc *vmp, u64_t id,
+static int getblock(struct vmproc *vmp, u64_t id,
vir_bytes vaddr, vir_bytes len)
{
yielded_t *yb;
return OK;
}
-PRIVATE int yieldblock(struct vmproc *vmp, u64_t id,
+static int yieldblock(struct vmproc *vmp, u64_t id,
vir_bytes vaddr, vir_bytes len, yielded_t **retyb)
{
yielded_t *newyb;
/*===========================================================================*
* do_forgetblocks *
*===========================================================================*/
-PUBLIC int do_forgetblocks(message *m)
+int do_forgetblocks(message *m)
{
int n;
struct vmproc *vmp;
/*===========================================================================*
* do_forgetblock *
*===========================================================================*/
-PUBLIC int do_forgetblock(message *m)
+int do_forgetblock(message *m)
{
int n;
struct vmproc *vmp;
/*===========================================================================*
* do_yieldblockgetblock *
*===========================================================================*/
-PUBLIC int do_yieldblockgetblock(message *m)
+int do_yieldblockgetblock(message *m)
{
u64_t yieldid, getid;
int n;
/*===========================================================================*
* do_rs_set_priv *
*===========================================================================*/
-PUBLIC int do_rs_set_priv(message *m)
+int do_rs_set_priv(message *m)
{
int r, n, nr;
struct vmproc *vmp;
/*===========================================================================*
* do_rs_update *
*===========================================================================*/
-PUBLIC int do_rs_update(message *m_ptr)
+int do_rs_update(message *m_ptr)
{
endpoint_t src_e, dst_e, reply_e;
int src_p, dst_p;
/*===========================================================================*
* rs_memctl_make_vm_instance *
*===========================================================================*/
-PRIVATE int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
+static int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
{
int r;
u32_t flags;
/*===========================================================================*
* do_rs_memctl *
*===========================================================================*/
-PUBLIC int do_rs_memctl(message *m_ptr)
+int do_rs_memctl(message *m_ptr)
{
endpoint_t ep;
int req, r, proc_nr;
/*===========================================================================*
* do_push_sig *
*===========================================================================*/
-PUBLIC int do_push_sig(message *msg)
+int do_push_sig(message *msg)
{
int r, n;
endpoint_t ep;
#define MAXSIZE (SLABSIZES-1+MINSIZE)
#define USEELEMENTS (1+(VM_PAGE_SIZE/MINSIZE/8))
-PRIVATE int pages = 0;
+static int pages = 0;
typedef u8_t element_t;
#define BITS_FULL (~(element_t)0)
#define LIST_FULL 3
#define LIST_NUMBER 4
-PRIVATE struct slabheader {
+static struct slabheader {
struct slabdata {
struct sdh sdh;
u8_t data[DATABYTES];
} *list_head[LIST_NUMBER];
} slabs[SLABSIZES];
-FORWARD int objstats(void *, int, struct slabheader **, struct slabdata
+static int objstats(void *, int, struct slabheader **, struct slabdata
**, int *);
#define GETSLAB(b, s) { \
/*===========================================================================*
* checklist *
*===========================================================================*/
-PRIVATE int checklist(char *file, int line,
+static int checklist(char *file, int line,
struct slabheader *s, int l, int bytes)
{
struct slabdata *n = s->list_head[l];
/*===========================================================================*
* void slab_sanitycheck *
*===========================================================================*/
-PUBLIC void slab_sanitycheck(char *file, int line)
+void slab_sanitycheck(char *file, int line)
{
int s;
for(s = 0; s < SLABSIZES; s++) {
/*===========================================================================*
* int slabsane *
*===========================================================================*/
-PUBLIC int slabsane_f(char *file, int line, void *mem, int bytes)
+int slabsane_f(char *file, int line, void *mem, int bytes)
{
struct slabheader *s;
struct slabdata *f;
/*===========================================================================*
* void *slaballoc *
*===========================================================================*/
-PUBLIC void *slaballoc(int bytes)
+void *slaballoc(int bytes)
{
int i;
int count = 0;
/*===========================================================================*
* int objstats *
*===========================================================================*/
-PRIVATE int objstats(void *mem, int bytes,
+static int objstats(void *mem, int bytes,
struct slabheader **sp, struct slabdata **fp, int *ip)
{
#if SANITYCHECKS
/*===========================================================================*
* void *slabfree *
*===========================================================================*/
-PUBLIC void slabfree(void *mem, int bytes)
+void slabfree(void *mem, int bytes)
{
int i;
struct slabheader *s;
/*===========================================================================*
* void *slablock *
*===========================================================================*/
-PUBLIC void slablock(void *mem, int bytes)
+void slablock(void *mem, int bytes)
{
int i;
struct slabheader *s;
/*===========================================================================*
* void *slabunlock *
*===========================================================================*/
-PUBLIC void slabunlock(void *mem, int bytes)
+void slabunlock(void *mem, int bytes)
{
int i;
struct slabheader *s;
/*===========================================================================*
* void slabstats *
*===========================================================================*/
-PUBLIC void slabstats(void)
+void slabstats(void)
{
int s, total = 0, totalbytes = 0;
static int n;
/*===========================================================================*
* get_mem_map *
*===========================================================================*/
-PUBLIC int get_mem_map(proc_nr, mem_map)
+int get_mem_map(proc_nr, mem_map)
int proc_nr; /* process to get map of */
struct mem_map *mem_map; /* put memory map here */
{
/*===========================================================================*
* get_mem_chunks *
*===========================================================================*/
-PUBLIC void get_mem_chunks(mem_chunks)
+void get_mem_chunks(mem_chunks)
struct memory *mem_chunks; /* store mem chunks here */
{
/* Initialize the free memory list from the 'memory' boot variable. Translate
/*===========================================================================*
* reserve_proc_mem *
*===========================================================================*/
-PUBLIC void reserve_proc_mem(mem_chunks, map_ptr)
+void reserve_proc_mem(mem_chunks, map_ptr)
struct memory *mem_chunks; /* store mem chunks here */
struct mem_map *map_ptr; /* memory to remove */
{
/*===========================================================================*
* vm_isokendpt *
*===========================================================================*/
-PUBLIC int vm_isokendpt(endpoint_t endpoint, int *proc)
+int vm_isokendpt(endpoint_t endpoint, int *proc)
{
*proc = _ENDPOINT_P(endpoint);
if(*proc < 0 || *proc >= NR_PROCS)
/*===========================================================================*
* get_stack_ptr *
*===========================================================================*/
-PUBLIC int get_stack_ptr(proc_nr_e, sp)
+int get_stack_ptr(proc_nr_e, sp)
int proc_nr_e; /* process to get sp of */
vir_bytes *sp; /* put stack pointer here */
{
/*===========================================================================*
* do_info *
*===========================================================================*/
-PUBLIC int do_info(message *m)
+int do_info(message *m)
{
struct vm_stats_info vsi;
struct vm_usage_info vui;
/*===========================================================================*
* swap_proc_slot *
*===========================================================================*/
-PUBLIC int swap_proc_slot(struct vmproc *src_vmp, struct vmproc *dst_vmp)
+int swap_proc_slot(struct vmproc *src_vmp, struct vmproc *dst_vmp)
{
struct vmproc orig_src_vmproc, orig_dst_vmproc;
/*===========================================================================*
* swap_proc_dyn_data *
*===========================================================================*/
-PUBLIC int swap_proc_dyn_data(struct vmproc *src_vmp, struct vmproc *dst_vmp)
+int swap_proc_dyn_data(struct vmproc *src_vmp, struct vmproc *dst_vmp)
{
int is_vm;
int r;
ssize_t value;
} result_t;
-PRIVATE char driver_label[32] = ""; /* driver DS label */
-PRIVATE dev_t driver_minor = -1; /* driver's partition minor to use */
-PRIVATE endpoint_t driver_endpt; /* driver endpoint */
-
-PRIVATE int may_write = FALSE; /* may we write to the device? */
-PRIVATE int sector_size = 512; /* size of a single disk sector */
-PRIVATE int min_read = 512; /* minimum total size of read req */
-PRIVATE int element_size = 512; /* minimum I/O vector element size */
-PRIVATE int max_size = 131072; /* maximum total size of any req */
+static char driver_label[32] = ""; /* driver DS label */
+static dev_t driver_minor = -1; /* driver's partition minor to use */
+static endpoint_t driver_endpt; /* driver endpoint */
+
+static int may_write = FALSE; /* may we write to the device? */
+static int sector_size = 512; /* size of a single disk sector */
+static int min_read = 512; /* minimum total size of read req */
+static int element_size = 512; /* minimum I/O vector element size */
+static int max_size = 131072; /* maximum total size of any req */
/* Note that we do not test exceeding the max_size limit, so it is safe to set
* it to a value lower than the driver supports.
*/
-PRIVATE struct partition part; /* base and size of target partition */
+static struct partition part; /* base and size of target partition */
#define NR_OPENED 10 /* maximum number of opened devices */
-PRIVATE dev_t opened[NR_OPENED]; /* list of currently opened devices */
-PRIVATE int nr_opened = 0; /* current number of opened devices */
+static dev_t opened[NR_OPENED]; /* list of currently opened devices */
+static int nr_opened = 0; /* current number of opened devices */
-PRIVATE int total_tests = 0; /* total number of tests performed */
-PRIVATE int failed_tests = 0; /* number of tests that failed */
-PRIVATE int failed_groups = 0; /* nr of groups that had failures */
-PRIVATE int group_failure; /* has this group had a failure yet? */
-PRIVATE int driver_deaths = 0; /* number of restarts that we saw */
+static int total_tests = 0; /* total number of tests performed */
+static int failed_tests = 0; /* number of tests that failed */
+static int failed_groups = 0; /* nr of groups that had failures */
+static int group_failure; /* has this group had a failure yet? */
+static int driver_deaths = 0; /* number of restarts that we saw */
/* Options supported by this driver. */
-PRIVATE struct optset optset_table[] = {
+static struct optset optset_table[] = {
{ "label", OPT_STRING, driver_label, sizeof(driver_label) },
{ "minor", OPT_INT, &driver_minor, 10 },
{ "rw", OPT_BOOL, &may_write, TRUE },
{ NULL, 0, NULL, 0 }
};
-PRIVATE int set_result(result_t *res, int type, ssize_t value)
+static int set_result(result_t *res, int type, ssize_t value)
{
/* Set the result to the given result type and with the given optional
* extra value. Return the type.
return type;
}
-PRIVATE void accept_result(result_t *res, int type, ssize_t value)
+static void accept_result(result_t *res, int type, ssize_t value)
{
/* If the result is of the given type and value, reset it to a success
* result. This allows for a logical OR on error codes.
set_result(res, RESULT_OK, 0);
}
-PRIVATE void got_result(result_t *res, char *desc)
+static void got_result(result_t *res, char *desc)
{
/* Process the result of a test. Keep statistics.
*/
}
}
-PRIVATE void test_group(char *name, int exec)
+static void test_group(char *name, int exec)
{
/* Start a new group of tests.
*/
group_failure = FALSE;
}
-PRIVATE void reopen_device(dev_t minor)
+static void reopen_device(dev_t minor)
{
/* Reopen a device after we were notified that the driver has died.
* Explicitly ignore any errors here; this is a feeble attempt to get
(void) sendrec(driver_endpt, &m);
}
-PRIVATE int sendrec_driver(message *m_ptr, ssize_t exp, result_t *res)
+static int sendrec_driver(message *m_ptr, ssize_t exp, result_t *res)
{
/* Make a call to the driver, and perform basic checks on the return
* message. Fill in the result structure, wiping out what was in there
return set_result(res, RESULT_OK, 0);
}
-PRIVATE int raw_xfer(dev_t minor, u64_t pos, iovec_s_t *iovec, int nr_req,
+static int raw_xfer(dev_t minor, u64_t pos, iovec_s_t *iovec, int nr_req,
int write, ssize_t exp, result_t *res)
{
/* Perform a transfer with a safecopy iovec already supplied.
return set_result(res, RESULT_TRUNC, exp - m.BDEV_STATUS);
}
-PRIVATE int vir_xfer(dev_t minor, u64_t pos, iovec_t *iovec, int nr_req,
+static int vir_xfer(dev_t minor, u64_t pos, iovec_t *iovec, int nr_req,
int write, ssize_t exp, result_t *res)
{
/* Perform a transfer, creating and revoking grants for the I/O vector.
return r;
}
-PRIVATE int simple_xfer(dev_t minor, u64_t pos, u8_t *buf, size_t size,
+static int simple_xfer(dev_t minor, u64_t pos, u8_t *buf, size_t size,
int write, ssize_t exp, result_t *res)
{
/* Perform a transfer involving a single buffer.
return vir_xfer(minor, pos, &iov, 1, write, exp, res);
}
-PRIVATE void alloc_buf_and_grant(u8_t **ptr, cp_grant_id_t *grant,
+static void alloc_buf_and_grant(u8_t **ptr, cp_grant_id_t *grant,
size_t size, int perms)
{
/* Allocate a buffer suitable for DMA (i.e. contiguous) and create a
panic("unable to allocate grant");
}
-PRIVATE void free_buf_and_grant(u8_t *ptr, cp_grant_id_t grant, size_t size)
+static void free_buf_and_grant(u8_t *ptr, cp_grant_id_t grant, size_t size)
{
/* Revoke a grant and free a buffer.
*/
free_contig(ptr, size);
}
-PRIVATE void bad_read1(void)
+static void bad_read1(void)
{
/* Test various illegal read transfer requests, part 1.
*/
cpf_revoke(grant);
}
-PRIVATE u32_t get_sum(u8_t *ptr, size_t size)
+static u32_t get_sum(u8_t *ptr, size_t size)
{
/* Compute a checksum over the given buffer.
*/
return sum;
}
-PRIVATE u32_t fill_rand(u8_t *ptr, size_t size)
+static u32_t fill_rand(u8_t *ptr, size_t size)
{
/* Fill the given buffer with random data. Return a checksum over the
* resulting data.
return get_sum(ptr, size);
}
-PRIVATE void test_sum(u8_t *ptr, size_t size, u32_t sum, int should_match,
+static void test_sum(u8_t *ptr, size_t size, u32_t sum, int should_match,
result_t *res)
{
/* If the test succeeded so far, check whether the given buffer does
}
}
-PRIVATE void bad_read2(void)
+static void bad_read2(void)
{
/* Test various illegal read transfer requests, part 2.
*
#define SECTOR_UNALIGN 2 /* word-aligned and sector-unaligned */
-PRIVATE void bad_write(void)
+static void bad_write(void)
{
/* Test various illegal write transfer requests, if writing is allowed.
* If handled correctly, these requests will not actually write data.
free_buf_and_grant(buf_ptr, buf_grant, buf_size);
}
-PRIVATE void vector_and_large_sub(size_t small_size)
+static void vector_and_large_sub(size_t small_size)
{
/* Check whether large vectored requests, and large single requests,
* succeed.
free_contig(buf_ptr, buf_size);
}
-PRIVATE void vector_and_large(void)
+static void vector_and_large(void)
{
/* Check whether large vectored requests, and large single requests,
* succeed. These are request patterns commonly used by MFS and the
}
}
-PRIVATE void open_device(dev_t minor)
+static void open_device(dev_t minor)
{
/* Open a partition or subpartition. Remember that it has been opened,
* so that we can reopen it later in the event of a driver crash.
"opening a subpartition");
}
-PRIVATE void close_device(dev_t minor)
+static void close_device(dev_t minor)
{
/* Close a partition or subpartition. Remove it from the list of opened
* devices.
"closing a subpartition");
}
-PRIVATE int vir_ioctl(dev_t minor, int req, void *ptr, ssize_t exp,
+static int vir_ioctl(dev_t minor, int req, void *ptr, ssize_t exp,
result_t *res)
{
/* Perform an I/O control request, using a local buffer.
return r;
}
-PRIVATE void misc_ioctl(void)
+static void misc_ioctl(void)
{
/* Test some ioctls.
*/
got_result(&res, "decreased open count after closing");
}
-PRIVATE void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
+static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
{
/* Test reads up to, across, and beyond partition limits.
*/
free_contig(buf_ptr, buf_size);
}
-PRIVATE void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
+static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
{
/* Test writes up to, across, and beyond partition limits. Use the
* first given subpartition to test, and the second to make sure there
free_contig(buf_ptr, buf_size);
}
-PRIVATE void vir_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
+static void vir_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
{
/* Create virtual, temporary subpartitions through the DIOCSETP ioctl,
* and perform tests on the resulting subpartitions.
close_device(sub0_minor);
}
-PRIVATE void real_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
+static void real_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
{
/* Create our own subpartitions by writing a partition table, and
* perform tests on the resulting real subpartitions.
free_contig(buf_ptr, buf_size);
}
-PRIVATE void part_limits(void)
+static void part_limits(void)
{
/* Test reads and writes up to, across, and beyond partition limits.
* As a side effect, test reading and writing partition sizes and
}
-PRIVATE void unaligned_size_io(u64_t base_pos, u8_t *buf_ptr, size_t buf_size,
+static void unaligned_size_io(u64_t base_pos, u8_t *buf_ptr, size_t buf_size,
u8_t *sec_ptr[2], int sectors, int pattern, u32_t ssum[5])
{
/* Perform a single small-element I/O read, write, readback test.
got_result(&res, "readback verification");
}
-PRIVATE void unaligned_size(void)
+static void unaligned_size(void)
{
/* Test sector-unaligned sizes in I/O vector elements. The total size
* of the request, however, has to add up to the sector size.
free_contig(buf_ptr, buf_size);
}
-PRIVATE void unaligned_pos1(void)
+static void unaligned_pos1(void)
{
/* Test sector-unaligned positions and total sizes for requests. This
* is a read-only test as no driver currently supports sector-unaligned
free_contig(buf_ptr, buf_size);
}
-PRIVATE void unaligned_pos2(void)
+static void unaligned_pos2(void)
{
/* Test sector-unaligned positions and total sizes for requests, second
* part. This one tests the use of multiple I/O vector elements, and
free_contig(buf_ptr, buf_size);
}
-PRIVATE void sweep_area(u64_t base_pos)
+static void sweep_area(u64_t base_pos)
{
/* Go over an eight-sector area from left (low address) to right (high
* address), reading and optionally writing in three-sector chunks, and
free_contig(buf_ptr, buf_size);
}
-PRIVATE void sweep_and_check(u64_t pos, int check_integ)
+static void sweep_and_check(u64_t pos, int check_integ)
{
/* Perform an area sweep at the given position. If asked for, get an
* integrity checksum over the beginning of the disk (first writing
}
}
-PRIVATE void basic_sweep(void)
+static void basic_sweep(void)
{
/* Perform a basic area sweep.
*/
sweep_area(cvu64(sector_size));
}
-PRIVATE void high_disk_pos(void)
+static void high_disk_pos(void)
{
/* Test 64-bit absolute disk positions. This means that after adding
* partition base to the given position, the driver will be dealing
sweep_and_check(base_pos, !cmp64u(part.base, 0));
}
-PRIVATE void high_part_pos(void)
+static void high_part_pos(void)
{
/* Test 64-bit partition-relative disk positions. In other words, use
* within the current partition a position that exceeds a 32-bit value.
sweep_and_check(base_pos, TRUE);
}
-PRIVATE void high_lba_pos1(void)
+static void high_lba_pos1(void)
{
/* Test 48-bit LBA positions, as opposed to *24-bit*. Drivers that only
* support 48-bit LBA ATA transfers, will treat the lower and upper 24
sweep_and_check(base_pos, !cmp64u(part.base, 0));
}
-PRIVATE void high_lba_pos2(void)
+static void high_lba_pos2(void)
{
/* Test 48-bit LBA positions, as opposed to *28-bit*. That means sector
* numbers in excess of 28-bit values; the old ATA upper limit. The
sweep_and_check(base_pos, !cmp64u(part.base, 0));
}
-PRIVATE void high_pos(void)
+static void high_pos(void)
{
/* Check whether the driver deals well with 64-bit positions and
* 48-bit LBA addresses. We test three cases: disk byte position beyond
high_lba_pos2();
}
-PRIVATE void open_primary(void)
+static void open_primary(void)
{
/* Open the primary device. This call has its own test group.
*/
open_device(driver_minor);
}
-PRIVATE void close_primary(void)
+static void close_primary(void)
{
/* Close the primary device. This call has its own test group.
*/
assert(nr_opened == 0);
}
-PRIVATE void do_tests(void)
+static void do_tests(void)
{
/* Perform all the tests.
*/
close_primary();
}
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize.
*/
return OK;
}
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
/* Initialize the SEF framework.
*/
sef_startup();
}
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* Driver task.
*/
}
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
char *key_u32 = "test_u32";
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
#include "com.h"
-PRIVATE int do_request(message *m)
+static int do_request(message *m)
{
struct vumap_vir vvec[MAPVEC_NR + 3];
struct vumap_phys pvec[MAPVEC_NR + 3];
return r;
}
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
return OK;
}
-PRIVATE void sef_cb_signal_handler(int sig)
+static void sef_cb_signal_handler(int sig)
{
if (sig == SIGTERM)
exit(0);
}
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_signal_handler(sef_cb_signal_handler);
sef_startup();
}
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
message m;
int r;
#define BUF_PREALLOC 0x1 /* if set, immediately allocate the page */
#define BUF_ADJACENT 0x2 /* virtually contiguous with the last buffer */
-PRIVATE unsigned int count = 0, failures = 0;
+static unsigned int count = 0, failures = 0;
-PRIVATE int success;
-PRIVATE char *fail_file;
-PRIVATE int fail_line;
+static int success;
+static char *fail_file;
+static int fail_line;
-PRIVATE int relay;
-PRIVATE endpoint_t endpt;
+static int relay;
+static endpoint_t endpt;
-PRIVATE int verbose;
+static int verbose;
-PRIVATE enum {
+static enum {
GE_NONE, /* no exception */
GE_REVOKED, /* revoked grant */
GE_INVALID /* invalid grant */
} grant_exception = GE_NONE;
-PRIVATE int grant_access = 0;
+static int grant_access = 0;
#define expect(r) expect_f((r), __FILE__, __LINE__)
-PRIVATE void alloc_buf(struct buf *buf, phys_bytes next)
+static void alloc_buf(struct buf *buf, phys_bytes next)
{
void *tmp = NULL;
vir_bytes addr;
panic("unable to allocate noncontiguous range");
}
-PRIVATE void alloc_bufs(struct buf *buf, int count)
+static void alloc_bufs(struct buf *buf, int count)
{
static vir_bytes base = 0x80000000L;
phys_bytes next;
#endif
}
-PRIVATE void free_bufs(struct buf *buf, int count)
+static void free_bufs(struct buf *buf, int count)
{
int i, j, r;
}
}
-PRIVATE int is_allocated(vir_bytes addr, size_t bytes, phys_bytes *phys)
+static int is_allocated(vir_bytes addr, size_t bytes, phys_bytes *phys)
{
int r;
return r == OK;
}
-PRIVATE int is_buf_allocated(struct buf *buf)
+static int is_buf_allocated(struct buf *buf)
{
return is_allocated(buf->addr, buf->pages * PAGE_SIZE, &buf->phys);
}
-PRIVATE void test_group(char *name)
+static void test_group(char *name)
{
if (verbose)
printf("Test group: %s (%s)\n",
name, relay ? "relay" : "local");
}
-PRIVATE void expect_f(int res, char *file, int line)
+static void expect_f(int res, char *file, int line)
{
if (!res && success) {
success = FALSE;
}
}
-PRIVATE void got_result(char *desc)
+static void got_result(char *desc)
{
count++;
}
}
-PRIVATE int relay_vumap(struct vumap_vir *vvec, int vcount, size_t offset,
+static int relay_vumap(struct vumap_vir *vvec, int vcount, size_t offset,
int access, struct vumap_phys *pvec, int *pcount)
{
struct vumap_vir gvvec[MAPVEC_NR + 3];
return (r != OK) ? r : m.m_type;
}
-PRIVATE int do_vumap(endpoint_t endpt, struct vumap_vir *vvec, int vcount,
+static int do_vumap(endpoint_t endpt, struct vumap_vir *vvec, int vcount,
size_t offset, int access, struct vumap_phys *pvec, int *pcount)
{
struct vumap_phys pv_backup[MAPVEC_NR + 3];
return r;
}
-PRIVATE void test_basics(void)
+static void test_basics(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[4];
free_bufs(buf, 4);
}
-PRIVATE void test_endpt(void)
+static void test_endpt(void)
{
struct vumap_vir vvec[1];
struct vumap_phys pvec[1];
free_bufs(buf, 1);
}
-PRIVATE void test_vector1(void)
+static void test_vector1(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[3];
free_bufs(buf, 2);
}
-PRIVATE void test_vector2(void)
+static void test_vector2(void)
{
struct vumap_vir vvec[2], *vvecp;
struct vumap_phys pvec[3], *pvecp;
free_bufs(buf, 2);
}
-PRIVATE void test_grant(void)
+static void test_grant(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[3];
free_bufs(buf, 2);
}
-PRIVATE void test_offset(void)
+static void test_offset(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[3];
free_bufs(buf, 4);
}
-PRIVATE void test_access(void)
+static void test_access(void)
{
struct vumap_vir vvec[3];
struct vumap_phys pvec[4], *pvecp;
*/
}
-PRIVATE void phys_limit(struct vumap_vir *vvec, int vcount,
+static void phys_limit(struct vumap_vir *vvec, int vcount,
struct vumap_phys *pvec, int pcount, struct buf *buf, char *desc)
{
int i, r;
got_result(desc);
}
-PRIVATE void test_limits(void)
+static void test_limits(void)
{
struct vumap_vir vvec[MAPVEC_NR + 3];
struct vumap_phys pvec[MAPVEC_NR + 3];
free_bufs(buf, nr_bufs);
}
-PRIVATE void do_tests(int use_relay)
+static void do_tests(int use_relay)
{
relay = use_relay;
test_limits();
}
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
int r;
return (failures) ? EINVAL : OK;
}
-PRIVATE void sef_local_startup(void)
+static void sef_local_startup(void)
{
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_startup();
}
-PUBLIC int main(int argc, char **argv)
+int main(int argc, char **argv)
{
env_setargs(argc, argv);
char buf_buf[BUF_SIZE + CLICK_SIZE];
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
}
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
int fid_send, fid_get;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
int fid_send, fid_get;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
int fid_send, fid_get;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* main *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
int fid_send, fid_get;
/* SEF functions and variables. */
-FORWARD void sef_local_startup(void);
+static void sef_local_startup(void);
/*===========================================================================*
* read_write_buff *
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
#define MAX_ERROR 5
#include "common.c"
-PUBLIC int errct;
-PRIVATE int count, condition_met;
-PRIVATE int th_a, th_b, th_c, th_d, th_e, th_f, th_g, th_h;
-PRIVATE int mutex_a_step, mutex_b_step, mutex_c_step;
-PRIVATE mutex_t mu[3];
-PRIVATE cond_t condition;
-PRIVATE mutex_t *count_mutex, *condition_mutex;
-PRIVATE once_t once;
-PRIVATE key_t key[MTHREAD_KEYS_MAX+1];
-PRIVATE int values[4];
-PRIVATE int first;
-PRIVATE event_t event;
-PRIVATE int event_a_step, event_b_step;
-PRIVATE rwlock_t rwlock;
-PRIVATE int rwlock_a_step, rwlock_b_step;
+int errct;
+static int count, condition_met;
+static int th_a, th_b, th_c, th_d, th_e, th_f, th_g, th_h;
+static int mutex_a_step, mutex_b_step, mutex_c_step;
+static mutex_t mu[3];
+static cond_t condition;
+static mutex_t *count_mutex, *condition_mutex;
+static once_t once;
+static key_t key[MTHREAD_KEYS_MAX+1];
+static int values[4];
+static int first;
+static event_t event;
+static int event_a_step, event_b_step;
+static rwlock_t rwlock;
+static int rwlock_a_step, rwlock_b_step;
#define VERIFY_RWLOCK(a, b, esub, eno) \
GEN_VERIFY(rwlock_a_step, a, rwlock_b_step, b, esub, eno)
#define MEG 1024*1024
#define MAGIC ((signed) 0xb4a3f1c2)
-FORWARD void destr_a(void *arg);
-FORWARD void destr_b(void *arg);
-FORWARD void *thread_a(void *arg);
-FORWARD void *thread_b(void *arg);
-FORWARD void *thread_c(void *arg);
-FORWARD void *thread_d(void *arg);
-FORWARD void thread_e(void);
-FORWARD void *thread_f(void *arg);
-FORWARD void *thread_g(void *arg);
-FORWARD void *thread_h(void *arg);
-FORWARD void test_scheduling(void);
-FORWARD void test_mutex(void);
-FORWARD void test_condition(void);
-FORWARD void test_attributes(void);
-FORWARD void test_keys(void);
-FORWARD void err(int subtest, int error);
+static void destr_a(void *arg);
+static void destr_b(void *arg);
+static void *thread_a(void *arg);
+static void *thread_b(void *arg);
+static void *thread_c(void *arg);
+static void *thread_d(void *arg);
+static void thread_e(void);
+static void *thread_f(void *arg);
+static void *thread_g(void *arg);
+static void *thread_h(void *arg);
+static void test_scheduling(void);
+static void test_mutex(void);
+static void test_condition(void);
+static void test_attributes(void);
+static void test_keys(void);
+static void err(int subtest, int error);
/*===========================================================================*
* thread_a *
*===========================================================================*/
-PRIVATE void *thread_a(void *arg) {
+static void *thread_a(void *arg) {
th_a++;
return(NULL);
}
/*===========================================================================*
* thread_b *
*===========================================================================*/
-PRIVATE void *thread_b(void *arg) {
+static void *thread_b(void *arg) {
th_b++;
if (mthread_once(&once, thread_e) != 0) err(10, 1);
return(NULL);
/*===========================================================================*
* thread_c *
*===========================================================================*/
-PRIVATE void *thread_c(void *arg) {
+static void *thread_c(void *arg) {
th_c++;
return(NULL);
}
/*===========================================================================*
* thread_d *
*===========================================================================*/
-PRIVATE void *thread_d(void *arg) {
+static void *thread_d(void *arg) {
th_d++;
mthread_exit(NULL); /* Thread wants to stop running */
return(NULL);
/*===========================================================================*
* thread_e *
*===========================================================================*/
-PRIVATE void thread_e(void) {
+static void thread_e(void) {
th_e++;
}
/*===========================================================================*
* thread_f *
*===========================================================================*/
-PRIVATE void *thread_f(void *arg) {
+static void *thread_f(void *arg) {
if (mthread_mutex_lock(condition_mutex) != 0) err(12, 1);
th_f++;
if (mthread_cond_signal(&condition) != 0) err(12, 2);
/*===========================================================================*
* thread_g *
*===========================================================================*/
-PRIVATE void *thread_g(void *arg) {
+static void *thread_g(void *arg) {
char bigarray[MTHREAD_STACK_MIN + 1];
if (mthread_mutex_lock(condition_mutex) != 0) err(13, 1);
memset(bigarray, '\0', MTHREAD_STACK_MIN + 1); /* Actually allocate it */
/*===========================================================================*
* thread_h *
*===========================================================================*/
-PRIVATE void *thread_h(void *arg) {
+static void *thread_h(void *arg) {
char bigarray[2 * MEG];
int reply;
if (mthread_mutex_lock(condition_mutex) != 0) err(14, 1);
/*===========================================================================*
* err *
*===========================================================================*/
-PRIVATE void err(int sub, int error) {
+static void err(int sub, int error) {
/* As we're running with multiple threads, they might all clobber the
* subtest variable. This wrapper prevents that from happening. */
/*===========================================================================*
* test_scheduling *
*===========================================================================*/
-PRIVATE void test_scheduling(void)
+static void test_scheduling(void)
{
unsigned int i;
thread_t t[7];
/*===========================================================================*
* mutex_a *
*===========================================================================*/
-PRIVATE void *mutex_a(void *arg)
+static void *mutex_a(void *arg)
{
mutex_t *mu = (mutex_t *) arg;
/*===========================================================================*
* mutex_b *
*===========================================================================*/
-PRIVATE void *mutex_b(void *arg)
+static void *mutex_b(void *arg)
{
mutex_t *mu = (mutex_t *) arg;
/*===========================================================================*
* mutex_c *
*===========================================================================*/
-PRIVATE void *mutex_c(void *arg)
+static void *mutex_c(void *arg)
{
mutex_t *mu = (mutex_t *) arg;
/*===========================================================================*
* test_mutex *
*===========================================================================*/
-PRIVATE void test_mutex(void)
+static void test_mutex(void)
{
unsigned int i;
thread_t t[3];
/*===========================================================================*
* cond_a *
*===========================================================================*/
-PRIVATE void *cond_a(void *arg)
+static void *cond_a(void *arg)
{
cond_t c;
int did_count = 0;
/*===========================================================================*
* cond_b *
*===========================================================================*/
-PRIVATE void *cond_b(void *arg)
+static void *cond_b(void *arg)
{
int did_count = 0;
while(1) {
/*===========================================================================*
* cond_broadcast *
*===========================================================================*/
-PRIVATE void *cond_broadcast(void *arg)
+static void *cond_broadcast(void *arg)
{
if (mthread_mutex_lock(condition_mutex) != 0) err(9, 1);
/*===========================================================================*
* test_condition *
*===========================================================================*/
-PRIVATE void test_condition(void)
+static void test_condition(void)
{
#define NTHREADS 10
int i;
/*===========================================================================*
* test_attributes *
*===========================================================================*/
-PRIVATE void test_attributes(void)
+static void test_attributes(void)
{
attr_t tattr;
thread_t tid;
/*===========================================================================*
* destr_a *
*===========================================================================*/
-PRIVATE void destr_a(void *value)
+static void destr_a(void *value)
{
int num;
/*===========================================================================*
* destr_b *
*===========================================================================*/
-PRIVATE void destr_b(void *value)
+static void destr_b(void *value)
{
/* This destructor must never trigger. */
err(16, 1);
/*===========================================================================*
* key_a *
*===========================================================================*/
-PRIVATE void *key_a(void *arg)
+static void *key_a(void *arg)
{
int i;
/*===========================================================================*
* key_b *
*===========================================================================*/
-PRIVATE void *key_b(void *arg)
+static void *key_b(void *arg)
{
int i;
/*===========================================================================*
* key_c *
*===========================================================================*/
-PRIVATE void *key_c(void *arg)
+static void *key_c(void *arg)
{
/* The only thing that this thread should do, is set a value. */
if (mthread_setspecific(key[0], (void *) mthread_self()) != 0) err(19, 1);
/*===========================================================================*
* test_keys *
*===========================================================================*/
-PRIVATE void test_keys(void)
+static void test_keys(void)
{
thread_t t[24];
int i, j;
/*===========================================================================*
* event_a *
*===========================================================================*/
-PRIVATE void *event_a(void *arg)
+static void *event_a(void *arg)
{
VERIFY_EVENT(0, 0, 21, 1);
/*===========================================================================*
* event_b *
*===========================================================================*/
-PRIVATE void *event_b(void *arg)
+static void *event_b(void *arg)
{
VERIFY_EVENT(0, 0, 22, 1);
/*===========================================================================*
* test_event *
*===========================================================================*/
-PRIVATE void test_event(void)
+static void test_event(void)
{
thread_t t[2];
int i;
/*===========================================================================*
* rwlock_a *
*===========================================================================*/
-PRIVATE void *rwlock_a(void *arg)
+static void *rwlock_a(void *arg)
{
/* acquire read lock */
VERIFY_RWLOCK(0, 0, 24, 1);
/*===========================================================================*
* rwlock_b *
*===========================================================================*/
-PRIVATE void *rwlock_b(void *arg)
+static void *rwlock_b(void *arg)
{
/* Step 1: acquire the read lock */
VERIFY_RWLOCK(1, 0, 25, 1);
/*===========================================================================*
* test_rwlock *
*===========================================================================*/
-PRIVATE void test_rwlock(void)
+static void test_rwlock(void)
{
thread_t t[2];
int i;