Skip to contentSkip to conversation

hvmloader: Use xen/errno.h rather than the host systems errno.h

PATCH Superseded Andrew Cooper 5 participants 10 messages Feb 18, 2016 – Feb 19, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvmloader: Use xen/errno.h rather than the host systems errno.h

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>

---
 tools/firmware/hvmloader/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/firmware/hvmloader/xenbus.c +1 -1
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@
 
 #include "util.h"
 #include "hypercall.h"
-#include <errno.h>
+#include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/event_channel.h>
 #include <xen/hvm/params.h>
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>
---

https://travis-ci.org/cardoe/xen/jobs/110249618 shows the patch in action getting past the previous problem.

Signature · 1 line
Doug Goldstein

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 1 line · Andrew Cooper
Quoted 31 lines

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>

---
 tools/firmware/hvmloader/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/firmware/hvmloader/xenbus.c +1 -1
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@
 
 #include "util.h"
 #include "hypercall.h"
-#include <errno.h>
+#include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/event_channel.h>
 #include <xen/hvm/params.h>
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw
In reply to Andrew Cooper
Quoted 16 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>

---
 tools/firmware/hvmloader/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/firmware/hvmloader/xenbus.c +0 -0
index d0ed993..947d865 100644

tools/firmware/hvmloader/xenbus.c line 30

Quoted 5 lines
tools/firmware/hvmloader/xenbus.c +1 -1
@@ -27,7 +27,7 @@
 
 #include "util.h"
 #include "hypercall.h"
-#include <errno.h>
+#include <xen/errno.h>

This doesn't seem to compile for me. Xen's error numbers live in a different name space.

Wei.

Quoted 6 lines
tools/firmware/hvmloader/xenbus.c +0 -0
 #include <xen/sched.h>
 #include <xen/event_channel.h>
 #include <xen/hvm/params.h>
Signature · 1 line
2.1.4
#4 lore raw
Quoted 18 lines · Wei Liu
Quoted 17 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>

---
 tools/firmware/hvmloader/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/firmware/hvmloader/xenbus.c +0 -0
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@
 
Quoted 6 lines

tools/firmware/hvmloader/xenbus.c line 30

Quoted 4 lines
tools/firmware/hvmloader/xenbus.c +1 -1
 #include "util.h"
 #include "hypercall.h"
-#include <errno.h>
+#include <xen/errno.h>

This doesn't seem to compile for me. Xen's error numbers live in a different name space.

It compiled fine for me. HVMLoader should use __XEN_TOOLS__.

Let me double check after a fully clean build.

~Andrew

#5 lore raw
Quoted 26 lines · Andrew Cooper
Quoted 18 lines · Wei Liu
Quoted 17 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>

---
 tools/firmware/hvmloader/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/firmware/hvmloader/xenbus.c +0 -0
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@
 
Quoted 6 lines

tools/firmware/hvmloader/xenbus.c line 30

Quoted 4 lines
tools/firmware/hvmloader/xenbus.c +1 -1
 #include "util.h"
 #include "hypercall.h"
-#include <errno.h>
+#include <xen/errno.h>

This doesn't seem to compile for me. Xen's error numbers live in a different name space.

Quoted 4 lines

It compiled fine for me. HVMLoader should use __XEN_TOOLS__.

Let me double check after a fully clean build.

On staging:

make[1]: Entering directory '/local/scratch/xen.git/tools/firmware/hvmloader'
gcc -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O0 -g3 -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -MMD -MF .xenbus.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -Werror -fno-stack-protector -fno-exceptions -fno-builtin -msoft-float -I/local/scratch/xen.git/tools/firmware/hvmloader/../../../tools/include -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -DENABLE_ROMBIOS -DENABLE_SEABIOS -c -o xenbus.o xenbus.c
xenbus.c: In function ‘xenbus_recv’:
xenbus.c:235:35: error: ‘xsd_errors’ undeclared (first use in this function)

         for ( i = 0; i < ((sizeof xsd_errors) / (sizeof xsd_errors[0])); i++ )
                                   ^
xenbus.c:235:35: note: each undeclared identifier is reported only once for each function it appears in
xenbus.c:239:16: error: ‘EIO’ undeclared (first use in this function)
         return EIO;
                ^
xenbus.c: In function ‘xenstore_write’:
xenbus.c:295:15: error: ‘EIO’ undeclared (first use in this function)
         ret = EIO;
               ^

/local/scratch/xen.git/tools/firmware/hvmloader/../../../tools/Rules.mk:191: recipe for target 'xenbus.o' failed make[1]: *** [xenbus.o] Error 1
make[1]: Leaving directory '/local/scratch/xen.git/tools/firmware/hvmloader'
Makefile:93: recipe for target 'all' failed
make: *** [all] Error 2

I actually had a similar patch stashed in my queue but that was the reason I never sent it out...

Wei.

