aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_suspend.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-05-28 09:30:19 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-05-28 09:30:19 +0100
commit5cc436c1d2b3b0be3f42104582f53eec3969b43a (patch)
tree1e30ade146ee7287c486d1309b5d3d2c69a2d9b9 /tools/libxc/xc_suspend.c
parent7f9a888af4b65cb8c22cea3c8295d30d0fedd623 (diff)
downloadxen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.gz
xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.bz2
xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.zip
libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_suspend.c')
-rw-r--r--tools/libxc/xc_suspend.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/libxc/xc_suspend.c b/tools/libxc/xc_suspend.c
index a334e821c1..90958f97fc 100644
--- a/tools/libxc/xc_suspend.c
+++ b/tools/libxc/xc_suspend.c
@@ -8,7 +8,7 @@
#include "xenguest.h"
#define SUSPEND_LOCK_FILE "/var/lib/xen/suspend_evtchn"
-static int lock_suspend_event(int domid)
+static int lock_suspend_event(xc_interface *xch, int domid)
{
int fd, rc;
mode_t mask;
@@ -34,7 +34,7 @@ static int lock_suspend_event(int domid)
return rc;
}
-static int unlock_suspend_event(int domid)
+static int unlock_suspend_event(xc_interface *xch, int domid)
{
int fd, pid, n;
char buf[128];
@@ -65,7 +65,7 @@ static int unlock_suspend_event(int domid)
return -EPERM;
}
-int xc_await_suspend(int xce, int suspend_evtchn)
+int xc_await_suspend(xc_interface *xch, int xce, int suspend_evtchn)
{
int rc;
@@ -84,19 +84,19 @@ int xc_await_suspend(int xce, int suspend_evtchn)
return 0;
}
-int xc_suspend_evtchn_release(int xce, int domid, int suspend_evtchn)
+int xc_suspend_evtchn_release(xc_interface *xch, int xce, int domid, int suspend_evtchn)
{
if (suspend_evtchn >= 0)
xc_evtchn_unbind(xce, suspend_evtchn);
- return unlock_suspend_event(domid);
+ return unlock_suspend_event(xch, domid);
}
-int xc_suspend_evtchn_init(int xc, int xce, int domid, int port)
+int xc_suspend_evtchn_init(xc_interface *xch, int xce, int domid, int port)
{
int rc, suspend_evtchn = -1;
- if (lock_suspend_event(domid))
+ if (lock_suspend_event(xch, domid))
return -EINVAL;
suspend_evtchn = xc_evtchn_bind_interdomain(xce, domid, port);
@@ -105,20 +105,20 @@ int xc_suspend_evtchn_init(int xc, int xce, int domid, int port)
goto cleanup;
}
- rc = xc_domain_subscribe_for_suspend(xc, domid, port);
+ rc = xc_domain_subscribe_for_suspend(xch, domid, port);
if (rc < 0) {
ERROR("failed to subscribe to domain: %d", rc);
goto cleanup;
}
/* event channel is pending immediately after binding */
- xc_await_suspend(xce, suspend_evtchn);
+ xc_await_suspend(xch, xce, suspend_evtchn);
return suspend_evtchn;
cleanup:
if (suspend_evtchn != -1)
- xc_suspend_evtchn_release(xce, domid, suspend_evtchn);
+ xc_suspend_evtchn_release(xch, xce, domid, suspend_evtchn);
return -1;
}