All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tamas K Lengyel <tamas.lengyel@intel.com>
To: xen-devel@lists.xenproject.org
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Tamas K Lengyel <tamas.lengyel@intel.com>, Wei Liu <wl@xen.org>
Subject: [PATCH v19 for-4.14 03/13] tools/libxl: Split libxl__domain_make
Date: Mon,  1 Jun 2020 06:21:37 -0700	[thread overview]
Message-ID: <853ceef8391bdfb7dc43ae2d9a9cb45818f256e4.1591017086.git.tamas.lengyel@intel.com> (raw)
In-Reply-To: <cover.1591017086.git.tamas.lengyel@intel.com>

Make part of libxl__domain_make into a separate function. No functional change.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
---
 tools/libxl/libxl_create.c   | 62 +++++++++++++++++++++++-------------
 tools/libxl/libxl_internal.h |  4 ++-
 2 files changed, 42 insertions(+), 24 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 75862dc6ed..09cf99d304 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -579,15 +579,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
                        uint32_t *domid, bool soft_reset)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    int ret, rc, nb_vm;
-    const char *dom_type;
-    char *uuid_string;
-    char *dom_path, *vm_path, *libxl_path;
-    struct xs_permissions roperm[2];
-    struct xs_permissions rwperm[1];
-    struct xs_permissions noperm[1];
-    xs_transaction_t t = 0;
-    libxl_vminfo *vm_list;
+    int ret, rc;
 
     /* convenience aliases */
     libxl_domain_create_info *info = &d_config->c_info;
@@ -595,12 +587,6 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
 
     assert(soft_reset || *domid == INVALID_DOMID);
 
-    uuid_string = libxl__uuid2string(gc, info->uuid);
-    if (!uuid_string) {
-        rc = ERROR_NOMEM;
-        goto out;
-    }
-
     if (!soft_reset) {
         struct xen_domctl_createdomain create = {
             .ssidref = info->ssidref,
@@ -731,7 +717,37 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
         goto out;
     }
 
-    dom_path = libxl__xs_get_dompath(gc, *domid);
+    rc = libxl__domain_make_xs_entries(gc, d_config, state, *domid);
+
+ out:
+    return rc;
+}
+
+int libxl__domain_make_xs_entries(libxl__gc *gc, libxl_domain_config *d_config,
+                                  libxl__domain_build_state *state,
+                                  uint32_t domid)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    int rc, nb_vm;
+    const char *dom_type;
+    char *uuid_string;
+    char *dom_path, *vm_path, *libxl_path;
+    struct xs_permissions roperm[2];
+    struct xs_permissions rwperm[1];
+    struct xs_permissions noperm[1];
+    xs_transaction_t t = 0;
+    libxl_vminfo *vm_list;
+
+    /* convenience aliases */
+    libxl_domain_create_info *info = &d_config->c_info;
+
+    uuid_string = libxl__uuid2string(gc, info->uuid);
+    if (!uuid_string) {
+        rc = ERROR_NOMEM;
+        goto out;
+    }
+
+    dom_path = libxl__xs_get_dompath(gc, domid);
     if (!dom_path) {
         rc = ERROR_FAIL;
         goto out;
@@ -739,12 +755,12 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
 
     vm_path = GCSPRINTF("/vm/%s", uuid_string);
     if (!vm_path) {
-        LOGD(ERROR, *domid, "cannot allocate create paths");
+        LOGD(ERROR, domid, "cannot allocate create paths");
         rc = ERROR_FAIL;
         goto out;
     }
 
-    libxl_path = libxl__xs_libxl_path(gc, *domid);
+    libxl_path = libxl__xs_libxl_path(gc, domid);
     if (!libxl_path) {
         rc = ERROR_FAIL;
         goto out;
@@ -755,10 +771,10 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
 
     roperm[0].id = 0;
     roperm[0].perms = XS_PERM_NONE;
-    roperm[1].id = *domid;
+    roperm[1].id = domid;
     roperm[1].perms = XS_PERM_READ;
 
-    rwperm[0].id = *domid;
+    rwperm[0].id = domid;
     rwperm[0].perms = XS_PERM_NONE;
 
 retry_transaction:
@@ -776,7 +792,7 @@ retry_transaction:
                     noperm, ARRAY_SIZE(noperm));
 
     xs_write(ctx->xsh, t, GCSPRINTF("%s/vm", dom_path), vm_path, strlen(vm_path));
-    rc = libxl__domain_rename(gc, *domid, 0, info->name, t);
+    rc = libxl__domain_rename(gc, domid, 0, info->name, t);
     if (rc)
         goto out;
 
@@ -866,7 +882,7 @@ retry_transaction:
 
     vm_list = libxl_list_vm(ctx, &nb_vm);
     if (!vm_list) {
-        LOGD(ERROR, *domid, "cannot get number of running guests");
+        LOGD(ERROR, domid, "cannot get number of running guests");
         rc = ERROR_FAIL;
         goto out;
     }
@@ -890,7 +906,7 @@ retry_transaction:
             t = 0;
             goto retry_transaction;
         }
