[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Enable compatibility mode operation for HYPERVISOR_acm_op.



# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Date 1168018477 0
# Node ID 56cd6d6691513a9c4eb40b7c571348e7be3e9865
# Parent  e82eda09ef417750be45d8cffe36d72de5ad806e
Enable compatibility mode operation for HYPERVISOR_acm_op.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/x86_64/compat/entry.S |    1 
 xen/common/Makefile                |    1 
 xen/common/acm_ops.c               |   21 ++++++++++++----
 xen/common/compat/acm_ops.c        |   47 +++++++++++++++++++++++++++++++++++++
 xen/include/xlat.lst               |    1 
 5 files changed, 65 insertions(+), 6 deletions(-)

diff -r e82eda09ef41 -r 56cd6d669151 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:36 2007 +0000
+++ b/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:37 2007 +0000
@@ -278,7 +278,6 @@ CFIX14:
 
 .section .rodata, "a", @progbits
 
-#define compat_acm_op domain_crash_synchronous
 #define compat_xenoprof_op domain_crash_synchronous
 #define compat_sysctl domain_crash_synchronous
 #define compat_domctl domain_crash_synchronous
diff -r e82eda09ef41 -r 56cd6d669151 xen/common/Makefile
--- a/xen/common/Makefile       Fri Jan 05 17:34:36 2007 +0000
+++ b/xen/common/Makefile       Fri Jan 05 17:34:37 2007 +0000
@@ -42,6 +42,7 @@ version.o: $(BASEDIR)/include/xen/compil
 
 ifeq ($(CONFIG_COMPAT),y)
 # extra dependencies
+acm_ops.o: compat/acm_ops.c
 grant_table.o: compat/grant_table.c
 schedule.o: compat/schedule.c
 endif
diff -r e82eda09ef41 -r 56cd6d669151 xen/common/acm_ops.c
--- a/xen/common/acm_ops.c      Fri Jan 05 17:34:36 2007 +0000
+++ b/xen/common/acm_ops.c      Fri Jan 05 17:34:37 2007 +0000
@@ -15,6 +15,7 @@
  *
  */
 
+#ifndef COMPAT
 #include <xen/config.h>
 #include <xen/types.h>
 #include <xen/lib.h>
@@ -28,6 +29,10 @@
 #include <xen/guest_access.h>
 #include <acm/acm_hooks.h>
 
+typedef long ret_t;
+
+#endif /* !COMPAT */
+
 #ifndef ACM_SECURITY
 
 
@@ -40,6 +45,7 @@ long do_acm_op(int cmd, XEN_GUEST_HANDLE
 #else
 
 
+#ifndef COMPAT
 int acm_authorize_acm_ops(struct domain *d)
 {
     /* currently, policy management functions are restricted to privileged 
domains */
@@ -47,11 +53,12 @@ int acm_authorize_acm_ops(struct domain 
         return -EPERM;
     return 0;
 }
-
-
-long do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
-{
-    long rc = -EFAULT;
+#endif
+
+
+ret_t do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
+{
+    ret_t rc = -EFAULT;
 
     if (acm_authorize_acm_ops(current->domain))
         return -EPERM;
@@ -217,6 +224,10 @@ long do_acm_op(int cmd, XEN_GUEST_HANDLE
     return rc;
 }
 
+#endif
+
+#if defined(CONFIG_COMPAT) && !defined(COMPAT)
+#include "compat/acm_ops.c"
 #endif
 
 /*
diff -r e82eda09ef41 -r 56cd6d669151 xen/common/compat/acm_ops.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/compat/acm_ops.c       Fri Jan 05 17:34:37 2007 +0000
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * compat/acm_ops.c
+ */
+
+#include <compat/acm.h>
+#include <compat/acm_ops.h>
+
+#define COMPAT
+#define ret_t int
+
+#define do_acm_op compat_acm_op
+
+static inline XEN_GUEST_HANDLE(void) acm_xlat_handle(COMPAT_HANDLE(void) cmp)
+{
+    XEN_GUEST_HANDLE(void) nat;
+
+    guest_from_compat_handle(nat, cmp);
+    return nat;
+}
+
+#define acm_setpolicy compat_acm_setpolicy
+#define acm_set_policy(h, sz) acm_set_policy(acm_xlat_handle(h), sz)
+
+#define acm_getpolicy compat_acm_getpolicy
+#define acm_get_policy(h, sz) acm_get_policy(acm_xlat_handle(h), sz)
+
+#define acm_dumpstats compat_acm_dumpstats
+#define acm_dump_statistics(h, sz) acm_dump_statistics(acm_xlat_handle(h), sz)
+
+#define acm_getssid compat_acm_getssid
+#define acm_get_ssid(r, h, sz) acm_get_ssid(r, acm_xlat_handle(h), sz)
+
+#define xen_acm_getdecision acm_getdecision
+CHECK_acm_getdecision;
+#undef xen_acm_getdecision
+
+#include "../acm_ops.c"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e82eda09ef41 -r 56cd6d669151 xen/include/xlat.lst
--- a/xen/include/xlat.lst      Fri Jan 05 17:34:36 2007 +0000
+++ b/xen/include/xlat.lst      Fri Jan 05 17:34:37 2007 +0000
@@ -9,6 +9,7 @@
 !      cpu_user_regs                   arch-x86/xen-@arch@.h
 !      trap_info                       arch-x86/xen.h
 !      vcpu_guest_context              arch-x86/xen.h
+?      acm_getdecision                 acm_ops.h
 ?      evtchn_alloc_unbound            event_channel.h
 ?      evtchn_bind_interdomain         event_channel.h
 ?      evtchn_bind_ipi                 event_channel.h

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.