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 3/3] xl: convert cpupool related return codes to EXIT_[SUCCESS|FAILURE]
Date: Fri, 23 Oct 2015 13:18:11 +0530 [thread overview]
Message-ID: <1445586491-15093-3-git-send-email-write.harmandeep@gmail.com> (raw)
In-Reply-To: <1445586491-15093-1-git-send-email-write.harmandeep@gmail.com>
turning cpupools 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 | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 2cb4fe8..c7009cf 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -7497,7 +7497,7 @@ out:
free(name);
free(config_data);
free(extra_config);
- return rc;
+ return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}
int main_cpupoollist(int argc, char **argv)
@@ -7524,14 +7524,14 @@ int main_cpupoollist(int argc, char **argv)
pool = argv[optind];
if (libxl_name_to_cpupoolid(ctx, pool, &poolid)) {
fprintf(stderr, "Pool \'%s\' does not exist\n", pool);
- return 1;
+ return EXIT_FAILURE;
}
}
poolinfo = libxl_list_cpupool(ctx, &n_pools);
if (!poolinfo) {
fprintf(stderr, "error getting cpupool info\n");
- return 1;
+ return EXIT_FAILURE;
}
printf("%-19s", "Name");
@@ -7562,7 +7562,7 @@ int main_cpupoollist(int argc, char **argv)
libxl_cpupoolinfo_list_free(poolinfo, n_pools);
- return 0;
+ return EXIT_SUCCESS;
}
int main_cpupooldestroy(int argc, char **argv)
@@ -7580,13 +7580,13 @@ int main_cpupooldestroy(int argc, char **argv)
if (libxl_cpupool_qualifier_to_cpupoolid(ctx, pool, &poolid, NULL) ||
!libxl_cpupoolid_is_valid(ctx, poolid)) {
fprintf(stderr, "unknown cpupool '%s'\n", pool);
- return 1;
+ return EXIT_FAILURE;
}
if (libxl_cpupool_destroy(ctx, poolid))
- return 1;
+ return EXIT_FAILURE;
- return 0;
+ return EXIT_SUCCESS;
}
int main_cpupoolrename(int argc, char **argv)
@@ -7605,17 +7605,17 @@ int main_cpupoolrename(int argc, char **argv)
if (libxl_cpupool_qualifier_to_cpupoolid(ctx, pool, &poolid, NULL) ||
!libxl_cpupoolid_is_valid(ctx, poolid)) {
fprintf(stderr, "unknown cpupool '%s'\n", pool);
- return 1;
+ return EXIT_FAILURE;
}
new_name = argv[optind];
if (libxl_cpupool_rename(ctx, new_name, poolid)) {
fprintf(stderr, "Can't rename cpupool '%s'\n", pool);
- return 1;
+ return EXIT_FAILURE;
}
- return 0;
+ return EXIT_SUCCESS;
}
int main_cpupoolcpuadd(int argc, char **argv)
@@ -7633,7 +7633,7 @@ int main_cpupoolcpuadd(int argc, char **argv)
libxl_bitmap_init(&cpumap);
if (libxl_cpu_bitmap_alloc(ctx, &cpumap, 0)) {
fprintf(stderr, "Unable to allocate cpumap");
- return 1;
+ return EXIT_FAILURE;
}
pool = argv[optind++];
@@ -7653,7 +7653,7 @@ int main_cpupoolcpuadd(int argc, char **argv)
out:
libxl_bitmap_dispose(&cpumap);
- return rc;
+ return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}
int main_cpupoolcpuremove(int argc, char **argv)
@@ -7667,7 +7667,7 @@ int main_cpupoolcpuremove(int argc, char **argv)
libxl_bitmap_init(&cpumap);
if (libxl_cpu_bitmap_alloc(ctx, &cpumap, 0)) {
fprintf(stderr, "Unable to allocate cpumap");
- return 1;
+ return EXIT_FAILURE;
}
SWITCH_FOREACH_OPT(opt, "", NULL, "cpupool-cpu-remove", 2) {
@@ -7691,7 +7691,7 @@ int main_cpupoolcpuremove(int argc, char **argv)
out:
libxl_bitmap_dispose(&cpumap);
- return rc;
+ return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}
int main_cpupoolmigrate(int argc, char **argv)
@@ -7712,19 +7712,19 @@ int main_cpupoolmigrate(int argc, char **argv)
if (libxl_domain_qualifier_to_domid(ctx, dom, &domid) ||
!libxl_domid_to_name(ctx, domid)) {
fprintf(stderr, "unknown domain '%s'\n", dom);
- return 1;
+ return EXIT_FAILURE;
}
if (libxl_cpupool_qualifier_to_cpupoolid(ctx, pool, &poolid, NULL) ||
!libxl_cpupoolid_is_valid(ctx, poolid)) {
fprintf(stderr, "unknown cpupool '%s'\n", pool);
- return 1;
+ return EXIT_FAILURE;
}
if (libxl_cpupool_movedomain(ctx, poolid, domid))
- return 1;
+ return EXIT_FAILURE;
- return 0;
+ return EXIT_SUCCESS;
}
int main_cpupoolnumasplit(int argc, char **argv)
@@ -7758,7 +7758,7 @@ int main_cpupoolnumasplit(int argc, char **argv)
poolinfo = libxl_list_cpupool(ctx, &n_pools);
if (!poolinfo) {
fprintf(stderr, "error getting cpupool info\n");
- return 1;
+ return EXIT_FAILURE;
}
poolid = poolinfo[0].poolid;
sched = poolinfo[0].sched;
@@ -7766,13 +7766,13 @@ int main_cpupoolnumasplit(int argc, char **argv)
if (n_pools > 1) {
fprintf(stderr, "splitting not possible, already cpupools in use\n");
- return 1;
+ return EXIT_FAILURE;
}
topology = libxl_get_cpu_topology(ctx, &n_cpus);
if (topology == NULL) {
fprintf(stderr, "libxl_get_topologyinfo failed\n");
- return 1;
+ return EXIT_FAILURE;
}
if (libxl_cpu_bitmap_alloc(ctx, &cpumap, 0)) {
@@ -7869,7 +7869,7 @@ out:
libxl_dominfo_dispose(&info);
free(name);
- return rc;
+ return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}
int main_getenforce(int argc, char **argv)
--
1.9.1
next prev parent 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 [PATCH 1/3] xl: convert scheduling related return codes to EXIT_[SUCCESS|FAILURE] Harmandeep Kaur
2015-10-23 7:48 ` [PATCH 2/3] xl: convert vcpu " Harmandeep Kaur
2015-10-23 10:41 ` Dario Faggioli
2015-10-23 7:48 ` Harmandeep Kaur [this message]
2015-10-23 12:10 ` [PATCH 3/3] xl: convert cpupool " 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-3-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.