summaryrefslogtreecommitdiffstats
path: root/hw/ide/core.c
diff options
context:
space:
mode:
authorIsaku Yamahata2011-04-03 13:32:46 +0200
committerKevin Wolf2011-04-07 13:51:48 +0200
commit757179038c4884dc43c2ecd0f4da3facb24f262c (patch)
tree76dd8c9d36c5324187b4650d672edb7fb9edb967 /hw/ide/core.c
parentexit if -drive specified is invalid instead of ignoring the "wrong" -drive (diff)
downloadqemu-757179038c4884dc43c2ecd0f4da3facb24f262c.tar.gz
qemu-757179038c4884dc43c2ecd0f4da3facb24f262c.tar.xz
qemu-757179038c4884dc43c2ecd0f4da3facb24f262c.zip
ide: consolidate drive_get(IF_IDE)
factor out ide initialization to call drive_get(IF_IDE) Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r--hw/ide/core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 007a4ee0c9..c11d457b7a 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2826,3 +2826,17 @@ const VMStateDescription vmstate_ide_bus = {
VMSTATE_END_OF_LIST()
}
};
+
+void ide_drive_get(DriveInfo **hd, int max_bus)
+{
+ int i;
+
+ if (drive_get_max_bus(IF_IDE) >= max_bus) {
+ fprintf(stderr, "qemu: too many IDE bus: %d\n", max_bus);
+ exit(1);
+ }
+
+ for(i = 0; i < max_bus * MAX_IDE_DEVS; i++) {
+ hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
+ }
+}