direct-io.hg

changeset 12385:bfe3f8f35e87

[XEN] Return -ENOSYS for undefined sub-functions.

Provides forward compatibility (allowing unambiguous detection of
unimplemented functionality).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Mon Nov 13 13:58:08 2006 +0000 (2006-11-13)
parents 69388eba4c03
children d0eb5da1086b
files 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
line diff
     1.1 --- a/xen/arch/x86/mm.c	Mon Nov 13 13:50:14 2006 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Mon Nov 13 13:58:08 2006 +0000
     1.3 @@ -2134,13 +2134,14 @@ int do_mmuext_op(
     1.4  
     1.5          default:
     1.6              MEM_LOG("Invalid extended pt command 0x%x", op.cmd);
     1.7 +            rc = -ENOSYS;
     1.8              okay = 0;
     1.9              break;
    1.10          }
    1.11  
    1.12          if ( unlikely(!okay) )
    1.13          {
    1.14 -            rc = -EINVAL;
    1.15 +            rc = rc ? rc : -EINVAL;
    1.16              break;
    1.17          }
    1.18  
    1.19 @@ -2151,9 +2152,11 @@ int do_mmuext_op(
    1.20      process_deferred_ops();
    1.21  
    1.22      /* Add incremental work we have done to the @done output parameter. */
    1.23 -    done += i;
    1.24      if ( unlikely(!guest_handle_is_null(pdone)) )
    1.25 +    {
    1.26 +        done += i;
    1.27          copy_to_guest(pdone, &done, 1);
    1.28 +    }
    1.29  
    1.30      UNLOCK_BIGLOCK(d);
    1.31      return rc;
    1.32 @@ -2351,12 +2354,14 @@ int do_mmu_update(
    1.33  
    1.34          default:
    1.35              MEM_LOG("Invalid page update command %x", cmd);
    1.36 +            rc = -ENOSYS;
    1.37 +            okay = 0;
    1.38              break;
    1.39          }
    1.40  
    1.41          if ( unlikely(!okay) )
    1.42          {
    1.43 -            rc = -EINVAL;
    1.44 +            rc = rc ? rc : -EINVAL;
    1.45              break;
    1.46          }
    1.47  
    1.48 @@ -2370,9 +2375,11 @@ int do_mmu_update(
    1.49      process_deferred_ops();
    1.50  
    1.51      /* Add incremental work we have done to the @done output parameter. */
    1.52 -    done += i;
    1.53      if ( unlikely(!guest_handle_is_null(pdone)) )
    1.54 +    {
    1.55 +        done += i;
    1.56          copy_to_guest(pdone, &done, 1);
    1.57 +    }
    1.58  
    1.59      UNLOCK_BIGLOCK(d);
    1.60      return rc;
     2.1 --- a/xen/arch/x86/oprofile/xenoprof.c	Mon Nov 13 13:50:14 2006 +0000
     2.2 +++ b/xen/arch/x86/oprofile/xenoprof.c	Mon Nov 13 13:58:08 2006 +0000
     2.3 @@ -684,7 +684,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
     2.4          break;
     2.5  
     2.6      default:
     2.7 -        ret = -EINVAL;
     2.8 +        ret = -ENOSYS;
     2.9      }
    2.10  
    2.11      spin_unlock(&xenoprof_lock);
     3.1 --- a/xen/arch/x86/physdev.c	Mon Nov 13 13:50:14 2006 +0000
     3.2 +++ b/xen/arch/x86/physdev.c	Mon Nov 13 13:58:08 2006 +0000
     3.3 @@ -135,7 +135,7 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
     3.4      }
     3.5  
     3.6      default:
     3.7 -        ret = -EINVAL;
     3.8 +        ret = -ENOSYS;
     3.9          break;
    3.10      }
    3.11  
     4.1 --- a/xen/arch/x86/x86_32/traps.c	Mon Nov 13 13:50:14 2006 +0000
     4.2 +++ b/xen/arch/x86/x86_32/traps.c	Mon Nov 13 13:58:08 2006 +0000
     4.3 @@ -360,7 +360,7 @@ static long register_guest_callback(stru
     4.4          break;
     4.5  
     4.6      default:
     4.7 -        ret = -EINVAL;
     4.8 +        ret = -ENOSYS;
     4.9          break;
    4.10      }
    4.11  
    4.12 @@ -373,12 +373,20 @@ static long unregister_guest_callback(st
    4.13  
    4.14      switch ( unreg->type )
    4.15      {
    4.16 +    case CALLBACKTYPE_event:
    4.17 +    case CALLBACKTYPE_failsafe:
    4.18 +#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
    4.19 +    case CALLBACKTYPE_sysenter:
    4.20 +#endif
    4.21 +        ret = -EINVAL;
    4.22 +        break;
    4.23 +
    4.24      case CALLBACKTYPE_nmi:
    4.25          ret = unregister_guest_nmi_callback();
    4.26          break;
    4.27  
    4.28      default:
    4.29 -        ret = -EINVAL;
    4.30 +        ret = -ENOSYS;
    4.31          break;
    4.32      }
    4.33  
    4.34 @@ -417,7 +425,7 @@ long do_callback_op(int cmd, XEN_GUEST_H
    4.35      break;
    4.36  
    4.37      default:
    4.38 -        ret = -EINVAL;
    4.39 +        ret = -ENOSYS;
    4.40          break;
    4.41      }
    4.42  
     5.1 --- a/xen/arch/x86/x86_64/traps.c	Mon Nov 13 13:50:14 2006 +0000
     5.2 +++ b/xen/arch/x86/x86_64/traps.c	Mon Nov 13 13:58:08 2006 +0000
     5.3 @@ -374,7 +374,7 @@ static long register_guest_callback(stru
     5.4          break;
     5.5  
     5.6      default:
     5.7 -        ret = -EINVAL;
     5.8 +        ret = -ENOSYS;
     5.9          break;
    5.10      }
    5.11  
    5.12 @@ -387,12 +387,18 @@ static long unregister_guest_callback(st
    5.13  
    5.14      switch ( unreg->type )
    5.15      {
    5.16 +    case CALLBACKTYPE_event:
    5.17 +    case CALLBACKTYPE_failsafe:
    5.18 +    case CALLBACKTYPE_syscall:
    5.19 +        ret = -EINVAL;
    5.20 +        break;
    5.21 +
    5.22      case CALLBACKTYPE_nmi:
    5.23          ret = unregister_guest_nmi_callback();
    5.24          break;
    5.25  
    5.26      default:
    5.27 -        ret = -EINVAL;
    5.28 +        ret = -ENOSYS;
    5.29          break;
    5.30      }
    5.31  
    5.32 @@ -431,7 +437,7 @@ long do_callback_op(int cmd, XEN_GUEST_H
    5.33      break;
    5.34  
    5.35      default:
    5.36 -        ret = -EINVAL;
    5.37 +        ret = -ENOSYS;
    5.38          break;
    5.39      }
    5.40