WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] return -ENOSYS for undefined sub-functions

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] return -ENOSYS for undefined sub-functions
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 13 Nov 2006 12:38:03 +0000
Delivery-date: Mon, 13 Nov 2006 04:37:12 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
.. in order to provide forward compatibility (allowing unambiguous detection
of unimplemented functionality)

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2006-10-16/xen/arch/x86/mm.c
===================================================================
--- 2006-10-16.orig/xen/arch/x86/mm.c   2006-10-26 13:26:20.000000000 +0200
+++ 2006-10-16/xen/arch/x86/mm.c        2006-10-26 13:26:43.000000000 +0200
@@ -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;
Index: 2006-10-16/xen/arch/x86/oprofile/xenoprof.c
===================================================================
--- 2006-10-16.orig/xen/arch/x86/oprofile/xenoprof.c    2006-10-26 
13:26:12.000000000 +0200
+++ 2006-10-16/xen/arch/x86/oprofile/xenoprof.c 2006-10-26 13:26:43.000000000 
+0200
@@ -684,7 +684,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         break;
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
     }
 
     spin_unlock(&xenoprof_lock);
Index: 2006-10-16/xen/arch/x86/physdev.c
===================================================================
--- 2006-10-16.orig/xen/arch/x86/physdev.c      2006-10-26 13:26:15.000000000 
+0200
+++ 2006-10-16/xen/arch/x86/physdev.c   2006-10-26 13:26:43.000000000 +0200
@@ -135,7 +135,7 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
     }
 
     default:
-        ret = -EINVAL;
+        ret = -ENOSYS;
         break;
     }
 
Index: 2006-10-16/xen/arch/x86/x86_32/traps.c
===================================================================
--- 2006-10-16.orig/xen/arch/x86/x86_32/traps.c 2006-10-26 13:26:20.000000000 
+0200
+++ 2006-10-16/xen/arch/x86/x86_32/traps.c      2006-10-26 13:26:43.000000000 
+0200
@@ -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;
     }
 
Index: 2006-10-16/xen/arch/x86/x86_64/traps.c
===================================================================
--- 2006-10-16.orig/xen/arch/x86/x86_64/traps.c 2006-10-26 13:26:20.000000000 
+0200
+++ 2006-10-16/xen/arch/x86/x86_64/traps.c      2006-10-26 13:26:43.000000000 
+0200
@@ -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;
     }
 


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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] return -ENOSYS for undefined sub-functions, Jan Beulich <=