From patchwork Fri Jan 13 06:32:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 135722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E44CAB6FAA for ; Fri, 13 Jan 2012 17:32:36 +1100 (EST) Received: from localhost ([::1]:38648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlagf-0002jh-A9 for incoming@patchwork.ozlabs.org; Fri, 13 Jan 2012 01:32:29 -0500 Received: from eggs.gnu.org ([140.186.70.92]:58524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlagY-0002jb-SD for qemu-devel@nongnu.org; Fri, 13 Jan 2012 01:32:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlagX-0007Cx-E3 for qemu-devel@nongnu.org; Fri, 13 Jan 2012 01:32:22 -0500 Received: from gate.crashing.org ([63.228.1.57]:57737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlagX-0007Cq-5N for qemu-devel@nongnu.org; Fri, 13 Jan 2012 01:32:21 -0500 Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id q0D6WEFn001021; Fri, 13 Jan 2012 00:32:15 -0600 Message-ID: <1326436334.26116.1.camel@pasglop> From: Benjamin Herrenschmidt To: qemu-devel@nongnu.org Date: Fri, 13 Jan 2012 17:32:14 +1100 X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 63.228.1.57 Subject: [Qemu-devel] [PATCH] Endian fixes for virtfs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This may not fix all of the endian problems in there but it's enough to make it work with some SLOF version I'm working on. Maybe more when I get the Linux client attached... Signed-off-by: Benjamin Herrenschmidt --- hw/9pfs/virtio-9p.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index e6ba6ba..08445a1 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -1349,7 +1349,9 @@ static void v9fs_open(void *opaque) if (s->proto_version == V9FS_PROTO_2000L) { err = pdu_unmarshal(pdu, offset, "dd", &fid, &mode); } else { - err = pdu_unmarshal(pdu, offset, "db", &fid, &mode); + uint8_t modebyte; + err = pdu_unmarshal(pdu, offset, "db", &fid, &modebyte); + mode = modebyte; } if (err < 0) { goto out_nofid; @@ -3261,9 +3263,9 @@ void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) ptr = pdu->elem.out_sg[0].iov_base; - memcpy(&pdu->size, ptr, 4); + pdu->size = le32_to_cpu(*(uint32_t *)ptr); pdu->id = ptr[4]; - memcpy(&pdu->tag, ptr + 5, 2); + pdu->tag = le16_to_cpu(*(uint16_t *)(ptr + 5)); qemu_co_queue_init(&pdu->complete); submit_pdu(s, pdu); }