From 59e2fb7252dbdc008a63d144b19be0cd8d873128 Mon Sep 17 00:00:00 2001 From: Felipe Franciosi Date: Fri, 5 Apr 2013 15:47:59 +0000 Subject: [PATCH] Allow xen guests to plug disks of 1 TiB or more The current xen backend driver implementation uses int64_t variables to store the size of the corresponding backend disk/file. It also uses an int64_t variable to store the block size of that image. When writing the number of sectors (file_size/block_size) to xenstore, however, it passes these values as 32 bit signed integers. This will cause an overflow for any disk of 1 TiB or more. This patch changes the xen backend driver to use a 64 bit integer write xenstore function. upstream-commit-id: 9246ce881128df2a69178779c1ef33c83df3c70d Signed-off-by: Felipe Franciosi Signed-off-by: Stefano Stabellini --- hw/xen_disk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 50fa25e57..c6f9cc762 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -683,9 +683,9 @@ static int blk_connect(struct XenDevice *xendev) blkdev->file_size, blkdev->file_size >> 20); /* Fill in number of sector size and number of sectors */ - xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk); - xenstore_write_be_int(&blkdev->xendev, "sectors", - blkdev->file_size / blkdev->file_blk); + xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk); + xenstore_write_be_int64(&blkdev->xendev, "sectors", + blkdev->file_size / blkdev->file_blk); if (xenstore_read_fe_int(&blkdev->xendev, "ring-ref", &blkdev->ring_ref) == -1) { return -1; -- 2.39.5