From patchwork Fri Feb 19 18:59:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 8363491 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 97CD09F314 for ; Fri, 19 Feb 2016 19:01:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A30FF20522 for ; Fri, 19 Feb 2016 19:01:54 +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 B04982050E for ; Fri, 19 Feb 2016 19:01:53 +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 1aWqHB-00080H-M5; Fri, 19 Feb 2016 18:59:37 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWqH9-00080C-L7 for xen-devel@lists.xen.org; Fri, 19 Feb 2016 18:59:35 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id 86/1F-02978-61667C65; Fri, 19 Feb 2016 18:59:34 +0000 X-Env-Sender: prvs=850f8f69e=Andrew.Cooper3@citrix.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1455908372!23617885!1 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 7119 invoked from network); 19 Feb 2016 18:59:34 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 19 Feb 2016 18:59:34 -0000 X-IronPort-AV: E=Sophos;i="5.22,471,1449532800"; d="scan'208";a="332952054" From: Andrew Cooper To: Xen-devel Date: Fri, 19 Feb 2016 18:59:30 +0000 Message-ID: <1455908370-12107-1-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , Ian Campbell , Andrew Cooper , Doug Goldstein , Jan Beulich , Ian Jackson Subject: [Xen-devel] [PATCH v2] hvmloader: Use xen/errno.h rather than the host systems errno.h 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=-4.2 required=5.0 tests=BAYES_00, 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 hvmloader is unhosted, and shouldn't use the system errno.h. It already has to use Xen's errno.h for other hypercalls. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Ian Campbell CC: Ian Jackson CC: Wei Liu CC: Doug Goldstein v2: Fix compilation. I am not sure how v1 compiled, but I did definitely check it before posting. Furthermore, this patch provies that attempting to combine two header files from the Xen public interface is an utter disaster... --- tools/firmware/hvmloader/util.h | 15 +++++++++++++++ tools/firmware/hvmloader/vnuma.c | 3 +-- tools/firmware/hvmloader/xenbus.c | 1 - 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h index 132d915..052de1a 100644 --- a/tools/firmware/hvmloader/util.h +++ b/tools/firmware/hvmloader/util.h @@ -9,6 +9,21 @@ #include #include "e820.h" +/* Persuade errno.h to give us some un-prefixed values. */ +#define __XEN_PUBLIC_ERRNO_H__ +#define XEN_ERRNO(name, value) name = value, +enum { +#include +}; + +/* Cause xs_wire.h to give us xsd_errors[]. */ +#define EINVAL EINVAL + +/* Fill in errno values needed by xs_wire.h, missing from errno.h. */ +#define EISDIR 21 +#define EROFS 30 +#define ENOTEMPTY 39 + #define __STR(...) #__VA_ARGS__ #define STR(...) __STR(__VA_ARGS__) diff --git a/tools/firmware/hvmloader/vnuma.c b/tools/firmware/hvmloader/vnuma.c index 4121cc6..85c1a79 100644 --- a/tools/firmware/hvmloader/vnuma.c +++ b/tools/firmware/hvmloader/vnuma.c @@ -28,7 +28,6 @@ #include "util.h" #include "hypercall.h" #include "vnuma.h" -#include unsigned int nr_vnodes, nr_vmemranges; unsigned int *vcpu_to_vnode, *vdistance; @@ -40,7 +39,7 @@ void init_vnuma_info(void) struct xen_vnuma_topology_info vnuma_topo = { .domid = DOMID_SELF }; rc = hypercall_memory_op(XENMEM_get_vnumainfo, &vnuma_topo); - if ( rc != -XEN_ENOBUFS ) + if ( rc != -ENOBUFS ) return; ASSERT(vnuma_topo.nr_vcpus == hvm_info->nr_vcpus); diff --git a/tools/firmware/hvmloader/xenbus.c b/tools/firmware/hvmloader/xenbus.c index d0ed993..448157d 100644 --- a/tools/firmware/hvmloader/xenbus.c +++ b/tools/firmware/hvmloader/xenbus.c @@ -27,7 +27,6 @@ #include "util.h" #include "hypercall.h" -#include #include #include #include