[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access. |
Date: |
Wed, 03 Nov 2010 14:39:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
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
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access.,
Markus Armbruster <=
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Gleb Natapov, 2010/11/03
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Markus Armbruster, 2010/11/03
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Gleb Natapov, 2010/11/03
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Markus Armbruster, 2010/11/03
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Gleb Natapov, 2010/11/04
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Markus Armbruster, 2010/11/04
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Gleb Natapov, 2010/11/04
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Markus Armbruster, 2010/11/04
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Gleb Natapov, 2010/11/04
- Re: [Qemu-devel] [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access., Markus Armbruster, 2010/11/05