diff mbox

[1/6] fsdev/9p-iov-marshal.c: Don't use cpu_to_*w() functions

Message ID 1467125451-16700-2-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell June 28, 2016, 2:50 p.m. UTC
Don't use the cpu_to_*w() functions, which we are trying to deprecate.
Instead just use cpu_to_*() to do the byteswap, which brings the
code in the marshal function in line with that in the unmarshal.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 fsdev/9p-iov-marshal.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

Comments

Eric Blake June 28, 2016, 3:09 p.m. UTC | #1
On 06/28/2016 08:50 AM, Peter Maydell wrote:
> Don't use the cpu_to_*w() functions, which we are trying to deprecate.
> Instead just use cpu_to_*() to do the byteswap, which brings the
> code in the marshal function in line with that in the unmarshal.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  fsdev/9p-iov-marshal.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 

>          case 'q': {
> -            uint64_t val;
> +            uint64_t val = va_arg(ap, uint64_t);;

s/;;/;/

With that fix,
Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
index fce1ee9..c33fac6 100644
--- a/fsdev/9p-iov-marshal.c
+++ b/fsdev/9p-iov-marshal.c
@@ -208,31 +208,25 @@  ssize_t v9fs_iov_vmarshal(struct iovec *in_sg, int in_num, size_t offset,
             break;
         }
         case 'w': {
-            uint16_t val;
+            uint16_t val = va_arg(ap, int);
             if (bswap) {
-                cpu_to_le16w(&val, va_arg(ap, int));
-            } else {
-                val =  va_arg(ap, int);
+                val = cpu_to_le16(val);
             }
             copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
             break;
         }
         case 'd': {
-            uint32_t val;
+            uint32_t val = va_arg(ap, uint32_t);
             if (bswap) {
-                cpu_to_le32w(&val, va_arg(ap, uint32_t));
-            } else {
-                val =  va_arg(ap, uint32_t);
+                val = cpu_to_le32(val);
             }
             copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
             break;
         }
         case 'q': {
-            uint64_t val;
+            uint64_t val = va_arg(ap, uint64_t);;
             if (bswap) {
-                cpu_to_le64w(&val, va_arg(ap, uint64_t));
-            } else {
-                val =  va_arg(ap, uint64_t);
+                val = cpu_to_le64(val);
             }
             copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
             break;