Revision 53db16b5 hw/qdev.c
b/hw/qdev.c | ||
---|---|---|
456 | 456 |
return NULL; |
457 | 457 |
} |
458 | 458 |
|
459 |
static void qbus_list_bus(DeviceState *dev, char *dest, int len)
|
|
459 |
static void qbus_list_bus(DeviceState *dev) |
|
460 | 460 |
{ |
461 | 461 |
BusState *child; |
462 | 462 |
const char *sep = " "; |
463 |
int pos = 0; |
|
464 | 463 |
|
465 |
pos += snprintf(dest+pos, len-pos,"child busses at \"%s\":",
|
|
466 |
dev->id ? dev->id : dev->info->name);
|
|
464 |
error_printf("child busses at \"%s\":",
|
|
465 |
dev->id ? dev->id : dev->info->name); |
|
467 | 466 |
QLIST_FOREACH(child, &dev->child_bus, sibling) { |
468 |
pos += snprintf(dest+pos, len-pos, "%s\"%s\"", sep, child->name);
|
|
467 |
error_printf("%s\"%s\"", sep, child->name);
|
|
469 | 468 |
sep = ", "; |
470 | 469 |
} |
470 |
error_printf("\n"); |
|
471 | 471 |
} |
472 | 472 |
|
473 |
static void qbus_list_dev(BusState *bus, char *dest, int len)
|
|
473 |
static void qbus_list_dev(BusState *bus) |
|
474 | 474 |
{ |
475 | 475 |
DeviceState *dev; |
476 | 476 |
const char *sep = " "; |
477 |
int pos = 0; |
|
478 | 477 |
|
479 |
pos += snprintf(dest+pos, len-pos, "devices at \"%s\":", |
|
480 |
bus->name); |
|
478 |
error_printf("devices at \"%s\":", bus->name); |
|
481 | 479 |
QLIST_FOREACH(dev, &bus->children, sibling) { |
482 |
pos += snprintf(dest+pos, len-pos, "%s\"%s\"", |
|
483 |
sep, dev->info->name); |
|
480 |
error_printf("%s\"%s\"", sep, dev->info->name); |
|
484 | 481 |
if (dev->id) |
485 |
pos += snprintf(dest+pos, len-pos, "/\"%s\"", dev->id);
|
|
482 |
error_printf("/\"%s\"", dev->id);
|
|
486 | 483 |
sep = ", "; |
487 | 484 |
} |
485 |
error_printf("\n"); |
|
488 | 486 |
} |
489 | 487 |
|
490 | 488 |
static BusState *qbus_find_bus(DeviceState *dev, char *elem) |
... | ... | |
531 | 529 |
{ |
532 | 530 |
DeviceState *dev; |
533 | 531 |
BusState *bus; |
534 |
char elem[128], msg[256];
|
|
532 |
char elem[128]; |
|
535 | 533 |
int pos, len; |
536 | 534 |
|
537 | 535 |
/* find start element */ |
... | ... | |
565 | 563 |
pos += len; |
566 | 564 |
dev = qbus_find_dev(bus, elem); |
567 | 565 |
if (!dev) { |
568 |
qbus_list_dev(bus, msg, sizeof(msg));
|
|
569 |
qemu_error("device \"%s\" not found\n%s\n", elem, msg);
|
|
566 |
qemu_error("device \"%s\" not found\n", elem);
|
|
567 |
qbus_list_dev(bus);
|
|
570 | 568 |
return NULL; |
571 | 569 |
} |
572 | 570 |
if (path[pos] == '\0') { |
... | ... | |
579 | 577 |
case 1: |
580 | 578 |
return QLIST_FIRST(&dev->child_bus); |
581 | 579 |
default: |
582 |
qbus_list_bus(dev, msg, sizeof(msg)); |
|
583 |
qemu_error("device has multiple child busses (%s)\n%s\n", |
|
584 |
path, msg); |
|
580 |
qemu_error("device has multiple child busses (%s)\n", path); |
|
581 |
qbus_list_bus(dev); |
|
585 | 582 |
return NULL; |
586 | 583 |
} |
587 | 584 |
} |
... | ... | |
594 | 591 |
pos += len; |
595 | 592 |
bus = qbus_find_bus(dev, elem); |
596 | 593 |
if (!bus) { |
597 |
qbus_list_bus(dev, msg, sizeof(msg));
|
|
598 |
qemu_error("child bus \"%s\" not found\n%s\n", elem, msg);
|
|
594 |
qemu_error("child bus \"%s\" not found\n", elem);
|
|
595 |
qbus_list_bus(dev);
|
|
599 | 596 |
return NULL; |
600 | 597 |
} |
601 | 598 |
} |
Also available in: Unified diff