Skip to contentSkip to conversation

tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface

PATCH Applied Andrew Cooper 3 participants 6 messages Feb 1, 2016 – Feb 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface

c/s 2d2f789 "tools: rename libxc's evtchn_port_or_error_t with an xc_ prefix" doesn't cater for older applications which have requested XC_WANT_COMPAT_EVTCHN_API

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

---
 tools/libxc/include/xenctrl_compat.h | 1 +
 1 file changed, 1 insertion(+)
tools/libxc/include/xenctrl_compat.h +1 -0
index dc513a3..93ccadb 100644
@@ -51,6 +51,7 @@ void *xc_map_foreign_bulk(xc_interface *xch, uint32_t dom, int prot,
 #ifdef XC_WANT_COMPAT_EVTCHN_API
 
 typedef struct xenevtchn_handle xc_evtchn;
+typedef xc_evtchn_port_or_error_t evtchn_port_or_error_t;
 
 xc_evtchn *xc_evtchn_open(xentoollog_logger *logger,
                              unsigned open_flags);
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Andrew Cooper

c/s 2d2f789 "tools: rename libxc's evtchn_port_or_error_t with an xc_ prefix" doesn't cater for older applications which have requested XC_WANT_COMPAT_EVTCHN_API

I think we can safely assume that such apps are not also using xenevtchn.h (otherwise there would be clashes already) so:

Quoted 1 line
Quoted 16 lines

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
---
 tools/libxc/include/xenctrl_compat.h | 1 +

 1 file changed, 1 insertion(+)
tools/libxc/include/xenctrl_compat.h +0 -0
index dc513a3..93ccadb 100644
@@ -51,6 +51,7 @@ void *xc_map_foreign_bulk(xc_interface *xch, uint32_t
 dom, int prot,
  #ifdef XC_WANT_COMPAT_EVTCHN_API
Quoted 6 lines


 typedef struct xenevtchn_handle xc_evtchn; +typedef xc_evtchn_port_or_error_t evtchn_port_or_error_t;
 xc_evtchn *xc_evtchn_open(xentoollog_logger *logger, unsigned open_flags);

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

Applied
#2 lore raw
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

c/s 2d2f789 "tools: rename libxc's evtchn_port_or_error_t with an xc_ prefix" doesn't cater for older applications which have requested XC_WANT_COMPAT_EVTCHN_API

Quoted 7 lines

I think we can safely assume that such apps are not also using xenevtchn.h
(otherwise there would be clashes already) so:

Quoted 1 line

applied.

#3 lore raw
In reply to Andrew Cooper
Quoted 3 lines · Andrew Cooper

c/s 2d2f789 "tools: rename libxc's evtchn_port_or_error_t with an xc_ prefix" doesn't cater for older applications which have requested XC_WANT_COMPAT_EVTCHN_API

Not sure, but I think this breaks staging at last in SLES11:

[ 93s] gcc -DPIC -O1 -fno-omit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -O0 -g3 -D__XEN_TOOLS__ -MMD -MF .xc_evtchn_compat.opic.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -D_GNU_SOURCE -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I../../xen/common/libelf -Werror -Wmissing-prototypes -I. -I./include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -pthread -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/toollog/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/packa
ges/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/evtchn/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -include /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/config.h -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/call/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/foreignmemory/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/. ./../tools/libs/gnttab/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/gnttab/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -fPIC -c -o xc_evtchn_compat.opic xc_evtchn_compat.c

[   93s] In file included from ./include/xenctrl.h:2577,
[   93s]                  from xc_evtchn_compat.c:9:
[   93s] ./include/xenctrl_compat.h:54: error: redefinition of typedef 'evtchn_port_or_error_t'
[   93s] /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/evtchn/include/xenevtchn.h:31: error: previous declaration of 'evtchn_port_or_error_t' was here
[   93s] make[4]: *** [xc_evtchn_compat.opic] Error 1

Olaf

#4 lore raw
Quoted 8 lines · Olaf Hering
Quoted 3 lines · Andrew Cooper

c/s 2d2f789 "tools: rename libxc's evtchn_port_or_error_t with an xc_ prefix" doesn't cater for older applications which have requested XC_WANT_COMPAT_EVTCHN_API

Not sure, but I think this breaks staging at last in SLES11:

[ 93s] gcc -DPIC -O1 -fno-omit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -O0 -g3 -D__XEN_TOOLS__ -MMD -MF .xc_evtchn_compat.opic.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -D_GNU_SOURCE -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I../../xen/common/libelf -Werror -Wmissing-prototypes -I. -I./include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -pthread -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/toollog/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/pac

kages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/evtchn/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -include /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/config.h -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/call/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/foreignmemory/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc /../../tools/libs/gnttab/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/gnttab/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/include -fPIC -c -o xc_evtchn_compat.opic xc_evtchn_compat.c

Quoted 7 lines
[   93s] In file included from ./include/xenctrl.h:2577,
[   93s]                  from xc_evtchn_compat.c:9:
[   93s] ./include/xenctrl_compat.h:54: error: redefinition of typedef 'evtchn_port_or_error_t'
[   93s] /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-dbg/tools/libxc/../../tools/libs/evtchn/include/xenevtchn.h:31: error: previous declaration of 'evtchn_port_or_error_t' was here
[   93s] make[4]: *** [xc_evtchn_compat.opic] Error 1

Olaf

Urgh. This is getting even more complicated.

This patch is needed to avoid breaking the build for older programs using just

#define XC_WANT_COMPAT_EVTCHN_API
#include <xenctrl.h>

so simply reverting it isn't a viable option either.

Is there any way in C to determine whether a typedef already exists?

~Andrew

#5 lore raw
Quoted 60 lines · Andrew Cooper
Quoted 52 lines · Olaf Hering
Quoted 3 lines · Andrew Cooper

c/s 2d2f789 "tools: rename libxc's evtchn_port_or_error_t with an xc_ prefix" doesn't cater for older applications which have requested XC_WANT_COMPAT_EVTCHN_API

Not sure, but I think this breaks staging at last in SLES11:

[   93s] gcc  -DPIC -O1 -fno-omit-frame-pointer -m64 -fno-strict- aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after- statement   -O0 -g3 -D__XEN_TOOLS__ -MMD -MF .xc_evtchn_compat.opic.d

(quoted diff) +0 -2
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls
-D_GNU_SOURCE -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-

protector -funwind-tables -fasynchronous-unwind-tables

(quoted diff) +0 -2
-I../../xen/common/libelf -Werror -Wmissing-prototypes -I. -I./include
-I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-

dbg/tools/libxc/../../tools/include -pthread -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/libs/toollog/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen- 4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/libs/evtchn/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/include -include /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/config.h -I/usr/src/packages/BUILD/xen- 4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/libs/call/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen- 4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/libs/foreignmemory/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen- 4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/libs/gnttab/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen- 4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/libs/gnttab/include -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/include  -fPIC -c -o xc_evtchn_compat.opic xc_evtchn_compat.c
[   93s] In file included from ./include/xenctrl.h:2577,
[   93s]                  from xc_evtchn_compat.c:9:
[   93s] ./include/xenctrl_compat.h:54: error: redefinition of typedef 'evtchn_port_or_error_t'
[   93s] /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non- dbg/tools/libxc/../../tools/libs/evtchn/include/xenevtchn.h:31: error:
previous declaration of 'evtchn_port_or_error_t' was here
[   93s] make[4]: *** [xc_evtchn_compat.opic] Error 1

Quoted 1 line

Olaf

Urgh.  This is getting even more complicated.

This patch is needed to avoid breaking the build for older programs using just

Quoted 6 lines

#define XC_WANT_COMPAT_EVTCHN_API
#include <xenctrl.h>

so simply reverting it isn't a viable option either.

Is there any way in C to determine whether a typedef already exists?

Not AFAIK.

A common trick is
#ifndef type_t
#define type_t type_t
typedef int type_t;
#endif

But I think what I'll do instead is have xc_evtchn_compat.c #define XC_BUILDING_COMPAT_EVTCHN_API and have xc_compat_evtchn.h DTRT based on that. There's a similar construct
in XC_BUILDING_COMPAT_MAP_FOREIGN_API (although for different reasons).

Patch forthcoming.

Ian.

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