Ticket #307: devman_logging.patch
File devman_logging.patch, 20.8 KB (added by , 14 years ago) |
---|
-
uspace/srv/devman/Makefile
=== modified file 'uspace/srv/devman/Makefile'
31 31 BINARY = devman 32 32 33 33 SOURCES = \ 34 log.c \ 34 35 main.c \ 35 36 devman.c \ 36 37 match.c \ -
uspace/srv/devman/devman.c
=== modified file 'uspace/srv/devman/devman.c'
39 39 #include <str_error.h> 40 40 41 41 #include "devman.h" 42 #include "log.h" 42 43 43 44 fun_node_t *find_node_child(fun_node_t *parent, const char *name); 44 45 … … 145 146 list_prepend(&drv->drivers, &drivers_list->drivers); 146 147 fibril_mutex_unlock(&drivers_list->drivers_mutex); 147 148 148 printf(NAME": the '%s' driverwas added to the list of available "149 devman_log_info("Driver `%s' was added to the list of available " 149 150 "drivers.\n", drv->name); 150 151 } 151 152 … … 236 237 */ 237 238 bool read_match_ids(const char *conf_path, match_id_list_t *ids) 238 239 { 239 printf(NAME ": read_match_ids conf_path = %s.\n", conf_path);240 devman_log_debug("read_match_ids(conf_path=\"%s\")\n", conf_path); 240 241 241 242 bool suc = false; 242 243 char *buf = NULL; … … 246 247 247 248 fd = open(conf_path, O_RDONLY); 248 249 if (fd < 0) { 249 printf(NAME ": unable to open %s\n", conf_path); 250 devman_log_error("Unable to open `%s' for reading: %s.\n", 251 conf_path, str_error(fd)); 250 252 goto cleanup; 251 253 } 252 254 opened = true; … … 254 256 len = lseek(fd, 0, SEEK_END); 255 257 lseek(fd, 0, SEEK_SET); 256 258 if (len == 0) { 257 printf(NAME ": configuration file '%s' is empty.\n", conf_path); 259 devman_log_error("Configuration file `%s' is empty.\n", 260 conf_path); 258 261 goto cleanup; 259 262 } 260 263 261 264 buf = malloc(len + 1); 262 265 if (buf == NULL) { 263 printf(NAME ": memory allocation failed when parsing file "264 " '%s'.\n", conf_path);266 devman_log_error("Memory allocation failed when parsing file " 267 "`%s'.\n", conf_path); 265 268 goto cleanup; 266 269 } 267 270 268 271 if (read(fd, buf, len) <= 0) { 269 printf(NAME ": unable to read file '%s'.\n", conf_path);272 devman_log_error("Unable to read file `%s'.\n", conf_path); 270 273 goto cleanup; 271 274 } 272 275 buf[len] = 0; … … 304 307 */ 305 308 bool get_driver_info(const char *base_path, const char *name, driver_t *drv) 306 309 { 307 printf(NAME ": get_driver_info base_path = %s, name = %s.\n",310 devman_log_debug("get_driver_info(base_path=\"%s\", name=\"%s\")\n", 308 311 base_path, name); 309 312 310 313 assert(base_path != NULL && name != NULL && drv != NULL); … … 336 339 /* Check whether the driver's binary exists. */ 337 340 struct stat s; 338 341 if (stat(drv->binary_path, &s) == ENOENT) { /* FIXME!! */ 339 printf(NAME ": driver not found at path %s.", drv->binary_path); 342 devman_log_error("Driver not found at path `%s'.", 343 drv->binary_path); 340 344 goto cleanup; 341 345 } 342 346 … … 363 367 */ 364 368 int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path) 365 369 { 366 printf(NAME ": lookup_available_drivers, dir = %s\n", dir_path);370 devman_log_debug("lookup_available_drivers(dir=\"%s\")\n", dir_path); 367 371 368 372 int drv_cnt = 0; 369 373 DIR *dir = NULL; … … 397 401 fun_node_t *fun; 398 402 dev_node_t *dev; 399 403 400 printf(NAME ": create_root_nodes\n");404 devman_log_debug("create_root_nodes()\n"); 401 405 402 406 fibril_rwlock_write_lock(&tree->rwlock); 403 407 … … 482 486 */ 483 487 void attach_driver(dev_node_t *dev, driver_t *drv) 484 488 { 485 printf(NAME ": attach_driver %s to device %s\n",486 d rv->name, dev->pfun->pathname);489 devman_log_debug("attach_driver(dev=\"%s\",drv=\"%s\")\n", 490 dev->pfun->pathname, drv->name); 487 491 488 492 fibril_mutex_lock(&drv->driver_mutex); 489 493 … … 505 509 506 510 assert(fibril_mutex_is_locked(&drv->driver_mutex)); 507 511 508 printf(NAME ": start_driver '%s'\n", drv->name);512 devman_log_debug("start_driver(drv=\"%s\")\n", drv->name); 509 513 510 514 rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL); 511 515 if (rc != EOK) { 512 printf(NAME ": error spawning %s (%s)\n",513 drv->name, str_error(rc));516 devman_log_error("Spawning driver `%s' (%s) failed: %s.\n", 517 drv->name, drv->binary_path, str_error(rc)); 514 518 return false; 515 519 } 516 520 … … 572 576 link_t *link; 573 577 int phone; 574 578 575 printf(NAME ": pass_devices_to_driver(`%s')\n", driver->name); 579 devman_log_debug("pass_devices_to_driver(driver=\"%s\")\n", 580 driver->name); 576 581 577 582 fibril_mutex_lock(&driver->driver_mutex); 578 583 … … 639 644 * the driver would be added to the device list and started 640 645 * immediately and possibly started here as well. 641 646 */ 642 printf(NAME ": driver %s goes intorunning state.\n", driver->name);647 devman_log_debug("Driver `%s' enters running state.\n", driver->name); 643 648 driver->state = DRIVER_RUNNING; 644 649 645 650 fibril_mutex_unlock(&driver->driver_mutex); … … 656 661 */ 657 662 void initialize_running_driver(driver_t *driver, dev_tree_t *tree) 658 663 { 659 printf(NAME ": initialize_running_driver (`%s')\n", driver->name); 664 devman_log_debug("initialize_running_driver(driver=\"%s\")\n", 665 driver->name); 660 666 661 667 /* 662 668 * Pass devices which have been already assigned to the driver to the … … 746 752 * We do not expect to have driver's mutex locked as we do not 747 753 * access any structures that would affect driver_t. 748 754 */ 749 printf(NAME ": add_device (driver `%s', device `%s')\n", drv->name,750 d ev->pfun->name);755 devman_log_debug("add_device(drv=\"%s\", dev=\"%s\")\n", 756 drv->name, dev->pfun->name); 751 757 752 758 sysarg_t rc; 753 759 ipc_call_t answer; … … 808 814 */ 809 815 driver_t *drv = find_best_match_driver(drivers_list, dev); 810 816 if (drv == NULL) { 811 printf(NAME ": no driver found for device '%s'.\n",817 devman_log_error("No driver found for device `%s'.\n", 812 818 dev->pfun->pathname); 813 819 return false; 814 820 } … … 846 852 */ 847 853 bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list) 848 854 { 849 printf(NAME ": init_device_tree.\n");855 devman_log_debug("init_device_tree()\n"); 850 856 851 857 tree->current_handle = 0; 852 858 … … 1025 1031 1026 1032 fun->pathname = (char *) malloc(pathsize); 1027 1033 if (fun->pathname == NULL) { 1028 printf(NAME ": failed to allocate device path.\n");1034 devman_log_error("Failed to allocate device path.\n"); 1029 1035 return false; 1030 1036 } 1031 1037 … … 1056 1062 assert(tree != NULL); 1057 1063 assert(fibril_rwlock_is_write_locked(&tree->rwlock)); 1058 1064 1065 devman_log_debug("insert_dev_node(dev=%p, pfun=%p [\"%s\"])\n", 1066 dev, pfun, pfun->pathname); 1067 1059 1068 /* Add the node to the handle-to-node map. */ 1060 1069 dev->handle = ++tree->current_handle; 1061 1070 unsigned long key = dev->handle; 1062 1071 hash_table_insert(&tree->devman_devices, &key, &dev->devman_dev); 1063 1072 1064 1073 /* Add the node to the list of its parent's children. */ 1065 printf("insert_dev_node: dev=%p, dev->pfun := %p\n", dev, pfun);1066 1074 dev->pfun = pfun; 1067 1075 pfun->child = dev; 1068 1076 -
uspace/srv/devman/log.c
=== added file 'uspace/srv/devman/log.c'
1 /* 2 * Copyright (c) 2011 Vojtech Horky 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** @addtogroup devman 30 * @{ 31 */ 32 33 #include <stdlib.h> 34 #include <stdio.h> 35 #include <fibril_synch.h> 36 37 #include "log.h" 38 #include "devman.h" 39 40 #define LOG_FILENAME "/log/" NAME 41 42 /** Serialization mutex for logging functions. */ 43 static FIBRIL_MUTEX_INITIALIZE(log_serializer); 44 45 /** File where to store the log. */ 46 static FILE *log_file = NULL; 47 48 /** Current log level. */ 49 static devman_log_level_t log_level; 50 51 /** Prefixes for individual logging levels. */ 52 static const char *log_level_names[] = { 53 "error: ", 54 "", 55 "debug: " 56 }; 57 58 /** Initialize the logging system. */ 59 void devman_log_init(devman_log_level_t level) 60 { 61 assert(level < DEVMAN_LOG_LEVEL_MAX); 62 63 log_level = level; 64 if (log_file == NULL) { 65 log_file = fopen(LOG_FILENAME, "w"); 66 } 67 } 68 69 /** Put single entry to the log. */ 70 void devman_log(devman_log_level_t level, const char *format, ...) 71 { 72 assert(level < DEVMAN_LOG_LEVEL_MAX); 73 74 FILE *screen_output = NULL; 75 if (level == DEVMAN_LOG_LEVEL_ERROR) { 76 screen_output = stderr; 77 } else { 78 screen_output = stdout; 79 } 80 81 va_list args; 82 83 /* 84 * Serialize access to log files. 85 * Always print to log file, to screen print only when the enabled 86 * log level is high enough. 87 */ 88 fibril_mutex_lock(&log_serializer); 89 90 if (log_file != NULL) { 91 va_start(args, format); 92 93 fprintf(log_file, "%s", log_level_names[level]); 94 vfprintf(log_file, format, args); 95 fflush(log_file); 96 97 va_end(args); 98 } 99 100 if (level <= log_level) { 101 va_start(args, format); 102 103 fprintf(screen_output, "%s: %s", NAME, log_level_names[level]); 104 vfprintf(screen_output, format, args); 105 fflush(screen_output); 106 107 va_end(args); 108 } 109 110 fibril_mutex_unlock(&log_serializer); 111 } 112 113 114 /** @} 115 */ -
uspace/srv/devman/log.h
=== added file 'uspace/srv/devman/log.h'
1 /* 2 * Copyright (c) 2011 Vojtech Horky 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** @addtogroup devman 30 * @{ 31 */ 32 33 #ifndef DEVMAN_LOG_H_ 34 #define DEVMAN_LOG_H_ 35 36 typedef enum { 37 DEVMAN_LOG_LEVEL_ERROR, 38 DEVMAN_LOG_LEVEL_INFO, 39 DEVMAN_LOG_LEVEL_DEBUG, 40 DEVMAN_LOG_LEVEL_MAX 41 } devman_log_level_t; 42 43 extern void devman_log(devman_log_level_t, const char *, ...); 44 extern void devman_log_init(devman_log_level_t); 45 #define devman_log_error(format, ...) \ 46 devman_log(DEVMAN_LOG_LEVEL_ERROR, format, ##__VA_ARGS__) 47 #define devman_log_info(format, ...) \ 48 devman_log(DEVMAN_LOG_LEVEL_INFO, format, ##__VA_ARGS__) 49 #define devman_log_debug(format, ...) \ 50 devman_log(DEVMAN_LOG_LEVEL_DEBUG, format, ##__VA_ARGS__) 51 52 #endif 53 54 /** @} 55 */ -
uspace/srv/devman/main.c
=== modified file 'uspace/srv/devman/main.c'
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> 47 48 #include <stdlib.h> … … 56 57 #include <devmap.h> 57 58 58 59 #include "devman.h" 60 #include "log.h" 59 61 60 62 #define DRIVER_DEFAULT_STORE "/drv" 61 63 … … 70 72 ipc_callid_t iid; 71 73 driver_t *driver = NULL; 72 74 73 printf(NAME ": devman_driver_register\n");75 devman_log_debug("devman_driver_register\n"); 74 76 75 77 iid = async_get_call(&icall); 76 78 if (IPC_GET_IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) { … … 87 89 return NULL; 88 90 } 89 91 90 printf(NAME ": the %s driver is trying to register by the service.\n",92 devman_log_debug("The `%s' driver is trying to register.\n", 91 93 drv_name); 92 94 93 95 /* Find driver structure. */ 94 96 driver = find_driver(&drivers_list, drv_name); 95 97 96 98 if (driver == NULL) { 97 printf(NAME ": no driver named %swas found.\n", drv_name);99 devman_log_error("No driver named `%s' was found.\n", drv_name); 98 100 free(drv_name); 99 101 drv_name = NULL; 100 102 async_answer_0(iid, ENOENT); … … 105 107 drv_name = NULL; 106 108 107 109 /* Create connection to the driver. */ 108 printf(NAME ": creating connection to the %s driver.\n", driver->name); 110 devman_log_debug("Creating connection to the `%s' driver.\n", 111 driver->name); 109 112 ipc_call_t call; 110 113 ipc_callid_t callid = async_get_call(&call); 111 114 if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) { … … 117 120 /* Remember driver's phone. */ 118 121 set_driver_phone(driver, IPC_GET_ARG5(call)); 119 122 120 printf(NAME ": the %s driver was successfully registered as running.\n", 123 devman_log_info( 124 "The `%s' driver was successfully registered as running.\n", 121 125 driver->name); 122 126 123 127 async_answer_0(callid, EOK); … … 141 145 142 146 callid = async_get_call(&call); 143 147 if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) { 144 printf(NAME ": ERROR: devman_receive_match_id - invalid "145 " protocol.\n");148 devman_log_error( 149 "Invalid protocol when trying to receive match id.\n"); 146 150 async_answer_0(callid, EINVAL); 147 151 delete_match_id(match_id); 148 152 return EINVAL; 149 153 } 150 154 151 155 if (match_id == NULL) { 152 printf(NAME ": ERROR: devman_receive_match_id - failed to " 153 "allocate match id.\n"); 156 devman_log_error("Failed to allocate match id.\n"); 154 157 async_answer_0(callid, ENOMEM); 155 158 return ENOMEM; 156 159 } … … 164 167 match_id->id = match_id_str; 165 168 if (rc != EOK) { 166 169 delete_match_id(match_id); 167 printf(NAME ": devman_receive_match_id - failed to receive "168 "match id string.\n");170 devman_log_error("Failed to receive match id string: %s.\n", 171 str_error(rc)); 169 172 return rc; 170 173 } 171 174 172 175 list_append(&match_id->link, &match_ids->ids); 173 176 174 printf(NAME ": received match id '%s', score = %d\n",177 devman_log_debug("Received match id `%s', score %d.\n", 175 178 match_id->id, match_id->score); 176 179 return rc; 177 180 } … … 227 230 228 231 if (ftype != fun_inner && ftype != fun_exposed) { 229 232 /* Unknown function type */ 230 printf(NAME ": Error, unknown function type provided by driver!\n"); 233 devman_log_error( 234 "Unknown function type %d provided by driver.\n", 235 (int) ftype); 231 236 232 237 fibril_rwlock_write_unlock(&tree->rwlock); 233 238 async_answer_0(callid, EINVAL); … … 264 269 265 270 fibril_rwlock_write_unlock(&tree->rwlock); 266 271 267 printf(NAME ": devman_add_function %s\n", fun->pathname);272 devman_log_debug("devman_add_function(fun=\"%s\")\n", fun->pathname); 268 273 269 274 devman_receive_match_ids(match_count, &fun->match_ids); 270 275 … … 346 351 /* Register the device's class alias by devmapper. */ 347 352 devmap_register_class_dev(class_info); 348 353 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);354 devman_log_info("Function `%s' added to class `%s' as `%s'.\n", 355 fun->pathname, class_name, class_info->dev_name); 351 356 352 357 async_answer_0(callid, EOK); 353 358 } … … 362 367 driver_t *driver = (driver_t *) drv; 363 368 364 369 initialize_running_driver(driver, &device_tree); 365 printf(NAME ": the %s driver was successfully initialized.\n",370 devman_log_debug("The `%s` driver was successfully initialized.\n", 366 371 driver->name); 367 372 return 0; 368 373 } … … 384 389 */ 385 390 fid_t fid = fibril_create(init_running_drv, driver); 386 391 if (fid == 0) { 387 printf(NAME ": Error creating fibril for the initialization of "388 " the newly registered running driver.\n");392 devman_log_error("Failed to create initialization fibril " \ 393 "for driver `%s' .\n", driver->name); 389 394 return; 390 395 } 391 396 fibril_add_ready(fid); … … 477 482 dev = fun->dev; 478 483 479 484 if (fun == NULL && dev == NULL) { 480 printf(NAME ": devman_forward error - no device or function with " 481 "handle %" PRIun " was found.\n", handle); 485 devman_log_error("IPC forwarding failed - " \ 486 "no device or function with handle " \ 487 "%" PRIun " was found.\n", handle); 482 488 async_answer_0(iid, ENOENT); 483 489 return; 484 490 } 485 491 486 492 if (fun == NULL && !drv_to_parent) { 487 printf(NAME ": devman_forward error - cannot connect to " 488 "handle %" PRIun ", refers to a device.\n", handle); 493 devman_log_error("IPC forwarding refused - " \ 494 "cannot connect to handle " \ 495 "%" PRIun " (refers to a device).\n", handle); 489 496 async_answer_0(iid, ENOENT); 490 497 return; 491 498 } … … 506 513 } 507 514 508 515 if (driver == NULL) { 509 printf(NAME ": devman_forward error - the device is not in %" PRIun510 " usable state.\n", handle);516 devman_log_error("IPC forwarding refused - " \ 517 "the device %" PRIun " is not in usable state.\n", handle); 511 518 async_answer_0(iid, ENOENT); 512 519 return; 513 520 } … … 519 526 method = DRIVER_CLIENT; 520 527 521 528 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);529 devman_log_error( 530 "Could not forward to driver `%s' (phone is %d).\n", 531 driver->name, (int) driver->phone); 525 532 async_answer_0(iid, EINVAL); 526 533 return; 527 534 } 528 535 529 536 if (fun != NULL) { 530 printf(NAME ": devman_forward: forward connection to function %s to " 531 "driver %s.\n", fun->pathname, driver->name); 537 devman_log_debug( 538 "Forwarding request for `%s' function to driver `%s'.\n", 539 fun->pathname, driver->name); 532 540 } else { 533 printf(NAME ": devman_forward: forward connection to device %s to " 534 "driver %s.\n", dev->pfun->pathname, driver->name); 541 devman_log_debug( 542 "Forwarding request for `%s' device to driver `%s'.\n", 543 dev->pfun->pathname, driver->name); 535 544 } 536 545 537 546 async_forward_fast(iid, driver->phone, method, fwd_h, 0, IPC_FF_NONE); … … 563 572 564 573 async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, fun->handle, 0, 565 574 IPC_FF_NONE); 566 printf(NAME ": devman_connection_devmapper: forwarded connection to " 567 "device %s to driver %s.\n", fun->pathname, dev->drv->name); 575 devman_log_debug( 576 "Forwarding devmapper request for `%s' function to driver `%s'.\n", 577 fun->pathname, dev->drv->name); 568 578 } 569 579 570 580 /** Function for handling connections to device manager. */ … … 599 609 /** Initialize device manager internal structures. */ 600 610 static bool devman_init(void) 601 611 { 602 printf(NAME ":devman_init - looking for available drivers.\n");612 devman_log_debug("devman_init - looking for available drivers.\n"); 603 613 604 614 /* Initialize list of available drivers. */ 605 615 init_driver_list(&drivers_list); 606 616 if (lookup_available_drivers(&drivers_list, 607 617 DRIVER_DEFAULT_STORE) == 0) { 608 printf(NAME "no drivers found.");618 devman_log_error("no drivers found."); 609 619 return false; 610 620 } 611 621 612 printf(NAME ": devman_init- list of drivers has been initialized.\n");622 devman_log_debug("devman_init - list of drivers has been initialized.\n"); 613 623 614 624 /* Create root device node. */ 615 625 if (!init_device_tree(&device_tree, &drivers_list)) { 616 printf(NAME " failed to initialize device tree.");626 devman_log_error("Failed to initialize device tree."); 617 627 return false; 618 628 } 619 629 … … 634 644 { 635 645 printf(NAME ": HelenOS Device Manager\n"); 636 646 647 devman_log_init(DEVMAN_LOG_LEVEL_INFO); 648 637 649 if (!devman_init()) { 638 printf(NAME ": Error while initializing service\n");650 devman_log_error("Error while initializing service.\n"); 639 651 return -1; 640 652 } 641 653 … … 643 655 async_set_client_connection(devman_connection); 644 656 645 657 /* Register device manager at naming service. */ 646 if (service_register(SERVICE_DEVMAN) != EOK) 658 if (service_register(SERVICE_DEVMAN) != EOK) { 659 devman_log_error("Failed registering as a service.\n"); 647 660 return -1; 661 } 648 662 649 printf(NAME ": Accepting connections \n");663 printf(NAME ": Accepting connections.\n"); 650 664 async_manager(); 651 665 652 666 /* Never reached. */