Rev 4573 | Rev 4621 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4573 | Rev 4592 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | printf(NAME ": HelenOS init\n"); |
53 | printf(NAME ": HelenOS init\n"); |
54 | } |
54 | } |
55 | 55 | ||
56 | static bool mount_root(const char *fstype) |
56 | static bool mount_root(const char *fstype) |
57 | { |
57 | { |
58 | int rc = -1; |
- | |
59 | char *opts = ""; |
58 | char *opts = ""; |
60 | const char *root_dev = "initrd"; |
59 | const char *root_dev = "initrd"; |
61 | 60 | ||
62 | if (str_cmp(fstype, "tmpfs") == 0) |
61 | if (str_cmp(fstype, "tmpfs") == 0) |
63 | opts = "restore"; |
62 | opts = "restore"; |
64 | 63 | ||
65 | while (rc < 0) { |
- | |
66 | rc = mount(fstype, "/", root_dev, opts, IPC_FLAG_BLOCKING); |
64 | int rc = mount(fstype, "/", root_dev, opts, IPC_FLAG_BLOCKING); |
67 | 65 | ||
68 | switch (rc) { |
66 | switch (rc) { |
69 | case EOK: |
67 | case EOK: |
70 | printf(NAME ": Root filesystem mounted, %s at %s\n", |
68 | printf(NAME ": Root filesystem mounted, %s at %s\n", |
71 | fstype, root_dev); |
69 | fstype, root_dev); |
72 | break; |
70 | break; |
73 | case EBUSY: |
71 | case EBUSY: |
74 | printf(NAME ": Root filesystem already mounted\n"); |
72 | printf(NAME ": Root filesystem already mounted\n"); |
75 | break; |
73 | return false; |
76 | case ELIMIT: |
74 | case ELIMIT: |
77 | printf(NAME ": Unable to mount root filesystem\n"); |
75 | printf(NAME ": Unable to mount root filesystem\n"); |
78 | return false; |
76 | return false; |
79 | case ENOENT: |
77 | case ENOENT: |
80 | printf(NAME ": Unknown filesystem type (%s)\n", fstype); |
78 | printf(NAME ": Unknown filesystem type (%s)\n", fstype); |
81 | return false; |
79 | return false; |
82 | } |
80 | default: |
- | 81 | printf(NAME ": Error mounting root filesystem (%d)\n", rc); |
|
- | 82 | return false; |
|
83 | } |
83 | } |
84 | 84 | ||
85 | return true; |
85 | return true; |
86 | } |
86 | } |
87 | 87 | ||
88 | static bool mount_devfs(void) |
88 | static bool mount_devfs(void) |
89 | { |
89 | { |
- | 90 | char null[MAX_DEVICE_NAME]; |
|
90 | int rc = -1; |
91 | int null_id = devmap_null_create(); |
91 | 92 | ||
92 | while (rc < 0) { |
93 | if (null_id == -1) { |
- | 94 | printf(NAME ": Unable to create null device\n"); |
|
- | 95 | return false; |
|
- | 96 | } |
|
- | 97 | ||
- | 98 | snprintf(null, MAX_DEVICE_NAME, "null%d", null_id); |
|
93 | rc = mount("devfs", "/dev", "null", "", IPC_FLAG_BLOCKING); |
99 | int rc = mount("devfs", "/dev", null, "", IPC_FLAG_BLOCKING); |
94 | 100 | ||
95 | switch (rc) { |
101 | switch (rc) { |
96 | case EOK: |
102 | case EOK: |
97 | printf(NAME ": Device filesystem mounted\n"); |
103 | printf(NAME ": Device filesystem mounted\n"); |
98 | break; |
104 | break; |
99 | case EBUSY: |
105 | case EBUSY: |
100 | printf(NAME ": Device filesystem already mounted\n"); |
106 | printf(NAME ": Device filesystem already mounted\n"); |
- | 107 | devmap_null_destroy(null_id); |
|
101 | break; |
108 | return false; |
102 | case ELIMIT: |
109 | case ELIMIT: |
103 | printf(NAME ": Unable to mount device filesystem\n"); |
110 | printf(NAME ": Unable to mount device filesystem\n"); |
- | 111 | devmap_null_destroy(null_id); |
|
104 | return false; |
112 | return false; |
105 | case ENOENT: |
113 | case ENOENT: |
106 | printf(NAME ": Unknown filesystem type (devfs)\n"); |
114 | printf(NAME ": Unknown filesystem type (devfs)\n"); |
- | 115 | devmap_null_destroy(null_id); |
|
107 | return false; |
116 | return false; |
108 | } |
117 | default: |
- | 118 | printf(NAME ": Error mounting device filesystem (%d)\n", rc); |
|
- | 119 | devmap_null_destroy(null_id); |
|
- | 120 | return false; |
|
109 | } |
121 | } |
110 | 122 | ||
111 | return true; |
123 | return true; |
112 | } |
124 | } |
113 | 125 | ||
Line 185... | Line 197... | ||
185 | spawn("/srv/console"); |
197 | spawn("/srv/console"); |
186 | spawn("/srv/fhc"); |
198 | spawn("/srv/fhc"); |
187 | spawn("/srv/obio"); |
199 | spawn("/srv/obio"); |
188 | spawn("/srv/ata_bd"); |
200 | spawn("/srv/ata_bd"); |
189 | spawn("/srv/gxe_bd"); |
201 | spawn("/srv/gxe_bd"); |
190 | 202 | ||
191 | usleep(250000); |
203 | usleep(250000); // FIXME |
192 | mount_data(); |
204 | mount_data(); |
193 | 205 | ||
194 | getvc("vc0", "/app/bdsh"); |
206 | getvc("vc0", "/app/bdsh"); |
195 | getvc("vc1", "/app/bdsh"); |
207 | getvc("vc1", "/app/bdsh"); |
196 | getvc("vc2", "/app/bdsh"); |
208 | getvc("vc2", "/app/bdsh"); |
197 | getvc("vc3", "/app/bdsh"); |
209 | getvc("vc3", "/app/bdsh"); |
198 | getvc("vc4", "/app/bdsh"); |
210 | getvc("vc4", "/app/bdsh"); |