[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 05/10] xl_cmdimpl: improve return codes for memset commands
- Use EXIT_{SUCCESS,FAILURE} for main_mem*() function - Use 0/1 as return values of set_memory_{max,target} Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@xxxxxxxxx> --- Changed since v1 * Changed exit() calls to 'return 1;' --- tools/libxl/xl_cmdimpl.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index fe27f35..ad88b4b 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3391,15 +3391,15 @@ static int set_memory_max(uint32_t domid, const char *mem) memorykb = parse_mem_size_kb(mem); if (memorykb == -1) { fprintf(stderr, "invalid memory size: %s\n", mem); - exit(3); + return 1; } if (libxl_domain_setmaxmem(ctx, domid, memorykb)) { fprintf(stderr, "cannot set domid %d static max memory to : %s\n", domid, mem); - return EXIT_FAILURE; + return 1; } - return EXIT_SUCCESS; + return 0; } int main_memmax(int argc, char **argv) @@ -3415,7 +3415,11 @@ int main_memmax(int argc, char **argv) domid = find_domain(argv[optind]); mem = argv[optind + 1]; - return set_memory_max(domid, mem); + if (set_memory_max(domid, mem)) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; } static int set_memory_target(uint32_t domid, const char *mem) @@ -3425,15 +3429,15 @@ static int set_memory_target(uint32_t domid, const char *mem) memorykb = parse_mem_size_kb(mem); if (memorykb == -1) { fprintf(stderr, "invalid memory size: %s\n", mem); - exit(3); + return 1; } if (libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */ 1)) { fprintf(stderr, "cannot set domid %d dynamic max memory to : %s\n", domid, mem); - return EXIT_FAILURE; + return 1; } - return EXIT_SUCCESS; + return 0; } int main_memset(int argc, char **argv) @@ -3449,7 +3453,11 @@ int main_memset(int argc, char **argv) domid = find_domain(argv[optind]); mem = argv[optind + 1]; - return set_memory_target(domid, mem); + if (set_memory_target(domid, mem)) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; } static int cd_insert(uint32_t domid, const char *virtdev, char *phys) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |