* Common routine that tries to make sending messages as easy as possible. * We allocate memory for the data, copy strings into that, but do not * free it unless there's an error. The dequeue part of the driver should * free the data. We don't send data when the device is disabled. We do * send data, even when we have no listeners, because we wish to avoid * races relating to startup and re
| 719 | * ${type}${what} at $(location dev) $(pnp-info dev) on $(parent dev) |
| 720 | */ |
| 721 | static void |
| 722 | devaddq(const char *type, const char *what, device_t dev) |
| 723 | { |
| 724 | struct dev_event_info *dei; |
| 725 | const char *parstr; |
| 726 | struct sbuf sb; |
| 727 | |
| 728 | dei = devctl_alloc_dei_sb(&sb); |
| 729 | if (dei == NULL) |
| 730 | return; |
| 731 | sbuf_cpy(&sb, type); |
| 732 | sbuf_cat(&sb, what); |
| 733 | sbuf_cat(&sb, " at "); |
| 734 | |
| 735 | /* Add in the location */ |
| 736 | bus_child_location_sb(dev, &sb); |
| 737 | sbuf_putc(&sb, ' '); |
| 738 | |
| 739 | /* Add in pnpinfo */ |
| 740 | bus_child_pnpinfo_sb(dev, &sb); |
| 741 | |
| 742 | /* Get the parent of this device, or / if high enough in the tree. */ |
| 743 | if (device_get_parent(dev) == NULL) |
| 744 | parstr = "."; /* Or '/' ? */ |
| 745 | else |
| 746 | parstr = device_get_nameunit(device_get_parent(dev)); |
| 747 | sbuf_cat(&sb, " on "); |
| 748 | sbuf_cat(&sb, parstr); |
| 749 | sbuf_putc(&sb, '\n'); |
| 750 | if (sbuf_finish(&sb) != 0) |
| 751 | goto bad; |
| 752 | devctl_queue(dei); |
| 753 | return; |
| 754 | bad: |
| 755 | devctl_free_dei(dei); |
| 756 | } |
| 757 | |
| 758 | /* |
| 759 | * A device was added to the tree. We are called just after it successfully |
no test coverage detected