[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] Return -ENOSYS for undefined sub-functions.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID bfe3f8f35e87af01588765e48c71de05e30ea234
# Parent  69388eba4c037a2c4fe2965e3d8b52b117c8028d
[XEN] Return -ENOSYS for undefined sub-functions.

Provides forward compatibility (allowing unambiguous detection of
unimplemented functionality).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/mm.c                |   15 +++++++++++----
 xen/arch/x86/oprofile/xenoprof.c |    2 +-
 xen/arch/x86/physdev.c           |    2 +-
 xen/arch/x86/x86_32/traps.c      |   34 +++++++++++++++++++++-------------
 xen/arch/x86/x86_64/traps.c      |   32 +++++++++++++++++++-------------
 5 files changed, 53 insertions(+), 32 deletions(-)

diff -r 69388eba4c03 -r bfe3f8f35e87 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Mon Nov 13 13:50:14 2006 +0000
+++ b/xen/arch/x86/mm.c Mon Nov 13 13:58:08 2006 +0000
@@ -2134,13 +2134,14 @@ int do_mmuext_op(
 
         default:
             MEM_LOG("Invalid extended pt command 0x%x", op.cmd);
+            rc = -ENOSYS;
             okay = 0;
             break;
         }
 
         if ( unlikely(!okay) )
         {
-            rc = -EINVAL;
+            rc = rc ? rc : -EINVAL;
             break;
         }
 
@@ -2151,9 +2152,11 @@ int do_mmuext_op(
     process_deferred_ops();
 
     /* Add incremental work we have done to the @done output parameter. */
-    done += i;
     if ( unlikely(!guest_handle_is_null(pdone)) )
+    {
+        done += i;
         copy_to_guest(pdone, &done, 1);
+    }
 
     UNLOCK_BIGLOCK(d);
     return rc;
@@ -2351,12 +2354,14 @@ int do_mmu_update(
 
         default:
             MEM_LOG("Invalid page update command %x", cmd);
+            rc = -ENOSYS;
+            okay = 0;
             break;
         }
 
         if ( unlikely(!okay) )
         {
-            rc = -EINVAL;
+            rc = rc ? rc : -EINVAL;
             break;
         }
 
@@ -2370,9 +2375,11 @@ int do_mmu_update(
     process_deferred_ops();
 
     /* Add incremental work we have done to the @done output parameter. */
-    done += i;
     if ( unlikely(!guest_handle_is_null(pdone)) )
+    {
+        done += i;
         copy_to_guest(pdone, &done, 1);
+    }
 
     UNLOCK_BIGLOCK(d);
     return rc;
diff -r 69388eba4c03 -r bfe3f8f35e87 xen/arch/x86/oprofile/xenoprof.c
--- a/xen/arch/x86/oprofile/xenoprof.c  Mon Nov 13 13:50:14 2006 +0000
+++ b/xen/arch/x86/oprofile/xenoprof.c  Mon Nov 13 13:58:08 2006 +0000
@@ -684,7 +684,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
     }
 
     spin_unlock(&xenoprof_lock);
diff -r 69388eba4c03 -r bfe3f8f35e87 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c    Mon Nov 13 13:50:14 2006 +0000
+++ b/xen/arch/x86/physdev.c    Mon Nov 13 13:58:08 2006 +0000
@@ -135,7 +135,7 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
     }
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
diff -r 69388eba4c03 -r bfe3f8f35e87 xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c       Mon Nov 13 13:50:14 2006 +0000
+++ b/xen/arch/x86/x86_32/traps.c       Mon Nov 13 13:58:08 2006 +0000
@@ -360,25 +360,33 @@ static long register_guest_callback(stru
         break;
 
     default:
+        ret = -ENOSYS;
+        break;
+    }
+
+    return ret;
+}
+
+static long unregister_guest_callback(struct callback_unregister *unreg)
+{
+    long ret;
+
+    switch ( unreg->type )
+    {
+    case CALLBACKTYPE_event:
+    case CALLBACKTYPE_failsafe:
+#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
+    case CALLBACKTYPE_sysenter:
+#endif
         ret = -EINVAL;
         break;
-    }
-
-    return ret;
-}
-
-static long unregister_guest_callback(struct callback_unregister *unreg)
-{
-    long ret;
-
-    switch ( unreg->type )
-    {
+
     case CALLBACKTYPE_nmi:
         ret = unregister_guest_nmi_callback();
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
@@ -417,7 +425,7 @@ long do_callback_op(int cmd, XEN_GUEST_H
     break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
diff -r 69388eba4c03 -r bfe3f8f35e87 xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c       Mon Nov 13 13:50:14 2006 +0000
+++ b/xen/arch/x86/x86_64/traps.c       Mon Nov 13 13:58:08 2006 +0000
@@ -374,25 +374,31 @@ static long register_guest_callback(stru
         break;
 
     default:
+        ret = -ENOSYS;
+        break;
+    }
+
+    return ret;
+}
+
+static long unregister_guest_callback(struct callback_unregister *unreg)
+{
+    long ret;
+
+    switch ( unreg->type )
+    {
+    case CALLBACKTYPE_event:
+    case CALLBACKTYPE_failsafe:
+    case CALLBACKTYPE_syscall:
         ret = -EINVAL;
         break;
-    }
-
-    return ret;
-}
-
-static long unregister_guest_callback(struct callback_unregister *unreg)
-{
-    long ret;
-
-    switch ( unreg->type )
-    {
+
     case CALLBACKTYPE_nmi:
         ret = unregister_guest_nmi_callback();
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
@@ -431,7 +437,7 @@ long do_callback_op(int cmd, XEN_GUEST_H
     break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.