diff mbox

[v2,for-4.7,3/6] tools/xsplice: fix mixing system errno values with Xen ones.

Message ID 1462272910-41200-4-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné May 3, 2016, 10:55 a.m. UTC
Avoid using system errno values when comparing with Xen errno values.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Using errno values inside of hypercall structs is not right IMHO, but there
are already several occurrences of this. Although I'm adding the correct XEN_
prefixes here, it's very likely that new additions/modifications to this
file will not take this into account, breaking it for OSes != Linux.
---
 tools/misc/xen-xsplice.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Wei Liu May 3, 2016, 11:30 a.m. UTC | #1
On Tue, May 03, 2016 at 12:55:07PM +0200, Roger Pau Monne wrote:
> Avoid using system errno values when comparing with Xen errno values.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> Using errno values inside of hypercall structs is not right IMHO, but there
> are already several occurrences of this. Although I'm adding the correct XEN_
> prefixes here, it's very likely that new additions/modifications to this
> file will not take this into account, breaking it for OSes != Linux.
> ---
>  tools/misc/xen-xsplice.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
> index 598e492..81e422e 100644
> --- a/tools/misc/xen-xsplice.c
> +++ b/tools/misc/xen-xsplice.c
> @@ -13,6 +13,8 @@
>  #include <xenctrl.h>
>  #include <xenstore.h>
>  
> +#include <xen/errno.h>
> +
>  static xc_interface *xch;
>  
>  void show_help(void)
> @@ -233,7 +235,7 @@ struct {
>          .function = xc_xsplice_revert,
>      },
>      {   .allow = XSPLICE_STATE_CHECKED,
> -        .expected = -ENOENT,
> +        .expected = -XEN_ENOENT,
>          .name = "unload",
>          .function = xc_xsplice_unload,
>      },
> @@ -276,7 +278,7 @@ int action_func(int argc, char *argv[], unsigned int idx)
>                  name, errno, strerror(errno));
>          return -1;
>      }
> -    if ( status.rc == -EAGAIN )
> +    if ( status.rc == -XEN_EAGAIN )
>      {
>          fprintf(stderr, "%s failed. Operation already in progress\n", name);
>          return -1;
> @@ -319,7 +321,7 @@ int action_func(int argc, char *argv[], unsigned int idx)
>  
>          if ( status.state != original_state )
>              break;
> -        if ( status.rc && status.rc != -EAGAIN )
> +        if ( status.rc && status.rc != -XEN_EAGAIN )
>          {
>              rc = status.rc;
>              break;
> -- 
> 2.6.4 (Apple Git-63)
>
Konrad Rzeszutek Wilk May 3, 2016, 1:27 p.m. UTC | #2
On Tue, May 03, 2016 at 12:55:07PM +0200, Roger Pau Monne wrote:
> Avoid using system errno values when comparing with Xen errno values.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

And since Wei acked it I may as well put it in now after some tests.

> ---
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> Using errno values inside of hypercall structs is not right IMHO, but there
> are already several occurrences of this. Although I'm adding the correct XEN_
> prefixes here, it's very likely that new additions/modifications to this
> file will not take this into account, breaking it for OSes != Linux.
> ---
>  tools/misc/xen-xsplice.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
> index 598e492..81e422e 100644
> --- a/tools/misc/xen-xsplice.c
> +++ b/tools/misc/xen-xsplice.c
> @@ -13,6 +13,8 @@
>  #include <xenctrl.h>
>  #include <xenstore.h>
>  
> +#include <xen/errno.h>
> +
>  static xc_interface *xch;
>  
>  void show_help(void)
> @@ -233,7 +235,7 @@ struct {
>          .function = xc_xsplice_revert,
>      },
>      {   .allow = XSPLICE_STATE_CHECKED,
> -        .expected = -ENOENT,
> +        .expected = -XEN_ENOENT,
>          .name = "unload",
>          .function = xc_xsplice_unload,
>      },
> @@ -276,7 +278,7 @@ int action_func(int argc, char *argv[], unsigned int idx)
>                  name, errno, strerror(errno));
>          return -1;
>      }
> -    if ( status.rc == -EAGAIN )
> +    if ( status.rc == -XEN_EAGAIN )
>      {
>          fprintf(stderr, "%s failed. Operation already in progress\n", name);
>          return -1;
> @@ -319,7 +321,7 @@ int action_func(int argc, char *argv[], unsigned int idx)
>  
>          if ( status.state != original_state )
>              break;
> -        if ( status.rc && status.rc != -EAGAIN )
> +        if ( status.rc && status.rc != -XEN_EAGAIN )
>          {
>              rc = status.rc;
>              break;
> -- 
> 2.6.4 (Apple Git-63)
>
Wei Liu May 3, 2016, 1:29 p.m. UTC | #3
On Tue, May 03, 2016 at 09:27:23AM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, May 03, 2016 at 12:55:07PM +0200, Roger Pau Monne wrote:
> > Avoid using system errno values when comparing with Xen errno values.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> And since Wei acked it I may as well put it in now after some tests.
> 

I don't expect it would make a difference on Linux, but more testing
wouldn't hurt.

Wei.
Konrad Rzeszutek Wilk May 3, 2016, 1:37 p.m. UTC | #4
On Tue, May 03, 2016 at 02:29:20PM +0100, Wei Liu wrote:
> On Tue, May 03, 2016 at 09:27:23AM -0400, Konrad Rzeszutek Wilk wrote:
> > On Tue, May 03, 2016 at 12:55:07PM +0200, Roger Pau Monne wrote:
> > > Avoid using system errno values when comparing with Xen errno values.
> > > 
> > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > 
> > Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > 
> > And since Wei acked it I may as well put it in now after some tests.
> > 
> 
> I don't expect it would make a difference on Linux, but more testing
> wouldn't hurt.

Right. I stuck 'Reviewed-by' on all of them except the
"libxl: fix usage of XEN_EOPNOTSUPP"

And they are ready to be checked in (after I test them)- so just give me
the heads up when you would like that.


> 
> Wei.
Wei Liu May 4, 2016, 3:26 p.m. UTC | #5
On Tue, May 03, 2016 at 09:37:01AM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, May 03, 2016 at 02:29:20PM +0100, Wei Liu wrote:
> > On Tue, May 03, 2016 at 09:27:23AM -0400, Konrad Rzeszutek Wilk wrote:
> > > On Tue, May 03, 2016 at 12:55:07PM +0200, Roger Pau Monne wrote:
> > > > Avoid using system errno values when comparing with Xen errno values.
> > > > 
> > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > > 
> > > Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > 
> > > And since Wei acked it I may as well put it in now after some tests.
> > > 
> > 
> > I don't expect it would make a difference on Linux, but more testing
> > wouldn't hurt.
> 
> Right. I stuck 'Reviewed-by' on all of them except the
> "libxl: fix usage of XEN_EOPNOTSUPP"
> 

I stuck your reviewed-by to the 3 xsplice patches in my branch and 
queued up all 4 patches for committing.

Wei.
Konrad Rzeszutek Wilk May 4, 2016, 3:57 p.m. UTC | #6
On Wed, May 04, 2016 at 04:26:31PM +0100, Wei Liu wrote:
> On Tue, May 03, 2016 at 09:37:01AM -0400, Konrad Rzeszutek Wilk wrote:
> > On Tue, May 03, 2016 at 02:29:20PM +0100, Wei Liu wrote:
> > > On Tue, May 03, 2016 at 09:27:23AM -0400, Konrad Rzeszutek Wilk wrote:
> > > > On Tue, May 03, 2016 at 12:55:07PM +0200, Roger Pau Monne wrote:
> > > > > Avoid using system errno values when comparing with Xen errno values.
> > > > > 
> > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > > > 
> > > > Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > > 
> > > > And since Wei acked it I may as well put it in now after some tests.
> > > > 
> > > 
> > > I don't expect it would make a difference on Linux, but more testing
> > > wouldn't hurt.
> > 
> > Right. I stuck 'Reviewed-by' on all of them except the
> > "libxl: fix usage of XEN_EOPNOTSUPP"
> > 
> 
> I stuck your reviewed-by to the 3 xsplice patches in my branch and 
> queued up all 4 patches for committing.

Thanks. They are all tested from me as well.

> 
> Wei.
Roger Pau Monné May 6, 2016, 8:54 a.m. UTC | #7
On Tue, May 03, 2016 at 09:37:01AM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, May 03, 2016 at 02:29:20PM +0100, Wei Liu wrote:
> > On Tue, May 03, 2016 at 09:27:23AM -0400, Konrad Rzeszutek Wilk wrote:
> > > On Tue, May 03, 2016 at 12:55:07PM +0200, Roger Pau Monne wrote:
> > > > Avoid using system errno values when comparing with Xen errno values.
> > > > 
> > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > > 
> > > Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > 
> > > And since Wei acked it I may as well put it in now after some tests.
> > > 
> > 
> > I don't expect it would make a difference on Linux, but more testing
> > wouldn't hurt.
> 
> Right. I stuck 'Reviewed-by' on all of them except the
> "libxl: fix usage of XEN_EOPNOTSUPP"

I think you missed patch 5/6 (xen/xsplice: add ELFOSABI_FREEBSD as a 
supported OSABI for payloads), which also needs you reviewed-by.

Thanks, Roger.
diff mbox

Patch

diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
index 598e492..81e422e 100644
--- a/tools/misc/xen-xsplice.c
+++ b/tools/misc/xen-xsplice.c
@@ -13,6 +13,8 @@ 
 #include <xenctrl.h>
 #include <xenstore.h>
 
+#include <xen/errno.h>
+
 static xc_interface *xch;
 
 void show_help(void)
@@ -233,7 +235,7 @@  struct {
         .function = xc_xsplice_revert,
     },
     {   .allow = XSPLICE_STATE_CHECKED,
-        .expected = -ENOENT,
+        .expected = -XEN_ENOENT,
         .name = "unload",
         .function = xc_xsplice_unload,
     },
@@ -276,7 +278,7 @@  int action_func(int argc, char *argv[], unsigned int idx)
                 name, errno, strerror(errno));
         return -1;
     }
-    if ( status.rc == -EAGAIN )
+    if ( status.rc == -XEN_EAGAIN )
     {
         fprintf(stderr, "%s failed. Operation already in progress\n", name);
         return -1;
@@ -319,7 +321,7 @@  int action_func(int argc, char *argv[], unsigned int idx)
 
         if ( status.state != original_state )
             break;
-        if ( status.rc && status.rc != -EAGAIN )
+        if ( status.rc && status.rc != -XEN_EAGAIN )
         {
             rc = status.rc;
             break;