From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LXGtA-0003xq-Nt for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LXGt9-0003xR-T7 for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:36 -0500 Received: from [199.232.76.173] (port=52335 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXGt9-0003xO-Mc for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:35 -0500 Received: from savannah.gnu.org ([199.232.41.3]:40284 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LXGt9-0002BF-ET for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:35 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LXGt7-0004pm-PF for qemu-devel@nongnu.org; Wed, 11 Feb 2009 15:20:34 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LXGt6-0004ph-JZ for qemu-devel@nongnu.org; Wed, 11 Feb 2009 15:20:33 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Wed, 11 Feb 2009 15:20:32 +0000 Subject: [Qemu-devel] [6597] qemu: record devfn on block driver instance (Marcelo Tosatti) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6597 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6597 Author: aliguori Date: 2009-02-11 15:20:29 +0000 (Wed, 11 Feb 2009) Log Message: ----------- qemu: record devfn on block driver instance (Marcelo Tosatti) Record PCIDev on the BlockDriverState structure to locate for release on hot-removal. Signed-off-by: Marcelo Tosatti Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/block_int.h trunk/hw/ide.c trunk/hw/lsi53c895a.c trunk/hw/virtio-blk.c Modified: trunk/block_int.h =================================================================== --- trunk/block_int.h 2009-02-11 15:20:20 UTC (rev 6596) +++ trunk/block_int.h 2009-02-11 15:20:29 UTC (rev 6597) @@ -127,6 +127,7 @@ int type; char device_name[32]; BlockDriverState *next; + void *private; }; struct BlockDriverAIOCB { Modified: trunk/hw/ide.c =================================================================== --- trunk/hw/ide.c 2009-02-11 15:20:20 UTC (rev 6596) +++ trunk/hw/ide.c 2009-02-11 15:20:29 UTC (rev 6597) @@ -28,6 +28,7 @@ #include "scsi-disk.h" #include "pcmcia.h" #include "block.h" +#include "block_int.h" #include "qemu-timer.h" #include "sysemu.h" #include "ppc_mac.h" @@ -3352,6 +3353,7 @@ { PCIIDEState *d; uint8_t *pci_conf; + int i; /* register a function 1 of PIIX3 */ d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE", @@ -3378,6 +3380,10 @@ ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6); ide_init_ioport(&d->ide_if[2], 0x170, 0x376); + for (i = 0; i < 4; i++) + if (hd_table[i]) + hd_table[i]->private = &d->dev; + register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d); } Modified: trunk/hw/lsi53c895a.c =================================================================== --- trunk/hw/lsi53c895a.c 2009-02-11 15:20:20 UTC (rev 6596) +++ trunk/hw/lsi53c895a.c 2009-02-11 15:20:29 UTC (rev 6597) @@ -13,6 +13,7 @@ #include "hw.h" #include "pci.h" #include "scsi-disk.h" +#include "block_int.h" //#define DEBUG_LSI //#define DEBUG_LSI_REG @@ -1958,6 +1959,7 @@ s->scsi_dev[id] = scsi_generic_init(bd, 1, lsi_command_complete, s); if (s->scsi_dev[id] == NULL) s->scsi_dev[id] = scsi_disk_init(bd, 1, lsi_command_complete, s); + bd->private = &s->pci_dev; } void *lsi_scsi_init(PCIBus *bus, int devfn) Modified: trunk/hw/virtio-blk.c =================================================================== --- trunk/hw/virtio-blk.c 2009-02-11 15:20:20 UTC (rev 6596) +++ trunk/hw/virtio-blk.c 2009-02-11 15:20:29 UTC (rev 6597) @@ -314,6 +314,7 @@ s->vdev.reset = virtio_blk_reset; s->bs = bs; s->rq = NULL; + bs->private = &s->vdev.pci_dev; bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); bdrv_set_geometry_hint(s->bs, cylinders, heads, secs);