summaryrefslogtreecommitdiff
path: root/fsdev/9p-iov-marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fsdev/9p-iov-marshal.c')
-rw-r--r--fsdev/9p-iov-marshal.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
index 663cad542..fb40bdf0d 100644
--- a/fsdev/9p-iov-marshal.c
+++ b/fsdev/9p-iov-marshal.c
@@ -12,8 +12,10 @@
*/
#include "qemu/osdep.h"
+#include <glib.h>
#include <glib/gprintf.h>
#include <utime.h>
+#include <sys/uio.h>
#include "9p-iov-marshal.h"
#include "qemu/bswap.h"
@@ -207,25 +209,31 @@ ssize_t v9fs_iov_vmarshal(struct iovec *in_sg, int in_num, size_t offset,
break;
}
case 'w': {
- uint16_t val = va_arg(ap, int);
+ uint16_t val;
if (bswap) {
- val = cpu_to_le16(val);
+ cpu_to_le16w(&val, va_arg(ap, int));
+ } else {
+ val = va_arg(ap, int);
}
copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
break;
}
case 'd': {
- uint32_t val = va_arg(ap, uint32_t);
+ uint32_t val;
if (bswap) {
- val = cpu_to_le32(val);
+ cpu_to_le32w(&val, va_arg(ap, uint32_t));
+ } else {
+ val = va_arg(ap, uint32_t);
}
copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
break;
}
case 'q': {
- uint64_t val = va_arg(ap, uint64_t);
+ uint64_t val;
if (bswap) {
- val = cpu_to_le64(val);
+ cpu_to_le64w(&val, va_arg(ap, uint64_t));
+ } else {
+ val = va_arg(ap, uint64_t);
}
copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
break;