From 751c6a17042b5d011013d6963c0505d671cf708e Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 22 Jul 2009 16:42:57 +0200 Subject: kill drives_table First step cleaning up the drives handling. This one does nothing but removing drives_table[], still it became seriously big. drive_get_index() is gone and is replaced by drives_get() which hands out DriveInfo pointers instead of a table index. This needs adaption in *tons* of places all over. The drives are now maintained as linked list. Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- hw/ppc_prep.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'hw/ppc_prep.c') diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index 7a219778cf..97190a2b7b 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -550,7 +550,7 @@ static void ppc_prep_init (ram_addr_t ram_size, PCIBus *pci_bus; qemu_irq *i8259; int ppc_boot_device; - int index; + DriveInfo *dinfo; BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BlockDriverState *fd[MAX_FD]; @@ -691,11 +691,8 @@ static void ppc_prep_init (ram_addr_t ram_size, } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - if (index != -1) - hd[i] = drives_table[index].bdrv; - else - hd[i] = NULL; + dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); + hd[i] = dinfo ? dinfo->bdrv : NULL; } for(i = 0; i < MAX_IDE_BUS; i++) { @@ -708,11 +705,8 @@ static void ppc_prep_init (ram_addr_t ram_size, // SB16_init(); for(i = 0; i < MAX_FD; i++) { - index = drive_get_index(IF_FLOPPY, 0, i); - if (index != -1) - fd[i] = drives_table[index].bdrv; - else - fd[i] = NULL; + dinfo = drive_get(IF_FLOPPY, 0, i); + fd[i] = dinfo ? dinfo->bdrv : NULL; } fdctrl_init(i8259[6], 2, 0, 0x3f0, fd); -- cgit v1.2.3