mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxc: osdep: convert xc_evtchn_bind_interdomain()
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
This commit is contained in:
1 parent
cb1325b0d5
commit
b491e4e05d
6 files changed
+32
-15
No files matched your search
@@ -94,6 +94,13 @@ xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
|
||||
return xce->ops->u.evtchn.bind_unbound_port(xce, xce->ops_handle, domid);
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
|
||||
evtchn_port_t remote_port)
|
||||
{
|
||||
return xce->ops->u.evtchn.bind_interdomain(xce, xce->ops_handle, domid, remote_port);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
|
||||
@@ -386,16 +386,17 @@ linux_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
|
||||
return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
|
||||
evtchn_port_t remote_port)
|
||||
static evtchn_port_or_error_t
|
||||
linux_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
|
||||
evtchn_port_t remote_port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
struct ioctl_evtchn_bind_interdomain bind;
|
||||
|
||||
bind.remote_domain = domid;
|
||||
bind.remote_port = remote_port;
|
||||
|
||||
return ioctl(xce->fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
|
||||
return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
@@ -441,6 +442,7 @@ static struct xc_osdep_ops linux_evtchn_ops = {
|
||||
.fd = &linux_evtchn_fd,
|
||||
.notify = &linux_evtchn_notify,
|
||||
.bind_unbound_port = &linux_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &linux_evtchn_bind_interdomain,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -302,27 +302,28 @@ static evtchn_port_or_error_t minios_evtchn_bind_unbound_port(xc_evtchn *xce, xc
|
||||
return port;
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
|
||||
static evtchn_port_or_error_t minios_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
|
||||
evtchn_port_t remote_port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
evtchn_port_t local_port;
|
||||
int ret, i;
|
||||
|
||||
assert(get_current() == main_thread);
|
||||
i = port_alloc(xce->fd);
|
||||
i = port_alloc(fd);
|
||||
if (i == -1)
|
||||
return -1;
|
||||
|
||||
printf("xc_evtchn_bind_interdomain(%d, %"PRId32")", domid, remote_port);
|
||||
ret = evtchn_bind_interdomain(domid, remote_port, evtchn_handler, (void*)(intptr_t)xce->fd, &local_port);
|
||||
ret = evtchn_bind_interdomain(domid, remote_port, evtchn_handler, (void*)(intptr_t)fd, &local_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 = local_port;
|
||||
files[fd].evtchn.ports[i].bound = 1;
|
||||
files[fd].evtchn.ports[i].port = local_port;
|
||||
unmask_evtchn(local_port);
|
||||
return local_port;
|
||||
}
|
||||
@@ -406,6 +407,7 @@ static struct xc_osdep_ops minios_evtchn_ops = {
|
||||
.fd = &minios_evtchn_fd,
|
||||
.notify = &minios_evtchn_notify,
|
||||
.bind_unbound_port = &minios_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &minios_evtchn_bind_interdomain,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -241,17 +241,18 @@ netbsd_evtchn_bind_unbound_port(xc_evtchn * xce, xc_osdep_handle h, int domid)
|
||||
return -1;
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
|
||||
evtchn_port_t remote_port)
|
||||
static evtchn_port_or_error_t
|
||||
netbsd_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
|
||||
evtchn_port_t remote_port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
struct ioctl_evtchn_bind_interdomain bind;
|
||||
int ret;
|
||||
|
||||
bind.remote_domain = domid;
|
||||
bind.remote_port = remote_port;
|
||||
|
||||
ret = ioctl(xce->fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
|
||||
ret = ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
|
||||
if (ret == 0)
|
||||
return bind.port;
|
||||
else
|
||||
@@ -306,6 +307,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = {
|
||||
.fd = &netbsd_evtchn_fd,
|
||||
.notify = &netbsd_evtchn_notify,
|
||||
.bind_unbound_port = &netbsd_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &netbsd_evtchn_bind_interdomain,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -229,15 +229,16 @@ solaris_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
|
||||
solaris_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
|
||||
evtchn_port_t remote_port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
struct ioctl_evtchn_bind_interdomain bind;
|
||||
|
||||
bind.remote_domain = domid;
|
||||
bind.remote_port = remote_port;
|
||||
|
||||
return ioctl(xce->fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
|
||||
return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
@@ -283,6 +284,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = {
|
||||
.fd = &solaris_evtchn_fd,
|
||||
.notify = &solaris_evtchn_notify,
|
||||
.bind_unbound_port = &solaris_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &solaris_evtchn_bind_interdomain,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ struct xc_osdep_ops
|
||||
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_port_or_error_t (*bind_interdomain)(xc_evtchn *xce, xc_osdep_handle h, int domid,
|
||||
evtchn_port_t remote_port);
|
||||
} evtchn;
|
||||
} u;
|
||||
};
|
||||
|
||||