diff mbox series

[XEN,for-4.13,v7,08/11] libxl: create: setdefault: Move physinfo into config_setdefault

Message ID 20191023130013.32382-9-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series libxl memkb & pt defaulting | expand

Commit Message

Ian Jackson Oct. 23, 2019, 1 p.m. UTC
No functional change.  This will let us refer to it in code we are
about to add to this function.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wl@xen.org>
---
v2: New patch in this version of the series.
---
 tools/libxl/libxl_create.c   | 17 ++++++++---------
 tools/libxl/libxl_dm.c       |  7 ++++++-
 tools/libxl/libxl_internal.h |  3 ++-
 3 files changed, 16 insertions(+), 11 deletions(-)

Comments

Jürgen Groß Oct. 23, 2019, 1:43 p.m. UTC | #1
On 23.10.19 15:00, Ian Jackson wrote:
> No functional change.  This will let us refer to it in code we are
> about to add to this function.
> 
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> Acked-by: Wei Liu <wl@xen.org>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen
diff mbox series

Patch

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index d65df7924d..0670ef90ed 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -28,15 +28,9 @@ 
 #include <xen-xsm/flask/flask.h>
 
 int libxl__domain_create_info_setdefault(libxl__gc *gc,
-                                         libxl_domain_create_info *c_info)
+                                         libxl_domain_create_info *c_info,
+                                         const libxl_physinfo *info)
 {
-    libxl_physinfo info[1];
-    int rc;
-
-    rc = libxl_get_physinfo(CTX, info);
-    if (rc)
-        return rc;
-
     if (!c_info->type) {
         LOG(ERROR, "domain type unspecified");
         return ERROR_INVAL;
@@ -915,6 +909,10 @@  int libxl__domain_config_setdefault(libxl__gc *gc,
     int ret;
     bool pod_enabled = false;
 
+    libxl_physinfo physinfo;
+    ret = libxl_get_physinfo(CTX, &physinfo);
+    if (ret) goto error_out;
+
     if (d_config->c_info.ssid_label) {
         char *s = d_config->c_info.ssid_label;
         ret = libxl_flask_context_to_sid(ctx, s, strlen(s),
@@ -1013,7 +1011,8 @@  int libxl__domain_config_setdefault(libxl__gc *gc,
         goto error_out;
     }
 
-    ret = libxl__domain_create_info_setdefault(gc, &d_config->c_info);
+    ret = libxl__domain_create_info_setdefault(gc, &d_config->c_info,
+                                               &physinfo);
     if (ret) {
         LOGD(ERROR, domid, "Unable to set domain create info defaults");
         goto error_out;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index c00356a2f1..e6a48974f8 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2167,7 +2167,12 @@  void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
     dm_config->c_info.run_hotplug_scripts =
         guest_config->c_info.run_hotplug_scripts;
 
-    ret = libxl__domain_create_info_setdefault(gc, &dm_config->c_info);
+    libxl_physinfo physinfo;
+    ret = libxl_get_physinfo(CTX, &physinfo);
+    if (ret) goto out;
+
+    ret = libxl__domain_create_info_setdefault(gc, &dm_config->c_info,
+                                               &physinfo);
     if (ret) goto out;
     ret = libxl__domain_build_info_setdefault(gc, &dm_config->b_info);
     if (ret) goto out;
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 0185b8ff01..6a614658c2 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1447,7 +1447,8 @@  _hidden int libxl__domain_config_setdefault(libxl__gc *gc,
                                             libxl_domain_config *d_config,
                                             uint32_t domid /* logging only */);
 _hidden int libxl__domain_create_info_setdefault(libxl__gc *gc,
-                                        libxl_domain_create_info *c_info);
+                                        libxl_domain_create_info *c_info,
+                                        const libxl_physinfo *info);
 _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc,
                                         libxl_domain_build_info *b_info);
 _hidden void libxl__rdm_setdefault(libxl__gc *gc,