public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix endianness for virtio-blk config space
@ 2008-04-01 16:04 Anthony Liguori
  2008-04-01 16:14 ` Hollis Blanchard
  2008-04-02  6:52 ` Avi Kivity
  0 siblings, 2 replies; 3+ messages in thread
From: Anthony Liguori @ 2008-04-01 16:04 UTC (permalink / raw)
  To: kvm-devel; +Cc: Anthony Liguori, Hollis Blanchard, Avi Kivity

The virtio config space is little endian.  Make sure that in virtio-blk we
store the values in little endian format.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

diff --git a/qemu/hw/virtio-blk.c b/qemu/hw/virtio-blk.c
index 0f55d2a..492bd7f 100644
--- a/qemu/hw/virtio-blk.c
+++ b/qemu/hw/virtio-blk.c
@@ -134,8 +134,8 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
     int64_t capacity;
 
     bdrv_get_geometry(s->bs, &capacity);
-    blkcfg.capacity = capacity;
-    blkcfg.seg_max = 128 - 2;
+    blkcfg.capacity = cpu_to_le64(capacity);
+    blkcfg.seg_max = cpu_to_le32(128 - 2);
     memcpy(config, &blkcfg, sizeof(blkcfg));
 }
 

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-02  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01 16:04 [PATCH] Fix endianness for virtio-blk config space Anthony Liguori
2008-04-01 16:14 ` Hollis Blanchard
2008-04-02  6:52 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox