From patchwork Mon Oct 30 17:48:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 10032977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E7281600C5 for ; Mon, 30 Oct 2017 17:50:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC06728926 for ; Mon, 30 Oct 2017 17:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0EEB28942; Mon, 30 Oct 2017 17:50:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 96A5D28926 for ; Mon, 30 Oct 2017 17:50:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9EAy-0006ov-OB; Mon, 30 Oct 2017 17:48:40 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9EAw-0006ms-Kx for xen-devel@lists.xenproject.org; Mon, 30 Oct 2017 17:48:38 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id E0/F8-19067-5F567F95; Mon, 30 Oct 2017 17:48:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRWlGSWpSXmKPExsXitHRDpO6X1O+ RBve2y1l83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmHbt9nK7irVHHy7F7mBsb1Ml2MnBwSAv4S h+YdZQOx2QR0JKY+vcTaxcjBISKgInF7rwFImFkgRGLiyQmsILawQKrE3gsr2EFsFgFVif0/b jKC2LwCNhL/e3vYIEbKS+xquwhWzwkUX9fxjxnEFhKwljh5sxuqXlDi5MwnLBDzNSVat/9mh7 DlJZq3zoaqV5FYP3UW2wRGvllIWmYhaZmFpGUBI/MqRo3i1KKy1CJdI1O9pKLM9IyS3MTMHF1 DA1O93NTi4sT01JzEpGK95PzcTYzAUKtnYGDcwbir3e8QoyQHk5Io707H75FCfEn5KZUZicUZ 8UWlOanFhxhlODiUJHhdgaErJFiUmp5akZaZAwx6mLQEB4+SCG9ZClCat7ggMbc4Mx0idYrRm KPj5t0/TBzPZr5uYBZiycvPS5US51UDmSQAUppRmgc3CBaNlxhlpYR5GRkYGIR4ClKLcjNLUO VfMYpzMCoJ84aATOHJzCuB2/cK6BQmoFM0JL+AnFKSiJCSamA0b1qwaXkj24E0O+PrgkEM7/3 npKwWq1yaZmO2ZoWIo00Rw5Wvml1Xf0YEtq+qVziz8onYG9aeEzcveTPMUO7Zfr4xRNHNqvCC ifiL6JJPd2ap75G7deaUs6szg11r45c+JrPbFukmh11VtTfnf1t82bXlY1lRJLPw32P7eX5my z1YZv97+V4lluKMREMt5qLiRADdmmDIwQIAAA== X-Env-Sender: prvs=469f563c5=Paul.Durrant@citrix.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1509385712!109444241!3 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: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5288 invoked from network); 30 Oct 2017 17:48:36 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-9.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 30 Oct 2017 17:48:36 -0000 X-IronPort-AV: E=Sophos;i="5.44,320,1505779200"; d="scan'208";a="449051815" From: Paul Durrant To: Date: Mon, 30 Oct 2017 17:48:27 +0000 Message-ID: <20171030174829.4518-10-paul.durrant@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171030174829.4518-1-paul.durrant@citrix.com> References: <20171030174829.4518-1-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Paul Durrant , Ian Jackson Subject: [Xen-devel] [PATCH v13 09/11] tools/libxenforeignmemory: reduce xenforeignmemory_restrict code footprint X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP By using a static inline stub in private.h for OS where this functionality is not implemented, the various duplicate stubs in the OS-specific source modules can be avoided. Signed-off-by: Paul Durrant Reviewed-by: Roger Pau Monné Acked-by: Wei Liu --- Cc: Ian Jackson v4: - Removed extraneous freebsd code. v3: - Patch added in response to review comments. --- tools/libs/foreignmemory/freebsd.c | 7 ------- tools/libs/foreignmemory/minios.c | 7 ------- tools/libs/foreignmemory/netbsd.c | 7 ------- tools/libs/foreignmemory/private.h | 12 +++++++++--- tools/libs/foreignmemory/solaris.c | 7 ------- 5 files changed, 9 insertions(+), 31 deletions(-) diff --git a/tools/libs/foreignmemory/freebsd.c b/tools/libs/foreignmemory/freebsd.c index dec447485a..6e6bc4b11f 100644 --- a/tools/libs/foreignmemory/freebsd.c +++ b/tools/libs/foreignmemory/freebsd.c @@ -95,13 +95,6 @@ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, return munmap(addr, num << PAGE_SHIFT); } -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid) -{ - errno = -EOPNOTSUPP; - return -1; -} - /* * Local variables: * mode: C diff --git a/tools/libs/foreignmemory/minios.c b/tools/libs/foreignmemory/minios.c index 75f340122e..43341ca301 100644 --- a/tools/libs/foreignmemory/minios.c +++ b/tools/libs/foreignmemory/minios.c @@ -58,13 +58,6 @@ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, return munmap(addr, num << PAGE_SHIFT); } -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid) -{ - errno = -EOPNOTSUPP; - return -1; -} - /* * Local variables: * mode: C diff --git a/tools/libs/foreignmemory/netbsd.c b/tools/libs/foreignmemory/netbsd.c index 9bf95ef4f0..54a418ebd6 100644 --- a/tools/libs/foreignmemory/netbsd.c +++ b/tools/libs/foreignmemory/netbsd.c @@ -100,13 +100,6 @@ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, return munmap(addr, num*XC_PAGE_SIZE); } -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid) -{ - errno = -EOPNOTSUPP; - return -1; -} - /* * Local variables: * mode: C diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h index b191000b49..b06ce12583 100644 --- a/tools/libs/foreignmemory/private.h +++ b/tools/libs/foreignmemory/private.h @@ -35,9 +35,6 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, void *addr, size_t num); -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid); - #if defined(__NetBSD__) || defined(__sun__) /* Strictly compat for those two only only */ void *compat_mapforeign_batch(xenforeignmem_handle *fmem, uint32_t dom, @@ -57,6 +54,13 @@ struct xenforeignmemory_resource_handle { }; #ifndef __linux__ +static inline int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, + domid_t domid) +{ + errno = EOPNOTSUPP; + return -1; +} + static inline int osdep_xenforeignmemory_map_resource( xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres) { @@ -70,6 +74,8 @@ static inline int osdep_xenforeignmemory_unmap_resource( return 0; } #else +int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, + domid_t domid); int osdep_xenforeignmemory_map_resource( xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres); int osdep_xenforeignmemory_unmap_resource( diff --git a/tools/libs/foreignmemory/solaris.c b/tools/libs/foreignmemory/solaris.c index a33decb4ae..ee8aae4fbd 100644 --- a/tools/libs/foreignmemory/solaris.c +++ b/tools/libs/foreignmemory/solaris.c @@ -97,13 +97,6 @@ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, return munmap(addr, num*XC_PAGE_SIZE); } -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid) -{ - errno = -EOPNOTSUPP; - return -1; -} - /* * Local variables: * mode: C