From: Harmandeep Kaur <write.harmandeep@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: stefano.stebellini@eu.citrix.com, wei.liu2@citrix.com,
ian.campbell@citrix.com, dario.faggioli@citrix.com,
ian.jackson@eu.citrix.com, george.dunlap@citrix.com,
Harmandeep Kaur <write.harmandeep@gmail.com>
Subject: [PATCH 1/3] xl: convert scheduling related return codes to EXIT_[SUCCESS|FAILURE]
Date: Fri, 23 Oct 2015 13:18:09 +0530 [thread overview]
Message-ID: <1445586491-15093-1-git-send-email-write.harmandeep@gmail.com> (raw)
turning scheduling related functions xl exit codes towards using the
EXIT_[SUCCESS|FAILURE] macros, instead of instead of arbitrary numbers
or libxl return codes.
Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
---
tools/libxl/xl_cmdimpl.c | 67 ++++++++++++++++++++++++------------------------
1 file changed, 33 insertions(+), 34 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 365798b..c215c14 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5851,13 +5851,13 @@ static int sched_credit_domain_output(int domid)
if (domid < 0) {
printf("%-33s %4s %6s %4s\n", "Name", "ID", "Weight", "Cap");
- return 0;
+ return EXIT_SUCCESS;
}
libxl_domain_sched_params_init(&scinfo);
rc = sched_domain_get(LIBXL_SCHEDULER_CREDIT, domid, &scinfo);
if (rc)
- return rc;
+ return EXIT_FAILURE;
domname = libxl_domid_to_name(ctx, domid);
printf("%-33s %4d %6d %4d\n",
domname,
@@ -5866,7 +5866,7 @@ static int sched_credit_domain_output(int domid)
scinfo.cap);
free(domname);
libxl_domain_sched_params_dispose(&scinfo);
- return 0;
+ return EXIT_SUCCESS;
}
static int sched_credit_pool_output(uint32_t poolid)
@@ -5887,7 +5887,7 @@ static int sched_credit_pool_output(uint32_t poolid)
scparam.ratelimit_us);
}
free(poolname);
- return 0;
+ return EXIT_SUCCESS;
}
static int sched_credit2_domain_output(
@@ -5899,13 +5899,13 @@ static int sched_credit2_domain_output(
if (domid < 0) {
printf("%-33s %4s %6s\n", "Name", "ID", "Weight");
- return 0;
+ return EXIT_SUCCESS;
}
libxl_domain_sched_params_init(&scinfo);
rc = sched_domain_get(LIBXL_SCHEDULER_CREDIT2, domid, &scinfo);
if (rc)
- return rc;
+ return EXIT_FAILURE;
domname = libxl_domid_to_name(ctx, domid);
printf("%-33s %4d %6d\n",
domname,
@@ -5913,7 +5913,7 @@ static int sched_credit2_domain_output(
scinfo.weight);
free(domname);
libxl_domain_sched_params_dispose(&scinfo);
- return 0;
+ return EXIT_SUCCESS;
}
static int sched_rtds_domain_output(
@@ -5925,13 +5925,14 @@ static int sched_rtds_domain_output(
if (domid < 0) {
printf("%-33s %4s %9s %9s\n", "Name", "ID", "Period", "Budget");
- return 0;
+ return EXIT_SUCCESS;
}
libxl_domain_sched_params_init(&scinfo);
rc = sched_domain_get(LIBXL_SCHEDULER_RTDS, domid, &scinfo);
if (rc)
- goto out;
+ libxl_domain_sched_params_dispose(&scinfo);
+ return EXIT_FAILURE;
domname = libxl_domid_to_name(ctx, domid);
printf("%-33s %4d %9d %9d\n",
@@ -5940,10 +5941,8 @@ static int sched_rtds_domain_output(
scinfo.period,
scinfo.budget);
free(domname);
-
-out:
libxl_domain_sched_params_dispose(&scinfo);
- return rc;
+ return EXIT_SUCCESS;
}
static int sched_rtds_pool_output(uint32_t poolid)
@@ -5954,7 +5953,7 @@ static int sched_rtds_pool_output(uint32_t poolid)
printf("Cpupool %s: sched=RTDS\n", poolname);
free(poolname);
- return 0;
+ return EXIT_SUCCESS;
}
static int sched_default_pool_output(uint32_t poolid)
@@ -5965,7 +5964,7 @@ static int sched_default_pool_output(uint32_t poolid)
printf("Cpupool %s:\n",
poolname);
free(poolname);
- return 0;
+ return EXIT_SUCCESS;
}
static int sched_domain_output(libxl_scheduler sched, int (*output)(int),
@@ -5981,14 +5980,14 @@ static int sched_domain_output(libxl_scheduler sched, int (*output)(int),
if (libxl_cpupool_qualifier_to_cpupoolid(ctx, cpupool, &poolid, NULL) ||
!libxl_cpupoolid_is_valid(ctx, poolid)) {
fprintf(stderr, "unknown cpupool \'%s\'\n", cpupool);
- return -ERROR_FAIL;
+ return EXIT_FAILURE;
}
}
info = libxl_list_domain(ctx, &nb_domain);
if (!info) {
fprintf(stderr, "libxl_list_domain failed.\n");
- return 1;
+ return EXIT_FAILURE;
}
poolinfo = libxl_list_cpupool(ctx, &n_pools);
if (!poolinfo) {
@@ -6016,7 +6015,7 @@ static int sched_domain_output(libxl_scheduler sched, int (*output)(int),
libxl_cpupoolinfo_list_free(poolinfo, n_pools);
libxl_dominfo_list_free(info, nb_domain);
- return 0;
+ return EXIT_SUCCESS;
}
/*
@@ -6080,16 +6079,16 @@ int main_sched_credit(int argc, char **argv)
if ((cpupool || opt_s) && (dom || opt_w || opt_c)) {
fprintf(stderr, "Specifying a cpupool or schedparam is not "
"allowed with domain options.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (!dom && (opt_w || opt_c)) {
fprintf(stderr, "Must specify a domain.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (!opt_s && (opt_t || opt_r)) {
fprintf(stderr, "Must specify schedparam to set schedule "
"parameter values.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (opt_s) {
@@ -6101,7 +6100,7 @@ int main_sched_credit(int argc, char **argv)
&poolid, NULL) ||
!libxl_cpupoolid_is_valid(ctx, poolid)) {
fprintf(stderr, "unknown cpupool \'%s\'\n", cpupool);
- return -ERROR_FAIL;
+ return EXIT_FAILURE;
}
}
@@ -6110,7 +6109,7 @@ int main_sched_credit(int argc, char **argv)
} else { /* Set scheduling parameters*/
rc = sched_credit_params_get(poolid, &scparam);
if (rc)
- return -rc;
+ return EXIT_FAILURE;
if (opt_t)
scparam.tslice_ms = tslice;
@@ -6120,7 +6119,7 @@ int main_sched_credit(int argc, char **argv)
rc = sched_credit_params_set(poolid, &scparam);
if (rc)
- return -rc;
+ return EXIT_FAILURE;
}
} else if (!dom) { /* list all domain's credit scheduler info */
return -sched_domain_output(LIBXL_SCHEDULER_CREDIT,
@@ -6144,11 +6143,11 @@ int main_sched_credit(int argc, char **argv)
rc = sched_domain_set(domid, &scinfo);
libxl_domain_sched_params_dispose(&scinfo);
if (rc)
- return -rc;
+ return EXIT_FAILURE;
}
}
- return 0;
+ return EXIT_SUCCESS;
}
int main_sched_credit2(int argc, char **argv)
@@ -6180,11 +6179,11 @@ int main_sched_credit2(int argc, char **argv)
if (cpupool && (dom || opt_w)) {
fprintf(stderr, "Specifying a cpupool is not allowed with other "
"options.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (!dom && opt_w) {
fprintf(stderr, "Must specify a domain.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (!dom) { /* list all domain's credit scheduler info */
@@ -6207,11 +6206,11 @@ int main_sched_credit2(int argc, char **argv)
rc = sched_domain_set(domid, &scinfo);
libxl_domain_sched_params_dispose(&scinfo);
if (rc)
- return -rc;
+ return EXIT_FAILURE;
}
}
- return 0;
+ return EXIT_SUCCESS;
}
/*
@@ -6256,15 +6255,15 @@ int main_sched_rtds(int argc, char **argv)
if (cpupool && (dom || opt_p || opt_b)) {
fprintf(stderr, "Specifying a cpupool is not allowed with "
"other options.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (!dom && (opt_p || opt_b)) {
fprintf(stderr, "Must specify a domain.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (opt_p != opt_b) {
fprintf(stderr, "Must specify period and budget\n");
- return 1;
+ return EXIT_FAILURE;
}
if (!dom) { /* list all domain's rt scheduler info */
@@ -6287,11 +6286,11 @@ int main_sched_rtds(int argc, char **argv)
rc = sched_domain_set(domid, &scinfo);
libxl_domain_sched_params_dispose(&scinfo);
if (rc)
- return -rc;
+ return EXIT_FAILURE;
}
}
- return 0;
+ return EXIT_SUCCESS;
}
int main_domid(int argc, char **argv)
--
1.9.1
next reply other threads:[~2015-10-23 7:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 7:48 Harmandeep Kaur [this message]
2015-10-23 7:48 ` [PATCH 2/3] xl: convert vcpu related return codes to EXIT_[SUCCESS|FAILURE] Harmandeep Kaur
2015-10-23 10:41 ` Dario Faggioli
2015-10-23 7:48 ` [PATCH 3/3] xl: convert cpupool " Harmandeep Kaur
2015-10-23 12:10 ` Dario Faggioli
2015-10-23 12:33 ` Harmandeep Kaur
2015-10-23 8:30 ` [PATCH 1/3] xl: convert scheduling " Dario Faggioli
2015-10-23 9:56 ` Ian Campbell
2015-10-23 10:03 ` Dario Faggioli
2015-10-23 10:16 ` Ian Campbell
2015-10-23 10:16 ` Dario Faggioli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445586491-15093-1-git-send-email-write.harmandeep@gmail.com \
--to=write.harmandeep@gmail.com \
--cc=dario.faggioli@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stebellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.