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 9/9 v2] xl: Improve return and exit codes of domain id and name related functions.
Date: Wed,  9 Mar 2016 00:32:10 +0530	[thread overview]
Message-ID: <1457463730-4712-10-git-send-email-write.harmandeep@gmail.com> (raw)
In-Reply-To: <1457463730-4712-1-git-send-email-write.harmandeep@gmail.com>

find_domain(), main_domid() and main_domname() are fixed.

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
---
v2: Add find_domain().
---
 tools/libxl/xl_cmdimpl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 4b2ae68..883589b 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -172,7 +172,7 @@ static uint32_t find_domain(const char *p)
     rc = libxl_domain_qualifier_to_domid(ctx, p, &domid);
     if (rc) {
         fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc);
-        exit(2);
+        exit(EXIT_FAILURE);
     }
     common_domname = libxl_domid_to_name(ctx, domid);
     return domid;
@@ -6335,12 +6335,12 @@ int main_domid(int argc, char **argv)
 
     if (libxl_name_to_domid(ctx, domname, &domid)) {
         fprintf(stderr, "Can't get domid of domain name '%s', maybe this domain does not exist.\n", domname);
-        return 1;
+        return EXIT_FAILURE;
     }
 
     printf("%d\n", domid);
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_domname(int argc, char **argv)
@@ -6358,19 +6358,19 @@ int main_domname(int argc, char **argv)
     if (domid == 0 && !strcmp(endptr, argv[optind])) {
         /*no digits at all*/
         fprintf(stderr, "Invalid domain id.\n\n");
-        return 1;
+        return EXIT_FAILURE;
     }
 
     domname = libxl_domid_to_name(ctx, domid);
     if (!domname) {
         fprintf(stderr, "Can't get domain name of domain id '%d', maybe this domain does not exist.\n", domid);
-        return 1;
+        return EXIT_FAILURE;
     }
 
     printf("%s\n", domname);
     free(domname);
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_rename(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:03 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 ` [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 ` Harmandeep Kaur [this message]

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-10-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).