[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/3] x86/pv: Fold {compat_}unregister_guest_callback() into its non-compat counterpart
These functions are almost identical. They differ only in the error emitted for the use of CALLBACKTYPE_syscall (which is inconsequential to guests), and the type of their argument. Have the callers pass the unreg.type parameter directly, avoiding the need for differently typed parameters. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- xen/arch/x86/pv/callback.c | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c index e6a17c5..866c835 100644 --- a/xen/arch/x86/pv/callback.c +++ b/xen/arch/x86/pv/callback.c @@ -125,11 +125,11 @@ static long register_guest_callback(struct callback_register *reg) return ret; } -static long unregister_guest_callback(struct callback_unregister *unreg) +static int unregister_guest_callback(unsigned int type) { - long ret; + int ret; - switch ( unreg->type ) + switch ( type ) { case CALLBACKTYPE_event: case CALLBACKTYPE_failsafe: @@ -178,7 +178,7 @@ long do_callback_op(int cmd, XEN_GUEST_HANDLE_PARAM(const_void) arg) if ( copy_from_guest(&unreg, arg, 1) ) break; - ret = unregister_guest_callback(&unreg); + ret = unregister_guest_callback(unreg.type); } break; @@ -263,33 +263,6 @@ static long compat_register_guest_callback(struct compat_callback_register *reg) return ret; } -static long compat_unregister_guest_callback( - struct compat_callback_unregister *unreg) -{ - long ret; - - switch ( unreg->type ) - { - case CALLBACKTYPE_event: - case CALLBACKTYPE_failsafe: - case CALLBACKTYPE_syscall32: - case CALLBACKTYPE_sysenter: - ret = -EINVAL; - break; - - case CALLBACKTYPE_nmi: - unregister_guest_nmi_callback(); - ret = 0; - break; - - default: - ret = -ENOSYS; - break; - } - - return ret; -} - long compat_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg) { long ret; @@ -316,7 +289,7 @@ long compat_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg) if ( copy_from_guest(&unreg, arg, 1) ) break; - ret = compat_unregister_guest_callback(&unreg); + ret = unregister_guest_callback(unreg.type); } break; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |