[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [PATCH 14/16] lguest: support v1 endian for per-device config.
From: Rusty Russell <rusty@rustcorp.com.au> We only use the config space for the block device (we can use the net device, but the mac address is endian-neutral). For some inexplicable reason, this previously used le conversion macros. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- tools/lguest/lguest.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index cfc494e..1845e0d 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c @@ -245,13 +245,6 @@ static u64 virtio_to_cpu64(u64 v) | ((v & 0x00000000000000FFULL) << 56); } -#define cpu_to_le16(v16) (v16) -#define cpu_to_le32(v32) (v32) -#define cpu_to_le64(v64) (v64) -#define le16_to_cpu(v16) (v16) -#define le32_to_cpu(v32) (v32) -#define le64_to_cpu(v64) (v64) - /* Is this iovec empty? */ static bool iov_empty(const struct iovec iov[], unsigned int num_iov) { @@ -1779,14 +1772,14 @@ static void setup_block_file(const char *filename) add_feature(dev, VIRTIO_BLK_F_FLUSH); /* Tell Guest how many sectors this device has. */ - conf.capacity = cpu_to_le64(vblk->len / 512); + conf.capacity = cpu_to_virtio64(vblk->len / 512); /* * Tell Guest not to put in too many descriptors at once: two are used * for the in and out elements. */ add_feature(dev, VIRTIO_BLK_F_SEG_MAX); - conf.seg_max = cpu_to_le32(VIRTQUEUE_NUM - 2); + conf.seg_max = cpu_to_virtio32(VIRTQUEUE_NUM - 2); /* We're compliant with the new damn spec. */ add_feature(dev, VIRTIO_F_VERSION_1); @@ -1795,7 +1788,7 @@ static void setup_block_file(const char *filename) set_config(dev, offsetof(struct virtio_blk_config, geometry), &conf); verbose("device %u: virtblock %llu sectors\n", - ++devices.device_num, le64_to_cpu(conf.capacity)); + ++devices.device_num, virtio_to_cpu64(conf.capacity)); } /*L:211 -- 1.8.1.2
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]