[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 11 of 25] libxc: osdep: convert xc_evtchn_bind_unbound_port()



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369007 0
# Node ID 8d07a123c875c57d0b1127d9a0cbd86c27c857d5
# Parent  f8ada96329da34e94ac3a7f4a6c6967aa5d2dd73
libxc: osdep: convert xc_evtchn_bind_unbound_port()

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r f8ada96329da -r 8d07a123c875 tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_evtchn.c   Fri Dec 03 09:36:47 2010 +0000
@@ -88,6 +88,12 @@ int xc_evtchn_notify(xc_evtchn *xce, evt
     return xce->ops->u.evtchn.notify(xce, xce->ops_handle, port);
 }
 
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+{
+    return xce->ops->u.evtchn.bind_unbound_port(xce, xce->ops_handle, domid);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r f8ada96329da -r 8d07a123c875 tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c    Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_linux.c    Fri Dec 03 09:36:47 2010 +0000
@@ -375,14 +375,15 @@ static int linux_evtchn_notify(xc_evtchn
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+static evtchn_port_or_error_t
+linux_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_unbound_port bind;
 
     bind.remote_domain = domid;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
 evtchn_port_or_error_t
@@ -439,6 +440,7 @@ static struct xc_osdep_ops linux_evtchn_
     .u.evtchn = {
         .fd = &linux_evtchn_fd,
         .notify = &linux_evtchn_notify,
+        .bind_unbound_port = &linux_evtchn_bind_unbound_port,
     },
 };
 
diff -r f8ada96329da -r 8d07a123c875 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_minios.c   Fri Dec 03 09:36:47 2010 +0000
@@ -277,26 +277,27 @@ static void evtchn_handler(evtchn_port_t
     wake_up(&event_queue);
 }
 
-evtchn_port_or_error_t xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+static evtchn_port_or_error_t minios_evtchn_bind_unbound_port(xc_evtchn *xce, 
xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     int ret, i;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    i = port_alloc(xce->fd);
+    i = port_alloc(fd);
     if (i == -1)
        return -1;
 
     printf("xc_evtchn_bind_unbound_port(%d)", domid);
-    ret = evtchn_alloc_unbound(domid, evtchn_handler, 
(void*)(intptr_t)xce->fd, &port);
+    ret = evtchn_alloc_unbound(domid, evtchn_handler, (void*)(intptr_t)fd, 
&port);
     printf(" = %d\n", ret);
 
     if (ret < 0) {
        errno = -ret;
        return -1;
     }
-    files[xce->fd].evtchn.ports[i].bound = 1;
-    files[xce->fd].evtchn.ports[i].port = port;
+    files[fd].evtchn.ports[i].bound = 1;
+    files[fd].evtchn.ports[i].port = port;
     unmask_evtchn(port);
     return port;
 }
@@ -404,6 +405,7 @@ static struct xc_osdep_ops minios_evtchn
     .u.evtchn = {
         .fd = &minios_evtchn_fd,
         .notify = &minios_evtchn_notify,
+        .bind_unbound_port = &minios_evtchn_bind_unbound_port,
     },
 };
 
diff -r f8ada96329da -r 8d07a123c875 tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c   Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_netbsd.c   Fri Dec 03 09:36:47 2010 +0000
@@ -225,15 +225,16 @@ static int netbsd_evtchn_notify(xc_evtch
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn * xce, int domid)
+static evtchn_port_or_error_t
+netbsd_evtchn_bind_unbound_port(xc_evtchn * xce, xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_unbound_port bind;
     int ret;
 
     bind.remote_domain = domid;
 
-    ret = ioctl(xce->fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
+    ret = ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
     if (ret == 0)
        return bind.port;
     else
@@ -304,6 +305,7 @@ static struct xc_osdep_ops netbsd_evtchn
     .u.evtchn = {
          .fd = &netbsd_evtchn_fd,
          .notify = &netbsd_evtchn_notify,
+         .bind_unbound_port = &netbsd_evtchn_bind_unbound_port,
     },
 };
 
diff -r f8ada96329da -r 8d07a123c875 tools/libxc/xc_solaris.c
--- a/tools/libxc/xc_solaris.c  Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_solaris.c  Fri Dec 03 09:36:47 2010 +0000
@@ -217,14 +217,15 @@ static int solaris_evtchn_notify(xc_evtc
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+static evtchn_port_or_error_t
+solaris_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_unbound_port bind;
 
     bind.remote_domain = domid;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
 evtchn_port_or_error_t
@@ -281,6 +282,7 @@ static struct xc_osdep_ops solaris_evtch
     .u.evtchn = {
         .fd = &solaris_evtchn_fd,
         .notify = &solaris_evtchn_notify,
+        .bind_unbound_port = &solaris_evtchn_bind_unbound_port,
     },
 };
 
diff -r f8ada96329da -r 8d07a123c875 tools/libxc/xenctrlosdep.h
--- a/tools/libxc/xenctrlosdep.h        Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xenctrlosdep.h        Fri Dec 03 09:36:47 2010 +0000
@@ -78,6 +78,8 @@ struct xc_osdep_ops
             int (*fd)(xc_evtchn *xce, xc_osdep_handle h);
 
             int (*notify)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t 
port);
+
+            evtchn_port_or_error_t (*bind_unbound_port)(xc_evtchn *xce, 
xc_osdep_handle h, int domid);
         } evtchn;
     } u;
 };

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.