Changeset ebcb05a in mainline
- Timestamp:
- 2011-04-01T19:00:51Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 969585f, ea53529
- Parents:
- bdbb6f6
- Location:
- uspace
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/isa/isa.c
rbdbb6f6 rebcb05a 135 135 fd = open(conf_path, O_RDONLY); 136 136 if (fd < 0) { 137 ddf_msg(LVL_ERROR, "Unable to open %s \n", conf_path);137 ddf_msg(LVL_ERROR, "Unable to open %s", conf_path); 138 138 goto cleanup; 139 139 } … … 144 144 lseek(fd, 0, SEEK_SET); 145 145 if (len == 0) { 146 ddf_msg(LVL_ERROR, "Configuration file '%s' is empty. \n",146 ddf_msg(LVL_ERROR, "Configuration file '%s' is empty.", 147 147 conf_path); 148 148 goto cleanup; … … 151 151 buf = malloc(len + 1); 152 152 if (buf == NULL) { 153 ddf_msg(LVL_ERROR, "Memory allocation failed. \n");153 ddf_msg(LVL_ERROR, "Memory allocation failed."); 154 154 goto cleanup; 155 155 } 156 156 157 157 if (0 >= read(fd, buf, len)) { 158 ddf_msg(LVL_ERROR, "Unable to read file '%s'. \n", conf_path);158 ddf_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path); 159 159 goto cleanup; 160 160 } … … 252 252 fun->hw_resources.count++; 253 253 254 ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s \n", irq,254 ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s", irq, 255 255 fun->fnode->name); 256 256 } … … 271 271 272 272 ddf_msg(LVL_NOTE, "Added io range (addr=0x%x, size=0x%x) to " 273 "function %s \n", (unsigned int) addr, (unsigned int) len,273 "function %s", (unsigned int) addr, (unsigned int) len, 274 274 fun->fnode->name); 275 275 } … … 332 332 if (val == end) { 333 333 ddf_msg(LVL_ERROR, "Cannot read match score for function " 334 "%s. \n", fun->fnode->name);334 "%s.", fun->fnode->name); 335 335 return; 336 336 } … … 339 339 get_match_id(&id, val); 340 340 if (id == NULL) { 341 ddf_msg(LVL_ERROR, "Cannot read match ID for function %s. \n",341 ddf_msg(LVL_ERROR, "Cannot read match ID for function %s.", 342 342 fun->fnode->name); 343 343 return; … … 345 345 346 346 ddf_msg(LVL_DEBUG, "Adding match id '%s' with score %d to " 347 "function %s \n", id, score, fun->fnode->name);347 "function %s", id, score, fun->fnode->name); 348 348 349 349 rc = ddf_fun_add_match_id(fun->fnode, id, score); 350 350 if (rc != EOK) { 351 ddf_msg(LVL_ERROR, "Failed adding match ID: %s \n",351 ddf_msg(LVL_ERROR, "Failed adding match ID: %s", 352 352 str_error(rc)); 353 353 } … … 379 379 !prop_parse(fun, line, "match", &fun_parse_match_id)) { 380 380 381 ddf_msg(LVL_ERROR, "Undefined device property at line '%s' \n",381 ddf_msg(LVL_ERROR, "Undefined device property at line '%s'", 382 382 line); 383 383 } … … 441 441 fun->fnode->ops = &isa_fun_ops; 442 442 443 ddf_msg(LVL_DEBUG, "Binding function %s. \n", fun->fnode->name);443 ddf_msg(LVL_DEBUG, "Binding function %s.", fun->fnode->name); 444 444 445 445 /* XXX Handle error */ … … 469 469 static int isa_add_device(ddf_dev_t *dev) 470 470 { 471 ddf_msg(LVL_DEBUG, "isa_add_device, device handle = %d \n",471 ddf_msg(LVL_DEBUG, "isa_add_device, device handle = %d", 472 472 (int) dev->handle); 473 473 474 474 /* Make the bus device more visible. Does not do anything. */ 475 ddf_msg(LVL_DEBUG, "Adding a 'ctl' function \n");475 ddf_msg(LVL_DEBUG, "Adding a 'ctl' function"); 476 476 477 477 ddf_fun_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl"); 478 478 if (ctl == NULL) { 479 ddf_msg(LVL_ERROR, "Failed creating control function. \n");479 ddf_msg(LVL_ERROR, "Failed creating control function."); 480 480 return EXDEV; 481 481 } 482 482 483 483 if (ddf_fun_bind(ctl) != EOK) { 484 ddf_msg(LVL_ERROR, "Failed binding control function. \n");484 ddf_msg(LVL_ERROR, "Failed binding control function."); 485 485 return EXDEV; 486 486 } … … 488 488 /* Add functions as specified in the configuration file. */ 489 489 isa_functions_add(dev); 490 ddf_msg(LVL_NOTE, "Finished enumerating legacy functions \n");490 ddf_msg(LVL_NOTE, "Finished enumerating legacy functions"); 491 491 492 492 return EOK; -
uspace/drv/ns8250/ns8250.c
rbdbb6f6 rebcb05a 276 276 static bool ns8250_pio_enable(ns8250_t *ns) 277 277 { 278 ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s \n", ns->dev->name);278 ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s", ns->dev->name); 279 279 280 280 /* Gain control over port's registers. */ … … 282 282 (void **) &ns->port)) { 283 283 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32 284 " for device %s. \n", ns->io_addr, ns->dev->name);284 " for device %s.", ns->io_addr, ns->dev->name); 285 285 return false; 286 286 } … … 296 296 static bool ns8250_dev_probe(ns8250_t *ns) 297 297 { 298 ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s \n", ns->dev->name);298 ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s", ns->dev->name); 299 299 300 300 ioport8_t *port_addr = ns->port; … … 315 315 316 316 if (!res) { 317 ddf_msg(LVL_DEBUG, "Device %s is not present. \n",317 ddf_msg(LVL_DEBUG, "Device %s is not present.", 318 318 ns->dev->name); 319 319 } … … 329 329 static int ns8250_dev_initialize(ns8250_t *ns) 330 330 { 331 ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s \n", ns->dev->name);331 ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ns->dev->name); 332 332 333 333 int ret = EOK; … … 341 341 if (ns->dev->parent_phone < 0) { 342 342 ddf_msg(LVL_ERROR, "Failed to connect to parent driver of " 343 "device %s. \n", ns->dev->name);343 "device %s.", ns->dev->name); 344 344 ret = ns->dev->parent_phone; 345 345 goto failed; … … 350 350 if (ret != EOK) { 351 351 ddf_msg(LVL_ERROR, "Failed to get HW resources for device " 352 "%s. \n", ns->dev->name);352 "%s.", ns->dev->name); 353 353 goto failed; 354 354 } … … 365 365 ns->irq = res->res.interrupt.irq; 366 366 irq = true; 367 ddf_msg(LVL_NOTE, "Device %s was asigned irq = 0x%x. \n",367 ddf_msg(LVL_NOTE, "Device %s was asigned irq = 0x%x.", 368 368 ns->dev->name, ns->irq); 369 369 break; … … 373 373 if (res->res.io_range.size < REG_COUNT) { 374 374 ddf_msg(LVL_ERROR, "I/O range assigned to " 375 "device %s is too small. \n", ns->dev->name);375 "device %s is too small.", ns->dev->name); 376 376 ret = ELIMIT; 377 377 goto failed; … … 379 379 ioport = true; 380 380 ddf_msg(LVL_NOTE, "Device %s was asigned I/O address = " 381 "0x%x. \n", ns->dev->name, ns->io_addr);382 break;381 "0x%x.", ns->dev->name, ns->io_addr); 382 break; 383 383 384 384 default: … … 388 388 389 389 if (!irq || !ioport) { 390 ddf_msg(LVL_ERROR, "Missing HW resource(s) for device %s. \n",390 ddf_msg(LVL_ERROR, "Missing HW resource(s) for device %s.", 391 391 ns->dev->name); 392 392 ret = ENOENT; … … 473 473 474 474 if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) { 475 ddf_msg(LVL_ERROR, "Invalid baud rate %d requested. \n",475 ddf_msg(LVL_ERROR, "Invalid baud rate %d requested.", 476 476 baud_rate); 477 477 return EINVAL; … … 658 658 if (!buf_push_back(&ns->input_buffer, val)) { 659 659 ddf_msg(LVL_WARN, "Buffer overflow on " 660 "%s. \n", ns->dev->name);660 "%s.", ns->dev->name); 661 661 } else { 662 662 ddf_msg(LVL_DEBUG2, "Character %c saved " 663 "to the buffer of %s. \n",663 "to the buffer of %s.", 664 664 val, ns->dev->name); 665 665 } … … 717 717 int rc; 718 718 719 ddf_msg(LVL_DEBUG, "ns8250_add_device %s (handle = %d) \n",719 ddf_msg(LVL_DEBUG, "ns8250_add_device %s (handle = %d)", 720 720 dev->name, (int) dev->handle); 721 721 … … 752 752 /* Register interrupt handler. */ 753 753 if (ns8250_register_interrupt_handler(ns) != EOK) { 754 ddf_msg(LVL_ERROR, "Failed to register interrupt handler. \n");754 ddf_msg(LVL_ERROR, "Failed to register interrupt handler."); 755 755 rc = EADDRNOTAVAIL; 756 756 goto fail; … … 761 761 if (rc != EOK) { 762 762 ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = " 763 "%d. \n", rc);763 "%d.", rc); 764 764 goto fail; 765 765 } … … 767 767 fun = ddf_fun_create(dev, fun_exposed, "a"); 768 768 if (fun == NULL) { 769 ddf_msg(LVL_ERROR, "Failed creating function. \n");769 ddf_msg(LVL_ERROR, "Failed creating function."); 770 770 goto fail; 771 771 } … … 775 775 rc = ddf_fun_bind(fun); 776 776 if (rc != EOK) { 777 ddf_msg(LVL_ERROR, "Failed binding function. \n");777 ddf_msg(LVL_ERROR, "Failed binding function."); 778 778 goto fail; 779 779 } … … 783 783 ddf_fun_add_to_class(fun, "serial"); 784 784 785 ddf_msg(LVL_NOTE, "Device %s successfully initialized. \n",785 ddf_msg(LVL_NOTE, "Device %s successfully initialized.", 786 786 dev->name); 787 787 … … 866 866 867 867 ddf_msg(LVL_DEBUG, "ns8250_get_props: baud rate %d, parity 0x%x, word " 868 "length %d, stop bits %d \n", *baud_rate, *parity, *word_length,868 "length %d, stop bits %d", *baud_rate, *parity, *word_length, 869 869 *stop_bits); 870 870 } … … 883 883 { 884 884 ddf_msg(LVL_DEBUG, "ns8250_set_props: baud rate %d, parity 0x%x, word " 885 "length %d, stop bits %d \n", baud_rate, parity, word_length,885 "length %d, stop bits %d", baud_rate, parity, word_length, 886 886 stop_bits); 887 887 -
uspace/drv/pciintel/pci.c
rbdbb6f6 rebcb05a 226 226 227 227 if (match_id_str == NULL) { 228 ddf_msg(LVL_ERROR, "Out of memory creating match ID. \n");228 ddf_msg(LVL_ERROR, "Out of memory creating match ID."); 229 229 return; 230 230 } … … 232 232 rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90); 233 233 if (rc != EOK) { 234 ddf_msg(LVL_ERROR, "Failed adding match ID: %s \n",234 ddf_msg(LVL_ERROR, "Failed adding match ID: %s", 235 235 str_error(rc)); 236 236 } … … 325 325 if (range_addr != 0) { 326 326 ddf_msg(LVL_DEBUG, "Function %s : address = %" PRIx64 327 ", size = %x \n", fun->fnode->name, range_addr,327 ", size = %x", fun->fnode->name, range_addr, 328 328 (unsigned int) range_size); 329 329 } … … 351 351 hw_res_list->count++; 352 352 353 ddf_msg(LVL_NOTE, "Function %s uses irq %x. \n", fun->fnode->name, irq);353 ddf_msg(LVL_NOTE, "Function %s uses irq %x.", fun->fnode->name, irq); 354 354 } 355 355 … … 407 407 char *fun_name = pci_fun_create_name(fun); 408 408 if (fun_name == NULL) { 409 ddf_msg(LVL_ERROR, "Out of memory. \n");409 ddf_msg(LVL_ERROR, "Out of memory."); 410 410 return; 411 411 } … … 413 413 fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name); 414 414 if (fnode == NULL) { 415 ddf_msg(LVL_ERROR, "Failed creating function. \n");415 ddf_msg(LVL_ERROR, "Failed creating function."); 416 416 return; 417 417 } … … 427 427 fnode->driver_data = fun; 428 428 429 ddf_msg(LVL_DEBUG, "Adding new function %s. \n",429 ddf_msg(LVL_DEBUG, "Adding new function %s.", 430 430 fnode->name); 431 431 … … 445 445 PCI_BRIDGE_SEC_BUS_NUM); 446 446 ddf_msg(LVL_DEBUG, "Device is pci-to-pci " 447 "bridge, secondary bus number = %d. \n",447 "bridge, secondary bus number = %d.", 448 448 bus_num); 449 449 if (child_bus > bus_num) … … 468 468 int rc; 469 469 470 ddf_msg(LVL_DEBUG, "pci_add_device \n");470 ddf_msg(LVL_DEBUG, "pci_add_device"); 471 471 dnode->parent_phone = -1; 472 472 473 473 bus = pci_bus_new(); 474 474 if (bus == NULL) { 475 ddf_msg(LVL_ERROR, "pci_add_device allocation failed. \n");475 ddf_msg(LVL_ERROR, "pci_add_device allocation failed."); 476 476 rc = ENOMEM; 477 477 goto fail; … … 484 484 if (dnode->parent_phone < 0) { 485 485 ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the " 486 "parent's driver. \n");486 "parent's driver."); 487 487 rc = dnode->parent_phone; 488 488 goto fail; … … 494 494 if (rc != EOK) { 495 495 ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources " 496 "for the device. \n");496 "for the device."); 497 497 goto fail; 498 498 } 499 499 got_res = true; 500 500 501 ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ". \n",501 ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".", 502 502 hw_resources.resources[0].res.io_range.address); 503 503 … … 511 511 if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8, 512 512 &bus->conf_addr_port)) { 513 ddf_msg(LVL_ERROR, "Failed to enable configuration ports. \n");513 ddf_msg(LVL_ERROR, "Failed to enable configuration ports."); 514 514 rc = EADDRNOTAVAIL; 515 515 goto fail; … … 518 518 519 519 /* Make the bus device more visible. It has no use yet. */ 520 ddf_msg(LVL_DEBUG, "Adding a 'ctl' function \n");520 ddf_msg(LVL_DEBUG, "Adding a 'ctl' function"); 521 521 522 522 ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl"); 523 523 if (ctl == NULL) { 524 printf(NAME ": error creating control function.\n");524 ddf_msg(LVL_ERROR, "Failed creating control function."); 525 525 rc = ENOMEM; 526 526 goto fail; … … 529 529 rc = ddf_fun_bind(ctl); 530 530 if (rc != EOK) { 531 printf(NAME ": error binding control function.\n");531 ddf_msg(LVL_ERROR, "Failed binding control function."); 532 532 goto fail; 533 533 } 534 534 535 535 /* Enumerate functions. */ 536 ddf_msg(LVL_DEBUG, "Scanning the bus \n");536 ddf_msg(LVL_DEBUG, "Scanning the bus"); 537 537 pci_bus_scan(bus, 0); 538 538 … … 634 634 int main(int argc, char *argv[]) 635 635 { 636 printf(NAME ": HelenOS pci bus driver (intel method 1).\n");636 printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n"); 637 637 pciintel_init(); 638 638 return ddf_driver_main(&pci_driver); -
uspace/drv/root/root.c
rbdbb6f6 rebcb05a 91 91 92 92 ddf_msg(LVL_DEBUG, "Adding new function for virtual devices. " 93 "Function node is `%s' (%d %s) \n", name,93 "Function node is `%s' (%d %s)", name, 94 94 VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID); 95 95 96 96 fun = ddf_fun_create(dev, fun_inner, name); 97 97 if (fun == NULL) { 98 ddf_msg(LVL_ERROR, "Failed creating function %s \n", name);98 ddf_msg(LVL_ERROR, "Failed creating function %s", name); 99 99 return ENOMEM; 100 100 } … … 103 103 VIRTUAL_FUN_MATCH_SCORE); 104 104 if (rc != EOK) { 105 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s\n", name); 105 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 106 name); 106 107 ddf_fun_destroy(fun); 107 108 return rc; … … 110 111 rc = ddf_fun_bind(fun); 111 112 if (rc != EOK) { 112 ddf_msg(LVL_ERROR, "Failed binding function %s: %s \n", name,113 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name, 113 114 str_error(rc)); 114 115 ddf_fun_destroy(fun); … … 137 138 platform = sysinfo_get_data("platform", &platform_size); 138 139 if (platform == NULL) { 139 ddf_msg(LVL_ERROR, "Failed to obtain platform name. \n");140 ddf_msg(LVL_ERROR, "Failed to obtain platform name."); 140 141 return ENOENT; 141 142 } … … 144 145 platform = realloc(platform, platform_size + 1); 145 146 if (platform == NULL) { 146 ddf_msg(LVL_ERROR, "Memory allocation failed. \n");147 ddf_msg(LVL_ERROR, "Memory allocation failed."); 147 148 return ENOMEM; 148 149 } … … 152 153 /* Construct match ID. */ 153 154 if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) { 154 ddf_msg(LVL_ERROR, "Memory allocation failed. \n");155 ddf_msg(LVL_ERROR, "Memory allocation failed."); 155 156 return ENOMEM; 156 157 } … … 158 159 /* Add function. */ 159 160 ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' " 160 " (%d %s) \n", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE,161 " (%d %s)", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE, 161 162 match_id); 162 163 163 164 fun = ddf_fun_create(dev, fun_inner, name); 164 165 if (fun == NULL) { 165 ddf_msg(LVL_ERROR, "Error creating function %s \n", name);166 ddf_msg(LVL_ERROR, "Error creating function %s", name); 166 167 return ENOMEM; 167 168 } … … 169 170 rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE); 170 171 if (rc != EOK) { 171 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s \n",172 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 172 173 name); 173 174 ddf_fun_destroy(fun); … … 177 178 rc = ddf_fun_bind(fun); 178 179 if (rc != EOK) { 179 ddf_msg(LVL_ERROR, "Failed binding function %s: %s \n", name,180 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name, 180 181 str_error(rc)); 181 182 ddf_fun_destroy(fun); … … 193 194 static int root_add_device(ddf_dev_t *dev) 194 195 { 195 ddf_msg(LVL_DEBUG, "root_add_device, device handle=%" PRIun "\n",196 ddf_msg(LVL_DEBUG, "root_add_device, device handle=%" PRIun, 196 197 dev->handle); 197 198 … … 206 207 int res = add_platform_fun(dev); 207 208 if (EOK != res) 208 ddf_msg(LVL_ERROR, "Failed adding child device for platform. \n");209 ddf_msg(LVL_ERROR, "Failed adding child device for platform."); 209 210 210 211 return res; -
uspace/drv/rootpc/rootpc.c
rbdbb6f6 rebcb05a 120 120 rootpc_fun_t *fun) 121 121 { 122 ddf_msg(LVL_DEBUG, "Adding new function '%s'. \n", name);122 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); 123 123 124 124 ddf_fun_t *fnode = NULL; … … 146 146 /* Register function. */ 147 147 if (ddf_fun_bind(fnode) != EOK) { 148 ddf_msg(LVL_ERROR, "Failed binding function %s. \n", name);148 ddf_msg(LVL_ERROR, "Failed binding function %s.", name); 149 149 goto failure; 150 150 } … … 159 159 ddf_fun_destroy(fnode); 160 160 161 ddf_msg(LVL_ERROR, "Failed adding function '%s'. \n", name);161 ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name); 162 162 163 163 return false; … … 177 177 static int rootpc_add_device(ddf_dev_t *dev) 178 178 { 179 ddf_msg(LVL_DEBUG, "rootpc_add_device, device handle = %d \n",179 ddf_msg(LVL_DEBUG, "rootpc_add_device, device handle = %d", 180 180 (int)dev->handle); 181 181 182 182 /* Register functions. */ 183 183 if (!rootpc_add_functions(dev)) { 184 ddf_msg(LVL_ERROR, "Failed to add functions for PC platform. \n");184 ddf_msg(LVL_ERROR, "Failed to add functions for PC platform."); 185 185 } 186 186 -
uspace/drv/rootvirt/rootvirt.c
rbdbb6f6 rebcb05a 84 84 int rc; 85 85 86 ddf_msg(LVL_DEBUG, "Registering function `%s' (match \"%s\") \n",86 ddf_msg(LVL_DEBUG, "Registering function `%s' (match \"%s\")", 87 87 vfun->name, vfun->match_id); 88 88 89 89 fun = ddf_fun_create(vdev, fun_inner, vfun->name); 90 90 if (fun == NULL) { 91 ddf_msg(LVL_ERROR, "Failed creating function %s \n", vfun->name);91 ddf_msg(LVL_ERROR, "Failed creating function %s", vfun->name); 92 92 return ENOMEM; 93 93 } … … 95 95 rc = ddf_fun_add_match_id(fun, vfun->match_id, 10); 96 96 if (rc != EOK) { 97 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s \n",97 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 98 98 vfun->name); 99 99 ddf_fun_destroy(fun); … … 103 103 rc = ddf_fun_bind(fun); 104 104 if (rc != EOK) { 105 ddf_msg(LVL_ERROR, "Failed binding function %s: %s \n", vfun->name,106 str_error(rc));105 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", 106 vfun->name, str_error(rc)); 107 107 ddf_fun_destroy(fun); 108 108 return rc; 109 109 } 110 110 111 ddf_msg(LVL_NOTE, "Registered child device `%s' \n", vfun->name);111 ddf_msg(LVL_NOTE, "Registered child device `%s'", vfun->name); 112 112 return EOK; 113 113 } … … 125 125 } 126 126 127 ddf_msg(LVL_DEBUG, "add_device(handle=%d) \n", (int)dev->handle);127 ddf_msg(LVL_DEBUG, "add_device(handle=%d)", (int)dev->handle); 128 128 129 129 /* -
uspace/drv/test1/test1.c
rbdbb6f6 rebcb05a 65 65 int rc; 66 66 67 ddf_msg(LVL_DEBUG, "Registering function `%s': %s. \n", name, message);67 ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message); 68 68 69 69 fun = ddf_fun_create(parent, fun_inner, name); 70 70 if (fun == NULL) { 71 ddf_msg(LVL_ERROR, "Failed creating function %s \n", name);71 ddf_msg(LVL_ERROR, "Failed creating function %s", name); 72 72 rc = ENOMEM; 73 73 goto leave; … … 76 76 rc = ddf_fun_add_match_id(fun, str_dup(match_id), match_score); 77 77 if (rc != EOK) { 78 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s \n",78 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 79 79 name); 80 80 goto leave; … … 83 83 rc = ddf_fun_bind(fun); 84 84 if (rc != EOK) { 85 ddf_msg(LVL_ERROR, "Failed binding function %s: %s \n", name,85 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name, 86 86 str_error(rc)); 87 87 goto leave; 88 88 } 89 89 90 ddf_msg(LVL_NOTE, "Registered child device `%s' \n", name);90 ddf_msg(LVL_NOTE, "Registered child device `%s'", name); 91 91 rc = EOK; 92 92 … … 128 128 int rc; 129 129 130 ddf_msg(LVL_DEBUG, "add_device(name=\"%s\", handle=%d) \n",130 ddf_msg(LVL_DEBUG, "add_device(name=\"%s\", handle=%d)", 131 131 dev->name, (int) dev->handle); 132 132 133 133 fun_a = ddf_fun_create(dev, fun_exposed, "a"); 134 134 if (fun_a == NULL) { 135 ddf_msg(LVL_ERROR, "Failed creating function 'a'. \n");135 ddf_msg(LVL_ERROR, "Failed creating function 'a'."); 136 136 return ENOMEM; 137 137 } … … 139 139 rc = ddf_fun_bind(fun_a); 140 140 if (rc != EOK) { 141 ddf_msg(LVL_ERROR, "Failed binding function 'a'. \n");141 ddf_msg(LVL_ERROR, "Failed binding function 'a'."); 142 142 return rc; 143 143 } … … 161 161 } 162 162 163 ddf_msg(LVL_DEBUG, "Device `%s' accepted. \n", dev->name);163 ddf_msg(LVL_DEBUG, "Device `%s' accepted.", dev->name); 164 164 165 165 return EOK; -
uspace/drv/test2/test2.c
rbdbb6f6 rebcb05a 65 65 int rc; 66 66 67 ddf_msg(LVL_DEBUG, "Registering function `%s': %s. \n", name, message);67 ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message); 68 68 69 69 fun = ddf_fun_create(parent, fun_inner, name); 70 70 if (fun == NULL) { 71 ddf_msg(LVL_ERROR, "Failed creating function %s \n", name);71 ddf_msg(LVL_ERROR, "Failed creating function %s", name); 72 72 return ENOMEM; 73 73 } … … 75 75 rc = ddf_fun_add_match_id(fun, match_id, match_score); 76 76 if (rc != EOK) { 77 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s \n",77 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 78 78 name); 79 79 ddf_fun_destroy(fun); … … 83 83 rc = ddf_fun_bind(fun); 84 84 if (rc != EOK) { 85 ddf_msg(LVL_ERROR, "Failed binding function %s: %s \n", name,85 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name, 86 86 str_error(rc)); 87 87 ddf_fun_destroy(fun); … … 89 89 } 90 90 91 ddf_msg(LVL_NOTE, "Registered child device `%s' \n", name);91 ddf_msg(LVL_NOTE, "Registered child device `%s'", name); 92 92 return EOK; 93 93 } … … 113 113 fun_a = ddf_fun_create(dev, fun_exposed, "a"); 114 114 if (fun_a == NULL) { 115 ddf_msg(LVL_ERROR, "Failed creating function 'a'. \n");115 ddf_msg(LVL_ERROR, "Failed creating function 'a'."); 116 116 return ENOMEM; 117 117 } … … 119 119 rc = ddf_fun_bind(fun_a); 120 120 if (rc != EOK) { 121 ddf_msg(LVL_ERROR, "Failed binding function 'a'. \n");121 ddf_msg(LVL_ERROR, "Failed binding function 'a'."); 122 122 return rc; 123 123 } … … 130 130 static int test2_add_device(ddf_dev_t *dev) 131 131 { 132 ddf_msg(LVL_DEBUG, "test2_add_device(name=\"%s\", handle=%d) \n",132 ddf_msg(LVL_DEBUG, "test2_add_device(name=\"%s\", handle=%d)", 133 133 dev->name, (int) dev->handle); 134 134 … … 136 136 fid_t postpone = fibril_create(postponed_birth, dev); 137 137 if (postpone == 0) { 138 ddf_msg(LVL_ERROR, "fibril_create() failed. \n");138 ddf_msg(LVL_ERROR, "fibril_create() failed."); 139 139 return ENOMEM; 140 140 } -
uspace/lib/c/generic/io/log.c
rbdbb6f6 rebcb05a 84 84 * if verbosity is less than or equal to current 85 85 * reporting level. 86 * @param fmt Format string 86 * @param fmt Format string (no traling newline). 87 87 */ 88 88 void log_msg(log_level_t level, const char *fmt, ...) … … 100 100 * if verbosity is less than or equal to current 101 101 * reporting level. 102 * @param fmt Format string 102 * @param fmt Format string (no trailing newline) 103 103 */ 104 104 void log_msgv(log_level_t level, const char *fmt, va_list args) … … 113 113 log_level_names[level]); 114 114 vfprintf(log_stream, fmt, args); 115 fputc('\n', log_stream); 115 116 fflush(log_stream); 116 117 -
uspace/lib/drv/generic/log.c
rbdbb6f6 rebcb05a 51 51 * if verbosity is less than or equal to current 52 52 * reporting level. 53 * @param fmt Format string 53 * @param fmt Format string (no trailing newline) 54 54 */ 55 55 void ddf_msg(log_level_t level, const char *fmt, ...) -
uspace/srv/devman/devman.c
rbdbb6f6 rebcb05a 148 148 149 149 log_msg(LVL_NOTE, "Driver `%s' was added to the list of available " 150 "drivers. \n", drv->name);150 "drivers.", drv->name); 151 151 } 152 152 … … 238 238 bool read_match_ids(const char *conf_path, match_id_list_t *ids) 239 239 { 240 log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\") \n", conf_path);240 log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path); 241 241 242 242 bool suc = false; … … 248 248 fd = open(conf_path, O_RDONLY); 249 249 if (fd < 0) { 250 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s. \n",250 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.", 251 251 conf_path, str_error(fd)); 252 252 goto cleanup; … … 257 257 lseek(fd, 0, SEEK_SET); 258 258 if (len == 0) { 259 log_msg(LVL_ERROR, "Configuration file '%s' is empty. \n",259 log_msg(LVL_ERROR, "Configuration file '%s' is empty.", 260 260 conf_path); 261 261 goto cleanup; … … 265 265 if (buf == NULL) { 266 266 log_msg(LVL_ERROR, "Memory allocation failed when parsing file " 267 "'%s'. \n", conf_path);267 "'%s'.", conf_path); 268 268 goto cleanup; 269 269 } … … 271 271 ssize_t read_bytes = safe_read(fd, buf, len); 272 272 if (read_bytes <= 0) { 273 log_msg(LVL_ERROR, "Unable to read file '%s'. \n", conf_path);273 log_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path); 274 274 goto cleanup; 275 275 } … … 309 309 bool get_driver_info(const char *base_path, const char *name, driver_t *drv) 310 310 { 311 log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\") \n",311 log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")", 312 312 base_path, name); 313 313 … … 369 369 int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path) 370 370 { 371 log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\") \n", dir_path);371 log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path); 372 372 373 373 int drv_cnt = 0; … … 403 403 dev_node_t *dev; 404 404 405 log_msg(LVL_DEBUG, "create_root_nodes() \n");405 log_msg(LVL_DEBUG, "create_root_nodes()"); 406 406 407 407 fibril_rwlock_write_lock(&tree->rwlock); … … 488 488 void attach_driver(dev_node_t *dev, driver_t *drv) 489 489 { 490 log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\") \n",490 log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")", 491 491 dev->pfun->pathname, drv->name); 492 492 … … 511 511 assert(fibril_mutex_is_locked(&drv->driver_mutex)); 512 512 513 log_msg(LVL_DEBUG, "start_driver(drv=\"%s\") \n", drv->name);513 log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name); 514 514 515 515 rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL); 516 516 if (rc != EOK) { 517 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s. \n",517 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.", 518 518 drv->name, drv->binary_path, str_error(rc)); 519 519 return false; … … 578 578 int phone; 579 579 580 log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\") \n",580 log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")", 581 581 driver->name); 582 582 … … 646 646 * immediately and possibly started here as well. 647 647 */ 648 log_msg(LVL_DEBUG, "Driver `%s' enters running state. \n", driver->name);648 log_msg(LVL_DEBUG, "Driver `%s' enters running state.", driver->name); 649 649 driver->state = DRIVER_RUNNING; 650 650 … … 663 663 void initialize_running_driver(driver_t *driver, dev_tree_t *tree) 664 664 { 665 log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\") \n",665 log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")", 666 666 driver->name); 667 667 … … 754 754 * access any structures that would affect driver_t. 755 755 */ 756 log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\") \n",756 log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")", 757 757 drv->name, dev->pfun->name); 758 758 … … 816 816 driver_t *drv = find_best_match_driver(drivers_list, dev); 817 817 if (drv == NULL) { 818 log_msg(LVL_ERROR, "No driver found for device `%s'. \n",818 log_msg(LVL_ERROR, "No driver found for device `%s'.", 819 819 dev->pfun->pathname); 820 820 return false; … … 854 854 bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list) 855 855 { 856 log_msg(LVL_DEBUG, "init_device_tree() \n");856 log_msg(LVL_DEBUG, "init_device_tree()"); 857 857 858 858 tree->current_handle = 0; … … 1033 1033 fun->pathname = (char *) malloc(pathsize); 1034 1034 if (fun->pathname == NULL) { 1035 log_msg(LVL_ERROR, "Failed to allocate device path. \n");1035 log_msg(LVL_ERROR, "Failed to allocate device path."); 1036 1036 return false; 1037 1037 } … … 1064 1064 assert(fibril_rwlock_is_write_locked(&tree->rwlock)); 1065 1065 1066 log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"]) \n",1066 log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])", 1067 1067 dev, pfun, pfun->pathname); 1068 1068 -
uspace/srv/devman/main.c
rbdbb6f6 rebcb05a 73 73 driver_t *driver = NULL; 74 74 75 log_msg(LVL_DEBUG, "devman_driver_register \n");75 log_msg(LVL_DEBUG, "devman_driver_register"); 76 76 77 77 iid = async_get_call(&icall); … … 90 90 } 91 91 92 log_msg(LVL_DEBUG, "The `%s' driver is trying to register. \n",92 log_msg(LVL_DEBUG, "The `%s' driver is trying to register.", 93 93 drv_name); 94 94 … … 97 97 98 98 if (driver == NULL) { 99 log_msg(LVL_ERROR, "No driver named `%s' was found. \n", drv_name);99 log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name); 100 100 free(drv_name); 101 101 drv_name = NULL; … … 108 108 109 109 /* Create connection to the driver. */ 110 log_msg(LVL_DEBUG, "Creating connection to the `%s' driver. \n",110 log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.", 111 111 driver->name); 112 112 ipc_call_t call; … … 122 122 123 123 log_msg(LVL_NOTE, 124 "The `%s' driver was successfully registered as running. \n",124 "The `%s' driver was successfully registered as running.", 125 125 driver->name); 126 126 … … 147 147 if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) { 148 148 log_msg(LVL_ERROR, 149 "Invalid protocol when trying to receive match id. \n");149 "Invalid protocol when trying to receive match id."); 150 150 async_answer_0(callid, EINVAL); 151 151 delete_match_id(match_id); … … 154 154 155 155 if (match_id == NULL) { 156 log_msg(LVL_ERROR, "Failed to allocate match id. \n");156 log_msg(LVL_ERROR, "Failed to allocate match id."); 157 157 async_answer_0(callid, ENOMEM); 158 158 return ENOMEM; … … 168 168 if (rc != EOK) { 169 169 delete_match_id(match_id); 170 log_msg(LVL_ERROR, "Failed to receive match id string: %s. \n",170 log_msg(LVL_ERROR, "Failed to receive match id string: %s.", 171 171 str_error(rc)); 172 172 return rc; … … 175 175 list_append(&match_id->link, &match_ids->ids); 176 176 177 log_msg(LVL_DEBUG, "Received match id `%s', score %d. \n",177 log_msg(LVL_DEBUG, "Received match id `%s', score %d.", 178 178 match_id->id, match_id->score); 179 179 return rc; … … 232 232 /* Unknown function type */ 233 233 log_msg(LVL_ERROR, 234 "Unknown function type %d provided by driver. \n",234 "Unknown function type %d provided by driver.", 235 235 (int) ftype); 236 236 … … 280 280 fibril_rwlock_write_unlock(&tree->rwlock); 281 281 282 log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\") \n", fun->pathname);282 log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname); 283 283 284 284 devman_receive_match_ids(match_count, &fun->match_ids); … … 362 362 devmap_register_class_dev(class_info); 363 363 364 log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'. \n",364 log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.", 365 365 fun->pathname, class_name, class_info->dev_name); 366 366 … … 378 378 379 379 initialize_running_driver(driver, &device_tree); 380 log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized. \n",380 log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.", 381 381 driver->name); 382 382 return 0; … … 401 401 if (fid == 0) { 402 402 log_msg(LVL_ERROR, "Failed to create initialization fibril " \ 403 "for driver `%s' .\n", driver->name);403 "for driver `%s'.", driver->name); 404 404 return; 405 405 } … … 537 537 if (dev == NULL) { 538 538 log_msg(LVL_ERROR, "IPC forwarding failed - no device or " 539 "function with handle %" PRIun " was found. \n", handle);539 "function with handle %" PRIun " was found.", handle); 540 540 async_answer_0(iid, ENOENT); 541 541 return; … … 544 544 if (fun == NULL && !drv_to_parent) { 545 545 log_msg(LVL_ERROR, NAME ": devman_forward error - cannot " 546 "connect to handle %" PRIun ", refers to a device. \n",546 "connect to handle %" PRIun ", refers to a device.", 547 547 handle); 548 548 async_answer_0(iid, ENOENT); … … 567 567 if (driver == NULL) { 568 568 log_msg(LVL_ERROR, "IPC forwarding refused - " \ 569 "the device %" PRIun " is not in usable state. \n", handle);569 "the device %" PRIun " is not in usable state.", handle); 570 570 async_answer_0(iid, ENOENT); 571 571 return; … … 580 580 if (driver->phone <= 0) { 581 581 log_msg(LVL_ERROR, 582 "Could not forward to driver `%s' (phone is %d). \n",582 "Could not forward to driver `%s' (phone is %d).", 583 583 driver->name, (int) driver->phone); 584 584 async_answer_0(iid, EINVAL); … … 588 588 if (fun != NULL) { 589 589 log_msg(LVL_DEBUG, 590 "Forwarding request for `%s' function to driver `%s'. \n",590 "Forwarding request for `%s' function to driver `%s'.", 591 591 fun->pathname, driver->name); 592 592 } else { 593 593 log_msg(LVL_DEBUG, 594 "Forwarding request for `%s' device to driver `%s'. \n",594 "Forwarding request for `%s' device to driver `%s'.", 595 595 dev->pfun->pathname, driver->name); 596 596 } … … 626 626 IPC_FF_NONE); 627 627 log_msg(LVL_DEBUG, 628 "Forwarding devmapper request for `%s' function to driver `%s'. \n",628 "Forwarding devmapper request for `%s' function to driver `%s'.", 629 629 fun->pathname, dev->drv->name); 630 630 } … … 662 662 static bool devman_init(void) 663 663 { 664 log_msg(LVL_DEBUG, "devman_init - looking for available drivers. \n");664 log_msg(LVL_DEBUG, "devman_init - looking for available drivers."); 665 665 666 666 /* Initialize list of available drivers. */ … … 668 668 if (lookup_available_drivers(&drivers_list, 669 669 DRIVER_DEFAULT_STORE) == 0) { 670 log_msg(LVL_FATAL, " no drivers found.");670 log_msg(LVL_FATAL, "No drivers found."); 671 671 return false; 672 672 } 673 673 674 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized. \n");674 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized."); 675 675 676 676 /* Create root device node. */ … … 703 703 704 704 if (!devman_init()) { 705 log_msg(LVL_ERROR, "Error while initializing service. \n");705 log_msg(LVL_ERROR, "Error while initializing service."); 706 706 return -1; 707 707 } … … 712 712 /* Register device manager at naming service. */ 713 713 if (service_register(SERVICE_DEVMAN) != EOK) { 714 log_msg(LVL_ERROR, "Failed registering as a service. \n");714 log_msg(LVL_ERROR, "Failed registering as a service."); 715 715 return -1; 716 716 }
Note:
See TracChangeset
for help on using the changeset viewer.