Quoted 1 line

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
In reply to Andrew Cooper
Quoted 27 lines · Andrew Cooper
Quoted 12 lines · Wei Liu
Quoted 11 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>
---
 tools/firmware/hvmloader/xenbus.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

tools/firmware/hvmloader/xenbus.c line 30

Quoted 11 lines
tools/firmware/hvmloader/xenbus.c +0 -0
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@


 #include "util.h"
 #include "hypercall.h"

tools/firmware/hvmloader/xenbus.c +1 -1
-#include <errno.h>
+#include <xen/errno.h>

This doesn't seem to compile for me. Xen's error numbers live in a different name space.

Quoted 1 line

It compiled fine for me.  HVMLoader should use __XEN_TOOLS__.

It shouldn't and doesn't, see 3237645813d7 which stopped setting __XEN_TOOLS__ globally for all of tools/* and consequently removed the -U__XEN_TOOLS__ from hvmloader.

In any case I don't think __XEN_TOOLS__ has any impact on xen/errno.h (which is, perhaps confusingly, xen/include/public/errno.h and not xen/include/xen/errno.h)

For normal userspace uses of __XEN_TOOLS__ you wouldn't want unprefixed Xen errno values added to your namespace anyway -- since you need to deal with OS errno names/values.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw
Quoted 32 lines · Ian Campbell
Quoted 20 lines · Andrew Cooper
Quoted 19 lines · Wei Liu
Quoted 18 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>

---
 tools/firmware/hvmloader/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/firmware/hvmloader/xenbus.c +0 -0
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@
 
Quoted 7 lines
Quoted 6 lines

tools/firmware/hvmloader/xenbus.c line 30

Quoted 4 lines
tools/firmware/hvmloader/xenbus.c +1 -1
 #include "util.h"
 #include "hypercall.h"
-#include <errno.h>
+#include <xen/errno.h>

This doesn't seem to compile for me. Xen's error numbers live in a different name space.

It compiled fine for me. HVMLoader should use __XEN_TOOLS__.

It shouldn't and doesn't, see 3237645813d7 which stopped setting __XEN_TOOLS__ globally for all of tools/* and consequently removed the -U__XEN_TOOLS__ from hvmloader.

Quoted 7 lines

In any case I don't think __XEN_TOOLS__ has any impact on xen/errno.h (which is, perhaps confusingly, xen/include/public/errno.h and not xen/include/xen/errno.h)

For normal userspace uses of __XEN_TOOLS__ you wouldn't want unprefixed Xen errno values added to your namespace anyway -- since you need to deal with OS errno names/values.

HVMloader is an unhosted 32bit environment, which is why it should not be using the hosts errno.h in the first place.

~Andrew

#8 lore raw
Quoted 37 lines · Andrew Cooper
Quoted 36 lines · Ian Campbell
Quoted 26 lines · Andrew Cooper
Quoted 12 lines · Wei Liu
Quoted 11 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>
---
 tools/firmware/hvmloader/xenbus.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

tools/firmware/hvmloader/xenbus.c line 30

Quoted 11 lines
tools/firmware/hvmloader/xenbus.c +0 -0
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@


 #include "util.h"
 #include "hypercall.h"

tools/firmware/hvmloader/xenbus.c +1 -1
-#include <errno.h>
+#include <xen/errno.h>

This doesn't seem to compile for me. Xen's error numbers live in a different name space.

Quoted 1 line

It compiled fine for me.  HVMLoader should use __XEN_TOOLS__.

It shouldn't and doesn't, see 3237645813d7 which stopped setting __XEN_TOOLS__ globally for all of tools/* and consequently removed the -U__XEN_TOOLS__ from hvmloader.

In any case I don't think __XEN_TOOLS__ has any impact on xen/errno.h (which is, perhaps confusingly, xen/include/public/errno.h and not xen/include/xen/errno.h)

Quoted 8 lines
Quoted 5 lines

For normal userspace uses of __XEN_TOOLS__ you wouldn't want unprefixed Xen
errno values added to your namespace anyway -- since you need to deal with
OS errno names/values.

HVMloader is an unhosted 32bit environment, which is why it should not be using the hosts errno.h in the first place.

Of course I know this, and it has nothing to do with anything I explained above.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw
In reply to Wei Liu
Quoted 12 lines · Wei Liu
Quoted 11 lines · Andrew Cooper

---
CC: Jan Beulich <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Doug Goldstein <[email protected]>
---
 tools/firmware/hvmloader/xenbus.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

tools/firmware/hvmloader/xenbus.c line 30

Quoted 11 lines
tools/firmware/hvmloader/xenbus.c +0 -0
index d0ed993..947d865 100644
@@ -27,7 +27,7 @@


 #include "util.h"
 #include "hypercall.h"

tools/firmware/hvmloader/xenbus.c +1 -1
-#include <errno.h>
+#include <xen/errno.h>

This doesn't seem to compile for me. Xen's error numbers live in a different name space.

Indeed.

Either all the codes in hvmloader would need updating or it needs to play the same trick as xen/include/xen/errno.h.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel