# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1187079699 -3600
# Node ID fdffab15499d1f976d41ca0c475e5fae1c2f02ad
# Parent 08e962b8597cdc7c1dbef7c8228f4ceef1d5737e
libxc: Various xc_evtchn_* functions must return signed integer type.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
tools/libxc/xc_evtchn.c | 7 +-
tools/libxc/xc_linux.c | 30 +++++-----
tools/libxc/xc_solaris.c | 30 +++++-----
tools/libxc/xenctrl.h | 134 ++++++++++++++++++++++++-----------------------
4 files changed, 109 insertions(+), 92 deletions(-)
diff -r 08e962b8597c -r fdffab15499d tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c Mon Aug 13 18:18:22 2007 +0100
+++ b/tools/libxc/xc_evtchn.c Tue Aug 14 09:21:39 2007 +0100
@@ -33,9 +33,10 @@ static int do_evtchn_op(int xc_handle, i
}
-int xc_evtchn_alloc_unbound(int xc_handle,
- uint32_t dom,
- uint32_t remote_dom)
+evtchn_port_or_error_t
+xc_evtchn_alloc_unbound(int xc_handle,
+ uint32_t dom,
+ uint32_t remote_dom)
{
int rc;
struct evtchn_alloc_unbound arg = {
diff -r 08e962b8597c -r fdffab15499d tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c Mon Aug 13 18:18:22 2007 +0100
+++ b/tools/libxc/xc_linux.c Tue Aug 14 09:21:39 2007 +0100
@@ -254,7 +254,8 @@ int xc_evtchn_notify(int xce_handle, evt
return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, ¬ify);
}
-evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(int xce_handle, int domid)
{
struct ioctl_evtchn_bind_unbound_port bind;
@@ -263,8 +264,9 @@ evtchn_port_t xc_evtchn_bind_unbound_por
return ioctl(xce_handle, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
}
-evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
- evtchn_port_t remote_port)
+evtchn_port_or_error_t
+xc_evtchn_bind_interdomain(int xce_handle, int domid,
+ evtchn_port_t remote_port)
{
struct ioctl_evtchn_bind_interdomain bind;
@@ -274,6 +276,16 @@ evtchn_port_t xc_evtchn_bind_interdomain
return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
}
+evtchn_port_or_error_t
+xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
+{
+ struct ioctl_evtchn_bind_virq bind;
+
+ bind.virq = virq;
+
+ return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+}
+
int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
{
struct ioctl_evtchn_unbind unbind;
@@ -281,15 +293,6 @@ int xc_evtchn_unbind(int xce_handle, evt
unbind.port = port;
return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
-}
-
-evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
-{
- struct ioctl_evtchn_bind_virq bind;
-
- bind.virq = virq;
-
- return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
}
static int dorw(int fd, char *data, size_t size, int do_write)
@@ -317,7 +320,8 @@ static int dorw(int fd, char *data, size
return 0;
}
-evtchn_port_t xc_evtchn_pending(int xce_handle)
+evtchn_port_or_error_t
+xc_evtchn_pending(int xce_handle)
{
evtchn_port_t port;
diff -r 08e962b8597c -r fdffab15499d tools/libxc/xc_solaris.c
--- a/tools/libxc/xc_solaris.c Mon Aug 13 18:18:22 2007 +0100
+++ b/tools/libxc/xc_solaris.c Tue Aug 14 09:21:39 2007 +0100
@@ -165,7 +165,8 @@ int xc_evtchn_notify(int xce_handle, evt
return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, ¬ify);
}
-evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(int xce_handle, int domid)
{
struct ioctl_evtchn_bind_unbound_port bind;
@@ -174,8 +175,9 @@ evtchn_port_t xc_evtchn_bind_unbound_por
return ioctl(xce_handle, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
}
-evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
- evtchn_port_t remote_port)
+evtchn_port_or_error_t
+xc_evtchn_bind_interdomain(int xce_handle, int domid,
+ evtchn_port_t remote_port)
{
struct ioctl_evtchn_bind_interdomain bind;
@@ -185,6 +187,16 @@ evtchn_port_t xc_evtchn_bind_interdomain
return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
}
+evtchn_port_or_error_t
+xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
+{
+ struct ioctl_evtchn_bind_virq bind;
+
+ bind.virq = virq;
+
+ return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+}
+
int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
{
struct ioctl_evtchn_unbind unbind;
@@ -192,15 +204,6 @@ int xc_evtchn_unbind(int xce_handle, evt
unbind.port = port;
return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
-}
-
-evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
-{
- struct ioctl_evtchn_bind_virq bind;
-
- bind.virq = virq;
-
- return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
}
static int dorw(int fd, char *data, size_t size, int do_write)
@@ -228,7 +231,8 @@ static int dorw(int fd, char *data, size
return 0;
}
-evtchn_port_t xc_evtchn_pending(int xce_handle)
+evtchn_port_or_error_t
+xc_evtchn_pending(int xce_handle)
{
evtchn_port_t port;
diff -r 08e962b8597c -r fdffab15499d tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Mon Aug 13 18:18:22 2007 +0100
+++ b/tools/libxc/xenctrl.h Tue Aug 14 09:21:39 2007 +0100
@@ -449,6 +449,9 @@ int xc_domain_setdebugging(int xc_handle
* EVENT CHANNEL FUNCTIONS
*/
+/* A port identifier is guaranteed to fit in 31 bits. */
+typedef int evtchn_port_or_error_t;
+
/**
* This function allocates an unbound port. Ports are named endpoints used for
* interdomain communication. This function is most useful in opening a
@@ -463,12 +466,77 @@ int xc_domain_setdebugging(int xc_handle
* @parm remote_dom the ID of the domain who will later bind
* @return allocated port (in @dom) on success, -1 on failure
*/
-int xc_evtchn_alloc_unbound(int xc_handle,
- uint32_t dom,
- uint32_t remote_dom);
+evtchn_port_or_error_t
+xc_evtchn_alloc_unbound(int xc_handle,
+ uint32_t dom,
+ uint32_t remote_dom);
int xc_evtchn_reset(int xc_handle,
uint32_t dom);
+
+/*
+ * Return a handle to the event channel driver, or -1 on failure, in which case
+ * errno will be set appropriately.
+ */
+int xc_evtchn_open(void);
+
+/*
+ * Close a handle previously allocated with xc_evtchn_open().
+ */
+int xc_evtchn_close(int xce_handle);
+
+/*
+ * Return an fd that can be select()ed on for further calls to
+ * xc_evtchn_pending().
+ */
+int xc_evtchn_fd(int xce_handle);
+
+/*
+ * Notify the given event channel. Returns -1 on failure, in which case
+ * errno will be set appropriately.
+ */
+int xc_evtchn_notify(int xce_handle, 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
+xc_evtchn_bind_unbound_port(int xce_handle, int 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
+xc_evtchn_bind_interdomain(int xce_handle, int domid,
+ evtchn_port_t remote_port);
+
+/*
+ * 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
+xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
+
+/*
+ * Unbind the given event channel. Returns -1 on failure, in which case errno
+ * will be set appropriately.
+ */
+int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
+
+/*
+ * Return the next event channel to become pending, or -1 on failure, in which
+ * case errno will be set appropriately.
+ */
+evtchn_port_or_error_t
+xc_evtchn_pending(int xce_handle);
+
+/*
+ * Unmask the given event channel. Returns -1 on failure, in which case errno
+ * will be set appropriately.
+ */
+int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
int xc_physdev_pci_access_modify(int xc_handle,
uint32_t domid,
@@ -699,66 +767,6 @@ int xc_version(int xc_handle, int cmd, v
int xc_acm_op(int xc_handle, int cmd, void *arg, unsigned long arg_size);
-/*
- * Return a handle to the event channel driver, or -1 on failure, in which case
- * errno will be set appropriately.
- */
-int xc_evtchn_open(void);
-
-/*
- * Close a handle previously allocated with xc_evtchn_open().
- */
-int xc_evtchn_close(int xce_handle);
-
-/*
- * Return an fd that can be select()ed on for further calls to
- * xc_evtchn_pending().
- */
-int xc_evtchn_fd(int xce_handle);
-
-/*
- * Notify the given event channel. Returns -1 on failure, in which case
- * errno will be set appropriately.
- */
-int xc_evtchn_notify(int xce_handle, 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_t xc_evtchn_bind_unbound_port(int xce_handle, int 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_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
- evtchn_port_t remote_port);
-
-/*
- * Unbind the given event channel. Returns -1 on failure, in which case errno
- * will be set appropriately.
- */
-int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
-
-/*
- * 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_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
-
-/*
- * Return the next event channel to become pending, or -1 on failure, in which
- * case errno will be set appropriately.
- */
-evtchn_port_t xc_evtchn_pending(int xce_handle);
-
-/*
- * Unmask the given event channel. Returns -1 on failure, in which case errno
- * will be set appropriately.
- */
-int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
-
/**************************
* GRANT TABLE OPERATIONS *
**************************/
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|