[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH -V3 15/32] virtio-9p: Use little endian format on vi
From: |
Aneesh Kumar K.V |
Subject: |
[Qemu-devel] [PATCH -V3 15/32] virtio-9p: Use little endian format on virtio |
Date: |
Thu, 25 Mar 2010 22:13:23 +0530 |
We need to use platform independent data format as
part of protocol data. 9P uses little endian format
on wire
Signed-off-by: Aneesh Kumar K.V <address@hidden>
---
hw/virtio-9p.c | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index e095916..e8a9eeb 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -426,23 +426,32 @@ static size_t pdu_unmarshal(V9fsPDU *pdu, size_t offset,
const char *fmt, ...)
for (i = 0; fmt[i]; i++) {
switch (fmt[i]) {
case 'b': {
- int8_t *valp = va_arg(ap, int8_t *);
+ uint8_t *valp = va_arg(ap, uint8_t *);
offset += pdu_unpack(valp, pdu, offset, sizeof(*valp));
break;
}
case 'w': {
- int16_t *valp = va_arg(ap, int16_t *);
- offset += pdu_unpack(valp, pdu, offset, sizeof(*valp));
+ uint16_t val, *valp;
+ valp = va_arg(ap, uint16_t *);
+ val = le16_to_cpupu(valp);
+ offset += pdu_unpack(&val, pdu, offset, sizeof(val));
+ *valp = val;
break;
}
case 'd': {
- int32_t *valp = va_arg(ap, int32_t *);
- offset += pdu_unpack(valp, pdu, offset, sizeof(*valp));
+ uint32_t val, *valp;
+ valp = va_arg(ap, uint32_t *);
+ val = le32_to_cpupu(valp);
+ offset += pdu_unpack(&val, pdu, offset, sizeof(val));
+ *valp = val;
break;
}
case 'q': {
- int64_t *valp = va_arg(ap, int64_t *);
- offset += pdu_unpack(valp, pdu, offset, sizeof(*valp));
+ uint64_t val, *valp;
+ valp = va_arg(ap, uint64_t *);
+ val = le64_to_cpup(valp);
+ offset += pdu_unpack(&val, pdu, offset, sizeof(val));
+ *valp = val;
break;
}
case 'v': {
@@ -498,22 +507,25 @@ static size_t pdu_marshal(V9fsPDU *pdu, size_t offset,
const char *fmt, ...)
for (i = 0; fmt[i]; i++) {
switch (fmt[i]) {
case 'b': {
- int8_t val = va_arg(ap, int);
+ uint8_t val = va_arg(ap, int);
offset += pdu_pack(pdu, offset, &val, sizeof(val));
break;
}
case 'w': {
- int16_t val = va_arg(ap, int);
+ uint16_t val;
+ cpu_to_le16w(&val, va_arg(ap, int));
offset += pdu_pack(pdu, offset, &val, sizeof(val));
break;
}
case 'd': {
- int32_t val = va_arg(ap, int);
+ uint32_t val;
+ cpu_to_le32w(&val, va_arg(ap, uint32_t));
offset += pdu_pack(pdu, offset, &val, sizeof(val));
break;
}
case 'q': {
- int64_t val = va_arg(ap, int64_t);
+ uint64_t val;
+ cpu_to_le64w(&val, va_arg(ap, uint64_t));
offset += pdu_pack(pdu, offset, &val, sizeof(val));
break;
}
--
1.7.0.2.323.g0d092
- Re: [Qemu-devel] [PATCH -V3 09/32] virtio-9p: Implement P9_TWRITE/ Thread model in QEMU, (continued)
- [Qemu-devel] [PATCH -V3 08/32] virtio-9p: Implement P9_TCLUNK, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 04/32] virtio-9p: Implement P9_TSTAT, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 10/32] virtio-9p: Implement P9_TCREATE, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 11/32] virtio-9p: Implement P9_TWSTAT, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 12/32] virtio-9p: Implement P9_TREMOVE, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 14/32] virtio-9p: Add multiple mount point support, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 16/32] virtio-9p: Add support for hardlink, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 13/32] virtio-9p: Implement P9_TFLUSH, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 17/32] Implement sync support in 9p server, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 15/32] virtio-9p: Use little endian format on virtio,
Aneesh Kumar K.V <=
- [Qemu-devel] [PATCH -V3 18/32] virtio-9p: Fix sg usage in the code, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 19/32] virtio-9p: Get the correct count values from the pdu, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 22/32] virtio-9p: Update existing fid path on rename, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 21/32] virtio-9p: Remove unnecessary definition of fid, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 23/32] vritio-9p: Fix chmod bug with directory, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 20/32] virtio-9p: Remove BUG_ON and add proper error handling, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 24/32] qemu-malloc: Add qemu_asprintf, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 26/32] virtio-9p: Create a commandline option -fsdev, Aneesh Kumar K.V, 2010/03/25
- [Qemu-devel] [PATCH -V3 25/32] virtio-9p: Move V9fs File system specific options to a separate header file., Aneesh Kumar K.V, 2010/03/25