From: Harmandeep Kaur <write.harmandeep@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, dario.faggioli@citrix.com,
ian.jackson@eu.citrix.com,
Harmandeep Kaur <write.harmandeep@gmail.com>
Subject: [PATCH 2/9 v2] xl: Improve return and exit codes of restore and save related functions.
Date: Wed, 9 Mar 2016 00:32:03 +0530 [thread overview]
Message-ID: <1457463730-4712-3-git-send-email-write.harmandeep@gmail.com> (raw)
In-Reply-To: <1457463730-4712-1-git-send-email-write.harmandeep@gmail.com>
save_domain(), main_restore(), main_save() and main_remus() in the file
xl_cmdimpl are fixed.
Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
---
v2: Add main_remus().
Remove create_domain().
---
tools/libxl/xl_cmdimpl.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 088971e..690eb91 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4131,7 +4131,7 @@ static int save_domain(uint32_t domid, const char *filename, int checkpoint,
fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (fd < 0) {
fprintf(stderr, "Failed to open temp file %s for writing\n", filename);
- exit(2);
+ exit(EXIT_FAILURE);
}
save_domain_core_writeconfig(fd, filename, config_data, config_len);
@@ -4151,7 +4151,7 @@ static int save_domain(uint32_t domid, const char *filename, int checkpoint,
else
libxl_domain_destroy(ctx, domid, 0);
- exit(rc < 0 ? 1 : 0);
+ exit(rc < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
static pid_t create_migration_child(const char *rune, int *send_fd,
@@ -4625,7 +4625,7 @@ int main_restore(int argc, char **argv)
checkpoint_file = argv[optind + 1];
} else {
help("restore");
- return 2;
+ return EXIT_FAILURE;
}
memset(&dom_info, 0, sizeof(dom_info));
@@ -4642,9 +4642,9 @@ int main_restore(int argc, char **argv)
rc = create_domain(&dom_info);
if (rc < 0)
- return -rc;
+ return EXIT_FAILURE;
- return 0;
+ return EXIT_SUCCESS;
}
int main_migrate_receive(int argc, char **argv)
@@ -4700,7 +4700,7 @@ int main_save(int argc, char **argv)
if (argc-optind > 3) {
help("save");
- return 2;
+ return EXIT_FAILURE;
}
domid = find_domain(argv[optind]);
@@ -4709,7 +4709,7 @@ int main_save(int argc, char **argv)
config_filename = argv[optind + 2];
save_domain(domid, filename, checkpoint, leavepaused, config_filename);
- return 0;
+ return EXIT_SUCCESS;
}
int main_migrate(int argc, char **argv)
@@ -8085,7 +8085,7 @@ int main_remus(int argc, char **argv)
send_fd = open("/dev/null", O_RDWR, 0644);
if (send_fd < 0) {
perror("failed to open /dev/null");
- exit(-1);
+ exit(EXIT_FAILURE);
}
} else {
@@ -8102,7 +8102,7 @@ int main_remus(int argc, char **argv)
if (!config_len) {
fprintf(stderr, "No config file stored for running domain and "
"none supplied - cannot start remus.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
child = create_migration_child(rune, &send_fd, &recv_fd);
@@ -8123,7 +8123,7 @@ int main_remus(int argc, char **argv)
if (libxl_domain_info(ctx, 0, domid)) {
fprintf(stderr, "Remus: Primary domain has been destroyed.\n");
close(send_fd);
- return 0;
+ return EXIT_SUCCESS;
}
/* If we are here, it means remus setup/domain suspend/backup has
@@ -8138,7 +8138,7 @@ int main_remus(int argc, char **argv)
}
close(send_fd);
- return -ERROR_FAIL;
+ return EXIT_FAILURE;
}
#endif
--
2.5.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-08 19:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 19:02 [PATCH 0/9 v2] xl: convert exit codes related to domain subcommands to EXIT_[SUCCESS|FAILURE] Harmandeep Kaur
2016-03-08 19:02 ` [PATCH 1/9 v2] xl: Improve return and exit codes of memory related functions Harmandeep Kaur
2016-03-08 19:02 ` Harmandeep Kaur [this message]
2016-03-08 19:02 ` [PATCH 3/9 v2] xl: Improve return and exit codes of migrate " Harmandeep Kaur
2016-03-08 19:02 ` [PATCH 4/9 v2] xl: Improve return and exit codes of console, vnc and core dump " Harmandeep Kaur
2016-03-08 19:02 ` [PATCH 5/9 v2] xl: Improve return and exit codes of pause, destroy and shutdown " Harmandeep Kaur
2016-03-08 19:02 ` [PATCH 6/9 v2] xl: Improve return and exit codes of list " Harmandeep Kaur
2016-03-08 19:02 ` [PATCH 7/9 v2] xl: Improve return and exit codes of create, config_update and rename " Harmandeep Kaur
2016-03-08 19:02 ` [PATCH 8/9 v2] xl : Improve return and exit codes debugging, special keys and triggering " Harmandeep Kaur
2016-03-08 19:02 ` [PATCH 9/9 v2] xl: Improve return and exit codes of domain id and name " Harmandeep Kaur
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=1457463730-4712-3-git-send-email-write.harmandeep@gmail.com \
--to=write.harmandeep@gmail.com \
--cc=dario.faggioli@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.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).