All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface
@ 2016-02-01 11:08 Andrew Cooper
  2016-02-01 11:19 ` Ian Campbell
  2016-02-03 17:12 ` Olaf Hering
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Cooper @ 2016-02-01 11:08 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Wei Liu

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

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxc/include/xenctrl_compat.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libxc/include/xenctrl_compat.h
index dc513a3..93ccadb 100644
--- a/tools/libxc/include/xenctrl_compat.h
+++ b/tools/libxc/include/xenctrl_compat.h
@@ -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);
-- 
2.1.4

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

* Re: [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface
  2016-02-01 11:08 [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface Andrew Cooper
@ 2016-02-01 11:19 ` Ian Campbell
  2016-02-03 11:48   ` Ian Campbell
  2016-02-03 17:12 ` Olaf Hering
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2016-02-01 11:19 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel; +Cc: Wei Liu, Ian Jackson

On Mon, 2016-02-01 at 11:08 +0000, Andrew Cooper wrote:
> 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:

> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
> CC: Ian Campbell <Ian.Campbell@citrix.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/libxc/include/xenctrl_compat.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/libxc/include/xenctrl_compat.h
> b/tools/libxc/include/xenctrl_compat.h
> index dc513a3..93ccadb 100644
> --- a/tools/libxc/include/xenctrl_compat.h
> +++ b/tools/libxc/include/xenctrl_compat.h
> @@ -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);

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface
  2016-02-01 11:19 ` Ian Campbell
@ 2016-02-03 11:48   ` Ian Campbell
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2016-02-03 11:48 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel; +Cc: Ian Jackson, Wei Liu

On Mon, 2016-02-01 at 11:19 +0000, Ian Campbell wrote:
> On Mon, 2016-02-01 at 11:08 +0000, Andrew Cooper wrote:
> > 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:
> 
> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>

applied.

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

* Re: [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface
  2016-02-01 11:08 [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface Andrew Cooper
  2016-02-01 11:19 ` Ian Campbell
@ 2016-02-03 17:12 ` Olaf Hering
  2016-02-03 17:18   ` Andrew Cooper
  1 sibling, 1 reply; 6+ messages in thread
From: Olaf Hering @ 2016-02-03 17:12 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Wei Liu, Ian Jackson, Ian Campbell, Xen-devel

On Mon, Feb 01, Andrew Cooper wrote:

> 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

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

* Re: [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface
  2016-02-03 17:12 ` Olaf Hering
@ 2016-02-03 17:18   ` Andrew Cooper
  2016-02-04  9:27     ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cooper @ 2016-02-03 17:18 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Wei Liu, Ian Jackson, Ian Campbell, Xen-devel

On 03/02/16 17:12, Olaf Hering wrote:
> On Mon, Feb 01, Andrew Cooper wrote:
>
>> 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
> [   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

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

* Re: [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface
  2016-02-03 17:18   ` Andrew Cooper
@ 2016-02-04  9:27     ` Ian Campbell
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2016-02-04  9:27 UTC (permalink / raw)
  To: Andrew Cooper, Olaf Hering; +Cc: Wei Liu, Ian Jackson, Xen-devel

On Wed, 2016-02-03 at 17:18 +0000, Andrew Cooper wrote:
> On 03/02/16 17:12, Olaf Hering wrote:
> > On Mon, Feb 01, Andrew Cooper wrote:
> > 
> > > 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/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
> > 
> > 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?

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
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-02-04  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 11:08 [PATCH] tools/libxc: Provide evtchn_port_or_error_t for compat xenctrl interface Andrew Cooper
2016-02-01 11:19 ` Ian Campbell
2016-02-03 11:48   ` Ian Campbell
2016-02-03 17:12 ` Olaf Hering
2016-02-03 17:18   ` Andrew Cooper
2016-02-04  9:27     ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.