Here's a generic answer to the question "which of the device's buses is this?"
int qbus_index(BusState *bus) { BusState *b; int i, index; index = -1; i = 0; QLIST_FOREACH(b, &bus->parent->child_bus, sibling) { if (b == bus) { index = i; } i++; } assert(0 <= index && index < i); return i - 1 - index; } The bus created first has index 0. Note that the child_bus holds the children in reverse creation order, and we can't traverse it backwards. Same problem also visible with makes info qtree: dev: piix3-ide, id "" [...] bus: ide.1 type IDE bus: ide.0 type IDE -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html