-        LOGED(ERROR, *domid, "domain creation ""xenstore transaction commit failed");
+        LOGED(ERROR, domid, "domain creation ""xenstore transaction commit failed");
         rc = ERROR_FAIL;
         goto out;
     }
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index c7ece066c4..19b367daca 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1983,7 +1983,9 @@ _hidden int libxl__domain_make(libxl__gc *gc,
                                libxl_domain_config *d_config,
                                libxl__domain_build_state *state,
                                uint32_t *domid, bool soft_reset);
-
+_hidden int libxl__domain_make_xs_entries(libxl__gc *gc, libxl_domain_config *d_config,
+                                          libxl__domain_build_state *state,
+                                          uint32_t domid);
 _hidden int libxl__domain_build(libxl__gc *gc,
                                 libxl_domain_config *d_config,
                                 uint32_t domid,
-- 
2.25.1



  parent reply	other threads:[~2020-06-01 13:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 13:21 [PATCH v19 for-4.14 00/13] VM forking Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 01/13] x86/mem_sharing: block interrupt injection for forks Tamas K Lengyel
2020-06-02  7:43   ` Paul Durrant
2020-06-02 10:26   ` Wei Liu
2020-06-09 23:44   ` Tian, Kevin
     [not found]   ` <MWHPR11MB16457D9235F56F9F10BDFE358C820@MWHPR11MB1645.namprd11.prod.outlook.com>
2020-06-09 23:53     ` Tian, Kevin
2020-06-09 23:54       ` Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 02/13] tools/libxc: xc_memshr_fork with interrupts blocked Tamas K Lengyel
2020-06-02  7:44   ` Paul Durrant
2020-06-02 10:26   ` Wei Liu
2020-06-01 13:21 ` Tamas K Lengyel [this message]
2020-06-01 13:21 ` [PATCH v19 for-4.14 04/13] tools/libxl: populate xenstore entries when launching dm for VM fork Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 05/13] tools/libxl: Add checks for dm_restore_file Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 06/13] tools/libxl: adjust domcreate_bootloader_done Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 07/13] tools/libxl: Adjust libxl__build_pre Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 08/13] tools/libxl: Adjust libxl__build_post Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 09/13] tools/libxl: libxl__build_hvm_fork Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 10/13] tools/libxl: set QEMU saved_state from dm_restore_file Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 11/13] tools/libxl: Add VM forking public functions Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 12/13] tools/xl: Add xl fork-vm command Tamas K Lengyel
2020-06-01 13:21 ` [PATCH v19 for-4.14 13/13] tools/xl: document " Tamas K Lengyel
2020-06-01 15:07 ` [PATCH v19 for-4.14 00/13] VM forking Paul Durrant
2020-06-01 17:11   ` George Dunlap
2020-06-01 18:37     ` Tamas K Lengyel
2020-06-02  7:37       ` Paul Durrant
2020-06-02  9:38         ` Jan Beulich
2020-06-15 19:27           ` Tamas K Lengyel
2020-06-16  7:07             ` Jan Beulich
2020-06-16  8:32 ` Jan Beulich
2020-06-16 13:05   ` Tamas K Lengyel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=853ceef8391bdfb7dc43ae2d9a9cb45818f256e4.1591017086.git.tamas.lengyel@intel.com \
    --to=tamas.lengyel@intel.com \
    --cc=anthony.perard@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.