From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4W2b-00012j-UX for qemu-devel@nongnu.org; Tue, 08 Jul 2014 10:06:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4W2V-00040v-6t for qemu-devel@nongnu.org; Tue, 08 Jul 2014 10:06:41 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:51964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4W2V-00040l-0i for qemu-devel@nongnu.org; Tue, 08 Jul 2014 10:06:35 -0400 Received: by mail-wi0-f175.google.com with SMTP id ho1so1069860wib.2 for ; Tue, 08 Jul 2014 07:06:34 -0700 (PDT) From: Nikolay Nikolaev Date: Tue, 08 Jul 2014 17:06:27 +0300 Message-ID: <20140708140620.7314.49455.stgit@3820> In-Reply-To: <20140708140447.7314.87628.stgit@3820> References: <20140708140447.7314.87628.stgit@3820> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 3/3] 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 2af2381..b9dcec1 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -72,6 +72,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 { @@ -201,6 +202,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); @@ -227,8 +229,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);