45,6 → 45,7 |
#include <malloc.h> |
#include <macros.h> |
#include <console.h> |
#include <string.h> |
#include "init.h" |
#include "version.h" |
|
51,9 → 52,13 |
static bool mount_fs(const char *fstype) |
{ |
int rc = -1; |
char *opts = ""; |
|
if (str_cmp(fstype, "tmpfs") == 0) |
opts = "restore"; |
|
while (rc < 0) { |
rc = mount(fstype, "/", "initrd", IPC_FLAG_BLOCKING); |
rc = mount(fstype, "/", "initrd", opts, IPC_FLAG_BLOCKING); |
|
switch (rc) { |
case EOK: |
74,6 → 79,32 |
return true; |
} |
|
static bool mount_devfs(void) |
{ |
int rc = -1; |
|
while (rc < 0) { |
rc = mount("devfs", "/dev", "null", "", IPC_FLAG_BLOCKING); |
|
switch (rc) { |
case EOK: |
printf(NAME ": Device filesystem mounted\n"); |
break; |
case EBUSY: |
printf(NAME ": Device filesystem already mounted\n"); |
break; |
case ELIMIT: |
printf(NAME ": Unable to mount device filesystem\n"); |
return false; |
case ENOENT: |
printf(NAME ": Unknown filesystem type (devfs)\n"); |
return false; |
} |
} |
|
return true; |
} |
|
static void spawn(char *fname) |
{ |
char *argv[2]; |
83,12 → 114,8 |
argv[0] = fname; |
argv[1] = NULL; |
|
if (task_spawn(fname, argv)) { |
/* Add reasonable delay to avoid intermixed klog output. */ |
usleep(10000); |
} else { |
if (!task_spawn(fname, argv)) |
printf(NAME ": Error spawning %s\n", fname); |
} |
} |
|
int main(int argc, char *argv[]) |
100,6 → 127,13 |
return -1; |
} |
|
spawn("/srv/devfs"); |
|
if (!mount_devfs()) { |
return(NAME ": Exiting\n"); |
return -2; |
} |
|
spawn("/srv/fb"); |
spawn("/srv/kbd"); |
spawn("/srv/console"); |