tmem: Unify XEN_SYSCTL_TMEM_OP_[[SAVE_[BEGIN|END]|RESTORE_BEGIN]
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 26 Sep 2016 15:05:09 +0000 (11:05 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 30 Sep 2016 19:26:57 +0000 (15:26 -0400)
commit4ca5e0103d0c713e9ec9fefe4ca9351abc342ad7
treec38ca454ec5c84c1037764dc59b4263a9518e04f
parentc4a398701ecf07a24ca391cbdc4a84fcca7c8d69
tmem: Unify XEN_SYSCTL_TMEM_OP_[[SAVE_[BEGIN|END]|RESTORE_BEGIN]

return values. For success they used to be 1 ([SAVE,RESTORE]_BEGIN),
0 if guest did not have any tmem (but only for SAVE_BEGIN), and
-1 for any type of failure.

And SAVE_END (which you would think would mirror SAVE_BEGIN)
had 0 for success and -1 if guest did not any tmem enabled for it.

This is confusing. Now the code will return 0 if the operation was
success.  Various XEN_EXX values are returned if tmem is not enabled
or the operation could not performed.

The xc_tmem.c code only needs one place to check - where we use
SAVE_BEGIN. The place where RESTORE_BEGIN is used will have errno
with the proper error value and return will be -1, so will still
fail properly.

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
tools/libxc/xc_tmem.c
xen/common/tmem.c