From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5mLd-0002l3-Pj for qemu-devel@nongnu.org; Fri, 11 Jul 2014 21:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5mLX-0001YI-OM for qemu-devel@nongnu.org; Fri, 11 Jul 2014 21:43:33 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:62458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5mLX-0001Xt-9c for qemu-devel@nongnu.org; Fri, 11 Jul 2014 21:43:27 -0400 Received: by mail-wi0-f177.google.com with SMTP id ho1so76684wib.10 for ; Fri, 11 Jul 2014 18:43:26 -0700 (PDT) From: Nikolay Nikolaev Date: Sat, 12 Jul 2014 04:43:19 +0300 Message-ID: <20140712014254.10636.31208.stgit@3820> In-Reply-To: <20140712014119.10636.81503.stgit@3820> References: <20140712014119.10636.81503.stgit@3820> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2 2/2 for-2.1] qtest: Adapt vhost-user-test to latehs vhost-user changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: snabb-devel@googlegroups.com, qemu-devel@nongnu.org, mst@redhat.com Cc: tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com A new field mmap_offset was added in the vhost-user message, we need to reflect this change in the test too. Signed-off-by: Nikolay Nikolaev --- tests/vhost-user-test.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 406ba70..75fedf0 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -76,6 +76,7 @@ typedef struct VhostUserMemoryRegion { uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory { @@ -205,6 +206,7 @@ static void read_guest_mem(void) uint32_t *guest_mem; gint64 end_time; int i, j; + size_t size; g_mutex_lock(data_mutex); @@ -231,8 +233,13 @@ static void read_guest_mem(void) g_assert_cmpint(memory.regions[i].memory_size, >, 1024); - guest_mem = mmap(0, memory.regions[i].memory_size, - PROT_READ | PROT_WRITE, MAP_SHARED, fds[i], 0); + size = memory.regions[i].memory_size + memory.regions[i].mmap_offset; + + guest_mem = mmap(0, size, PROT_READ | PROT_WRITE, + MAP_SHARED, fds[i], 0); + + g_assert(guest_mem != MAP_FAILED); + guest_mem += (memory.regions[i].mmap_offset / sizeof(*guest_mem)); for (j = 0; j < 256; j++) { uint32_t a = readl(memory.regions[i].guest_phys_addr + j*4);