Changes in uspace/app/init/init.c [31e9fe0:73d8600] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
r31e9fe0 r73d8600 49 49 #include <loc.h> 50 50 #include <str_error.h> 51 #include <config.h> 51 52 #include "init.h" 52 53 … … 59 60 #define TMPFS_FS_TYPE "tmpfs" 60 61 #define TMPFS_MOUNT_POINT "/tmp" 61 62 #define DATA_FS_TYPE "fat"63 #define DATA_DEVICE "bd/ata1disk0"64 #define DATA_MOUNT_POINT "/data"65 62 66 63 #define SRV_CONSOLE "/srv/console" … … 130 127 opts = "restore"; 131 128 132 int rc = mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts,129 int rc = vfs_mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts, 133 130 IPC_FLAG_BLOCKING, 0); 134 131 return mount_report("Root filesystem", ROOT_MOUNT_POINT, fstype, … … 147 144 static bool mount_locfs(void) 148 145 { 149 int rc = mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "",146 int rc = vfs_mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "", 150 147 IPC_FLAG_BLOCKING, 0); 151 148 return mount_report("Location service filesystem", LOCFS_MOUNT_POINT, … … 156 153 { 157 154 struct stat s; 158 if (stat(path, &s) == ENOENT) {155 if (stat(path, &s) != 0) { 159 156 printf("%s: Unable to stat %s\n", NAME, path); 160 157 return ENOENT; … … 176 173 va_start(ap, path); 177 174 task_id_t id; 178 int rc = task_spawn(&id, path, cnt, ap); 175 task_wait_t wait; 176 int rc = task_spawn(&id, &wait, path, cnt, ap); 179 177 va_end(ap); 180 178 … … 193 191 task_exit_t texit; 194 192 int retval; 195 rc = task_wait( id, &texit, &retval);193 rc = task_wait(&wait, &texit, &retval); 196 194 if (rc != EOK) { 197 195 printf("%s: Error waiting for %s (%s)\n", NAME, path, … … 257 255 258 256 task_id_t id; 259 int rc = task_spawnl(&id, app, app, winreg, NULL); 257 task_wait_t wait; 258 int rc = task_spawnl(&id, &wait, app, app, winreg, NULL); 260 259 if (rc != EOK) { 261 260 printf("%s: Error spawning %s %s (%s)\n", NAME, app, … … 266 265 task_exit_t texit; 267 266 int retval; 268 rc = task_wait( id, &texit, &retval);267 rc = task_wait(&wait, &texit, &retval); 269 268 if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) { 270 269 printf("%s: Error retrieving retval from %s (%s)\n", NAME, … … 276 275 } 277 276 278 static void getterm(const char *svc, const char *app, bool wmsg) 279 { 280 char term[LOC_NAME_MAXLEN]; 281 snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc); 282 283 printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app); 284 285 /* Wait for the terminal service to be ready */ 286 service_id_t service_id; 287 int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 288 if (rc != EOK) { 289 printf("%s: Error waiting on %s (%s)\n", NAME, term, 290 str_error(rc)); 291 return; 292 } 293 294 if (wmsg) { 295 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term, 296 app, NULL); 297 if (rc != EOK) { 298 printf("%s: Error spawning %s -w %s %s (%s)\n", NAME, 299 APP_GETTERM, term, app, str_error(rc)); 300 } 277 static void getterm(const char *svc, const char *app, bool msg) 278 { 279 if (msg) { 280 printf("%s: Spawning %s %s %s --msg --wait -- %s\n", NAME, 281 APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 282 283 int rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 284 LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL); 285 if (rc != EOK) 286 printf("%s: Error spawning %s %s %s --msg --wait -- %s\n", 287 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 301 288 } else { 302 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app, 303 NULL); 304 if (rc != EOK) { 305 printf("%s: Error spawning %s %s %s (%s)\n", NAME, 306 APP_GETTERM, term, app, str_error(rc)); 307 } 289 printf("%s: Spawning %s %s %s --wait -- %s\n", NAME, 290 APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 291 292 int rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 293 LOCFS_MOUNT_POINT, "--wait", "--", app, NULL); 294 if (rc != EOK) 295 printf("%s: Error spawning %s %s %s --wait -- %s\n", 296 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 308 297 } 309 298 } … … 311 300 static bool mount_tmpfs(void) 312 301 { 313 int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0);302 int rc = vfs_mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0); 314 303 return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT, 315 304 TMPFS_FS_TYPE, NULL, rc); 316 305 } 317 306 318 static bool mount_data(void)319 {320 int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0, 0);321 return mount_report("Data filesystem", DATA_MOUNT_POINT, DATA_FS_TYPE,322 DATA_DEVICE, rc);323 }324 325 307 int main(int argc, char *argv[]) 326 308 { 309 int rc; 310 327 311 info_print(); 328 312 … … 336 320 srv_start("/srv/tmpfs"); 337 321 322 srv_start("/srv/klog"); 338 323 srv_start("/srv/locfs"); 339 324 srv_start("/srv/taskmon"); … … 349 334 srv_start("/srv/apic"); 350 335 srv_start("/srv/i8259"); 336 srv_start("/srv/icp-ic"); 351 337 srv_start("/srv/obio"); 352 338 srv_start("/srv/cuda_adb"); 353 339 srv_start("/srv/s3c24xx_uart"); 354 340 srv_start("/srv/s3c24xx_ts"); 341 342 srv_start("/srv/vbd"); 343 srv_start("/srv/volsrv"); 355 344 356 345 srv_start("/srv/loopip"); … … 360 349 srv_start("/srv/udp"); 361 350 srv_start("/srv/dnsrsrv"); 351 srv_start("/srv/dhcp"); 352 srv_start("/srv/nconfsrv"); 362 353 363 354 srv_start("/srv/clipboard"); 364 355 srv_start("/srv/remcons"); 365 356 366 /*367 * Start these synchronously so that mount_data() can be368 * non-blocking.369 */370 #ifdef CONFIG_START_BD371 srv_start("/srv/ata_bd");372 #endif373 374 #ifdef CONFIG_MOUNT_DATA375 /* Make sure fat is running. */376 if (str_cmp(STRING(RDFMT), "fat") != 0)377 srv_start("/srv/fat");378 379 mount_data();380 #else381 (void) mount_data;382 #endif383 384 357 srv_start("/srv/input", HID_INPUT); 385 358 srv_start("/srv/output", HID_OUTPUT); 386 387 int rc = compositor(HID_INPUT, HID_COMPOSITOR_SERVER); 359 srv_start("/srv/hound"); 360 361 if (!config_key_exists("console")) { 362 rc = compositor(HID_INPUT, HID_COMPOSITOR_SERVER); 363 if (rc == EOK) { 364 gui_start("/app/barber", HID_COMPOSITOR_SERVER); 365 gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER); 366 gui_start("/app/vterm", HID_COMPOSITOR_SERVER); 367 } 368 } 369 370 rc = console(HID_INPUT, HID_OUTPUT); 388 371 if (rc == EOK) { 389 gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER); 390 gui_start("/app/vterm", HID_COMPOSITOR_SERVER); 391 } else { 392 rc = console(HID_INPUT, HID_OUTPUT); 393 if (rc == EOK) { 394 getterm("term/vc0", "/app/bdsh", true); 395 getterm("term/vc1", "/app/bdsh", false); 396 getterm("term/vc2", "/app/bdsh", false); 397 getterm("term/vc3", "/app/bdsh", false); 398 getterm("term/vc4", "/app/bdsh", false); 399 getterm("term/vc5", "/app/bdsh", false); 400 getterm("term/vc6", "/app/klog", false); 401 } 372 getterm("term/vc0", "/app/bdsh", true); 373 getterm("term/vc1", "/app/bdsh", false); 374 getterm("term/vc2", "/app/bdsh", false); 375 getterm("term/vc3", "/app/bdsh", false); 376 getterm("term/vc4", "/app/bdsh", false); 377 getterm("term/vc5", "/app/bdsh", false); 402 378 } 403 379
Note:
See TracChangeset
for help on using the changeset viewer.