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

Re: [Xen-devel] [PATCH v3 5/5] xl: improve return and exit codes of parse related functions



On Tue, 2015-10-27 at 15:20 +0530, Harmandeep Kaur wrote:
> Turning  parsing related functions exit codes towards using the
> EXIT_[SUCCESS|FAILURE] constants, instead of instead of arbitrary
> numbers
> or libxl return codes.
>       - for main_*: arbitrary -> EXIT_SUCCESS|EXIT_FAILURE.
>       - for internal fucntion: arbitrary -> 0/1.
> 
> Don't touch parse_config_data() which is big enough to deserve its
> own patch.
> 
> Signed-off-by: Harmandeep Kaur <write.harmandeep@xxxxxxxxx>
> ---
> v2->v3: Reverted return of parse_mem_size_kb() to -1.
>       And exculded out of scope changes.
> 
There are a couple more of out of scope changes, though, at least
according to me. So, as Wei also said for patch 1, if you send v4 of
this series and, as far as this patch is concerned, you only...

> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 76d9af6..1ddf144 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c

> @@ -3118,6 +3118,7 @@ void help(const char *command)
>      }
>  }
>  
> +/* Function returns -1 if the parsing fails */
>  static int64_t parse_mem_size_kb(const char *mem)
>  {
>      char *endptr;
> @@ -3264,7 +3265,7 @@ 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);
> +        exit(EXIT_FAILURE);
>      }
>  
>      rc = libxl_domain_setmaxmem(ctx, domid, memorykb);
> @@ -3302,7 +3303,7 @@ static void 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);
> +        exit(EXIT_FAILURE);
>      }
>  
>      libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */
> 1);
>
... Leave these two functions alone (set_memory_max() and
 set_memory_target()), then you can add the following tag to the
changelog:

Reviewed-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>

Thanks and Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
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®.