aboutsummaryrefslogtreecommitdiffstats
path: root/tools/blktap/lib
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-11-28 13:50:32 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-11-28 13:50:32 +0000
commitbc7926798919a5523af71386727493ef5aa5fd7d (patch)
tree0fe6e25101fe460f555468f62ecaede4fd6887cb /tools/blktap/lib
parent5348ff2ec07add9d95b67bef3a5ae7f85ee4b393 (diff)
downloadxen-bc7926798919a5523af71386727493ef5aa5fd7d.tar.gz
xen-bc7926798919a5523af71386727493ef5aa5fd7d.tar.bz2
xen-bc7926798919a5523af71386727493ef5aa5fd7d.zip
[BLKTAP] Use lartge enough types to express parameters of large block devices.
While the kernel side of blktap drivers is using 64-bit sector numbers correctly when reporting disk sizing, the userspace parts where this dat is actually generated is truncating at 32-bit. There are 3 variables related to disk sizing which are used in the kernel/userspace code 'size', 'sector size' & 'info'. In kernel space these are treated as being unsigned long long, unsigned long, and unsigned int, respectively. In the blktap userspace code this were all varyingly long, unsigned long. This mismatch caused 32-bit wraparound on large disks. The attached patch updates the blktap userspace to use the same data types as kernel space for all these params, thus both fixing the 32-bit bug & giving the code consistency. This patch has been tested both by comparing /proc/partitions in the guest, with the image size seen in the host, and by using Stephen Tweedie's 'verify-data' tool on a variety of multi-TB sized disks. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'tools/blktap/lib')
-rw-r--r--tools/blktap/lib/blktaplib.h12
-rw-r--r--tools/blktap/lib/xenbus.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/tools/blktap/lib/blktaplib.h b/tools/blktap/lib/blktaplib.h
index 456497a608..12f4950133 100644
--- a/tools/blktap/lib/blktaplib.h
+++ b/tools/blktap/lib/blktaplib.h
@@ -97,9 +97,9 @@ typedef struct {
} pending_req_t;
struct blkif_ops {
- long int (*get_size)(struct blkif *blkif);
- long int (*get_secsize)(struct blkif *blkif);
- unsigned (*get_info)(struct blkif *blkif);
+ unsigned long long (*get_size)(struct blkif *blkif);
+ unsigned long (*get_secsize)(struct blkif *blkif);
+ unsigned int (*get_info)(struct blkif *blkif);
};
typedef struct blkif {
@@ -156,9 +156,9 @@ typedef struct domid_translate {
} domid_translate_t ;
typedef struct image {
- long int size;
- long int secsize;
- long int info;
+ unsigned long long size;
+ unsigned long secsize;
+ unsigned int info;
} image_t;
typedef struct msg_hdr {
diff --git a/tools/blktap/lib/xenbus.c b/tools/blktap/lib/xenbus.c
index ea7377d47c..d50e492784 100644
--- a/tools/blktap/lib/xenbus.c
+++ b/tools/blktap/lib/xenbus.c
@@ -219,7 +219,7 @@ static void ueblktap_setup(struct xs_handle *h, char *bepath)
}
/* Supply the information about the device to xenstore */
- er = xs_printf(h, be->backpath, "sectors", "%lu",
+ er = xs_printf(h, be->backpath, "sectors", "%llu",
be->blkif->ops->get_size(be->blkif));
if (er == 0) {