From patchwork Fri Jan 15 13:22:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 8040391 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C7A8C9F716 for ; Fri, 15 Jan 2016 13:25:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B513C20459 for ; Fri, 15 Jan 2016 13:25:44 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AE6E20497 for ; Fri, 15 Jan 2016 13:25:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aK4Li-00042w-Dx; Fri, 15 Jan 2016 13:23:30 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aK4Lf-0003vs-Sj for xen-devel@lists.xen.org; Fri, 15 Jan 2016 13:23:28 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 5C/5F-09570-FC2F8965; Fri, 15 Jan 2016 13:23:27 +0000 X-Env-Sender: prvs=815b692d9=Ian.Campbell@citrix.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1452864204!16105378!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20596 invoked from network); 15 Jan 2016 13:23:26 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-6.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 15 Jan 2016 13:23:26 -0000 X-IronPort-AV: E=Sophos;i="5.22,299,1449532800"; d="scan'208";a="325395777" From: Ian Campbell To: , , Date: Fri, 15 Jan 2016 13:22:52 +0000 Message-ID: <1452864188-2417-14-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452864188-2417-1-git-send-email-ian.campbell@citrix.com> References: <1452864168.32341.97.camel@citrix.com> <1452864188-2417-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Campbell Subject: [Xen-devel] [PATCH XEN v8 13/29] tools/libs/foreignmemory: use size_t for size arguments. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, RCVD_IN_BRBL_LASTEXT, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Surprisingly it appears no callers need updating. Signed-off-by: Ian Campbell Acked-by: Wei Liu Acked-by: Ian Jackson --- v4: New patch --- tools/libs/foreignmemory/compat.c | 2 +- tools/libs/foreignmemory/freebsd.c | 4 ++-- .../libs/foreignmemory/include/xenforeignmemory.h | 5 +++-- tools/libs/foreignmemory/linux.c | 23 +++++++++++----------- tools/libs/foreignmemory/minios.c | 4 ++-- tools/libs/foreignmemory/netbsd.c | 2 +- tools/libs/foreignmemory/solaris.c | 2 +- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/tools/libs/foreignmemory/compat.c b/tools/libs/foreignmemory/compat.c index b8c6fc6..039297c 100644 --- a/tools/libs/foreignmemory/compat.c +++ b/tools/libs/foreignmemory/compat.c @@ -23,7 +23,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, uint32_t dom, int prot, - const xen_pfn_t *arr, int *err, unsigned int num) + const xen_pfn_t *arr, int *err, size_t num) { xen_pfn_t *pfn; unsigned int i; diff --git a/tools/libs/foreignmemory/freebsd.c b/tools/libs/foreignmemory/freebsd.c index 3c3ad09..ed26ebb 100644 --- a/tools/libs/foreignmemory/freebsd.c +++ b/tools/libs/foreignmemory/freebsd.c @@ -85,7 +85,7 @@ int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem) void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, uint32_t dom, int prot, const xen_pfn_t *arr, int *err, - unsigned int num) + size_t num) { int fd = fmem->fd; privcmd_mmapbatch_t ioctlx; @@ -119,7 +119,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, } int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, - void *addr, unsigned int num) + void *addr, size_t num) { return munmap(addr, num << PAGE_SHIFT); } diff --git a/tools/libs/foreignmemory/include/xenforeignmemory.h b/tools/libs/foreignmemory/include/xenforeignmemory.h index b783af3..04ff548 100644 --- a/tools/libs/foreignmemory/include/xenforeignmemory.h +++ b/tools/libs/foreignmemory/include/xenforeignmemory.h @@ -56,14 +56,15 @@ int xenforeignmemory_close(xenforeignmemory_handle *fmem); */ void *xenforeignmemory_map(xenforeignmemory_handle *fmem, uint32_t dom, int prot, const xen_pfn_t *arr, int *err, - unsigned int num); + size_t pages); + /* * Unmap a mapping previous created with xenforeignmemory_map(). * * Returns 0 on success on failure sets errno and returns -1. */ int xenforeignmemory_unmap(xenforeignmemory_handle *fmem, - void *addr, unsigned int num); + void *addr, size_t pages); #endif diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c index 40ecd41..6620391 100644 --- a/tools/libs/foreignmemory/linux.c +++ b/tools/libs/foreignmemory/linux.c @@ -115,10 +115,11 @@ static int map_foreign_batch_single(int fd, uint32_t dom, * This will keep the request ring full and avoids delays. */ static int retry_paged(int fd, uint32_t dom, void *addr, - const xen_pfn_t *arr, int *err, unsigned int num) + const xen_pfn_t *arr, int *err, size_t num) { privcmd_mmapbatch_v2_t ioctlx; - int rc, paged = 0, i = 0; + int rc, paged = 0; + size_t i = 0; do { @@ -134,7 +135,7 @@ static int retry_paged(int fd, uint32_t dom, void *addr, /* At least one gfn is still in paging state */ ioctlx.num = 1; ioctlx.dom = dom; - ioctlx.addr = (unsigned long)addr + ((unsigned long)i<fd; privcmd_mmapbatch_v2_t ioctlx; void *addr; - unsigned int i; + size_t i; int rc; - addr = mmap(NULL, (unsigned long)num << PAGE_SHIFT, prot, MAP_SHARED, + addr = mmap(NULL, num << PAGE_SHIFT, prot, MAP_SHARED, fd, 0); if ( addr == MAP_FAILED ) { @@ -212,7 +213,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, if ( pfn == MAP_FAILED ) { PERROR("mmap of pfn array failed"); - (void)munmap(addr, (unsigned long)num << PAGE_SHIFT); + (void)munmap(addr, num << PAGE_SHIFT); return NULL; } } @@ -245,7 +246,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, continue; } rc = map_foreign_batch_single(fd, dom, pfn + i, - (unsigned long)addr + ((unsigned long)i<