[XEN] Return -ENOSYS for undefined sub-functions.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 13 Nov 2006 13:58:08 +0000 (13:58 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 13 Nov 2006 13:58:08 +0000 (13:58 +0000)
Provides forward compatibility (allowing unambiguous detection of
unimplemented functionality).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/mm.c
xen/arch/x86/oprofile/xenoprof.c
xen/arch/x86/physdev.c
xen/arch/x86/x86_32/traps.c
xen/arch/x86/x86_64/traps.c

index 8e2ad2c7887d2fbd8c24a7d3912f8f24311f3c12..d812b2e4847ea1024f6f2bead8d6cee632fb29fb 100644 (file)
@@ -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;
index 288e7b2f7407c89976761a520d78d69368d7756d..ad4c1db195ac18460204f27376cb55a4eb5e1685 100644 (file)
@@ -684,7 +684,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg)
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
     }
 
     spin_unlock(&xenoprof_lock);
index 2d4841a039446a44d43b05680ecb207779ccec97..cde604bffc6f39bffa1aca1f18e738f92521cb7c 100644 (file)
@@ -135,7 +135,7 @@ long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
     }
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
index 409828bbaea18738b1e903e83f4cf4b78bf9d302..d5d1e5e8f76a20661760eac66e434937221ae231 100644 (file)
@@ -360,7 +360,7 @@ static long register_guest_callback(struct callback_register *reg)
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
@@ -373,12 +373,20 @@ static long unregister_guest_callback(struct callback_unregister *unreg)
 
     switch ( unreg->type )
     {
+    case CALLBACKTYPE_event:
+    case CALLBACKTYPE_failsafe:
+#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
+    case CALLBACKTYPE_sysenter:
+#endif
+        ret = -EINVAL;
+        break;
+
     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_HANDLE(void) arg)
     break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
index 82e09402fdaa5f7ff0268ee723baf0c9a081ee46..5eb91130a5fde4cb167b1ffa636bc49cc69dc5c8 100644 (file)
@@ -374,7 +374,7 @@ static long register_guest_callback(struct callback_register *reg)
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
@@ -387,12 +387,18 @@ static long unregister_guest_callback(struct callback_unregister *unreg)
 
     switch ( unreg->type )
     {
+    case CALLBACKTYPE_event:
+    case CALLBACKTYPE_failsafe:
+    case CALLBACKTYPE_syscall:
+        ret = -EINVAL;
+        break;
+
     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_HANDLE(void) arg)
     break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }