From: Harmandeep Kaur <write.harmandeep@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: lars.kurth@citrix.com, wei.liu2@citrix.com,
ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com,
dario.faggioli@citrix.com, ian.jackson@eu.citrix.com,
george.dunlap@citrix.com,
Harmandeep Kaur <write.harmandeep@gmail.com>
Subject: [PATCH v2 3/5] xl: improve return and exit codes of vcpu related functions
Date: Sat, 24 Oct 2015 11:01:34 +0530 [thread overview]
Message-ID: <1445664696-14258-4-git-send-email-write.harmandeep@gmail.com> (raw)
In-Reply-To: <1445664696-14258-1-git-send-email-write.harmandeep@gmail.com>
turning vcpu manipulation functions xl exit codes toward 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 | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 718be54..f71a7f0 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5316,7 +5316,7 @@ int main_vcpulist(int argc, char **argv)
}
vcpulist(argc - optind, argv + optind);
- return 0;
+ return EXIT_SUCCESS;
}
int main_vcpupin(int argc, char **argv)
@@ -5332,7 +5332,7 @@ int main_vcpupin(int argc, char **argv)
long vcpuid;
const char *vcpu, *hard_str, *soft_str;
char *endptr;
- int opt, nb_cpu, nb_vcpu, rc = -1;
+ int opt, nb_cpu, nb_vcpu, rc = EXIT_FAILURE;
libxl_bitmap_init(&cpumap_hard);
libxl_bitmap_init(&cpumap_soft);
@@ -5407,10 +5407,10 @@ int main_vcpupin(int argc, char **argv)
if (ferror(stdout) || fflush(stdout)) {
perror("stdout");
- exit(-1);
+ exit(EXIT_FAILURE);
}
- rc = 0;
+ rc = EXIT_SUCCESS;
goto out;
}
@@ -5430,7 +5430,7 @@ int main_vcpupin(int argc, char **argv)
libxl_vcpuinfo_list_free(vcpuinfo, nb_vcpu);
}
- rc = 0;
+ rc = EXIT_SUCCESS;
out:
libxl_bitmap_dispose(&cpumap_soft);
libxl_bitmap_dispose(&cpumap_hard);
@@ -5459,8 +5459,7 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, int check_host)
unsigned int host_cpu = libxl_get_max_cpus(ctx);
libxl_dominfo dominfo;
- rc = libxl_domain_info(ctx, &dominfo, domid);
- if (rc)
+ if (libxl_domain_info(ctx, &dominfo, domid))
return 1;
if (max_vcpus > dominfo.vcpu_online && max_vcpus > host_cpu) {
@@ -5473,8 +5472,7 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, int check_host)
if (rc)
return 1;
}
- rc = libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus);
- if (rc) {
+ if (libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus)){
fprintf(stderr, "libxl_cpu_bitmap_alloc failed, rc: %d\n", rc);
return 1;
}
@@ -5508,7 +5506,9 @@ int main_vcpuset(int argc, char **argv)
break;
}
- return vcpuset(find_domain(argv[optind]), argv[optind + 1], check_host);
+ if (vcpuset(find_domain(argv[optind]), argv[optind + 1], check_host))
+ return EXIT_FAILURE;
+ else return EXIT_SUCCESS;
}
static void output_xeninfo(void)
--
1.9.1
next prev parent reply other threads:[~2015-10-24 5:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-24 5:31 [PATCH v2 0/5] xl: convert exit codes to EXIT_[SUCCESS|FAILURE] Harmandeep Kaur
2015-10-24 5:31 ` [PATCH v2 1/5] " Harmandeep Kaur
2015-10-26 9:32 ` Dario Faggioli
2015-10-26 17:39 ` Wei Liu
2015-10-24 5:31 ` [PATCH v2 2/5] xl: improve return and exit codes of scheduling related functions Harmandeep Kaur
2015-10-26 9:56 ` Dario Faggioli
2015-10-24 5:31 ` Harmandeep Kaur [this message]
2015-10-26 10:03 ` [PATCH v2 3/5] xl: improve return and exit codes of vcpu " Dario Faggioli
2015-10-24 5:31 ` [PATCH v2 4/5] xl: improve return and exit codes of cpupool " Harmandeep Kaur
2015-10-26 10:06 ` Dario Faggioli
2015-10-24 5:31 ` [PATCH v2 5/5] xl: improve return and exit codes of parse " Harmandeep Kaur
2015-10-26 10:34 ` Dario Faggioli
2015-10-26 10:40 ` Dario Faggioli
2015-10-26 17:54 ` Wei Liu
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=1445664696-14258-4-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=lars.kurth@citrix.com \
--cc=stefano.stabellini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).