Mailing List Archive

[PATCH] return -ENOSYS for undefined sub-functions
.. in order to provide forward compatibility (allowing unambiguous detection
of unimplemented functionality)

Signed-off-by: Jan Beulich <jbeulich@novell.com>

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@lists.xensource.com
http://lists.xensource.com/xen-devel