Skip to contentSkip to conversation

return -ENOSYS for undefined sub-functions

PATCH New Jan Beulich 1 participant 1 message Nov 13, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 return -ENOSYS for undefined sub-functions

.. in order to provide forward compatibility (allowing unambiguous detection of unimplemented functionality)

xen/arch/x86/mm.c +12 -5
Index: 2006-10-16/xen/arch/x86/mm.c
===================================================================
@@ -2134,8 +2134,9 @@ int do_mmuext_op(
 
         default:
             MEM_LOG("Invalid extended pt command 0x%x", op.cmd);
-            okay = 0;
-            break;
+            rc = -ENOSYS;
+            count = i--;
+            continue;
         }
 
         if ( unlikely(!okay) )
@@ -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,7 +2354,9 @@ int do_mmu_update(
 
         default:
             MEM_LOG("Invalid page update command %x", cmd);
-            break;
+            rc = -ENOSYS;
+            count = i--;
+            continue;
         }
 
         if ( unlikely(!okay) )
@@ -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;
xen/arch/x86/oprofile/xenoprof.c +1 -1
Index: 2006-10-16/xen/arch/x86/oprofile/xenoprof.c
===================================================================
@@ -684,7 +684,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
     }
 
     spin_unlock(&xenoprof_lock);
xen/arch/x86/physdev.c +1 -1
Index: 2006-10-16/xen/arch/x86/physdev.c
===================================================================
@@ -135,7 +135,7 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
     }
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
xen/arch/x86/x86_32/traps.c +11 -3
Index: 2006-10-16/xen/arch/x86/x86_32/traps.c
===================================================================
@@ -355,7 +355,7 @@ static long register_guest_callback(stru
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
@@ -368,12 +368,20 @@ static long unregister_guest_callback(st
 
     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;
     }
 
@@ -412,7 +420,7 @@ long do_callback_op(int cmd, XEN_GUEST_H
     break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
xen/arch/x86/x86_64/traps.c +9 -3
Index: 2006-10-16/xen/arch/x86/x86_64/traps.c
===================================================================
@@ -369,7 +369,7 @@ static long register_guest_callback(stru
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
@@ -382,12 +382,18 @@ static long unregister_guest_callback(st
 
     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;
     }
 
@@ -426,7 +432,7 @@ long do_callback_op(int cmd, XEN_GUEST_H
     break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }