diff mbox

[v2] libxenevtchn: rename evtchn_port_or_errot_t as xenevtchn_port...

Message ID 1454590829-2963-1-git-send-email-ian.campbell@citrix.com
State New, archived
Headers show

Commit Message

Ian Campbell Feb. 4, 2016, 1 p.m. UTC
Otherwise the name clashes with the libxc evtchn_compat use of the
name (which is compat, so can't really change), and triggers an error
with older gcc relating to redefining typedefs (which are not allowed
per the spec, but which are tolerated by newer gcc)

None of qemu-trad, qemu-xen or mini-os actually use this type, so this
should be fine. Note that the library API is not actually stable until
4.7 is releases.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
---
v2: New approach instwad of "tools: libxc: do not redefine
evtchn_port_or_error_t in xc_evtchn_compat.c"
---
 tools/console/daemon/io.c                     | 10 +++++-----
 tools/libs/evtchn/freebsd.c                   |  8 ++++----
 tools/libs/evtchn/include/xenevtchn.h         | 10 +++++-----
 tools/libs/evtchn/linux.c                     |  8 ++++----
 tools/libs/evtchn/minios.c                    |  8 ++++----
 tools/libs/evtchn/netbsd.c                    |  8 ++++----
 tools/libs/evtchn/solaris.c                   |  8 ++++----
 tools/libvchan/init.c                         |  4 ++--
 tools/libxl/libxl_event.c                     |  2 +-
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c |  6 +++---
 10 files changed, 36 insertions(+), 36 deletions(-)

Comments

Olaf Hering Feb. 4, 2016, 1:36 p.m. UTC | #1
On Thu, Feb 04, Ian Campbell wrote:

> Cc: Olaf Hering <olaf@aepfle.de>

Also this builds on SLE11/12.

Tested-by: Olaf Hering <olaf@aepfle.de>

Olaf
Wei Liu Feb. 4, 2016, 1:51 p.m. UTC | #2
On Thu, Feb 04, 2016 at 01:00:29PM +0000, Ian Campbell wrote:
> Otherwise the name clashes with the libxc evtchn_compat use of the
> name (which is compat, so can't really change), and triggers an error
> with older gcc relating to redefining typedefs (which are not allowed
> per the spec, but which are tolerated by newer gcc)
> 
> None of qemu-trad, qemu-xen or mini-os actually use this type, so this
> should be fine. Note that the library API is not actually stable until
> 4.7 is releases.
> 
> Reported-by: Olaf Hering <olaf@aepfle.de>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: Olaf Hering <olaf@aepfle.de>

Acked-by: Wei Liu <wei.liu2@citrix.com>
Ian Campbell Feb. 4, 2016, 4:20 p.m. UTC | #3
On Thu, 2016-02-04 at 14:36 +0100, Olaf Hering wrote:
> On Thu, Feb 04, Ian Campbell wrote:
> 
> > Cc: Olaf Hering <olaf@aepfle.de>
> 
> Also this builds on SLE11/12.
> 
> Tested-by: Olaf Hering <olaf@aepfle.de>

Applied with this + Wei's ack, thanks.

Ian.
diff mbox

Patch

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 34666c4..7e6a886 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -101,8 +101,8 @@  struct domain {
 	struct domain *next;
 	char *conspath;
 	int ring_ref;
-	evtchn_port_or_error_t local_port;
-	evtchn_port_or_error_t remote_port;
+	xenevtchn_port_or_error_t local_port;
+	xenevtchn_port_or_error_t remote_port;
 	xenevtchn_handle *xce_handle;
 	int xce_pollfd_idx;
 	struct xencons_interface *interface;
@@ -868,7 +868,7 @@  static void handle_tty_write(struct domain *dom)
 
 static void handle_ring_read(struct domain *dom)
 {
-	evtchn_port_or_error_t port;
+	xenevtchn_port_or_error_t port;
 
 	if (dom->is_dead)
 		return;
@@ -914,7 +914,7 @@  static void handle_hv_logs(xenevtchn_handle *xce_handle, bool force)
 	char *bufptr = buffer;
 	unsigned int size;
 	static uint32_t index = 0;
-	evtchn_port_or_error_t port = -1;
+	xenevtchn_port_or_error_t port = -1;
 
 	if (!force && ((port = xenevtchn_pending(xce_handle)) == -1))
 		return;
@@ -1005,7 +1005,7 @@  static void reset_fds(void)
 void handle_io(void)
 {
 	int ret;
-	evtchn_port_or_error_t log_hv_evtchn = -1;
+	xenevtchn_port_or_error_t log_hv_evtchn = -1;
 	int xce_pollfd_idx = -1;
 	int xs_pollfd_idx = -1;
 	xenevtchn_handle *xce_handle = NULL;
diff --git a/tools/libs/evtchn/freebsd.c b/tools/libs/evtchn/freebsd.c
index ead2e71..30eaa70 100644
--- a/tools/libs/evtchn/freebsd.c
+++ b/tools/libs/evtchn/freebsd.c
@@ -62,7 +62,7 @@  int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32_t domid)
+xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32_t domid)
 {
     int ret, fd = xce->fd;
     struct ioctl_evtchn_bind_unbound_port bind;
@@ -73,7 +73,7 @@  evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32
     return ( ret == 0 ) ? bind.port : ret;
 }
 
-evtchn_port_or_error_t
+xenevtchn_port_or_error_t
 xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid, evtchn_port_t remote_port)
 {
     int ret, fd = xce->fd;
@@ -86,7 +86,7 @@  xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid, evtchn_port_t
     return ( ret == 0 ) ? bind.port : ret;
 }
 
-evtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
+xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
 {
     int ret, fd = xce->fd;
     struct ioctl_evtchn_bind_virq bind;
@@ -107,7 +107,7 @@  int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
-evtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
+xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 {
     int fd = xce->fd;
     evtchn_port_t port;
diff --git a/tools/libs/evtchn/include/xenevtchn.h b/tools/libs/evtchn/include/xenevtchn.h
index 0fa3f84..93b80cb 100644
--- a/tools/libs/evtchn/include/xenevtchn.h
+++ b/tools/libs/evtchn/include/xenevtchn.h
@@ -28,7 +28,7 @@ 
 #include <xen/event_channel.h>
 
 /* A port identifier is guaranteed to fit in 31 bits. */
-typedef int evtchn_port_or_error_t;
+typedef int xenevtchn_port_or_error_t;
 
 typedef struct xenevtchn_handle xenevtchn_handle;
 
@@ -101,14 +101,14 @@  int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port);
  * Returns a new event port awaiting interdomain connection from the given
  * domain ID, or -1 on failure, in which case errno will be set appropriately.
  */
-evtchn_port_or_error_t
+xenevtchn_port_or_error_t
 xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32_t domid);
 
 /*
  * Returns a new event port bound to the remote port for the given domain ID,
  * or -1 on failure, in which case errno will be set appropriately.
  */
-evtchn_port_or_error_t
+xenevtchn_port_or_error_t
 xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
                            evtchn_port_t remote_port);
 
@@ -116,7 +116,7 @@  xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
  * Bind an event channel to the given VIRQ. Returns the event channel bound to
  * the VIRQ, or -1 on failure, in which case errno will be set appropriately.
  */
-evtchn_port_or_error_t
+xenevtchn_port_or_error_t
 xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq);
 
 /*
@@ -142,7 +142,7 @@  int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port);
  * xenevtchn_unmask (if you want to receive any further
  * notifications).
  */
