xl: Some small fixes to xl
PATCH 1/1 xl: Some small fixes to xl
The patch fixes following problems:
-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 -parse_mem_size_kb() returns type int64_t -String generated by strdup() should be freed -When using 'xl help', mem-max and mem-set's output is not as intend, and it's also breaks bash completion, fix it.
tools/libxl/libxl.c +1 -1
@@ -2531,7 +2531,7 @@ }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 ; }
tools/libxl/xl_cmdimpl.c +16 -8
@@ -1300,7 +1300,7 @@void set_memory_target (char *p,char *mem) { -long long int memorykb; +int64_t memorykb;find_domain (p);
@@ -1310,7 +1310,7 @@exit (3 ); } -printf ("setting domid %d memory to : %lld\n" , domid, memorykb); +printf ("setting domid %d memory to : %ld\n" , domid, memorykb);libxl_set_memory_target (&ctx, domid, memorykb,/* enforce */ 1 ); }
@@ -3644,7 +3644,8 @@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 )
@@ -3661,9 +3662,10 @@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 {
@@ -3672,6 +3674,8 @@ 0, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;
@@ -3684,7 +3688,8 @@ {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 )
@@ -3692,9 +3697,10 @@ 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 {
@@ -3703,6 +3709,8 @@ domuid, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;
tools/libxl/xl_cmdtable.c +4 -8
@@ -110,17 +110,13 @@ }, {"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,
Signature · 2 lines
Regards Yang Hongyang
Please provide a signed-off-by line.
K.
Quoted 136 lines · Yang Hongyang
The patch fixes following problems:
-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(quoted diff) +0
-3-parse_mem_size_kb() returns type int64_t -String generated by strdup() should be freed -When using 'xl help', mem-max and mem-set's output is not as intend, and it'salso
breaks bash completion, fix it.diff -r
840f269d95fbtools/libxl/libxl.ctools/libxl/libxl.c Fri May 21 22:56:02 2010 +0800 renamed from tools/libxl/libxl.c Wed May 19 22:59:52 2010 +0100 +1
-1@@ -2531,7 +2531,7 @@ } 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
840f269d95fbtools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c Fri May 21 22:56:02 2010 +0800 renamed from tools/libxl/xl_cmdimpl.c Wed May 19 22:59:52 2010 +0100 +16
-8@@ -1300,7 +1300,7 @@ void set_memory_target(char *p, char *mem) { - long long int memorykb; + int64_t memorykb; find_domain(p);@@ -1310,7 +1310,7 @@ exit(3); } - printf("setting domid %d memory to : %lld\n", domid, memorykb); + printf("setting domid %d memory to : %ld\n", domid, memorykb); libxl_set_memory_target(&ctx, domid, memorykb, /* enforce */ 1); }@@ -3644,7 +3644,8 @@ 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)@@ -3661,9 +3662,10 @@ 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 {@@ -3672,6 +3674,8 @@ 0, uptime_str); } + if (now_str) + free(now_str); if (uptime_str) free(uptime_str); return;@@ -3684,7 +3688,8 @@ { 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)@@ -3692,9 +3697,10 @@ 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 {@@ -3703,6 +3709,8 @@ domuid, uptime_str); } + if (now_str) + free(now_str); if (uptime_str) free(uptime_str); return;diff -r
840f269d95fbtools/libxl/xl_cmdtable.ctools/libxl/xl_cmdtable.c Fri May 21 22:56:02 2010 +0800 renamed from tools/libxl/xl_cmdtable.c Wed May 19 22:59:52 2010 +0100 +4
-8@@ -110,17 +110,13 @@ }, { "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,
Quoted 36 lines · Yang Hongyang
The patch fixes following problems:
(quoted diff) +0
-4-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 -parse_mem_size_kb() returns type int64_t -String generated by strdup() should be freed -When using 'xl help', mem-max and mem-set's output is not as intend, and it's also breaks bash completion, fix it.diff -r
840f269d95fbtools/libxl/libxl.ctools/libxl/libxl.c +1
-1@@ -2531,7 +2531,7 @@ }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
840f269d95fbtools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c +1
-1@@ -1300,7 +1300,7 @@void set_memory_target (char *p,char *mem) { -long long int memorykb; +int64_t memorykb;find_domain (p);
tools/libxl/xl_cmdimpl.c line 1314
Quoted 6 lines
tools/libxl/xl_cmdimpl.c +1
-1@@ -1310,7 +1310,7 @@exit (3 ); } -printf ("setting domid %d memory to : %lld\n" , domid, memorykb); +printf ("setting domid %d memory to : %ld\n" , domid, memorykb);
This is wrong; "int64_t" isn't necessarily long. What was wrong with the previous version?
J
Quoted 94 lines
tools/libxl/xl_cmdimpl.c +14
-6libxl_set_memory_target (&ctx, domid, memorykb,/* enforce */ 1 ); }@@ -3644,7 +3644,8 @@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 )@@ -3661,9 +3662,10 @@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 {@@ -3672,6 +3674,8 @@ 0, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;@@ -3684,7 +3688,8 @@ {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 )@@ -3692,9 +3697,10 @@ 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 {@@ -3703,6 +3709,8 @@ domuid, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;diff -r
840f269d95fbtools/libxl/xl_cmdtable.ctools/libxl/xl_cmdtable.c +4
-8@@ -110,17 +110,13 @@ }, {"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,
Hi jeremy,
Thank you for your review.
Quoted 15 lines · Jeremy Fitzhardinge
Quoted 14 lines · Yang Hongyang
The patch fixes following problems:
(quoted diff) +0
-4-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 -parse_mem_size_kb() returns type int64_t -String generated by strdup() should be freed -When using 'xl help', mem-max and mem-set's output is not as intend, and it's also breaks bash completion, fix it.diff -r
840f269d95fbtools/libxl/libxl.ctools/libxl/libxl.c +0
-0
...snip...
Quoted 8 lines
tools/libxl/libxl.c
Quoted 5 lines
}tools/libxl/libxl.c +1
-1-printf ("setting domid %d memory to : %lld\n" , domid, memorykb); +printf ("setting domid %d memory to : %ld\n" , domid, memorykb);This is wrong; "
int64_t" isn't necessarily long. What was wrong with the previous version?
There's a problem. libxl_set_memory_target() takes memorykb as uint32_t, so, if you want set as 'long long int', you should also modify this lib function I think.
For this reason, when I set the memory to 100t, libxl_set_memory_target() will take the memorykb as 0...
Quoted 100 lines
J
Quoted 94 lines
libxl_set_memory_target(&ctx, domid, memorykb, /* enforce */ 1);}
tools/libxl/libxl.c +14
-6@@ -3644,7 +3644,8 @@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 )@@ -3661,9 +3662,10 @@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 {@@ -3672,6 +3674,8 @@ 0, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;@@ -3684,7 +3688,8 @@ {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 )@@ -3692,9 +3697,10 @@ 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 {@@ -3703,6 +3709,8 @@ domuid, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;diff -r
840f269d95fbtools/libxl/xl_cmdtable.ctools/libxl/xl_cmdtable.c +4
-8@@ -110,17 +110,13 @@ }, {"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,
Signature · 2 lines
Regards Yang Hongyang
Quoted 27 lines · Yang Hongyang
Hi jeremy,
Thank you for your review.
Quoted 15 lines · Jeremy Fitzhardinge
Quoted 14 lines · Yang Hongyang
The patch fixes following problems:
(quoted diff) +0
-4-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 -parse_mem_size_kb() returns type int64_t -String generated by strdup() should be freed -When using 'xl help', mem-max and mem-set's output is not as intend, and it's also breaks bash completion, fix it.diff -r
840f269d95fbtools/libxl/libxl.ctools/libxl/libxl.c +0
-0...snip...
Quoted 6 lines
Quoted 5 lines
}tools/libxl/libxl.c +1
-1-printf ("setting domid %d memory to : %lld\n" , domid, memorykb); +printf ("setting domid %d memory to : %ld\n" , domid, memorykb);
Quoted 9 lines
Quoted 2 lines
This is wrong; "
int64_t" isn't necessarily long. What was wrong with the previous version?There's a problem.
libxl_set_memory_target()takes memorykb asuint32_t, so, if you want set as 'long long int', you should also modify this lib function I think.
For this reason, when I set the memory to 100t,libxl_set_memory_target()will take the memorykb as 0...
Yes, we need to use uint64_t in libxenlight too, also I prefer uint64_t to unsigned long long.
Finally in the printf call the best way to print a uint64_t in decimal format is using PRId64.
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH]xl: Some small fixes to xl"):
Quoted 2 lines
Finally in the printf call the best way to print a
uint64_tin decimal format is using PRId64.
PRIu64 I think you mean. PRId64 is for int64_t.
Ian.
Quoted 5 lines · Ian Jackson
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH]xl: Some small fixes to xl"):
Quoted 2 lines
Finally in the printf call the best way to print a
uint64_tin decimal format is using PRId64.PRIu64 I think you mean. PRId64 is for
int64_t.
Yes, thank you
Quoted 4 lines · Stefano Stabellini
Quoted 2 lines · Ian Jackson
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH]xl: Some small fixes to xl"):
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Finally in the printf call the best way to print a
uint64_tin decimal format is using PRId64.PRIu64 I think you mean. PRId64 is for
int64_t.Yes, thank you
I personally find those format macros pretty odious and avoid them unless there's no other option, but I'll leave that up to you.
J
The patch fixes following problems:
-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's also breaks bash completion, fix it.
tools/libxl/libxl.c +1 -1
@@ -2531,7 +2531,7 @@ }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 ; }
tools/libxl/xl_cmdimpl.c +14 -6
@@ -3644,7 +3644,8 @@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 )
@@ -3661,9 +3662,10 @@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 {
@@ -3672,6 +3674,8 @@ 0, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;
@@ -3684,7 +3688,8 @@ {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 )
@@ -3692,9 +3697,10 @@ 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 {
@@ -3703,6 +3709,8 @@ domuid, uptime_str); } +if (now_str) +free (now_str);if (uptime_str)free (uptime_str);return ;
tools/libxl/xl_cmdtable.c +4 -8
@@ -110,17 +110,13 @@ }, {"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,
Signature · 2 lines
Regards Yang Hongyang
Quoted 38 lines · Stefano Stabellini
Quoted 27 lines · Yang Hongyang
Hi jeremy,
Thank you for your review.
Quoted 15 lines · Jeremy Fitzhardinge
Quoted 14 lines · Yang Hongyang
The patch fixes following problems:
(quoted diff) +0
-4-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 -parse_mem_size_kb() returns type int64_t -String generated by strdup() should be freed -When using 'xl help', mem-max and mem-set's output is not as intend, and it's also breaks bash completion, fix it.diff -r
840f269d95fbtools/libxl/libxl.ctools/libxl/libxl.c +0
-0...snip...
Quoted 6 lines
Quoted 5 lines
}tools/libxl/libxl.c +1
-1-printf ("setting domid %d memory to : %lld\n" , domid, memorykb); +printf ("setting domid %d memory to : %ld\n" , domid, memorykb);Quoted 9 lines
Quoted 2 lines
This is wrong; "
int64_t" isn't necessarily long. What was wrong with the previous version?There's a problem.
libxl_set_memory_target()takes memorykb asuint32_t, so, if you want set as 'long long int', you should also modify this lib function I think.
For this reason, when I set the memory to 100t,libxl_set_memory_target()will take the memorykb as 0...
Quoted 6 lines
Yes, we need to use
uint64_tin libxenlight too, also I preferuint64_tto unsigned long long.
Finally in the printf call the best way to print auint64_tin decimal format is using PRId64.
By the way, xc_domain_setmaxmem() take max_memkb as 'unsigned int' It we use uint64_t, we should change that also.
Quoted 2 lines
Signature · 2 lines
Regards Yang Hongyang