]> xenbits.xensource.com Git - xen.git/commit
libxl: Fix libxl_set_memory_target return value
authorGeorge Dunlap <George.Dunlap@eu.citrix.com>
Mon, 9 May 2016 11:30:55 +0000 (13:30 +0200)
committerWei Liu <wei.liu2@citrix.com>
Thu, 9 Jun 2016 15:31:56 +0000 (16:31 +0100)
commitecdc6fd8787b9e01e53d85e995ce8a495d8d93a5
treef7820d37f761caf6d1ba85a28c6c9d1a23f421d6
parent63710aa95a2f809ccb457662b62b46ef7f67e783
libxl: Fix libxl_set_memory_target return value

libxl_set_memory_target seems to have the following return values:

 '1' : on failure, if the failure happens because of a xenstore error
       *or* invalid target
 '-1': on error, the setmaxmem and set_pod_target hypercalls
       return -1 and set errno appropriately.
 '0' : on success

Make it consistently return ERROR_FAIL on failure, unless the
parameters were invalid, in which case return ERROR_INVAL.

In accordance with CODING_SYTLE:

  1. Leave rc uninitialized, and set when an error is detected

  2. Use 'r' for return values to functions whose return values are a
     different error space (like xc_domain_setmaxmem and
     xc_domain_set_pod_target)

  3. Use 'lrc' for return values to local functions libxl__*
     where a failure means retry, rather than fail the whole function
     (libxl__fill_dom0_memory_info), to reduce the risk of that.

Signed-off-by: George Dunlap <George.Dunlap@eu.citrix.com>
Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@gmail.com>
Reviewed-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c