All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
Date: Mon, 20 Jul 2015 16:55:01 +0200	[thread overview]
Message-ID: <1437404102-7807-3-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1437404102-7807-1-git-send-email-roger.pau@citrix.com>

We cannot use the systems errno values when checking return values from Xen,
because some OSes don't have the same set of errno definitions. Instead
use the definitions present in Xen public errno.h header.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
I have not checked if there are other places in libxl that need similar
treatment, I just came around this because FreeBSD doesn't have EBADSLT
defined.
---
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/libxl_psr.c      | 26 +++++++++++++-------------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 2b6b2a0..cf5db8a 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -55,6 +55,7 @@
 #include "xentoollog.h"
 
 #include <xen/io/xenbus.h>
+#include <xen/errno.h>
 
 #ifdef LIBXL_H
 # error libxl.h should be included via libxl_internal.h, not separately
diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c
index 2a07777..5711c38 100644
--- a/tools/libxl/libxl_psr.c
+++ b/tools/libxl/libxl_psr.c
@@ -24,17 +24,17 @@ static void libxl__psr_log_err_msg(libxl__gc *gc, int err)
     char *msg;
 
     switch (err) {
-    case ENOSYS:
-    case EOPNOTSUPP:
+    case XEN_ENOSYS:
+    case XEN_EOPNOTSUPP:
         msg = "unsupported operation";
         break;
-    case ESRCH:
+    case XEN_ESRCH:
         msg = "invalid domain ID";
         break;
-    case EBADSLT:
+    case XEN_EBADSLT:
         msg = "socket is not supported";
         break;
-    case EFAULT:
+    case XEN_EFAULT:
         msg = "failed to exchange data with Xen";
         break;
     default:
@@ -50,16 +50,16 @@ static void libxl__psr_cmt_log_err_msg(libxl__gc *gc, int err)
     char *msg;
 
     switch (err) {
-    case ENODEV:
+    case XEN_ENODEV:
         msg = "CMT is not supported in this system";
         break;
-    case EEXIST:
+    case XEN_EEXIST:
         msg = "CMT is already attached to this domain";
         break;
-    case ENOENT:
+    case XEN_ENOENT:
         msg = "CMT is not attached to this domain";
         break;
-    case EUSERS:
+    case XEN_EUSERS:
         msg = "no free RMID available";
         break;
     default:
@@ -75,16 +75,16 @@ static void libxl__psr_cat_log_err_msg(libxl__gc *gc, int err)
     char *msg;
 
     switch (err) {
-    case ENODEV:
+    case XEN_ENODEV:
         msg = "CAT is not supported in this system";
         break;
-    case ENOENT:
+    case XEN_ENOENT:
         msg = "CAT is not enabled on the socket";
         break;
-    case EUSERS:
+    case XEN_EUSERS:
         msg = "no free COS available";
         break;
-    case EEXIST:
+    case XEN_EEXIST:
         msg = "The same CBM is already set to this domain";
         break;
 
-- 
1.9.5 (Apple Git-50.3)


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

  parent reply	other threads:[~2015-07-20 14:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20 14:54 [PATCH for-4.6 0/3] FreeBSD fixes Roger Pau Monne
2015-07-20 14:55 ` [PATCH for-4.6 1/3] libxl: include sys/endian.h for FreeBSD Roger Pau Monne
2015-07-21  9:36   ` Wei Liu
2015-07-21 14:49     ` Ian Campbell
2015-07-20 14:55 ` Roger Pau Monne [this message]
2015-07-21 11:15   ` [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values Ian Jackson
2015-07-21 11:36     ` Ian Jackson
2015-07-21 11:43       ` Andrew Cooper
2015-07-21 12:40         ` Ian Jackson
2015-07-21 12:47           ` Ian Campbell
2015-07-21 13:14             ` Jan Beulich
2015-07-21 13:30               ` Ian Campbell
2015-07-20 14:55 ` [PATCH for-4.6 3/3] hotplug/FreeBSD: fix xendriverdomain rc.d script Roger Pau Monne
2015-07-21 11:03   ` Wei Liu
2015-07-21 14:49     ` Ian Campbell

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=1437404102-7807-3-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@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.