aboutsummaryrefslogtreecommitdiff
path: root/hw/xen_disk.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-07-22 16:42:57 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-27 14:08:23 -0500
commit751c6a17042b5d011013d6963c0505d671cf708e (patch)
tree61a769ed1a1c16ebdfc1397ce9d775222dfa8e57 /hw/xen_disk.c
parent8a14daa5a1ae22fcfc317f4727a88d6c15c39aae (diff)
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 <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/xen_disk.c')
-rw-r--r--hw/xen_disk.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 7ed6c33aae..100ef8e9bc 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -107,7 +107,7 @@ struct XenBlkDev {
int requests_finished;
/* qemu block driver */
- int index;
+ DriveInfo *dinfo;
BlockDriverState *bs;
QEMUBH *bh;
};
@@ -575,7 +575,7 @@ static void blk_alloc(struct XenDevice *xendev)
static int blk_init(struct XenDevice *xendev)
{
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
- int mode, qflags, have_barriers, info = 0;
+ int index, mode, qflags, have_barriers, info = 0;
char *h;
/* read xenstore entries */
@@ -622,9 +622,9 @@ static int blk_init(struct XenDevice *xendev)
info |= VDISK_CDROM;
/* init qemu block driver */
- blkdev->index = (blkdev->xendev.dev - 202 * 256) / 16;
- blkdev->index = drive_get_index(IF_XEN, 0, blkdev->index);
- if (blkdev->index == -1) {
+ index = (blkdev->xendev.dev - 202 * 256) / 16;
+ blkdev->dinfo = drive_get(IF_XEN, 0, index);
+ if (!blkdev->dinfo) {
/* setup via xenbus -> create new block driver instance */
xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n");
blkdev->bs = bdrv_new(blkdev->dev);
@@ -640,7 +640,7 @@ static int blk_init(struct XenDevice *xendev)
} else {
/* setup via qemu cmdline -> already setup for us */
xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n");
- blkdev->bs = drives_table[blkdev->index].bdrv;
+ blkdev->bs = blkdev->dinfo->bdrv;
}
blkdev->file_blk = BLOCK_SIZE;
blkdev->file_size = bdrv_getlength(blkdev->bs);
@@ -729,7 +729,7 @@ static void blk_disconnect(struct XenDevice *xendev)
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
if (blkdev->bs) {
- if (blkdev->index == -1) {
+ if (!blkdev->dinfo) {
/* close/delete only if we created it ourself */
bdrv_close(blkdev->bs);
bdrv_delete(blkdev->bs);