aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common
diff options
context:
space:
mode:
authorEmmanuel Ackaouy <ack@xensource.com>2007-01-05 17:34:37 +0000
committerEmmanuel Ackaouy <ack@xensource.com>2007-01-05 17:34:37 +0000
commit62320af21e472e4e27791dd5858cc323776aa340 (patch)
tree28edba15f52be52b9f399e59e4484d958fc8bb2b /xen/common
parentf5404d9805bc400ef5ed4d626c38828db4b662b5 (diff)
downloadxen-62320af21e472e4e27791dd5858cc323776aa340.tar.gz
xen-62320af21e472e4e27791dd5858cc323776aa340.tar.bz2
xen-62320af21e472e4e27791dd5858cc323776aa340.zip
Enable compatibility mode operation for HYPERVISOR_acm_op.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/common')
-rw-r--r--xen/common/Makefile1
-rw-r--r--xen/common/acm_ops.c15
-rw-r--r--xen/common/compat/acm_ops.c47
3 files changed, 61 insertions, 2 deletions
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 625d5a122a..ac4683bb82 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -42,6 +42,7 @@ version.o: $(BASEDIR)/include/xen/compile.h
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 --git a/xen/common/acm_ops.c b/xen/common/acm_ops.c
index d6ed629398..f9d8a72da6 100644
--- a/xen/common/acm_ops.c
+++ b/xen/common/acm_ops.c
@@ -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(void) arg)
#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 *d)
return -EPERM;
return 0;
}
+#endif
-long do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
+ret_t do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
{
- long rc = -EFAULT;
+ ret_t rc = -EFAULT;
if (acm_authorize_acm_ops(current->domain))
return -EPERM;
@@ -219,6 +226,10 @@ long do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
#endif
+#if defined(CONFIG_COMPAT) && !defined(COMPAT)
+#include "compat/acm_ops.c"
+#endif
+
/*
* Local variables:
* mode: C
diff --git a/xen/common/compat/acm_ops.c b/xen/common/compat/acm_ops.c
new file mode 100644
index 0000000000..28af1a8e6c
--- /dev/null
+++ b/xen/common/compat/acm_ops.c
@@ -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:
+ */