From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7vJv-0006Ac-R9 for qemu-devel@nongnu.org; Thu, 17 Jul 2014 19:42:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7vJo-0000Zz-5v for qemu-devel@nongnu.org; Thu, 17 Jul 2014 19:42:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7vJn-0000Zl-U4 for qemu-devel@nongnu.org; Thu, 17 Jul 2014 19:42:32 -0400 Date: Fri, 18 Jul 2014 02:44:50 +0300 From: "Michael S. Tsirkin" Message-ID: <1405640614-9252-7-git-send-email-mst@redhat.com> References: <1405640614-9252-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1405640614-9252-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL v2 6/7] qtest: Adapt vhost-user-test to latest vhost-user changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Nikolay Nikolaev , Anthony Liguori , Antonios Motakis From: Nikolay Nikolaev 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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); -- MST