mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxc: osdep: convert xc_evtchn_unbind()
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
1fd1a4254d
commit
dbb5c70a0d
6 files changed
+26
-11
No files matched your search
@@ -107,6 +107,11 @@ xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq)
|
||||
return xce->ops->u.evtchn.bind_virq(xce, xce->ops_handle, virq);
|
||||
}
|
||||
|
||||
int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
|
||||
{
|
||||
return xce->ops->u.evtchn.unbind(xce, xce->ops_handle, port);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
|
||||
@@ -410,13 +410,14 @@ linux_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
|
||||
return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
|
||||
}
|
||||
|
||||
int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
|
||||
static int linux_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
struct ioctl_evtchn_unbind unbind;
|
||||
|
||||
unbind.port = port;
|
||||
|
||||
return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind);
|
||||
return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
@@ -445,6 +446,7 @@ static struct xc_osdep_ops linux_evtchn_ops = {
|
||||
.bind_unbound_port = &linux_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &linux_evtchn_bind_interdomain,
|
||||
.bind_virq = &linux_evtchn_bind_virq,
|
||||
.unbind = &linux_evtchn_unbind,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -328,20 +328,21 @@ static evtchn_port_or_error_t minios_evtchn_bind_interdomain(xc_evtchn *xce, xc_
|
||||
return local_port;
|
||||
}
|
||||
|
||||
int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
|
||||
static int minios_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
int i;
|
||||
for (i = 0; i < MAX_EVTCHN_PORTS; i++)
|
||||
if (files[xce->fd].evtchn.ports[i].port == port) {
|
||||
files[xce->fd].evtchn.ports[i].port = -1;
|
||||
if (files[fd].evtchn.ports[i].port == port) {
|
||||
files[fd].evtchn.ports[i].port = -1;
|
||||
break;
|
||||
}
|
||||
if (i == MAX_EVTCHN_PORTS) {
|
||||
printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, xce->fd);
|
||||
printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, fd);
|
||||
errno = -EINVAL;
|
||||
return -1;
|
||||
}
|
||||
files[xce->fd].evtchn.ports[i].bound = 0;
|
||||
files[fd].evtchn.ports[i].bound = 0;
|
||||
unbind_evtchn(port);
|
||||
return 0;
|
||||
}
|
||||
@@ -410,6 +411,7 @@ static struct xc_osdep_ops minios_evtchn_ops = {
|
||||
.bind_unbound_port = &minios_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &minios_evtchn_bind_interdomain,
|
||||
.bind_virq = &minios_evtchn_bind_virq,
|
||||
.unbind = &minios_evtchn_unbind,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -259,13 +259,14 @@ netbsd_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
|
||||
return -1;
|
||||
}
|
||||
|
||||
int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
|
||||
static int netbsd_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
struct ioctl_evtchn_unbind unbind;
|
||||
|
||||
unbind.port = port;
|
||||
|
||||
return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind);
|
||||
return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
|
||||
}
|
||||
|
||||
static evtchn_port_or_error_t
|
||||
@@ -310,6 +311,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = {
|
||||
.bind_unbound_port = &netbsd_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &netbsd_evtchn_bind_interdomain,
|
||||
.bind_virq = &netbsd_evtchn_bind_virq,
|
||||
.unbind = &netbsd_evtchn_unbind,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -252,13 +252,14 @@ solaris_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
|
||||
return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
|
||||
}
|
||||
|
||||
int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
|
||||
static int solaris_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
|
||||
{
|
||||
int fd = (int)h;
|
||||
struct ioctl_evtchn_unbind unbind;
|
||||
|
||||
unbind.port = port;
|
||||
|
||||
return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind);
|
||||
return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
|
||||
}
|
||||
|
||||
evtchn_port_or_error_t
|
||||
@@ -287,6 +288,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = {
|
||||
.bind_unbound_port = &solaris_evtchn_bind_unbound_port,
|
||||
.bind_interdomain = &solaris_evtchn_bind_interdomain,
|
||||
.bind_virq = &solaris_evtchn_bind_virq,
|
||||
.unbind = &solaris_evtchn_unbind,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ struct xc_osdep_ops
|
||||
evtchn_port_or_error_t (*bind_interdomain)(xc_evtchn *xce, xc_osdep_handle h, int domid,
|
||||
evtchn_port_t remote_port);
|
||||
evtchn_port_or_error_t (*bind_virq)(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq);
|
||||
|
||||
int (*unbind)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port);
|
||||
} evtchn;
|
||||
} u;
|
||||
};
|
||||
|
||||