Changes in uspace/srv/devman/main.c [7beb220:b927375] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r7beb220 rb927375 39 39 #include <assert.h> 40 40 #include <ipc/services.h> 41 #include < ns.h>41 #include <ipc/ns.h> 42 42 #include <async.h> 43 43 #include <stdio.h> 44 44 #include <errno.h> 45 #include <str_error.h>46 45 #include <bool.h> 47 46 #include <fibril_synch.h> … … 52 51 #include <sys/stat.h> 53 52 #include <ctype.h> 54 #include <io/log.h>55 53 #include <ipc/devman.h> 56 54 #include <ipc/driver.h> 57 55 #include <thread.h> 58 #include < loc.h>56 #include <devmap.h> 59 57 60 58 #include "devman.h" … … 64 62 static driver_list_t drivers_list; 65 63 static dev_tree_t device_tree; 64 static class_list_t class_list; 66 65 67 66 /** Register running driver. */ … … 72 71 driver_t *driver = NULL; 73 72 74 log_msg(LVL_DEBUG, "devman_driver_register");73 printf(NAME ": devman_driver_register \n"); 75 74 76 75 iid = async_get_call(&icall); … … 89 88 } 90 89 91 log_msg(LVL_DEBUG, "The `%s' driver is trying to register.",90 printf(NAME ": the %s driver is trying to register by the service.\n", 92 91 drv_name); 93 92 94 93 /* Find driver structure. */ 95 94 driver = find_driver(&drivers_list, drv_name); 95 96 96 if (driver == NULL) { 97 log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name);97 printf(NAME ": no driver named %s was found.\n", 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 133 107 /* Create connection to the driver. */ 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);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); 139 113 async_answer_0(iid, ENOTSUP); 140 114 return NULL; 141 115 } 142 116 143 fibril_mutex_unlock(&driver->driver_mutex);144 145 log_msg(LVL_NOTE,146 "The `%s' driver was successfully registered as running.",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", 147 121 driver->name); 148 122 123 async_answer_0(callid, EOK); 149 124 async_answer_0(iid, EOK); 150 125 … … 167 142 callid = async_get_call(&call); 168 143 if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) { 169 log_msg(LVL_ERROR,170 " Invalid protocol when trying to receive match id.");144 printf(NAME ": ERROR: devman_receive_match_id - invalid " 145 "protocol.\n"); 171 146 async_answer_0(callid, EINVAL); 172 147 delete_match_id(match_id); … … 175 150 176 151 if (match_id == NULL) { 177 log_msg(LVL_ERROR, "Failed to allocate match id."); 152 printf(NAME ": ERROR: devman_receive_match_id - failed to " 153 "allocate match id.\n"); 178 154 async_answer_0(callid, ENOMEM); 179 155 return ENOMEM; … … 189 165 if (rc != EOK) { 190 166 delete_match_id(match_id); 191 log_msg(LVL_ERROR, "Failed to receive match id string: %s.",192 str_error(rc));167 printf(NAME ": devman_receive_match_id - failed to receive " 168 "match id string.\n"); 193 169 return rc; 194 170 } … … 196 172 list_append(&match_id->link, &match_ids->ids); 197 173 198 log_msg(LVL_DEBUG, "Received match id `%s', score %d.",174 printf(NAME ": received match id '%s', score = %d \n", 199 175 match_id->id, match_id->score); 200 176 return rc; … … 252 228 if (ftype != fun_inner && ftype != fun_exposed) { 253 229 /* Unknown function type */ 254 log_msg(LVL_ERROR, 255 "Unknown function type %d provided by driver.", 256 (int) ftype); 230 printf(NAME ": Error, unknown function type provided by driver!\n"); 257 231 258 232 fibril_rwlock_write_unlock(&tree->rwlock); … … 269 243 } 270 244 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 281 245 fun_node_t *fun = create_fun_node(); 282 fun->ftype = ftype;283 284 246 if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) { 285 247 fibril_rwlock_write_unlock(&tree->rwlock); … … 303 265 fibril_rwlock_write_unlock(&tree->rwlock); 304 266 305 log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);267 printf(NAME ": devman_add_function %s\n", fun->pathname); 306 268 307 269 devman_receive_match_ids(match_count, &fun->match_ids); … … 327 289 } 328 290 } else { 329 loc_register_tree_function(fun, tree);291 devmap_register_tree_function(fun, tree); 330 292 } 331 293 … … 334 296 } 335 297 336 static void devman_add_function_to_cat(ipc_callid_t callid, ipc_call_t *call) 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) 337 325 { 338 326 devman_handle_t handle = IPC_GET_ARG1(*call); 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, 327 328 /* Get class name. */ 329 char *class_name; 330 int rc = async_data_write_accept((void **) &class_name, true, 345 331 0, 0, 0, 0); 346 332 if (rc != EOK) { … … 355 341 } 356 342 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."); 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 410 352 async_answer_0(callid, EOK); 411 353 } … … 421 363 422 364 initialize_running_driver(driver, &device_tree); 423 log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.",365 printf(NAME ": the %s driver was successfully initialized. \n", 424 366 driver->name); 425 367 return 0; … … 443 385 fid_t fid = fibril_create(init_running_drv, driver); 444 386 if (fid == 0) { 445 log_msg(LVL_ERROR, "Failed to create initialization fibril " \446 " for driver `%s'.", driver->name);387 printf(NAME ": Error creating fibril for the initialization of " 388 "the newly registered running driver.\n"); 447 389 return; 448 390 } 449 391 fibril_add_ready(fid); 450 392 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; 393 ipc_callid_t callid; 394 ipc_call_t call; 395 bool cont = true; 396 while (cont) { 397 callid = async_get_call(&call); 457 398 458 399 switch (IPC_GET_IMETHOD(call)) { 400 case IPC_M_PHONE_HUNGUP: 401 cont = false; 402 continue; 459 403 case DEVMAN_ADD_FUNCTION: 460 404 devman_add_function(callid, &call); 461 405 break; 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); 406 case DEVMAN_ADD_DEVICE_TO_CLASS: 407 devman_add_function_to_class(callid, &call); 467 408 break; 468 409 default: … … 497 438 } 498 439 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 }660 440 661 441 /** Function for handling connections from a client to the device manager. */ … … 665 445 async_answer_0(iid, EOK); 666 446 667 while (true) { 447 bool cont = true; 448 while (cont) { 668 449 ipc_call_t call; 669 450 ipc_callid_t callid = async_get_call(&call); 670 451 671 if (!IPC_GET_IMETHOD(call))672 break;673 674 452 switch (IPC_GET_IMETHOD(call)) { 453 case IPC_M_PHONE_HUNGUP: 454 cont = false; 455 continue; 675 456 case DEVMAN_DEVICE_GET_HANDLE: 676 457 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);692 458 break; 693 459 default: … … 711 477 dev = fun->dev; 712 478 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); 479 if (fun == NULL && dev == NULL) { 480 printf(NAME ": devman_forward error - no device or function with " 481 "handle %" PRIun " was found.\n", handle); 722 482 async_answer_0(iid, ENOENT); 723 483 return; … … 725 485 726 486 if (fun == NULL && !drv_to_parent) { 727 log_msg(LVL_ERROR, NAME ": devman_forward error - cannot " 728 "connect to handle %" PRIun ", refers to a device.", 729 handle); 487 printf(NAME ": devman_forward error - cannot connect to " 488 "handle %" PRIun ", refers to a device.\n", handle); 730 489 async_answer_0(iid, ENOENT); 731 490 return; … … 748 507 749 508 if (driver == NULL) { 750 log_msg(LVL_ERROR, "IPC forwarding refused - " \751 " the device %" PRIun " is not in usable state.", handle);509 printf(NAME ": devman_forward error - the device is not in %" PRIun 510 " usable state.\n", handle); 752 511 async_answer_0(iid, ENOENT); 753 512 return; … … 760 519 method = DRIVER_CLIENT; 761 520 762 if (!driver->sess) { 763 log_msg(LVL_ERROR, 764 "Could not forward to driver `%s'.", driver->name); 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); 765 525 async_answer_0(iid, EINVAL); 766 526 return; … … 768 528 769 529 if (fun != NULL) { 770 log_msg(LVL_DEBUG, 771 "Forwarding request for `%s' function to driver `%s'.", 772 fun->pathname, driver->name); 530 printf(NAME ": devman_forward: forward connection to function %s to " 531 "driver %s.\n", fun->pathname, driver->name); 773 532 } else { 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); 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); 789 545 fun_node_t *fun; 790 546 dev_node_t *dev; 791 547 792 fun = find_loc_tree_function(&device_tree, service_id); 548 fun = find_devmap_tree_function(&device_tree, devmap_handle); 549 if (fun == NULL) 550 fun = find_devmap_class_function(&class_list, devmap_handle); 793 551 794 552 if (fun == NULL || fun->dev->drv == NULL) { 795 log_msg(LVL_WARN, "devman_connection_loc(): function "796 "not found.\n");797 553 async_answer_0(iid, ENOENT); 798 554 return; … … 801 557 dev = fun->dev; 802 558 803 async_exch_t *exch = async_exchange_begin(dev->drv->sess); 804 async_forward_fast(iid, exch, DRIVER_CLIENT, fun->handle, 0, 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, 805 565 IPC_FF_NONE); 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); 566 printf(NAME ": devman_connection_devmapper: forwarded connection to " 567 "device %s to driver %s.\n", fun->pathname, dev->drv->name); 811 568 } 812 569 813 570 /** Function for handling connections to device manager. */ 814 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall , void *arg)571 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall) 815 572 { 816 573 /* Select interface. */ … … 826 583 devman_forward(iid, icall, false); 827 584 break; 828 case DEVMAN_CONNECT_FROM_ LOC:829 /* Someone connected through locnode. */830 devman_connection_ loc(iid, icall);585 case DEVMAN_CONNECT_FROM_DEVMAP: 586 /* Someone connected through devmap node. */ 587 devman_connection_devmapper(iid, icall); 831 588 break; 832 589 case DEVMAN_CONNECT_TO_PARENTS_DEVICE: … … 843 600 static bool devman_init(void) 844 601 { 845 log_msg(LVL_DEBUG, "devman_init - looking for available drivers.");602 printf(NAME ": devman_init - looking for available drivers.\n"); 846 603 847 604 /* Initialize list of available drivers. */ … … 849 606 if (lookup_available_drivers(&drivers_list, 850 607 DRIVER_DEFAULT_STORE) == 0) { 851 log_msg(LVL_FATAL, "No drivers found.");608 printf(NAME " no drivers found."); 852 609 return false; 853 610 } 854 611 855 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.");612 printf(NAME ": devman_init - list of drivers has been initialized.\n"); 856 613 857 614 /* Create root device node. */ 858 615 if (!init_device_tree(&device_tree, &drivers_list)) { 859 log_msg(LVL_FATAL, "Failed to initialize device tree.");616 printf(NAME " failed to initialize device tree."); 860 617 return false; 861 618 } 862 619 620 init_class_list(&class_list); 621 863 622 /* 864 * !!! devman_connection ... as the device manager is not a real loc623 * !!! devman_connection ... as the device manager is not a real devmap 865 624 * driver (it uses a completely different ipc protocol than an ordinary 866 * locdriver) forwarding a connection from client to the devman by867 * location servicewould not work.625 * devmap driver) forwarding a connection from client to the devman by 626 * devmapper would not work. 868 627 */ 869 loc_server_register(NAME, devman_connection);628 devmap_driver_register(NAME, devman_connection); 870 629 871 630 return true; … … 876 635 printf(NAME ": HelenOS Device Manager\n"); 877 636 878 if (log_init(NAME, LVL_WARN) != EOK) {879 printf(NAME ": Error initializing logging subsystem.\n");880 return -1;881 }882 883 637 if (!devman_init()) { 884 log_msg(LVL_ERROR, "Error while initializing service.");638 printf(NAME ": Error while initializing service\n"); 885 639 return -1; 886 640 } … … 890 644 891 645 /* Register device manager at naming service. */ 892 if (service_register(SERVICE_DEVMAN) != EOK) { 893 log_msg(LVL_ERROR, "Failed registering as a service."); 646 if (service_register(SERVICE_DEVMAN) != EOK) 894 647 return -1; 895 } 896 897 printf(NAME ": Accepting connections.\n"); 898 task_retval(0); 648 649 printf(NAME ": Accepting connections\n"); 899 650 async_manager(); 900 651
Note:
See TracChangeset
for help on using the changeset viewer.