]> xenbits.xensource.com Git - people/jgross/xen.git/commitdiff
tools: drop all deprecated usages of xs_*_open() and friends in tools
authorJuergen Gross <jgross@suse.com>
Fri, 2 Oct 2020 15:41:40 +0000 (17:41 +0200)
committerWei Liu <wl@xen.org>
Thu, 8 Oct 2020 12:47:59 +0000 (12:47 +0000)
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>
Acked-by: Wei Liu <wl@xen.org>
12 files changed:
tools/console/client/main.c
tools/console/daemon/utils.c
tools/libs/light/libxl.c
tools/libs/light/libxl_exec.c
tools/libs/light/libxl_fork.c
tools/libs/stat/xenstat.c
tools/libs/vchan/init.c
tools/misc/xen-lowmemd.c
tools/python/xen/lowlevel/xs/xs.c
tools/tests/mce-test/tools/xen-mceinj.c
tools/xenbackendd/xenbackendd.c
tools/xenpmd/xenpmd.c

index f92ad3d8cfdd824c6e57b37f0a94d29d0835ae04..088be28dff029ce23be09c59448d7ab36779cd6f 100644 (file)
@@ -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");
        }
index 97d7798b33888f269a3f88ac5758e4e149c29594..f9dd8a60c5c497c3dc2c9c5779b38bca547dd5a9 100644 (file)
@@ -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;
index 621acc88f3e29b333398a496b7052867479a7a17..d2a87157a23088072217119a07d4f38bdedaa136 100644 (file)
@@ -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);
index 47c9c8f1ba692bb34e9113615a5cc91b43cffcfc..a8b949b1938554e20a3ce6162fc83f1651dbebeb 100644 (file)
@@ -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;
 }
index 9a4709b9a4a0562b68613b3ec8c46c055e4686cc..5d47dceb8a7fc2a01bd123356e57864ebc482af2 100644 (file)
@@ -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;
index 6f93d4e98247a0422e12d7594b5d3a6e1f695b56..e49689aa2da94b3eba3a3aede8e71d72f8c0fc72 100644 (file)
@@ -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);
        }
index ad4b64fbe3d372025ba7fa1355bd1a23d7773b86..c8510e6ce98a6ca5c6ea9174c044928527356fab 100644 (file)
@@ -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);
index 79ad34cb4a237ffc41fc908fdba46a783ce0a9a6..a3a2741242c0223942ae1a58a729739707e0926b 100644 (file)
@@ -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");
index b7d4b6ef5dedc87810cf5c93cb5cb47d2173d99c..0dad7fa5f2fc4ff842305f895f137d2b6479e9cd 100644 (file)
@@ -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;
     }
 
index 380e42190ca6fbf68ef889a579fdf03bce04a341..1187d01e5f48b5d0de9ea2e4ee3785d7fcfad6de 100644 (file)
@@ -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;
index b6d92984e0acf1bf827244f469fb3c4857308e60..21884af77266155b106fc681565c626c61936af6 100644 (file)
@@ -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;
index 1c801caa712a8374e4c15f1c7f858a73bfde2c7f..35fd1c931acb24ca7638e50d4a351f5728d1df6d 100644 (file)
@@ -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;
 }