[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 08/10] libxl: make libxlDomainFreeMem static



libxlDomainFreeMem() is only used in libxl_domain.c and thus should
be declared static.  While at it, change the signature to take a
libxl_ctx instead of libxlDomainObjPrivatePtr, since only the
libxl_ctx is needed.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_domain.c | 16 ++++++++--------
 src/libxl/libxl_domain.h |  4 ----
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 69d5c5b..6bd38c5 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -848,8 +848,8 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, 
virDomainObjPtr vm)
     return ret;
 }
 
-int
-libxlDomainFreeMem(libxlDomainObjPrivatePtr priv, libxl_domain_config 
*d_config)
+static int
+libxlDomainFreeMem(libxl_ctx *ctx, libxl_domain_config *d_config)
 {
     uint32_t needed_mem;
     uint32_t free_mem;
@@ -858,10 +858,10 @@ libxlDomainFreeMem(libxlDomainObjPrivatePtr priv, 
libxl_domain_config *d_config)
     int tries = 3;
     int wait_secs = 10;
 
-    if ((ret = libxl_domain_need_memory(priv->ctx, &d_config->b_info,
+    if ((ret = libxl_domain_need_memory(ctx, &d_config->b_info,
                                         &needed_mem)) >= 0) {
         for (i = 0; i < tries; ++i) {
-            if ((ret = libxl_get_free_memory(priv->ctx, &free_mem)) < 0)
+            if ((ret = libxl_get_free_memory(ctx, &free_mem)) < 0)
                 break;
 
             if (free_mem >= needed_mem) {
@@ -869,17 +869,17 @@ libxlDomainFreeMem(libxlDomainObjPrivatePtr priv, 
libxl_domain_config *d_config)
                 break;
             }
 
-            if ((ret = libxl_set_memory_target(priv->ctx, 0,
+            if ((ret = libxl_set_memory_target(ctx, 0,
                                                free_mem - needed_mem,
                                                /* relative */ 1, 0)) < 0)
                 break;
 
-            ret = libxl_wait_for_free_memory(priv->ctx, 0, needed_mem,
+            ret = libxl_wait_for_free_memory(ctx, 0, needed_mem,
                                              wait_secs);
             if (ret == 0 || ret != ERROR_NOMEM)
                 break;
 
-            if ((ret = libxl_wait_for_memory_target(priv->ctx, 0, 1)) < 0)
+            if ((ret = libxl_wait_for_memory_target(ctx, 0, 1)) < 0)
                 break;
         }
     }
@@ -1003,7 +1003,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, 
virDomainObjPtr vm,
                                priv->ctx, &d_config) < 0)
         goto endjob;
 
-    if (cfg->autoballoon && libxlDomainFreeMem(priv, &d_config) < 0) {
+    if (cfg->autoballoon && libxlDomainFreeMem(priv->ctx, &d_config) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("libxenlight failed to get free memory for domain 
'%s'"),
                        d_config.c_info.name);
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 297dffb..2db4d77 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -141,10 +141,6 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver,
                              virDomainObjPtr vm);
 
 int
-libxlDomainFreeMem(libxlDomainObjPrivatePtr priv,
-                   libxl_domain_config *d_config);
-
-int
 libxlDomainStart(libxlDriverPrivatePtr driver,
                  virDomainObjPtr vm,
                  bool start_paused,
-- 
1.8.4.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.