xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
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 5/9 v2] xl: Improve return and exit codes of pause, destroy and shutdown related functions.
Date: Wed,  9 Mar 2016 00:32:06 +0530	[thread overview]
Message-ID: <1457463730-4712-6-git-send-email-write.harmandeep@gmail.com> (raw)
In-Reply-To: <1457463730-4712-1-git-send-email-write.harmandeep@gmail.com>

destroy_domain(), wait_for_domain_deaths(), shutdown_domain(),
reboot_domain(), main_pause(), main_unpause(), main_destroy()
and main_shutdown_or_reboot() are fixed.

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
---
v2: No changes.
---
 tools/libxl/xl_cmdimpl.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 5cedfe8..02aec34 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3705,10 +3705,10 @@ static void destroy_domain(uint32_t domid, int force)
         fprintf(stderr, "Not destroying domain 0; use -f to force.\n"
                         "This can only be done when using a disaggregated "
                         "hardware domain and toolstack.\n\n");
-        exit(-1);
+        exit(EXIT_FAILURE);
     }
     rc = libxl_domain_destroy(ctx, domid, 0);
-    if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(-1); }
+    if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(EXIT_FAILURE); }
 }
 
 static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr)
@@ -3720,7 +3720,7 @@ static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr)
         rc = libxl_event_wait(ctx, &event, LIBXL_EVENTMASK_ALL, 0,0);
         if (rc) {
             LOG("Failed to get event, quitting (rc=%d)", rc);
-            exit(-1);
+            exit(EXIT_FAILURE);
         }
 
         switch (event->type) {
@@ -3765,14 +3765,14 @@ static void shutdown_domain(uint32_t domid,
     }
 
     if (rc) {
-        fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(-1);
+        fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(EXIT_FAILURE);
     }
 
     if (deathw) {
         rc = libxl_evenable_domain_death(ctx, domid, for_user, deathw);
         if (rc) {
             fprintf(stderr,"wait for death failed (evgen, rc=%d)\n",rc);
-            exit(-1);
+            exit(EXIT_FAILURE);
         }
     }
 }
@@ -3796,14 +3796,14 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw,
         }
     }
     if (rc) {
-        fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(-1);
+        fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(EXIT_FAILURE);
     }
 
     if (deathw) {
         rc = libxl_evenable_domain_death(ctx, domid, for_user, deathw);
         if (rc) {
             fprintf(stderr,"wait for death failed (evgen, rc=%d)\n",rc);
-            exit(-1);
+            exit(EXIT_FAILURE);
         }
     }
 }
@@ -4802,7 +4802,7 @@ int main_pause(int argc, char **argv)
 
     pause_domain(find_domain(argv[optind]));
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_unpause(int argc, char **argv)
@@ -4815,7 +4815,7 @@ int main_unpause(int argc, char **argv)
 
     unpause_domain(find_domain(argv[optind]));
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_destroy(int argc, char **argv)
@@ -4830,7 +4830,7 @@ int main_destroy(int argc, char **argv)
     }
 
     destroy_domain(find_domain(argv[optind]), force);
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
@@ -4862,7 +4862,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
 
     if (!argv[optind] && !all) {
         fprintf(stderr, "You must specify -a or a domain id.\n\n");
-        return opt;
+        return EXIT_FAILURE;
     }
 
     if (all) {
@@ -4870,7 +4870,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
         libxl_evgen_domain_death **deathws = NULL;
         if (!(dominfo = libxl_list_domain(ctx, &nb_domain))) {
             fprintf(stderr, "libxl_list_domain failed.\n");
-            return -1;
+            return EXIT_FAILURE;
         }
 
         if (wait_for_it)
@@ -4901,7 +4901,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
     }
 
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_shutdown(int argc, char **argv)
-- 
2.5.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  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 ` [PATCH 2/9 v2] xl: Improve return and exit codes of restore and save " Harmandeep Kaur
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 ` Harmandeep Kaur [this message]
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-6-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).