Lots of cleanup of boot code.
This commit is contained in:
parent
97c169b93a
commit
cf4f92dc21
|
@ -20,34 +20,35 @@
|
||||||
#define OUTPUT_FILE 2
|
#define OUTPUT_FILE 2
|
||||||
|
|
||||||
/* Report problems. */
|
/* Report problems. */
|
||||||
void report(char *problem, char *message)
|
static void report(const char *problem, const char *message)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s:\n", problem);
|
fprintf(stderr, "%s:\n", problem);
|
||||||
fprintf(stderr, " %s\n\n", message);
|
fprintf(stderr, " %s\n\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int copy_data(int srcfd, int dstfd)
|
static int copy_data(int srcfd, int dstfd)
|
||||||
{
|
{
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
int total=0;
|
int total=0;
|
||||||
|
|
||||||
|
/** FIXME: handle error from read() */
|
||||||
|
|
||||||
/* Copy the little bytes themselves. (Source from cp.c). */
|
/* Copy the little bytes themselves. (Source from cp.c). */
|
||||||
while ((n= read(srcfd, buf, sizeof(buf))) > 0) {
|
while ((n= read(srcfd, buf, sizeof(buf))) > 0) {
|
||||||
char *bp = buf;
|
char *bp = buf;
|
||||||
ssize_t r;
|
ssize_t r = 0;
|
||||||
|
|
||||||
|
/** FIXME: handle error from write() */
|
||||||
while (n > 0 && (r= write(dstfd, bp, n)) > 0) {
|
while (n > 0 && (r= write(dstfd, bp, n)) > 0) {
|
||||||
bp += r;
|
bp += r;
|
||||||
n -= r;
|
n -= r;
|
||||||
total += r;
|
total += r;
|
||||||
}
|
}
|
||||||
if (r <= 0) {
|
if (r == 0) {
|
||||||
if (r == 0) {
|
fprintf(stderr, "Warning: EOF writing to output file.\n");
|
||||||
fprintf(stderr, "Warning: EOF writing to output file.\n");
|
return(-1);
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(total);
|
return(total);
|
||||||
|
@ -62,8 +63,7 @@ int main(int argc, char **argv)
|
||||||
int fdin, fdout;
|
int fdin, fdout;
|
||||||
char * bp;
|
char * bp;
|
||||||
int n,r;
|
int n,r;
|
||||||
int total_size=0;
|
int total_size;
|
||||||
int result;
|
|
||||||
|
|
||||||
/* Check if command line arguments are present, or print usage. */
|
/* Check if command line arguments are present, or print usage. */
|
||||||
if (argc!=3) {
|
if (argc!=3) {
|
||||||
|
@ -113,13 +113,13 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
bp = (char *) &aout;
|
bp = (char *) &aout;
|
||||||
n = sizeof(aout);
|
n = sizeof(aout);
|
||||||
lseek(fdout, 0, SEEK_SET);
|
lseek(fdout, 0L, SEEK_SET);
|
||||||
while (n > 0 && (r= write(fdout, bp, n)) > 0) {
|
while (n > 0 && (r= write(fdout, bp, n)) > 0) {
|
||||||
bp += r;
|
bp += r;
|
||||||
n -= r;
|
n -= r;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Prepended data file (%u bytes) with a.out header (%u bytes).\n",
|
printf("Prepended data file (%d bytes) with a.out header (%u bytes).\n",
|
||||||
total_size, sizeof(aout));
|
total_size, sizeof(aout));
|
||||||
printf("Done.\n");
|
printf("Done.\n");
|
||||||
|
|
||||||
|
|
98
boot/boot.c
98
boot/boot.c
|
@ -64,7 +64,7 @@ static int block_size;
|
||||||
*/
|
*/
|
||||||
unsigned char boot_spec[24];
|
unsigned char boot_spec[24];
|
||||||
|
|
||||||
char *bios_err(int err)
|
static const char *bios_err(int err)
|
||||||
/* Translate BIOS error code to a readable string. (This is a rare trait
|
/* Translate BIOS error code to a readable string. (This is a rare trait
|
||||||
* known as error checking and reporting. Take a good look at it, you won't
|
* known as error checking and reporting. Take a good look at it, you won't
|
||||||
* see it often.)
|
* see it often.)
|
||||||
|
@ -168,7 +168,7 @@ char *unix_err(int err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rwerr(char *rw, off_t sec, int err)
|
static void rwerr(const char *rw, off_t sec, int err)
|
||||||
{
|
{
|
||||||
printf("\n%s error 0x%02x (%s) at sector %ld absolute\n",
|
printf("\n%s error 0x%02x (%s) at sector %ld absolute\n",
|
||||||
rw, err, bios_err(err), sec);
|
rw, err, bios_err(err), sec);
|
||||||
|
@ -208,8 +208,8 @@ struct biosdev {
|
||||||
int device; /* Device to edit parameters. */
|
int device; /* Device to edit parameters. */
|
||||||
} bootdev;
|
} bootdev;
|
||||||
|
|
||||||
struct termios termbuf;
|
static struct termios termbuf;
|
||||||
int istty;
|
static int istty;
|
||||||
|
|
||||||
void quit(int status)
|
void quit(int status)
|
||||||
{
|
{
|
||||||
|
@ -219,13 +219,13 @@ void quit(int status)
|
||||||
|
|
||||||
#define exit(s) quit(s)
|
#define exit(s) quit(s)
|
||||||
|
|
||||||
void report(char *label)
|
void report(const char *label)
|
||||||
/* edparams: label: No such file or directory */
|
/* edparams: label: No such file or directory */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "edparams: %s: %s\n", label, strerror(errno));
|
fprintf(stderr, "edparams: %s: %s\n", label, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
void fatal(char *label)
|
void fatal(const char *label)
|
||||||
{
|
{
|
||||||
report(label);
|
report(label);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -338,7 +338,7 @@ int getch(void)
|
||||||
|
|
||||||
#endif /* UNIX */
|
#endif /* UNIX */
|
||||||
|
|
||||||
char *readline(void)
|
static char *readline(void)
|
||||||
/* Read a line including a newline with echoing. */
|
/* Read a line including a newline with echoing. */
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
|
@ -375,13 +375,13 @@ char *readline(void)
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sugar(char *tok)
|
static int sugar(const char *tok)
|
||||||
/* Recognize special tokens. */
|
/* Recognize special tokens. */
|
||||||
{
|
{
|
||||||
return strchr("=(){};\n", tok[0]) != nil;
|
return strchr("=(){};\n", tok[0]) != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *onetoken(char **aline)
|
static char *onetoken(char **aline)
|
||||||
/* Returns a string with one token for tokenize. */
|
/* Returns a string with one token for tokenize. */
|
||||||
{
|
{
|
||||||
char *line= *aline;
|
char *line= *aline;
|
||||||
|
@ -429,7 +429,7 @@ typedef struct token {
|
||||||
char *token;
|
char *token;
|
||||||
} token;
|
} token;
|
||||||
|
|
||||||
token **tokenize(token **acmds, char *line)
|
static token **tokenize(token **acmds, char *line)
|
||||||
/* Takes a line apart to form tokens. The tokens are inserted into a command
|
/* Takes a line apart to form tokens. The tokens are inserted into a command
|
||||||
* chain at *acmds. Tokenize returns a reference to where another line could
|
* chain at *acmds. Tokenize returns a reference to where another line could
|
||||||
* be added. Tokenize looks at spaces as token separators, and recognizes only
|
* be added. Tokenize looks at spaces as token separators, and recognizes only
|
||||||
|
@ -450,10 +450,10 @@ token **tokenize(token **acmds, char *line)
|
||||||
return acmds;
|
return acmds;
|
||||||
}
|
}
|
||||||
|
|
||||||
token *cmds; /* String of commands to execute. */
|
static token *cmds; /* String of commands to execute. */
|
||||||
int err; /* Set on an error. */
|
static int err; /* Set on an error. */
|
||||||
|
|
||||||
char *poptoken(void)
|
static char *poptoken(void)
|
||||||
/* Pop one token off the command chain. */
|
/* Pop one token off the command chain. */
|
||||||
{
|
{
|
||||||
token *cmd= cmds;
|
token *cmd= cmds;
|
||||||
|
@ -465,7 +465,7 @@ char *poptoken(void)
|
||||||
return tok;
|
return tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void voidtoken(void)
|
static void voidtoken(void)
|
||||||
/* Remove one token from the command chain. */
|
/* Remove one token from the command chain. */
|
||||||
{
|
{
|
||||||
free(poptoken());
|
free(poptoken());
|
||||||
|
@ -480,7 +480,7 @@ void parse_code(char *code)
|
||||||
(void) tokenize(&cmds, code);
|
(void) tokenize(&cmds, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int interrupt(void)
|
static int interrupt(void)
|
||||||
/* Clean up after an ESC has been typed. */
|
/* Clean up after an ESC has been typed. */
|
||||||
{
|
{
|
||||||
if (escape()) {
|
if (escape()) {
|
||||||
|
@ -493,14 +493,14 @@ int interrupt(void)
|
||||||
|
|
||||||
#if BIOS
|
#if BIOS
|
||||||
|
|
||||||
int activate;
|
static int activate;
|
||||||
|
|
||||||
struct biosdev {
|
struct biosdev {
|
||||||
char name[8];
|
char name[8];
|
||||||
int device, primary, secondary;
|
int device, primary, secondary;
|
||||||
} bootdev, tmpdev;
|
} bootdev, tmpdev;
|
||||||
|
|
||||||
int get_master(char *master, struct part_entry **table, u32_t pos)
|
static int get_master(char *master, struct part_entry **table, u32_t pos)
|
||||||
/* Read a master boot sector and its partition table. */
|
/* Read a master boot sector and its partition table. */
|
||||||
{
|
{
|
||||||
int r, n;
|
int r, n;
|
||||||
|
@ -526,7 +526,7 @@ int get_master(char *master, struct part_entry **table, u32_t pos)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize(void)
|
static void initialize(void)
|
||||||
{
|
{
|
||||||
char master[SECTOR_SIZE];
|
char master[SECTOR_SIZE];
|
||||||
struct part_entry *table[NR_PARTITIONS];
|
struct part_entry *table[NR_PARTITIONS];
|
||||||
|
@ -718,7 +718,7 @@ enum resnames {
|
||||||
R_LS, R_MENU, R_OFF, R_SAVE, R_SET, R_TRAP, R_UNSET
|
R_LS, R_MENU, R_OFF, R_SAVE, R_SET, R_TRAP, R_UNSET
|
||||||
};
|
};
|
||||||
|
|
||||||
char resnames[][6] = {
|
static char resnames[][6] = {
|
||||||
"", "boot", "ctty", "delay", "echo", "exit", "help",
|
"", "boot", "ctty", "delay", "echo", "exit", "help",
|
||||||
"ls", "menu", "off", "save", "set", "trap", "unset",
|
"ls", "menu", "off", "save", "set", "trap", "unset",
|
||||||
};
|
};
|
||||||
|
@ -726,7 +726,7 @@ char resnames[][6] = {
|
||||||
/* Using this for all null strings saves a lot of memory. */
|
/* Using this for all null strings saves a lot of memory. */
|
||||||
#define null (resnames[0])
|
#define null (resnames[0])
|
||||||
|
|
||||||
enum resnames reserved(char *s)
|
static enum resnames reserved(const char *s)
|
||||||
/* Recognize reserved strings. */
|
/* Recognize reserved strings. */
|
||||||
{
|
{
|
||||||
enum resnames r;
|
enum resnames r;
|
||||||
|
@ -737,13 +737,13 @@ enum resnames reserved(char *s)
|
||||||
return R_NULL;
|
return R_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sfree(char *s)
|
static void sfree(char *s)
|
||||||
/* Free a non-null string. */
|
/* Free a non-null string. */
|
||||||
{
|
{
|
||||||
if (s != nil && s != null) free(s);
|
if (s != nil && s != null) free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *copystr(char *s)
|
static char *copystr(char *s)
|
||||||
/* Copy a non-null string using malloc. */
|
/* Copy a non-null string using malloc. */
|
||||||
{
|
{
|
||||||
char *c;
|
char *c;
|
||||||
|
@ -754,12 +754,12 @@ char *copystr(char *s)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_default(environment *e)
|
static int is_default(environment *e)
|
||||||
{
|
{
|
||||||
return (e->flags & E_SPECIAL) && e->defval == nil;
|
return (e->flags & E_SPECIAL) && e->defval == nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
environment **searchenv(char *name)
|
static environment **searchenv(char *name)
|
||||||
{
|
{
|
||||||
environment **aenv= &env;
|
environment **aenv= &env;
|
||||||
|
|
||||||
|
@ -781,7 +781,7 @@ char *b_value(char *name)
|
||||||
return e == nil || !(e->flags & E_VAR) ? nil : e->value;
|
return e == nil || !(e->flags & E_VAR) ? nil : e->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *b_body(char *name)
|
static char *b_body(char *name)
|
||||||
/* The value of a function. */
|
/* The value of a function. */
|
||||||
{
|
{
|
||||||
environment *e= b_getenv(name);
|
environment *e= b_getenv(name);
|
||||||
|
@ -789,7 +789,7 @@ char *b_body(char *name)
|
||||||
return e == nil || !(e->flags & E_FUNCTION) ? nil : e->value;
|
return e == nil || !(e->flags & E_FUNCTION) ? nil : e->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int b_setenv(int flags, char *name, char *arg, char *value)
|
static int b_setenv(int flags, char *name, char *arg, char *value)
|
||||||
/* Change the value of an environment variable. Returns the flags of the
|
/* Change the value of an environment variable. Returns the flags of the
|
||||||
* variable if you are not allowed to change it, 0 otherwise.
|
* variable if you are not allowed to change it, 0 otherwise.
|
||||||
*/
|
*/
|
||||||
|
@ -864,7 +864,7 @@ void b_unset(char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long a2l(char *a)
|
long a2l(const char *a)
|
||||||
/* Cheap atol(). */
|
/* Cheap atol(). */
|
||||||
{
|
{
|
||||||
int sign= 1;
|
int sign= 1;
|
||||||
|
@ -894,7 +894,7 @@ char *ul2a10(u32_t n)
|
||||||
return ul2a(n, 10);
|
return ul2a(n, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned a2x(char *a)
|
unsigned a2x(const char *a)
|
||||||
/* Ascii to hex. */
|
/* Ascii to hex. */
|
||||||
{
|
{
|
||||||
unsigned n= 0;
|
unsigned n= 0;
|
||||||
|
@ -915,7 +915,7 @@ unsigned a2x(char *a)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_parameters(void)
|
static void get_parameters(void)
|
||||||
{
|
{
|
||||||
char params[SECTOR_SIZE + 1];
|
char params[SECTOR_SIZE + 1];
|
||||||
token **acmds;
|
token **acmds;
|
||||||
|
@ -997,14 +997,14 @@ void get_parameters(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char *addptr;
|
static char *addptr;
|
||||||
|
|
||||||
void addparm(char *n)
|
static void addparm(const char *n)
|
||||||
{
|
{
|
||||||
while (*n != 0 && *addptr != 0) *addptr++ = *n++;
|
while (*n != 0 && *addptr != 0) *addptr++ = *n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_parameters(void)
|
static void save_parameters(void)
|
||||||
/* Save nondefault environment variables to the bootparams sector. */
|
/* Save nondefault environment variables to the bootparams sector. */
|
||||||
{
|
{
|
||||||
environment *e;
|
environment *e;
|
||||||
|
@ -1045,7 +1045,7 @@ void save_parameters(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_env(void)
|
static void show_env(void)
|
||||||
/* Show the environment settings. */
|
/* Show the environment settings. */
|
||||||
{
|
{
|
||||||
environment *e;
|
environment *e;
|
||||||
|
@ -1418,15 +1418,16 @@ int exec_bootstrap(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void boot_device(char *devname)
|
static void boot_device(char *devname)
|
||||||
/* Boot the device named by devname. */
|
/* Boot the device named by devname. */
|
||||||
{
|
{
|
||||||
dev_t dev= name2dev(devname);
|
dev_t dev= name2dev(devname);
|
||||||
int save_dev= device;
|
int save_dev= device;
|
||||||
int r;
|
int r;
|
||||||
char *err;
|
const char *err;
|
||||||
|
|
||||||
if (tmpdev.device < 0) {
|
if (tmpdev.device < 0) {
|
||||||
|
/* FIXME: clearer error message. */
|
||||||
if (dev != -1) printf("Can't boot from %s\n", devname);
|
if (dev != -1) printf("Can't boot from %s\n", devname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1444,7 +1445,7 @@ void boot_device(char *devname)
|
||||||
(void) dev_open();
|
(void) dev_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctty(char *line)
|
static void ctty(char *line)
|
||||||
{
|
{
|
||||||
if (line == nil) {
|
if (line == nil) {
|
||||||
serial_line = -1;
|
serial_line = -1;
|
||||||
|
@ -1459,13 +1460,13 @@ void ctty(char *line)
|
||||||
|
|
||||||
#else /* DOS */
|
#else /* DOS */
|
||||||
|
|
||||||
void boot_device(char *devname)
|
static void boot_device(char *devname)
|
||||||
/* No booting of other devices under DOS. */
|
/* No booting of other devices under DOS. */
|
||||||
{
|
{
|
||||||
printf("Can't boot devices under DOS\n");
|
printf("Can't boot devices under DOS\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctty(char *line)
|
static void ctty(char *line)
|
||||||
/* Don't know how to handle serial lines under DOS. */
|
/* Don't know how to handle serial lines under DOS. */
|
||||||
{
|
{
|
||||||
printf("No serial line support under DOS\n");
|
printf("No serial line support under DOS\n");
|
||||||
|
@ -1474,7 +1475,7 @@ void ctty(char *line)
|
||||||
#endif /* DOS */
|
#endif /* DOS */
|
||||||
#endif /* BIOS */
|
#endif /* BIOS */
|
||||||
|
|
||||||
void ls(char *dir)
|
static void ls(char *dir)
|
||||||
/* List the contents of a directory. */
|
/* List the contents of a directory. */
|
||||||
{
|
{
|
||||||
ino_t ino;
|
ino_t ino;
|
||||||
|
@ -1496,21 +1497,21 @@ void ls(char *dir)
|
||||||
while ((ino= r_readdir(name)) != 0) printf("%s/%s\n", dir, name);
|
while ((ino= r_readdir(name)) != 0) printf("%s/%s\n", dir, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_t milli_time(void)
|
static u32_t milli_time(void)
|
||||||
{
|
{
|
||||||
return get_tick() * MSEC_PER_TICK;
|
return get_tick() * MSEC_PER_TICK;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_t milli_since(u32_t base)
|
static u32_t milli_since(u32_t base)
|
||||||
{
|
{
|
||||||
return (milli_time() + (TICKS_PER_DAY*MSEC_PER_TICK) - base)
|
return (milli_time() + (TICKS_PER_DAY*MSEC_PER_TICK) - base)
|
||||||
% (TICKS_PER_DAY*MSEC_PER_TICK);
|
% (TICKS_PER_DAY*MSEC_PER_TICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Thandler;
|
static char *Thandler;
|
||||||
u32_t Tbase, Tcount;
|
static u32_t Tbase, Tcount;
|
||||||
|
|
||||||
void unschedule(void)
|
static void unschedule(void)
|
||||||
/* Invalidate a waiting command. */
|
/* Invalidate a waiting command. */
|
||||||
{
|
{
|
||||||
alarm(0);
|
alarm(0);
|
||||||
|
@ -1521,7 +1522,7 @@ void unschedule(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void schedule(long msec, char *cmd)
|
static void schedule(long msec, char *cmd)
|
||||||
/* Schedule command at a certain time from now. */
|
/* Schedule command at a certain time from now. */
|
||||||
{
|
{
|
||||||
unschedule();
|
unschedule();
|
||||||
|
@ -1552,7 +1553,7 @@ void delay(char *msec)
|
||||||
} while (!interrupt() && !expired() && milli_since(base) < count);
|
} while (!interrupt() && !expired() && milli_since(base) < count);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum whatfun { NOFUN, SELECT, DEFFUN, USERFUN } menufun(environment *e)
|
static enum whatfun { NOFUN, SELECT, DEFFUN, USERFUN } menufun(environment *e)
|
||||||
{
|
{
|
||||||
if (!(e->flags & E_FUNCTION) || e->arg[0] == 0) return NOFUN;
|
if (!(e->flags & E_FUNCTION) || e->arg[0] == 0) return NOFUN;
|
||||||
if (e->arg[1] != ',') return SELECT;
|
if (e->arg[1] != ',') return SELECT;
|
||||||
|
@ -1587,6 +1588,7 @@ void menu(void)
|
||||||
case SELECT:
|
case SELECT:
|
||||||
printf(" %c Select %s kernel\n", e->arg[0],e->name);
|
printf(" %c Select %s kernel\n", e->arg[0],e->name);
|
||||||
break;
|
break;
|
||||||
|
case NOFUN:
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1655,7 +1657,7 @@ void help(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute(void)
|
static void execute(void)
|
||||||
/* Get one command from the command chain and execute it. */
|
/* Get one command from the command chain and execute it. */
|
||||||
{
|
{
|
||||||
token *second, *third, *fourth, *sep;
|
token *second, *third, *fourth, *sep;
|
||||||
|
@ -1915,7 +1917,7 @@ int run_trailer(void)
|
||||||
return !err;
|
return !err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitor(void)
|
static void monitor(void)
|
||||||
/* Read a line and tokenize it. */
|
/* Read a line and tokenize it. */
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
|
|
|
@ -187,9 +187,9 @@ void readerr(off_t sec, int err);
|
||||||
/* Report a read error. */
|
/* Report a read error. */
|
||||||
char *ul2a(u32_t n, unsigned b), *ul2a10(u32_t n);
|
char *ul2a(u32_t n, unsigned b), *ul2a10(u32_t n);
|
||||||
/* Transform u32_t to ASCII at base b or base 10. */
|
/* Transform u32_t to ASCII at base b or base 10. */
|
||||||
long a2l(char *a);
|
long a2l(const char *a);
|
||||||
/* Cheap atol(). */
|
/* Cheap atol(). */
|
||||||
unsigned a2x(char *a);
|
unsigned a2x(const char *a);
|
||||||
/* ASCII to hex. */
|
/* ASCII to hex. */
|
||||||
dev_t name2dev(char *name);
|
dev_t name2dev(char *name);
|
||||||
/* Translate a device name to a device number. */
|
/* Translate a device name to a device number. */
|
||||||
|
|
15
boot/rawfs.h
15
boot/rawfs.h
|
@ -30,14 +30,19 @@
|
||||||
* errors.
|
* errors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef INC_RAWFS_H
|
||||||
|
#define INC_RAWFS_H
|
||||||
|
|
||||||
#define ROOT_INO ((ino_t) 1) /* Inode nr of root dir. */
|
#define ROOT_INO ((ino_t) 1) /* Inode nr of root dir. */
|
||||||
|
|
||||||
off_t r_super(int *);
|
extern off_t r_super(int *);
|
||||||
void r_stat(Ino_t file, struct stat *stp);
|
extern void r_stat(Ino_t file, struct stat *stp);
|
||||||
off_t r_vir2abs(off_t virblockno);
|
extern off_t r_vir2abs(off_t virblockno);
|
||||||
ino_t r_readdir(char *name);
|
extern ino_t r_readdir(char *name);
|
||||||
ino_t r_lookup(Ino_t cwd, char *path);
|
extern ino_t r_lookup(Ino_t cwd, char *path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $PchId: rawfs.h,v 1.4 1996/04/19 08:16:36 philip Exp $
|
* $PchId: rawfs.h,v 1.4 1996/04/19 08:16:36 philip Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue