From patchwork Thu Aug 31 09:35:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9931651 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 07809603FB for ; Thu, 31 Aug 2017 09:38:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE340288D1 for ; Thu, 31 Aug 2017 09:38:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1193288E2; Thu, 31 Aug 2017 09:38:40 +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 E8961288E0 for ; Thu, 31 Aug 2017 09:38:39 +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 1dnLtb-00069l-BR; Thu, 31 Aug 2017 09:36:19 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnLtZ-00067L-QV for xen-devel@lists.xenproject.org; Thu, 31 Aug 2017 09:36:17 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id E7/17-03093-198D7A95; Thu, 31 Aug 2017 09:36:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeJIrShJLcpLzFFi42JxWrrBXnfCjeW RBucfaVt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmLT7SxFMyXrZi95gVTA+M78S5GDg4JAX+J OV+quxg5OdgEdCSmPr3EChIWEVCRuL3XACTMLFAs8fd/NzNIWFggReJQvxhImEVAVeLY7x3MI DavgLXEyhNzwWwJAXmJXW0XWUFsTgEbiSWLGhhBbCGgmkMrlzFD2CoS66fOYoPoFZQ4OfMJC8 QqCYmDL14wT2DknYUkNQtJagEj0ypGjeLUorLUIl0jS72kosz0jJLcxMwcXUMDM73c1OLixPT UnMSkYr3k/NxNjMCwYQCCHYwHFgUeYpTkYFIS5Q27sDxSiC8pP6UyI7E4I76oNCe1+BCjDAeH kgSvwHWgnGBRanpqRVpmDjCAYdISHDxKIry5IGne4oLE3OLMdIjUKUZFKXHeNJCEAEgiozQPr g0WNZcYZaWEeRmBDhHiKUgtys0sQZV/xSjOwagkzMsAMoUnM68EbvoroMVMQItjvZaCLC5JRE hJNTCWvHWfXNX29Nq+HdGL/tuL6p+rlNHXfKPdbP9i+3a3/OMiypOnznWuFHpSx2B+/lzu4f7 eidwrL1UeMVCVeXFrjsm9rNsOO+q4hC+UM13Q23laoU84YV3Mt7u1BlFHT338dPu3q8Kj2u5m a9/PpTPVphTsfHd4YmfGtQ9XRFeVZ67M2TT3f8p6JZbijERDLeai4kQAKIPnUpUCAAA= X-Env-Sender: prvs=4091fd0e1=Paul.Durrant@citrix.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1504172174!80484866!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36667 invoked from network); 31 Aug 2017 09:36:16 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 31 Aug 2017 09:36:16 -0000 X-IronPort-AV: E=Sophos;i="5.41,451,1498521600"; d="scan'208";a="446032833" From: Paul Durrant To: Date: Thu, 31 Aug 2017 10:35:57 +0100 Message-ID: <20170831093605.2757-5-paul.durrant@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170831093605.2757-1-paul.durrant@citrix.com> References: <20170831093605.2757-1-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Wei Liu , Paul Durrant , Ian Jackson Subject: [Xen-devel] [PATCH v3 04/12] 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é --- Cc: Ian Jackson Cc: Wei Liu v3: - Patch added in response to review comments. --- tools/libs/foreignmemory/minios.c | 7 ------- tools/libs/foreignmemory/netbsd.c | 7 ------- tools/libs/foreignmemory/private.h | 12 +++++++++--- tools/libs/foreignmemory/solaris.c | 7 ------- 4 files changed, 9 insertions(+), 24 deletions(-) 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 9ff94b724d..8a8d48d2da 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) { @@ -66,6 +70,8 @@ static inline void osdep_xenforeignmemory_unmap_resource( { } #else +int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, + domid_t domid); int osdep_xenforeignmemory_map_resource( xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres); void 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