Changes in uspace/srv/devman/main.c [b927375:7beb220] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rb927375 r7beb220 39 39 #include <assert.h> 40 40 #include <ipc/services.h> 41 #include < ipc/ns.h>41 #include <ns.h> 42 42 #include <async.h> 43 43 #include <stdio.h> 44 44 #include <errno.h> 45 #include <str_error.h> 45 46 #include <bool.h> 46 47 #include <fibril_synch.h> … … 51 52 #include <sys/stat.h> 52 53 #include <ctype.h> 54 #include <io/log.h> 53 55 #include <ipc/devman.h> 54 56 #include <ipc/driver.h> 55 57 #include <thread.h> 56 #include < devmap.h>58 #include <loc.h> 57 59 58 60 #include "devman.h" … … 62 64 static driver_list_t drivers_list; 63 65 static dev_tree_t device_tree; 64 static class_list_t class_list;65 66 66 67 /** Register running driver. */ … … 71 72 driver_t *driver = NULL; 72 73 73 printf(NAME ": devman_driver_register \n");74 log_msg(LVL_DEBUG, "devman_driver_register"); 74 75 75 76 iid = async_get_call(&icall); … … 88 89 } 89 90 90 printf(NAME ": the %s driver is trying to register by the service.\n",91 log_msg(LVL_DEBUG, "The `%s' driver is trying to register.", 91 92 drv_name); 92 93 93 94 /* Find driver structure. */ 94 95 driver = find_driver(&drivers_list, drv_name); 95 96 96 if (driver == NULL) { 97 printf(NAME ": no driver named %s was found.\n", drv_name);97 log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name); 98 98 free(drv_name); 99 99 drv_name = NULL; … … 105 105 drv_name = NULL; 106 106 107 fibril_mutex_lock(&driver->driver_mutex); 108 109 if (driver->sess) { 110 /* We already have a connection to the driver. */ 111 log_msg(LVL_ERROR, "Driver '%s' already started.\n", 112 driver->name); 113 fibril_mutex_unlock(&driver->driver_mutex); 114 async_answer_0(iid, EEXISTS); 115 return NULL; 116 } 117 118 switch (driver->state) { 119 case DRIVER_NOT_STARTED: 120 /* Somebody started the driver manually. */ 121 log_msg(LVL_NOTE, "Driver '%s' started manually.\n", 122 driver->name); 123 driver->state = DRIVER_STARTING; 124 break; 125 case DRIVER_STARTING: 126 /* The expected case */ 127 break; 128 case DRIVER_RUNNING: 129 /* Should not happen since we do not have a connected session */ 130 assert(false); 131 } 132 107 133 /* Create connection to the driver. */ 108 printf(NAME ": creating connection to the %s driver.\n", driver->name);109 ipc_call_t call;110 ipc_callid_t callid = async_get_call(&call);111 if ( IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {112 async_answer_0(callid, ENOTSUP);134 log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.", 135 driver->name); 136 driver->sess = async_callback_receive(EXCHANGE_SERIALIZE); 137 if (!driver->sess) { 138 fibril_mutex_unlock(&driver->driver_mutex); 113 139 async_answer_0(iid, ENOTSUP); 114 140 return NULL; 115 141 } 116 142 117 /* Remember driver's phone. */118 set_driver_phone(driver, IPC_GET_ARG5(call));119 120 printf(NAME ": the %s driver was successfully registered as running.\n",143 fibril_mutex_unlock(&driver->driver_mutex); 144 145 log_msg(LVL_NOTE, 146 "The `%s' driver was successfully registered as running.", 121 147 driver->name); 122 148 123 async_answer_0(callid, EOK);124 149 async_answer_0(iid, EOK); 125 150 … … 142 167 callid = async_get_call(&call); 143 168 if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) { 144 printf(NAME ": ERROR: devman_receive_match_id - invalid "145 " protocol.\n");169 log_msg(LVL_ERROR, 170 "Invalid protocol when trying to receive match id."); 146 171 async_answer_0(callid, EINVAL); 147 172 delete_match_id(match_id); … … 150 175 151 176 if (match_id == NULL) { 152 printf(NAME ": ERROR: devman_receive_match_id - failed to " 153 "allocate match id.\n"); 177 log_msg(LVL_ERROR, "Failed to allocate match id."); 154 178 async_answer_0(callid, ENOMEM); 155 179 return ENOMEM; … … 165 189 if (rc != EOK) { 166 190 delete_match_id(match_id); 167 printf(NAME ": devman_receive_match_id - failed to receive "168 "match id string.\n");191 log_msg(LVL_ERROR, "Failed to receive match id string: %s.", 192 str_error(rc)); 169 193 return rc; 170 194 } … … 172 196 list_append(&match_id->link, &match_ids->ids); 173 197 174 printf(NAME ": received match id '%s', score = %d \n",198 log_msg(LVL_DEBUG, "Received match id `%s', score %d.", 175 199 match_id->id, match_id->score); 176 200 return rc; … … 228 252 if (ftype != fun_inner && ftype != fun_exposed) { 229 253 /* Unknown function type */ 230 printf(NAME ": Error, unknown function type provided by driver!\n"); 254 log_msg(LVL_ERROR, 255 "Unknown function type %d provided by driver.", 256 (int) ftype); 231 257 232 258 fibril_rwlock_write_unlock(&tree->rwlock); … … 243 269 } 244 270 271 /* Check that function with same name is not there already. */ 272 if (find_fun_node_in_device(pdev, fun_name) != NULL) { 273 fibril_rwlock_write_unlock(&tree->rwlock); 274 async_answer_0(callid, EEXISTS); 275 printf(NAME ": Warning, driver tried to register `%s' twice.\n", 276 fun_name); 277 free(fun_name); 278 return; 279 } 280 245 281 fun_node_t *fun = create_fun_node(); 282 fun->ftype = ftype; 283 246 284 if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) { 247 285 fibril_rwlock_write_unlock(&tree->rwlock); … … 265 303 fibril_rwlock_write_unlock(&tree->rwlock); 266 304 267 printf(NAME ": devman_add_function %s\n", fun->pathname);305 log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname); 268 306 269 307 devman_receive_match_ids(match_count, &fun->match_ids); … … 289 327 } 290 328 } else { 291 devmap_register_tree_function(fun, tree);329 loc_register_tree_function(fun, tree); 292 330 } 293 331 … … 296 334 } 297 335 298 static void devmap_register_class_dev(dev_class_info_t *cli) 299 { 300 /* Create devmap path and name for the device. */ 301 char *devmap_pathname = NULL; 302 303 asprintf(&devmap_pathname, "%s/%s%c%s", DEVMAP_CLASS_NAMESPACE, 304 cli->dev_class->name, DEVMAP_SEPARATOR, cli->dev_name); 305 if (devmap_pathname == NULL) 306 return; 307 308 /* 309 * Register the device by the device mapper and remember its devmap 310 * handle. 311 */ 312 devmap_device_register_with_iface(devmap_pathname, 313 &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP); 314 315 /* 316 * Add device to the hash map of class devices registered by device 317 * mapper. 318 */ 319 class_add_devmap_function(&class_list, cli); 320 321 free(devmap_pathname); 322 } 323 324 static void devman_add_function_to_class(ipc_callid_t callid, ipc_call_t *call) 336 static void devman_add_function_to_cat(ipc_callid_t callid, ipc_call_t *call) 325 337 { 326 338 devman_handle_t handle = IPC_GET_ARG1(*call); 327 328 /* Get class name. */ 329 char *class_name; 330 int rc = async_data_write_accept((void **) &class_name, true, 339 category_id_t cat_id; 340 int rc; 341 342 /* Get category name. */ 343 char *cat_name; 344 rc = async_data_write_accept((void **) &cat_name, true, 331 345 0, 0, 0, 0); 332 346 if (rc != EOK) { … … 341 355 } 342 356 343 dev_class_t *cl = get_dev_class(&class_list, class_name); 344 dev_class_info_t *class_info = add_function_to_class(fun, cl, NULL); 345 346 /* Register the device's class alias by devmapper. */ 347 devmap_register_class_dev(class_info); 348 349 printf(NAME ": function'%s' added to class '%s', class name '%s' was " 350 "asigned to it\n", fun->pathname, class_name, class_info->dev_name); 351 357 rc = loc_category_get_id(cat_name, &cat_id, IPC_FLAG_BLOCKING); 358 if (rc == EOK) { 359 loc_service_add_to_cat(fun->service_id, cat_id); 360 } else { 361 log_msg(LVL_ERROR, "Failed adding function `%s' to category " 362 "`%s'.", fun->pathname, cat_name); 363 } 364 365 log_msg(LVL_NOTE, "Function `%s' added to category `%s'.", 366 fun->pathname, cat_name); 367 368 async_answer_0(callid, EOK); 369 } 370 371 /** Remove function. */ 372 static void devman_remove_function(ipc_callid_t callid, ipc_call_t *call) 373 { 374 devman_handle_t fun_handle = IPC_GET_ARG1(*call); 375 dev_tree_t *tree = &device_tree; 376 int rc; 377 378 fibril_rwlock_write_lock(&tree->rwlock); 379 380 fun_node_t *fun = find_fun_node_no_lock(&device_tree, fun_handle); 381 if (fun == NULL) { 382 fibril_rwlock_write_unlock(&tree->rwlock); 383 async_answer_0(callid, ENOENT); 384 return; 385 } 386 387 log_msg(LVL_DEBUG, "devman_remove_function(fun='%s')", fun->pathname); 388 389 if (fun->ftype == fun_inner) { 390 /* Handle possible descendants */ 391 /* TODO */ 392 log_msg(LVL_WARN, "devman_remove_function(): not handling " 393 "descendants\n"); 394 } else { 395 /* Unregister from location service */ 396 rc = loc_service_unregister(fun->service_id); 397 if (rc != EOK) { 398 log_msg(LVL_ERROR, "Failed unregistering tree service."); 399 fibril_rwlock_write_unlock(&tree->rwlock); 400 async_answer_0(callid, EIO); 401 return; 402 } 403 } 404 405 remove_fun_node(&device_tree, fun); 406 fibril_rwlock_write_unlock(&tree->rwlock); 407 delete_fun_node(fun); 408 409 log_msg(LVL_DEBUG, "devman_remove_function() succeeded."); 352 410 async_answer_0(callid, EOK); 353 411 } … … 363 421 364 422 initialize_running_driver(driver, &device_tree); 365 printf(NAME ": the %s driver was successfully initialized. \n",423 log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.", 366 424 driver->name); 367 425 return 0; … … 385 443 fid_t fid = fibril_create(init_running_drv, driver); 386 444 if (fid == 0) { 387 printf(NAME ": Error creating fibril for the initialization of "388 " the newly registered running driver.\n");445 log_msg(LVL_ERROR, "Failed to create initialization fibril " \ 446 "for driver `%s'.", driver->name); 389 447 return; 390 448 } 391 449 fibril_add_ready(fid); 392 450 393 ipc_callid_t callid; 394 ipc_call_t call; 395 bool cont = true; 396 while (cont) { 397 callid = async_get_call(&call); 451 while (true) { 452 ipc_call_t call; 453 ipc_callid_t callid = async_get_call(&call); 454 455 if (!IPC_GET_IMETHOD(call)) 456 break; 398 457 399 458 switch (IPC_GET_IMETHOD(call)) { 400 case IPC_M_PHONE_HUNGUP:401 cont = false;402 continue;403 459 case DEVMAN_ADD_FUNCTION: 404 460 devman_add_function(callid, &call); 405 461 break; 406 case DEVMAN_ADD_DEVICE_TO_CLASS: 407 devman_add_function_to_class(callid, &call); 462 case DEVMAN_ADD_DEVICE_TO_CATEGORY: 463 devman_add_function_to_cat(callid, &call); 464 break; 465 case DEVMAN_REMOVE_FUNCTION: 466 devman_remove_function(callid, &call); 408 467 break; 409 468 default: … … 438 497 } 439 498 499 /** Get device name. */ 500 static void devman_fun_get_name(ipc_callid_t iid, ipc_call_t *icall) 501 { 502 devman_handle_t handle = IPC_GET_ARG1(*icall); 503 504 fun_node_t *fun = find_fun_node(&device_tree, handle); 505 if (fun == NULL) { 506 async_answer_0(iid, ENOMEM); 507 return; 508 } 509 510 ipc_callid_t data_callid; 511 size_t data_len; 512 if (!async_data_read_receive(&data_callid, &data_len)) { 513 async_answer_0(iid, EINVAL); 514 return; 515 } 516 517 void *buffer = malloc(data_len); 518 if (buffer == NULL) { 519 async_answer_0(data_callid, ENOMEM); 520 async_answer_0(iid, ENOMEM); 521 return; 522 } 523 524 size_t sent_length = str_size(fun->name); 525 if (sent_length > data_len) { 526 sent_length = data_len; 527 } 528 529 async_data_read_finalize(data_callid, fun->name, sent_length); 530 async_answer_0(iid, EOK); 531 532 free(buffer); 533 } 534 535 536 /** Get device path. */ 537 static void devman_fun_get_path(ipc_callid_t iid, ipc_call_t *icall) 538 { 539 devman_handle_t handle = IPC_GET_ARG1(*icall); 540 541 fun_node_t *fun = find_fun_node(&device_tree, handle); 542 if (fun == NULL) { 543 async_answer_0(iid, ENOMEM); 544 return; 545 } 546 547 ipc_callid_t data_callid; 548 size_t data_len; 549 if (!async_data_read_receive(&data_callid, &data_len)) { 550 async_answer_0(iid, EINVAL); 551 return; 552 } 553 554 void *buffer = malloc(data_len); 555 if (buffer == NULL) { 556 async_answer_0(data_callid, ENOMEM); 557 async_answer_0(iid, ENOMEM); 558 return; 559 } 560 561 size_t sent_length = str_size(fun->pathname); 562 if (sent_length > data_len) { 563 sent_length = data_len; 564 } 565 566 async_data_read_finalize(data_callid, fun->pathname, sent_length); 567 async_answer_0(iid, EOK); 568 569 free(buffer); 570 } 571 572 static void devman_dev_get_functions(ipc_callid_t iid, ipc_call_t *icall) 573 { 574 ipc_callid_t callid; 575 size_t size; 576 size_t act_size; 577 int rc; 578 579 if (!async_data_read_receive(&callid, &size)) { 580 async_answer_0(callid, EREFUSED); 581 async_answer_0(iid, EREFUSED); 582 return; 583 } 584 585 fibril_rwlock_read_lock(&device_tree.rwlock); 586 587 dev_node_t *dev = find_dev_node_no_lock(&device_tree, 588 IPC_GET_ARG1(*icall)); 589 if (dev == NULL) { 590 fibril_rwlock_read_unlock(&device_tree.rwlock); 591 async_answer_0(callid, ENOENT); 592 async_answer_0(iid, ENOENT); 593 return; 594 } 595 596 devman_handle_t *hdl_buf = (devman_handle_t *) malloc(size); 597 if (hdl_buf == NULL) { 598 fibril_rwlock_read_unlock(&device_tree.rwlock); 599 async_answer_0(callid, ENOMEM); 600 async_answer_0(iid, ENOMEM); 601 return; 602 } 603 604 rc = dev_get_functions(&device_tree, dev, hdl_buf, size, &act_size); 605 if (rc != EOK) { 606 fibril_rwlock_read_unlock(&device_tree.rwlock); 607 async_answer_0(callid, rc); 608 async_answer_0(iid, rc); 609 return; 610 } 611 612 fibril_rwlock_read_unlock(&device_tree.rwlock); 613 614 sysarg_t retval = async_data_read_finalize(callid, hdl_buf, size); 615 free(hdl_buf); 616 617 async_answer_1(iid, retval, act_size); 618 } 619 620 621 /** Get handle for child device of a function. */ 622 static void devman_fun_get_child(ipc_callid_t iid, ipc_call_t *icall) 623 { 624 fun_node_t *fun; 625 626 fibril_rwlock_read_lock(&device_tree.rwlock); 627 628 fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall)); 629 if (fun == NULL) { 630 fibril_rwlock_read_unlock(&device_tree.rwlock); 631 async_answer_0(iid, ENOENT); 632 return; 633 } 634 635 if (fun->child == NULL) { 636 fibril_rwlock_read_unlock(&device_tree.rwlock); 637 async_answer_0(iid, ENOENT); 638 return; 639 } 640 641 async_answer_1(iid, EOK, fun->child->handle); 642 643 fibril_rwlock_read_unlock(&device_tree.rwlock); 644 } 645 646 /** Find handle for the function instance identified by its service ID. */ 647 static void devman_fun_sid_to_handle(ipc_callid_t iid, ipc_call_t *icall) 648 { 649 fun_node_t *fun; 650 651 fun = find_loc_tree_function(&device_tree, IPC_GET_ARG1(*icall)); 652 653 if (fun == NULL) { 654 async_answer_0(iid, ENOENT); 655 return; 656 } 657 658 async_answer_1(iid, EOK, fun->handle); 659 } 440 660 441 661 /** Function for handling connections from a client to the device manager. */ … … 445 665 async_answer_0(iid, EOK); 446 666 447 bool cont = true; 448 while (cont) { 667 while (true) { 449 668 ipc_call_t call; 450 669 ipc_callid_t callid = async_get_call(&call); 451 670 671 if (!IPC_GET_IMETHOD(call)) 672 break; 673 452 674 switch (IPC_GET_IMETHOD(call)) { 453 case IPC_M_PHONE_HUNGUP:454 cont = false;455 continue;456 675 case DEVMAN_DEVICE_GET_HANDLE: 457 676 devman_function_get_handle(callid, &call); 677 break; 678 case DEVMAN_DEV_GET_FUNCTIONS: 679 devman_dev_get_functions(callid, &call); 680 break; 681 case DEVMAN_FUN_GET_CHILD: 682 devman_fun_get_child(callid, &call); 683 break; 684 case DEVMAN_FUN_GET_NAME: 685 devman_fun_get_name(callid, &call); 686 break; 687 case DEVMAN_FUN_GET_PATH: 688 devman_fun_get_path(callid, &call); 689 break; 690 case DEVMAN_FUN_SID_TO_HANDLE: 691 devman_fun_sid_to_handle(callid, &call); 458 692 break; 459 693 default: … … 477 711 dev = fun->dev; 478 712 479 if (fun == NULL && dev == NULL) { 480 printf(NAME ": devman_forward error - no device or function with " 481 "handle %" PRIun " was found.\n", handle); 713 /* 714 * For a valid function to connect to we need a device. The root 715 * function, for example, has no device and cannot be connected to. 716 * This means @c dev needs to be valid regardless whether we are 717 * connecting to a device or to a function. 718 */ 719 if (dev == NULL) { 720 log_msg(LVL_ERROR, "IPC forwarding failed - no device or " 721 "function with handle %" PRIun " was found.", handle); 482 722 async_answer_0(iid, ENOENT); 483 723 return; … … 485 725 486 726 if (fun == NULL && !drv_to_parent) { 487 printf(NAME ": devman_forward error - cannot connect to " 488 "handle %" PRIun ", refers to a device.\n", handle); 727 log_msg(LVL_ERROR, NAME ": devman_forward error - cannot " 728 "connect to handle %" PRIun ", refers to a device.", 729 handle); 489 730 async_answer_0(iid, ENOENT); 490 731 return; … … 507 748 508 749 if (driver == NULL) { 509 printf(NAME ": devman_forward error - the device is not in %" PRIun510 " usable state.\n", handle);750 log_msg(LVL_ERROR, "IPC forwarding refused - " \ 751 "the device %" PRIun " is not in usable state.", handle); 511 752 async_answer_0(iid, ENOENT); 512 753 return; … … 519 760 method = DRIVER_CLIENT; 520 761 521 if (driver->phone <= 0) { 522 printf(NAME ": devman_forward: cound not forward to driver %s ", 523 driver->name); 524 printf("the driver's phone is %" PRIun ").\n", driver->phone); 762 if (!driver->sess) { 763 log_msg(LVL_ERROR, 764 "Could not forward to driver `%s'.", driver->name); 525 765 async_answer_0(iid, EINVAL); 526 766 return; … … 528 768 529 769 if (fun != NULL) { 530 printf(NAME ": devman_forward: forward connection to function %s to " 531 "driver %s.\n", fun->pathname, driver->name); 770 log_msg(LVL_DEBUG, 771 "Forwarding request for `%s' function to driver `%s'.", 772 fun->pathname, driver->name); 532 773 } else { 533 printf(NAME ": devman_forward: forward connection to device %s to " 534 "driver %s.\n", dev->pfun->pathname, driver->name); 535 } 536 537 async_forward_fast(iid, driver->phone, method, fwd_h, 0, IPC_FF_NONE); 538 } 539 540 /** Function for handling connections from a client forwarded by the device 541 * mapper to the device manager. */ 542 static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall) 543 { 544 devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall); 774 log_msg(LVL_DEBUG, 775 "Forwarding request for `%s' device to driver `%s'.", 776 dev->pfun->pathname, driver->name); 777 } 778 779 async_exch_t *exch = async_exchange_begin(driver->sess); 780 async_forward_fast(iid, exch, method, fwd_h, 0, IPC_FF_NONE); 781 async_exchange_end(exch); 782 } 783 784 /** Function for handling connections from a client forwarded by the location 785 * service to the device manager. */ 786 static void devman_connection_loc(ipc_callid_t iid, ipc_call_t *icall) 787 { 788 service_id_t service_id = IPC_GET_ARG2(*icall); 545 789 fun_node_t *fun; 546 790 dev_node_t *dev; 547 791 548 fun = find_devmap_tree_function(&device_tree, devmap_handle); 549 if (fun == NULL) 550 fun = find_devmap_class_function(&class_list, devmap_handle); 792 fun = find_loc_tree_function(&device_tree, service_id); 551 793 552 794 if (fun == NULL || fun->dev->drv == NULL) { 795 log_msg(LVL_WARN, "devman_connection_loc(): function " 796 "not found.\n"); 553 797 async_answer_0(iid, ENOENT); 554 798 return; … … 557 801 dev = fun->dev; 558 802 559 if (dev->state != DEVICE_USABLE || dev->drv->phone <= 0) { 560 async_answer_0(iid, EINVAL); 561 return; 562 } 563 564 async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, fun->handle, 0, 803 async_exch_t *exch = async_exchange_begin(dev->drv->sess); 804 async_forward_fast(iid, exch, DRIVER_CLIENT, fun->handle, 0, 565 805 IPC_FF_NONE); 566 printf(NAME ": devman_connection_devmapper: forwarded connection to " 567 "device %s to driver %s.\n", fun->pathname, dev->drv->name); 806 async_exchange_end(exch); 807 808 log_msg(LVL_DEBUG, 809 "Forwarding loc service request for `%s' function to driver `%s'.", 810 fun->pathname, dev->drv->name); 568 811 } 569 812 570 813 /** Function for handling connections to device manager. */ 571 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall )814 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 572 815 { 573 816 /* Select interface. */ … … 583 826 devman_forward(iid, icall, false); 584 827 break; 585 case DEVMAN_CONNECT_FROM_ DEVMAP:586 /* Someone connected through devmapnode. */587 devman_connection_ devmapper(iid, icall);828 case DEVMAN_CONNECT_FROM_LOC: 829 /* Someone connected through loc node. */ 830 devman_connection_loc(iid, icall); 588 831 break; 589 832 case DEVMAN_CONNECT_TO_PARENTS_DEVICE: … … 600 843 static bool devman_init(void) 601 844 { 602 printf(NAME ": devman_init - looking for available drivers.\n");845 log_msg(LVL_DEBUG, "devman_init - looking for available drivers."); 603 846 604 847 /* Initialize list of available drivers. */ … … 606 849 if (lookup_available_drivers(&drivers_list, 607 850 DRIVER_DEFAULT_STORE) == 0) { 608 printf(NAME " no drivers found.");851 log_msg(LVL_FATAL, "No drivers found."); 609 852 return false; 610 853 } 611 854 612 printf(NAME ": devman_init - list of drivers has been initialized.\n");855 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized."); 613 856 614 857 /* Create root device node. */ 615 858 if (!init_device_tree(&device_tree, &drivers_list)) { 616 printf(NAME " failed to initialize device tree.");859 log_msg(LVL_FATAL, "Failed to initialize device tree."); 617 860 return false; 618 861 } 619 862 620 init_class_list(&class_list);621 622 863 /* 623 * !!! devman_connection ... as the device manager is not a real devmap864 * !!! devman_connection ... as the device manager is not a real loc 624 865 * driver (it uses a completely different ipc protocol than an ordinary 625 * devmapdriver) forwarding a connection from client to the devman by626 * devmapperwould not work.866 * loc driver) forwarding a connection from client to the devman by 867 * location service would not work. 627 868 */ 628 devmap_driver_register(NAME, devman_connection);869 loc_server_register(NAME, devman_connection); 629 870 630 871 return true; … … 635 876 printf(NAME ": HelenOS Device Manager\n"); 636 877 878 if (log_init(NAME, LVL_WARN) != EOK) { 879 printf(NAME ": Error initializing logging subsystem.\n"); 880 return -1; 881 } 882 637 883 if (!devman_init()) { 638 printf(NAME ": Error while initializing service\n");884 log_msg(LVL_ERROR, "Error while initializing service."); 639 885 return -1; 640 886 } … … 644 890 645 891 /* Register device manager at naming service. */ 646 if (service_register(SERVICE_DEVMAN) != EOK) 892 if (service_register(SERVICE_DEVMAN) != EOK) { 893 log_msg(LVL_ERROR, "Failed registering as a service."); 647 894 return -1; 648 649 printf(NAME ": Accepting connections\n"); 895 } 896 897 printf(NAME ": Accepting connections.\n"); 898 task_retval(0); 650 899 async_manager(); 651 900
Note:
See TracChangeset
for help on using the changeset viewer.