@@ -398,7 +398,7 @@ int main(int argc, char **argv)
exit(EINVAL);
}
- xs = xs_daemon_open();
+ xs = xs_open(0);
if (xs == NULL) {
err(errno, "Could not contact XenStore");
}
@@ -104,7 +104,7 @@ void daemonize(const char *pidfile)
bool xen_setup(void)
{
- xs = xs_daemon_open();
+ xs = xs_open(0);
if (xs == NULL) {
dolog(LOG_ERR,
"Failed to contact xenstore (%m). Is it running?");
@@ -131,7 +131,7 @@ bool xen_setup(void)
out:
if (xs)
- xs_daemon_close(xs);
+ xs_close(xs);
if (xc)
xc_interface_close(xc);
return false;
@@ -103,9 +103,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
rc = ERROR_FAIL; goto out;
}
- ctx->xsh = xs_daemon_open();
- if (!ctx->xsh)
- ctx->xsh = xs_domain_open();
+ ctx->xsh = xs_open(0);
if (!ctx->xsh) {
LOGEV(ERROR, errno, "cannot connect to xenstore");
rc = ERROR_FAIL; goto out;
@@ -171,7 +169,7 @@ int libxl_ctx_free(libxl_ctx *ctx)
if (ctx->xch) xc_interface_close(ctx->xch);
libxl_version_info_dispose(&ctx->version_info);
- if (ctx->xsh) xs_daemon_close(ctx->xsh);
+ if (ctx->xsh) xs_close(ctx->xsh);
if (ctx->xce) xenevtchn_close(ctx->xce);
libxl__poller_put(ctx, ctx->poller_app);
@@ -178,7 +178,7 @@ int libxl__xenstore_child_wait_deprecated(libxl__gc *gc,
unsigned int num;
char **l = NULL;
- xsh = xs_daemon_open();
+ xsh = xs_open(0);
if (xsh == NULL) {
LOG(ERROR, "Unable to open xenstore connection");
goto err;
@@ -206,7 +206,7 @@ int libxl__xenstore_child_wait_deprecated(libxl__gc *gc,
free(p);
xs_unwatch(xsh, path, path);
- xs_daemon_close(xsh);
+ xs_close(xsh);
return rc;
again:
free(p);
@@ -226,7 +226,7 @@ again:
LOG(ERROR, "%s not ready", what);
xs_unwatch(xsh, path, path);
- xs_daemon_close(xsh);
+ xs_close(xsh);
err:
return -1;
}
@@ -663,7 +663,7 @@ int libxl__ev_child_xenstore_reopen(libxl__gc *gc, const char *what) {
int rc;
assert(!CTX->xsh);
- CTX->xsh = xs_daemon_open();
+ CTX->xsh = xs_open(0);
if (!CTX->xsh) {
LOGE(ERROR, "%s: xenstore reopen failed", what);
rc = ERROR_FAIL; goto out;
@@ -107,7 +107,7 @@ xenstat_handle *xenstat_init(void)
return NULL;
}
- handle->xshandle = xs_daemon_open_readonly(); /* open handle to xenstore*/
+ handle->xshandle = xs_open(0); /* open handle to xenstore*/
if (handle->xshandle == NULL) {
perror("unable to open xenstore");
xc_interface_close(handle->xc_handle);
@@ -125,7 +125,7 @@ void xenstat_uninit(xenstat_handle * handle)
for (i = 0; i < NUM_COLLECTORS; i++)
collectors[i].uninit(handle);
xc_interface_close(handle->xc_handle);
- xs_daemon_close(handle->xshandle);
+ xs_close(handle->xshandle);
free(handle->priv);
free(handle);
}
@@ -251,7 +251,7 @@ static int init_xs_srv(struct libxenvchan *ctrl, int domain, const char* xs_base
char ref[16];
char* domid_str = NULL;
xs_transaction_t xs_trans = XBT_NULL;
- xs = xs_domain_open();
+ xs = xs_open(0);
if (!xs)
goto fail;
domid_str = xs_read(xs, 0, "domid", NULL);
@@ -293,7 +293,7 @@ retry_transaction:
}
fail_xs_open:
free(domid_str);
- xs_daemon_close(xs);
+ xs_close(xs);
fail:
return ret;
}
@@ -408,9 +408,7 @@ struct libxenvchan *libxenvchan_client_init(struct xentoollog_logger *logger,
ctrl->write.order = ctrl->read.order = 0;
ctrl->is_server = 0;
- xs = xs_daemon_open();
- if (!xs)
- xs = xs_domain_open();
+ xs = xs_open(0);
if (!xs)
goto fail;
@@ -452,7 +450,7 @@ struct libxenvchan *libxenvchan_client_init(struct xentoollog_logger *logger,
out:
if (xs)
- xs_daemon_close(xs);
+ xs_close(xs);
return ctrl;
fail:
libxenvchan_close(ctrl);
@@ -24,7 +24,7 @@ void cleanup(void)
if (xch)
xc_interface_close(xch);
if (xs_handle)
- xs_daemon_close(xs_handle);
+ xs_close(xs_handle);
}
/* Never shrink dom0 below 1 GiB */
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
return 2;
}
- xs_handle = xs_daemon_open();
+ xs_handle = xs_open(0);
if (xs_handle == NULL)
{
perror("Failed to open xenstore connection");
@@ -791,7 +791,7 @@ static PyObject *xspy_close(XsHandle *self)
PySequence_SetItem(self->watches, i, Py_None);
}
- xs_daemon_close(xh);
+ xs_close(xh);
self->xh = NULL;
Py_INCREF(Py_None);
@@ -985,7 +985,7 @@ xshandle_init(XsHandle *self, PyObject *args, PyObject *kwds)
&readonly))
goto fail;
- self->xh = (readonly ? xs_daemon_open_readonly() : xs_daemon_open());
+ self->xh = xs_open(0);
if (!self->xh)
goto fail;
@@ -999,7 +999,7 @@ xshandle_init(XsHandle *self, PyObject *args, PyObject *kwds)
static void xshandle_dealloc(XsHandle *self)
{
if (self->xh) {
- xs_daemon_close(self->xh);
+ xs_close(self->xh);
self->xh = NULL;
}
@@ -411,13 +411,13 @@ static long xs_get_dom_mem(int domid)
unsigned int plen;
struct xs_handle *xs;
- xs = xs_daemon_open();
+ xs = xs_open(0);
if (!xs)
return -1;
sprintf(path, "/local/domain/%d/memory/target", domid);
memstr = xs_read(xs, XBT_NULL, path, &plen);
- xs_daemon_close(xs);
+ xs_close(xs);
if (!memstr || !plen)
return -1;
@@ -122,7 +122,7 @@ usage(void)
static int
xen_setup(void)
{
- xs = xs_daemon_open();
+ xs = xs_open(0);
if (xs == NULL) {
dolog(LOG_ERR,
"Failed to contact xenstore (%s). Is it running?",
@@ -138,7 +138,7 @@ xen_setup(void)
out:
if (xs) {
- xs_daemon_close(xs);
+ xs_close(xs);
xs = NULL;
}
return -1;
@@ -502,18 +502,18 @@ int main(int argc, char *argv[])
#ifndef RUN_STANDALONE
daemonize();
#endif
- xs = (struct xs_handle *)xs_daemon_open();
+ xs = xs_open(0);
if ( xs == NULL )
return -1;
if ( write_one_time_battery_info() == 0 )
{
- xs_daemon_close(xs);
+ xs_close(xs);
return -1;
}
wait_for_and_update_battery_status_request();
- xs_daemon_close(xs);
+ xs_close(xs);
return 0;
}
Switch all usages of xs_daemon_open*() and xs_domain_open() to use xs_open() instead. While at it switch xs_daemon_close() users to xs_close(). Signed-off-by: Juergen Gross <jgross@suse.com> --- tools/console/client/main.c | 2 +- tools/console/daemon/utils.c | 4 ++-- tools/libs/light/libxl.c | 6 ++---- tools/libs/light/libxl_exec.c | 6 +++--- tools/libs/light/libxl_fork.c | 2 +- tools/libs/stat/xenstat.c | 4 ++-- tools/libs/vchan/init.c | 10 ++++------ tools/misc/xen-lowmemd.c | 4 ++-- tools/python/xen/lowlevel/xs/xs.c | 6 +++--- tools/tests/mce-test/tools/xen-mceinj.c | 4 ++-- tools/xenbackendd/xenbackendd.c | 4 ++-- tools/xenpmd/xenpmd.c | 6 +++--- 12 files changed, 27 insertions(+), 31 deletions(-)