WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xl: Some small fixes

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: Some small fixes
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 26 May 2010 09:05:39 -0700
Delivery-date: Wed, 26 May 2010 09:07:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1274858027 -3600
# Node ID cef74c37b4f683127494d6b6b2acb0df6efce035
# Parent  2a3d51e575900631ce14a57a9331b06c5f396e22
xl: Some small fixes

- When use mem-set, I got suspicious error output:
  # xl mem-set 1 256g
  setting domid 1 memory to : 268435456
  [0] libxl.c:2535:libxl_set_memory_target: memory_dynamic_max must be
  less than or equal to memory_static_max
  : Success
- String generated by strdup() should be freed
- When using 'xl help', mem-max and mem-set's output is not as intend,
  and it also breaks bash completion, fix it.

Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
---
 tools/libxl/libxl.c       |    2 +-
 tools/libxl/xl_cmdimpl.c  |   20 ++++++++++++++------
 tools/libxl/xl_cmdtable.c |   12 ++++--------
 3 files changed, 19 insertions(+), 15 deletions(-)

diff -r 2a3d51e57590 -r cef74c37b4f6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed May 26 08:12:15 2010 +0100
+++ b/tools/libxl/libxl.c       Wed May 26 08:13:47 2010 +0100
@@ -2531,7 +2531,7 @@ int libxl_set_memory_target(struct libxl
         }
 
         if (target_memkb > memorykb) {
-            XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
+            XL_LOG(ctx, XL_LOG_ERROR,
                 "memory_dynamic_max must be less than or equal to 
memory_static_max\n");
             return 1;
         }
diff -r 2a3d51e57590 -r cef74c37b4f6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed May 26 08:12:15 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Wed May 26 08:13:47 2010 +0100
@@ -3678,7 +3678,8 @@ static void print_dom0_uptime(int short_
     int fd;
     char buf[512];
     uint32_t uptime = 0;
-    char *uptime_str = 0;
+    char *uptime_str = NULL;
+    char *now_str = NULL;
 
     fd = open("/proc/uptime", O_RDONLY);
     if (fd == -1)
@@ -3695,9 +3696,10 @@ static void print_dom0_uptime(int short_
 
     if (short_mode)
     {
+        now_str = current_time_to_string(now);
         uptime_str = uptime_to_string(uptime, 1);
-        printf(" %s up %s, %s (%d)\n", current_time_to_string(now),
-               uptime_str, libxl_domid_to_name(&ctx, 0), 0);
+        printf(" %s up %s, %s (%d)\n", now_str, uptime_str,
+               libxl_domid_to_name(&ctx, 0), 0);
     }
     else
     {
@@ -3706,6 +3708,8 @@ static void print_dom0_uptime(int short_
                0, uptime_str);
     }
 
+    if (now_str)
+        free(now_str);
     if (uptime_str)
         free(uptime_str);
     return;
@@ -3718,7 +3722,8 @@ static void print_domU_uptime(uint32_t d
 {
     uint32_t s_time = 0;
     uint32_t uptime = 0;
-    char *uptime_str = 0;
+    char *uptime_str = NULL;
+    char *now_str = NULL;
 
     s_time = libxl_vm_get_start_time(&ctx, domuid);
     if (s_time == -1)
@@ -3726,9 +3731,10 @@ static void print_domU_uptime(uint32_t d
     uptime = now - s_time;
     if (short_mode)
     {
+        now_str = current_time_to_string(now);
         uptime_str = uptime_to_string(uptime, 1);
-        printf(" %s up %s, %s (%d)\n", current_time_to_string(now),
-               uptime_str, libxl_domid_to_name(&ctx, domuid), domuid);
+        printf(" %s up %s, %s (%d)\n", now_str, uptime_str,
+               libxl_domid_to_name(&ctx, domuid), domuid);
     }
     else
     {
@@ -3737,6 +3743,8 @@ static void print_domU_uptime(uint32_t d
                domuid, uptime_str);
     }
 
+    if (now_str)
+        free(now_str);
     if (uptime_str)
         free(uptime_str);
     return;
diff -r 2a3d51e57590 -r cef74c37b4f6 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Wed May 26 08:12:15 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c Wed May 26 08:13:47 2010 +0100
@@ -110,17 +110,13 @@ struct cmd_spec cmd_table[] = {
     },
     { "mem-max",
       &main_memmax,
-      "Set the maximum amount reservation for a domain.\n"
-      "Units default to kilobytes, but can be suffixed with\n"
-      "'b' (bytes), 'k' (KB), 'm' (MB), 'g' (GB) or 't' (TB)",
-      "<Domain> <MemKB>",
+      "Set the maximum amount reservation for a domain",
+      "<Domain> <MemKB['b'[bytes]|'k'[KB]|'m'[MB]|'g'[GB]|'t'[TB]]>",
     },
     { "mem-set",
       &main_memset,
-      "Set the current memory usage for a domain.\n"
-      "Units default to kilobytes, but can be suffixed with\n"
-      "'b' (bytes), 'k' (KB), 'm' (MB), 'g' (GB) or 't' (TB)",
-      "<Domain> <MemKB>",
+      "Set the current memory usage for a domain",
+      "<Domain> <MemKB['b'[bytes]|'k'[KB]|'m'[MB]|'g'[GB]|'t'[TB]]>",
     },
     { "button-press",
       &main_button_press,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: Some small fixes, Xen patchbot-unstable <=