-evtchn_port_or_error_t
+xenevtchn_port_or_error_t
 xenevtchn_pending(xenevtchn_handle *xce);
 
 /*
diff --git a/tools/libs/evtchn/linux.c b/tools/libs/evtchn/linux.c
index 0a3c6e1..a581c5d 100644
--- a/tools/libs/evtchn/linux.c
+++ b/tools/libs/evtchn/linux.c
@@ -64,7 +64,7 @@  int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce,
+xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce,
                                                    uint32_t domid)
 {
     int fd = xce->fd;
@@ -75,7 +75,7 @@  evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce,
     return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
+xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
                                                   uint32_t domid,
                                                   evtchn_port_t remote_port)
 {
@@ -88,7 +88,7 @@  evtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
     return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
+xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
                                            unsigned int virq)
 {
     int fd = xce->fd;
@@ -109,7 +109,7 @@  int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
-evtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
+xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 {
     int fd = xce->fd;
     evtchn_port_t port;
diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index 2c89952..ccf37f0 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -128,7 +128,7 @@  static void evtchn_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
     wake_up(&event_queue);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32_t domid)
+xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32_t domid)
 {
     int fd = xce->fd;
     struct evtchn_port_info *port_info;
@@ -155,7 +155,7 @@  evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32
     return port;
 }
 
-evtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
+xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
                                                   evtchn_port_t remote_port)
 {
     int fd = xce->fd;
@@ -199,7 +199,7 @@  int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
     return -1;
 }
 
-evtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
+xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
 {
     int fd = xce->fd;
     struct evtchn_port_info *port_info;
@@ -224,7 +224,7 @@  evtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int v
     return port;
 }
 
-evtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
+xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 {
     int fd = xce->fd;
     struct evtchn_port_info *port_info;
diff --git a/tools/libs/evtchn/netbsd.c b/tools/libs/evtchn/netbsd.c
index 77ae51f..114c6e6 100644
--- a/tools/libs/evtchn/netbsd.c
+++ b/tools/libs/evtchn/netbsd.c
@@ -62,7 +62,7 @@  int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle * xce, uint32_t domid)
+xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle * xce, uint32_t domid)
 {
     int fd = xce->fd;
     struct ioctl_evtchn_bind_unbound_port bind;
@@ -77,7 +77,7 @@  evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle * xce, uint3
         return -1;
 }
 
-evtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
+xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
                                                   evtchn_port_t remote_port)
 {
     int fd = xce->fd;
@@ -104,7 +104,7 @@  int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
+xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
 {
     int fd = xce->fd;
     struct ioctl_evtchn_bind_virq bind;
@@ -119,7 +119,7 @@  evtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int v
         return bind.port;
 }
 
-evtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
+xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 {
     int fd = xce->fd;
     evtchn_port_t port;
diff --git a/tools/libs/evtchn/solaris.c b/tools/libs/evtchn/solaris.c
index b4720cd..dc249aa 100644
--- a/tools/libs/evtchn/solaris.c
+++ b/tools/libs/evtchn/solaris.c
@@ -65,7 +65,7 @@  int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32_t domid)
+xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32_t domid)
 {
     int fd = xce->fd;
     struct ioctl_evtchn_bind_unbound_port bind;
@@ -75,7 +75,7 @@  evtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce, uint32
     return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
+xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid,
                                                   evtchn_port_t remote_port)
 {
     int fd = xce->fd;
@@ -87,7 +87,7 @@  evtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_
     return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
-evtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
+xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsigned int virq)
 {
     int fd = xce->fd;
     struct ioctl_evtchn_bind_virq bind;
@@ -107,7 +107,7 @@  int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
     return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
-evtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
+xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 {
     int fd = xce->fd;
     evtchn_port_t port;
diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
index cadd12c..83e1dee 100644
--- a/tools/libvchan/init.c
+++ b/tools/libvchan/init.c
@@ -215,7 +215,7 @@  static int init_gnt_cli(struct libxenvchan *ctrl, int domain, uint32_t ring_ref)
 static int init_evt_srv(struct libxenvchan *ctrl, int domain,
                         struct xentoollog_logger *logger)
 {
-	evtchn_port_or_error_t port;
+	xenevtchn_port_or_error_t port;
 
 	ctrl->event = xenevtchn_open(logger, 0);
 	if (!ctrl->event)
@@ -348,7 +348,7 @@  out:
 static int init_evt_cli(struct libxenvchan *ctrl, int domain,
                         struct xentoollog_logger *logger)
 {
-	evtchn_port_or_error_t port;
+	xenevtchn_port_or_error_t port;
 
 	ctrl->event = xenevtchn_open(logger, 0);
 	if (!ctrl->event)
diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 8548365..02b39e6 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -719,7 +719,7 @@  static void evtchn_fd_callback(libxl__egc *egc, libxl__ev_fd *ev,
     EGC_GC;
     libxl__ev_evtchn *evev;
     int rc;
-    evtchn_port_or_error_t port;
+    xenevtchn_port_or_error_t port;
 
     rc = evtchn_revents_check(egc, revents);
     if (rc) return;
diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index c2d4737..b711fd8 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -81,7 +81,7 @@  CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
 {
 	CAMLparam3(xce, domid, remote_port);
 	CAMLlocal1(port);
-	evtchn_port_or_error_t rc;
+	xenevtchn_port_or_error_t rc;
 
 	rc = xenevtchn_bind_interdomain(_H(xce), Int_val(domid), Int_val(remote_port));
 	if (rc == -1)
@@ -95,7 +95,7 @@  CAMLprim value stub_eventchn_bind_dom_exc_virq(value xce)
 {
 	CAMLparam1(xce);
 	CAMLlocal1(port);
-	evtchn_port_or_error_t rc;
+	xenevtchn_port_or_error_t rc;
 
 	rc = xenevtchn_bind_virq(_H(xce), VIRQ_DOM_EXC);
 	if (rc == -1)
@@ -121,7 +121,7 @@  CAMLprim value stub_eventchn_pending(value xce)
 {
 	CAMLparam1(xce);
 	CAMLlocal1(result);
-	evtchn_port_or_error_t port;
+	xenevtchn_port_or_error_t port;
 
 	port = xenevtchn_pending(_H(xce));
 	if (port == -1)