xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] hvmloader: Use xen/errno.h rather than the host systems errno.h
@ 2016-02-19 18:59 Andrew Cooper
  2016-02-22 11:10 ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2016-02-19 18:59 UTC (permalink / raw)
  To: Xen-devel
  Cc: Wei Liu, Ian Campbell, Andrew Cooper, Doug Goldstein, Jan Beulich,
	Ian Jackson

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 <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Doug Goldstein <cardoe@cardoe.com>

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 <xen/hvm/hvm_info_table.h>
 #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 <xen/errno.h>
+};
+
+/* 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 <xen/errno.h>
 
 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 <errno.h>
 #include <xen/sched.h>
 #include <xen/event_channel.h>
 #include <xen/hvm/params.h>
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-22 11:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19 18:59 [PATCH v2] hvmloader: Use xen/errno.h rather than the host systems errno.h Andrew Cooper
2016-02-22 11:10 ` Jan Beulich
2016-02-22 11:24   ` Andrew Cooper
2016-02-22 11:43     ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).