[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxc: improve error handling of xc Credit1 and Credit2 helpers
commit 9ef164f8b9e5db09efee6b93e71c842585bd4c0a Author: Dario Faggioli <dario.faggioli@xxxxxxxxxx> AuthorDate: Wed Sep 28 16:04:30 2016 +0100 Commit: George Dunlap <george.dunlap@xxxxxxxxxx> CommitDate: Wed Sep 28 16:05:01 2016 +0100 libxc: improve error handling of xc Credit1 and Credit2 helpers In fact, libxc wrappers should, on error, set errno and return -1. Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxc/xc_csched.c | 27 +++++++++++++++------------ tools/libxc/xc_csched2.c | 15 +++++++++------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/tools/libxc/xc_csched.c b/tools/libxc/xc_csched.c index bf03bfc..139fc16 100644 --- a/tools/libxc/xc_csched.c +++ b/tools/libxc/xc_csched.c @@ -37,7 +37,10 @@ xc_sched_credit_domain_set( domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; domctl.u.scheduler_op.u.credit = *sdom; - return do_domctl(xch, &domctl); + if ( do_domctl(xch, &domctl) ) + return -1; + + return 0; } int @@ -47,18 +50,18 @@ xc_sched_credit_domain_get( struct xen_domctl_sched_credit *sdom) { DECLARE_DOMCTL; - int err; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = (domid_t) domid; domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo; - err = do_domctl(xch, &domctl); - if ( err == 0 ) - *sdom = domctl.u.scheduler_op.u.credit; + if ( do_domctl(xch, &domctl) ) + return -1; + + *sdom = domctl.u.scheduler_op.u.credit; - return err; + return 0; } int @@ -67,7 +70,6 @@ xc_sched_credit_params_set( uint32_t cpupool_id, struct xen_sysctl_credit_schedule *schedule) { - int rc; DECLARE_SYSCTL; sysctl.cmd = XEN_SYSCTL_scheduler_op; @@ -77,11 +79,12 @@ xc_sched_credit_params_set( sysctl.u.scheduler_op.u.sched_credit = *schedule; - rc = do_sysctl(xch, &sysctl); + if ( do_sysctl(xch, &sysctl) ) + return -1; *schedule = sysctl.u.scheduler_op.u.sched_credit; - return rc; + return 0; } int @@ -90,7 +93,6 @@ xc_sched_credit_params_get( uint32_t cpupool_id, struct xen_sysctl_credit_schedule *schedule) { - int rc; DECLARE_SYSCTL; sysctl.cmd = XEN_SYSCTL_scheduler_op; @@ -98,9 +100,10 @@ xc_sched_credit_params_get( sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT; sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_getinfo; - rc = do_sysctl(xch, &sysctl); + if ( do_sysctl(xch, &sysctl) ) + return -1; *schedule = sysctl.u.scheduler_op.u.sched_credit; - return rc; + return 0; } diff --git a/tools/libxc/xc_csched2.c b/tools/libxc/xc_csched2.c index 5b62a5f..12c95e6 100644 --- a/tools/libxc/xc_csched2.c +++ b/tools/libxc/xc_csched2.c @@ -37,7 +37,10 @@ xc_sched_credit2_domain_set( domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; domctl.u.scheduler_op.u.credit2 = *sdom; - return do_domctl(xch, &domctl); + if ( do_domctl(xch, &domctl) ) + return -1; + + return 0; } int @@ -47,18 +50,18 @@ xc_sched_credit2_domain_get( struct xen_domctl_sched_credit2 *sdom) { DECLARE_DOMCTL; - int err; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = (domid_t) domid; domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT2; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo; - err = do_domctl(xch, &domctl); - if ( err == 0 ) - *sdom = domctl.u.scheduler_op.u.credit2; + if ( do_domctl(xch, &domctl) ) + return -1; + + *sdom = domctl.u.scheduler_op.u.credit2; - return err; + return 0; } int -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |