ia64/xen-unstable

changeset 15751:fdffab15499d

libxc: Various xc_evtchn_* functions must return signed integer type.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Aug 14 09:21:39 2007 +0100 (2007-08-14)
parents 08e962b8597c
children ef79bf6f0142
files tools/libxc/xc_evtchn.c tools/libxc/xc_linux.c tools/libxc/xc_solaris.c tools/libxc/xenctrl.h
line diff
     1.1 --- a/tools/libxc/xc_evtchn.c	Mon Aug 13 18:18:22 2007 +0100
     1.2 +++ b/tools/libxc/xc_evtchn.c	Tue Aug 14 09:21:39 2007 +0100
     1.3 @@ -33,9 +33,10 @@ static int do_evtchn_op(int xc_handle, i
     1.4  }
     1.5  
     1.6  
     1.7 -int xc_evtchn_alloc_unbound(int xc_handle,
     1.8 -                            uint32_t dom,
     1.9 -                            uint32_t remote_dom)
    1.10 +evtchn_port_or_error_t
    1.11 +xc_evtchn_alloc_unbound(int xc_handle,
    1.12 +                        uint32_t dom,
    1.13 +                        uint32_t remote_dom)
    1.14  {
    1.15      int rc;
    1.16      struct evtchn_alloc_unbound arg = {
     2.1 --- a/tools/libxc/xc_linux.c	Mon Aug 13 18:18:22 2007 +0100
     2.2 +++ b/tools/libxc/xc_linux.c	Tue Aug 14 09:21:39 2007 +0100
     2.3 @@ -254,7 +254,8 @@ int xc_evtchn_notify(int xce_handle, evt
     2.4      return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, &notify);
     2.5  }
     2.6  
     2.7 -evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
     2.8 +evtchn_port_or_error_t
     2.9 +xc_evtchn_bind_unbound_port(int xce_handle, int domid)
    2.10  {
    2.11      struct ioctl_evtchn_bind_unbound_port bind;
    2.12  
    2.13 @@ -263,8 +264,9 @@ evtchn_port_t xc_evtchn_bind_unbound_por
    2.14      return ioctl(xce_handle, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
    2.15  }
    2.16  
    2.17 -evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
    2.18 -    evtchn_port_t remote_port)
    2.19 +evtchn_port_or_error_t
    2.20 +xc_evtchn_bind_interdomain(int xce_handle, int domid,
    2.21 +                           evtchn_port_t remote_port)
    2.22  {
    2.23      struct ioctl_evtchn_bind_interdomain bind;
    2.24  
    2.25 @@ -274,6 +276,16 @@ evtchn_port_t xc_evtchn_bind_interdomain
    2.26      return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
    2.27  }
    2.28  
    2.29 +evtchn_port_or_error_t
    2.30 +xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
    2.31 +{
    2.32 +    struct ioctl_evtchn_bind_virq bind;
    2.33 +
    2.34 +    bind.virq = virq;
    2.35 +
    2.36 +    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
    2.37 +}
    2.38 +
    2.39  int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
    2.40  {
    2.41      struct ioctl_evtchn_unbind unbind;
    2.42 @@ -283,15 +295,6 @@ int xc_evtchn_unbind(int xce_handle, evt
    2.43      return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
    2.44  }
    2.45  
    2.46 -evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
    2.47 -{
    2.48 -    struct ioctl_evtchn_bind_virq bind;
    2.49 -
    2.50 -    bind.virq = virq;
    2.51 -
    2.52 -    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
    2.53 -}
    2.54 -
    2.55  static int dorw(int fd, char *data, size_t size, int do_write)
    2.56  {
    2.57      size_t offset = 0;
    2.58 @@ -317,7 +320,8 @@ static int dorw(int fd, char *data, size
    2.59      return 0;
    2.60  }
    2.61  
    2.62 -evtchn_port_t xc_evtchn_pending(int xce_handle)
    2.63 +evtchn_port_or_error_t
    2.64 +xc_evtchn_pending(int xce_handle)
    2.65  {
    2.66      evtchn_port_t port;
    2.67  
     3.1 --- a/tools/libxc/xc_solaris.c	Mon Aug 13 18:18:22 2007 +0100
     3.2 +++ b/tools/libxc/xc_solaris.c	Tue Aug 14 09:21:39 2007 +0100
     3.3 @@ -165,7 +165,8 @@ int xc_evtchn_notify(int xce_handle, evt
     3.4      return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, &notify);
     3.5  }
     3.6  
     3.7 -evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid)
     3.8 +evtchn_port_or_error_t
     3.9 +xc_evtchn_bind_unbound_port(int xce_handle, int domid)
    3.10  {
    3.11      struct ioctl_evtchn_bind_unbound_port bind;
    3.12  
    3.13 @@ -174,8 +175,9 @@ evtchn_port_t xc_evtchn_bind_unbound_por
    3.14      return ioctl(xce_handle, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
    3.15  }
    3.16  
    3.17 -evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
    3.18 -    evtchn_port_t remote_port)
    3.19 +evtchn_port_or_error_t
    3.20 +xc_evtchn_bind_interdomain(int xce_handle, int domid,
    3.21 +                           evtchn_port_t remote_port)
    3.22  {
    3.23      struct ioctl_evtchn_bind_interdomain bind;
    3.24  
    3.25 @@ -185,6 +187,16 @@ evtchn_port_t xc_evtchn_bind_interdomain
    3.26      return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
    3.27  }
    3.28  
    3.29 +evtchn_port_or_error_t
    3.30 +xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
    3.31 +{
    3.32 +    struct ioctl_evtchn_bind_virq bind;
    3.33 +
    3.34 +    bind.virq = virq;
    3.35 +
    3.36 +    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
    3.37 +}
    3.38 +
    3.39  int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
    3.40  {
    3.41      struct ioctl_evtchn_unbind unbind;
    3.42 @@ -194,15 +206,6 @@ int xc_evtchn_unbind(int xce_handle, evt
    3.43      return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
    3.44  }
    3.45  
    3.46 -evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
    3.47 -{
    3.48 -    struct ioctl_evtchn_bind_virq bind;
    3.49 -
    3.50 -    bind.virq = virq;
    3.51 -
    3.52 -    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
    3.53 -}
    3.54 -
    3.55  static int dorw(int fd, char *data, size_t size, int do_write)
    3.56  {
    3.57      size_t offset = 0;
    3.58 @@ -228,7 +231,8 @@ static int dorw(int fd, char *data, size
    3.59      return 0;
    3.60  }
    3.61  
    3.62 -evtchn_port_t xc_evtchn_pending(int xce_handle)
    3.63 +evtchn_port_or_error_t
    3.64 +xc_evtchn_pending(int xce_handle)
    3.65  {
    3.66      evtchn_port_t port;
    3.67  
     4.1 --- a/tools/libxc/xenctrl.h	Mon Aug 13 18:18:22 2007 +0100
     4.2 +++ b/tools/libxc/xenctrl.h	Tue Aug 14 09:21:39 2007 +0100
     4.3 @@ -449,6 +449,9 @@ int xc_domain_setdebugging(int xc_handle
     4.4   * EVENT CHANNEL FUNCTIONS
     4.5   */
     4.6  
     4.7 +/* A port identifier is guaranteed to fit in 31 bits. */
     4.8 +typedef int evtchn_port_or_error_t;
     4.9 +
    4.10  /**
    4.11   * This function allocates an unbound port.  Ports are named endpoints used for
    4.12   * interdomain communication.  This function is most useful in opening a
    4.13 @@ -463,13 +466,78 @@ int xc_domain_setdebugging(int xc_handle
    4.14   * @parm remote_dom the ID of the domain who will later bind
    4.15   * @return allocated port (in @dom) on success, -1 on failure
    4.16   */
    4.17 -int xc_evtchn_alloc_unbound(int xc_handle,
    4.18 -                            uint32_t dom,
    4.19 -                            uint32_t remote_dom);
    4.20 +evtchn_port_or_error_t
    4.21 +xc_evtchn_alloc_unbound(int xc_handle,
    4.22 +                        uint32_t dom,
    4.23 +                        uint32_t remote_dom);
    4.24  
    4.25  int xc_evtchn_reset(int xc_handle,
    4.26                      uint32_t dom);
    4.27  
    4.28 +/*
    4.29 + * Return a handle to the event channel driver, or -1 on failure, in which case
    4.30 + * errno will be set appropriately.
    4.31 + */
    4.32 +int xc_evtchn_open(void);
    4.33 +
    4.34 +/*
    4.35 + * Close a handle previously allocated with xc_evtchn_open().
    4.36 + */
    4.37 +int xc_evtchn_close(int xce_handle);
    4.38 +
    4.39 +/*
    4.40 + * Return an fd that can be select()ed on for further calls to
    4.41 + * xc_evtchn_pending().
    4.42 + */
    4.43 +int xc_evtchn_fd(int xce_handle);
    4.44 +
    4.45 +/*
    4.46 + * Notify the given event channel. Returns -1 on failure, in which case
    4.47 + * errno will be set appropriately.
    4.48 + */
    4.49 +int xc_evtchn_notify(int xce_handle, evtchn_port_t port);
    4.50 +
    4.51 +/*
    4.52 + * Returns a new event port awaiting interdomain connection from the given
    4.53 + * domain ID, or -1 on failure, in which case errno will be set appropriately.
    4.54 + */
    4.55 +evtchn_port_or_error_t
    4.56 +xc_evtchn_bind_unbound_port(int xce_handle, int domid);
    4.57 +
    4.58 +/*
    4.59 + * Returns a new event port bound to the remote port for the given domain ID,
    4.60 + * or -1 on failure, in which case errno will be set appropriately.
    4.61 + */
    4.62 +evtchn_port_or_error_t
    4.63 +xc_evtchn_bind_interdomain(int xce_handle, int domid,
    4.64 +                           evtchn_port_t remote_port);
    4.65 +
    4.66 +/*
    4.67 + * Bind an event channel to the given VIRQ. Returns the event channel bound to
    4.68 + * the VIRQ, or -1 on failure, in which case errno will be set appropriately.
    4.69 + */
    4.70 +evtchn_port_or_error_t
    4.71 +xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
    4.72 +
    4.73 +/*
    4.74 + * Unbind the given event channel. Returns -1 on failure, in which case errno
    4.75 + * will be set appropriately.
    4.76 + */
    4.77 +int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
    4.78 +
    4.79 +/*
    4.80 + * Return the next event channel to become pending, or -1 on failure, in which
    4.81 + * case errno will be set appropriately.  
    4.82 + */
    4.83 +evtchn_port_or_error_t
    4.84 +xc_evtchn_pending(int xce_handle);
    4.85 +
    4.86 +/*
    4.87 + * Unmask the given event channel. Returns -1 on failure, in which case errno
    4.88 + * will be set appropriately.
    4.89 + */
    4.90 +int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
    4.91 +
    4.92  int xc_physdev_pci_access_modify(int xc_handle,
    4.93                                   uint32_t domid,
    4.94                                   int bus,
    4.95 @@ -699,66 +767,6 @@ int xc_version(int xc_handle, int cmd, v
    4.96  
    4.97  int xc_acm_op(int xc_handle, int cmd, void *arg, unsigned long arg_size);
    4.98  
    4.99 -/*
   4.100 - * Return a handle to the event channel driver, or -1 on failure, in which case
   4.101 - * errno will be set appropriately.
   4.102 - */
   4.103 -int xc_evtchn_open(void);
   4.104 -
   4.105 -/*
   4.106 - * Close a handle previously allocated with xc_evtchn_open().
   4.107 - */
   4.108 -int xc_evtchn_close(int xce_handle);
   4.109 -
   4.110 -/*
   4.111 - * Return an fd that can be select()ed on for further calls to
   4.112 - * xc_evtchn_pending().
   4.113 - */
   4.114 -int xc_evtchn_fd(int xce_handle);
   4.115 -
   4.116 -/*
   4.117 - * Notify the given event channel. Returns -1 on failure, in which case
   4.118 - * errno will be set appropriately.
   4.119 - */
   4.120 -int xc_evtchn_notify(int xce_handle, evtchn_port_t port);
   4.121 -
   4.122 -/*
   4.123 - * Returns a new event port awaiting interdomain connection from the given
   4.124 - * domain ID, or -1 on failure, in which case errno will be set appropriately.
   4.125 - */
   4.126 -evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid);
   4.127 -
   4.128 -/*
   4.129 - * Returns a new event port bound to the remote port for the given domain ID,
   4.130 - * or -1 on failure, in which case errno will be set appropriately.
   4.131 - */
   4.132 -evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
   4.133 -    evtchn_port_t remote_port);
   4.134 -
   4.135 -/*
   4.136 - * Unbind the given event channel. Returns -1 on failure, in which case errno
   4.137 - * will be set appropriately.
   4.138 - */
   4.139 -int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
   4.140 -
   4.141 -/*
   4.142 - * Bind an event channel to the given VIRQ. Returns the event channel bound to
   4.143 - * the VIRQ, or -1 on failure, in which case errno will be set appropriately.
   4.144 - */
   4.145 -evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
   4.146 -
   4.147 -/*
   4.148 - * Return the next event channel to become pending, or -1 on failure, in which
   4.149 - * case errno will be set appropriately.  
   4.150 - */
   4.151 -evtchn_port_t xc_evtchn_pending(int xce_handle);
   4.152 -
   4.153 -/*
   4.154 - * Unmask the given event channel. Returns -1 on failure, in which case errno
   4.155 - * will be set appropriately.
   4.156 - */
   4.157 -int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
   4.158 -
   4.159  /**************************
   4.160   * GRANT TABLE OPERATIONS *
   4.161   **************************/