From patchwork Tue Oct 10 16:31:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9998065 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 597DD603FF for ; Tue, 10 Oct 2017 22:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D640287BD for ; Tue, 10 Oct 2017 22:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41EC7287E9; Tue, 10 Oct 2017 22:13:15 +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=-2.6 required=2.0 tests=BAYES_00, DATE_IN_PAST_03_06, 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 AB2D2287BD for ; Tue, 10 Oct 2017 22:13:14 +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 1e22jz-0005CM-QN; Tue, 10 Oct 2017 22:11:07 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e22jx-0005AF-PG for xen-devel@lists.xenproject.org; Tue, 10 Oct 2017 22:11:05 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 10/74-11179-9754DD95; Tue, 10 Oct 2017 22:11:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRWlGSWpSXmKPExsXitHRDpG6F691 Igx1nZSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owTz9cyFtxVqpjRcIOpgXG9TBcjJ4eEgL9E x/vn7CA2m4COxNSnl1i7GDk4RARUJG7vNQAJMwuESEw8OYEVxBYWSJXofPsNzGYRUJW4/q2FG cTmFbCRmP3sKiPESHmJXW0XwWo4geIPl7SAxYUErCXWvW5kgqgXlDg58wkLxHxNidbtv9khbH mJ5q2zmSHqVSTWT53FNoGRbxaSlllIWmYhaVnAyLyKUaM4tagstUjX0FAvqSgzPaMkNzEzR9f QwFgvN7W4ODE9NScxqVgvOT93EyMw1BiAYAfj6t9OhxglOZiURHlfq9+NFOJLyk+pzEgszogv Ks1JLT7EKMPBoSTBm+gClBMsSk1PrUjLzAEGPUxagoNHSYQ31BkozVtckJhbnJkOkTrFqMvRc fPuHyYhlrz8vFQpcd4ikBkCIEUZpXlwI2AReIlRVkqYlxHoKCGegtSi3MwSVPlXjOIcjErCvE EgU3gy80rgNr0COoIJ6AjRtDsgR5QkIqSkGhgXTTteYbvzq5nn1BVPvZj4fuZ4JbhWhZ+d/il Y+5IGl+zx0yn7zmZ/+DU9wkBGQ98jt3vNlTOzNWSPrmtg6rved6pcND3i2Xz9Wzsz2mbO1NGp uOAleJ9xm4uXZWujYrrOnQqfjXMceqz6FPSyom+9e7zo7+48s/aZob+sMqKbXBi0JG/FPlBiK c5INNRiLipOBABJFf/7uwIAAA== X-Env-Sender: prvs=4497f262f=Paul.Durrant@citrix.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1507673456!108982716!5 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 41036 invoked from network); 10 Oct 2017 22:11:04 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 10 Oct 2017 22:11:04 -0000 X-IronPort-AV: E=Sophos;i="5.43,359,1503360000"; d="scan'208";a="444965163" From: Paul Durrant To: Date: Tue, 10 Oct 2017 17:31:24 +0100 Message-ID: <20171010163126.2558-10-paul.durrant@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171010163126.2558-1-paul.durrant@citrix.com> References: <20171010163126.2558-1-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Paul Durrant , Ian Jackson Subject: [Xen-devel] [PATCH v10 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 80b22bdbfc..b5d5f0a354 100644 --- a/tools/libs/foreignmemory/private.h +++ b/tools/libs/foreignmemory/private.h @@ -32,9 +32,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, @@ -54,6 +51,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) { @@ -67,6 +71,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