diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-08-14 09:21:39 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-08-14 09:21:39 +0100 |
commit | 807d8048a2e07509b79ebc20826f6ba115f6de2c (patch) | |
tree | 041f3596ad27d5ae902a35412177538527557813 /tools | |
parent | 2209d892f996e67d003ad248071e487507f7fc2f (diff) | |
download | xen-807d8048a2e07509b79ebc20826f6ba115f6de2c.tar.gz xen-807d8048a2e07509b79ebc20826f6ba115f6de2c.tar.bz2 xen-807d8048a2e07509b79ebc20826f6ba115f6de2c.zip |
libxc: Various xc_evtchn_* functions must return signed integer type.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libxc/xc_evtchn.c | 7 | ||||
-rw-r--r-- | tools/libxc/xc_linux.c | 28 | ||||
-rw-r--r-- | tools/libxc/xc_solaris.c | 28 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 134 |
4 files changed, 107 insertions, 90 deletions
diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index c0f3b9b54c..0992a7bdbb 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -33,9 +33,10 @@ static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size) } -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 --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index 440cb4f0f4..d12cf94c05 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -254,7 +254,8 @@ int xc_evtchn_notify(int xce_handle, evtchn_port_t port) 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_port(int xce_handle, int domid) 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,22 +276,23 @@ evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid, return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind); } -int xc_evtchn_unbind(int xce_handle, evtchn_port_t port) +evtchn_port_or_error_t +xc_evtchn_bind_virq(int xce_handle, unsigned int virq) { - struct ioctl_evtchn_unbind unbind; + struct ioctl_evtchn_bind_virq bind; - unbind.port = port; + bind.virq = virq; - return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind); + return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind); } -evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq) +int xc_evtchn_unbind(int xce_handle, evtchn_port_t port) { - struct ioctl_evtchn_bind_virq bind; + struct ioctl_evtchn_unbind unbind; - bind.virq = virq; + unbind.port = port; - return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind); + return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind); } 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_t size, int do_write) 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 --git a/tools/libxc/xc_solaris.c b/tools/libxc/xc_solaris.c index 65008115ea..a39157028d 100644 --- a/tools/libxc/xc_solaris.c +++ b/tools/libxc/xc_solaris.c @@ -165,7 +165,8 @@ int xc_evtchn_notify(int xce_handle, evtchn_port_t port) 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_port(int xce_handle, int domid) 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,22 +187,23 @@ evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid, return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind); } -int xc_evtchn_unbind(int xce_handle, evtchn_port_t port) +evtchn_port_or_error_t +xc_evtchn_bind_virq(int xce_handle, unsigned int virq) { - struct ioctl_evtchn_unbind unbind; + struct ioctl_evtchn_bind_virq bind; - unbind.port = port; + bind.virq = virq; - return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind); + return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind); } -evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq) +int xc_evtchn_unbind(int xce_handle, evtchn_port_t port) { - struct ioctl_evtchn_bind_virq bind; + struct ioctl_evtchn_unbind unbind; - bind.virq = virq; + unbind.port = port; - return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind); + return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind); } 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_t size, int do_write) 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 --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 7d3a7ecc79..73ff16c2cf 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -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,13 +466,78 @@ 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, int bus, @@ -699,66 +767,6 @@ int xc_version(int xc_handle, int cmd, void *arg); 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 * **************************/ |