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

[Xen-changelog] [xen-3.0.5-testing] acm: Remove unecessary compat shim from do_acm_op().



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1177598169 -3600
# Node ID d0acb5a3e8d8540ceb936a01a14e033619af5226
# Parent  f8fd9afd2aadf19458fff9e144e567d113d80aa0
acm: Remove unecessary compat shim from do_acm_op().
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/compat/acm_ops.c        |   47 -----------------------------------
 xen/arch/x86/x86_64/compat/entry.S |    4 +--
 xen/common/Makefile                |    1 
 xen/common/acm_ops.c               |   49 +++++++++----------------------------
 xen/include/Makefile               |    2 -
 xen/include/xlat.lst               |    1 
 6 files changed, 15 insertions(+), 89 deletions(-)

diff -r f8fd9afd2aad -r d0acb5a3e8d8 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Thu Apr 26 15:25:09 2007 +0100
+++ b/xen/arch/x86/x86_64/compat/entry.S        Thu Apr 26 15:36:09 2007 +0100
@@ -331,7 +331,7 @@ ENTRY(compat_hypercall_table)
         .quad compat_vcpu_op
         .quad compat_ni_hypercall       /* 25 */
         .quad compat_mmuext_op
-        .quad compat_acm_op
+        .quad do_acm_op
         .quad compat_nmi_op
         .quad compat_sched_op
         .quad compat_callback_op        /* 30 */
@@ -374,7 +374,7 @@ ENTRY(compat_hypercall_args_table)
         .byte 3 /* compat_vcpu_op           */
         .byte 0 /* compat_ni_hypercall      */  /* 25 */
         .byte 4 /* compat_mmuext_op         */
-        .byte 1 /* compat_acm_op            */
+        .byte 1 /* do_acm_op                */
         .byte 2 /* compat_nmi_op            */
         .byte 2 /* compat_sched_op          */
         .byte 2 /* compat_callback_op       */  /* 30 */
diff -r f8fd9afd2aad -r d0acb5a3e8d8 xen/common/Makefile
--- a/xen/common/Makefile       Thu Apr 26 15:25:09 2007 +0100
+++ b/xen/common/Makefile       Thu Apr 26 15:36:09 2007 +0100
@@ -43,7 +43,6 @@ 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
 kexec.o: compat/kexec.c
 schedule.o: compat/schedule.c
diff -r f8fd9afd2aad -r d0acb5a3e8d8 xen/common/acm_ops.c
--- a/xen/common/acm_ops.c      Thu Apr 26 15:25:09 2007 +0100
+++ b/xen/common/acm_ops.c      Thu Apr 26 15:36:09 2007 +0100
@@ -12,10 +12,8 @@
  * License.
  *
  * Process acm command requests from guest OS.
- *
  */
 
-#ifndef COMPAT
 #include <xen/config.h>
 #include <xen/types.h>
 #include <xen/lib.h>
@@ -29,38 +27,25 @@
 #include <xen/guest_access.h>
 #include <acm/acm_hooks.h>
 
-typedef long ret_t;
-
-#endif /* !COMPAT */
-
 #ifndef ACM_SECURITY
 
-
 long do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
 {
     return -ENOSYS;
 }
 
-
 #else
 
-
-#ifndef COMPAT
 int acm_authorize_acm_ops(struct domain *d)
 {
-    /* currently, policy management functions are restricted to privileged 
domains */
-    if (!IS_PRIV(d))
-        return -EPERM;
-    return 0;
-}
-#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 (IS_PRIV(d) ? 0 : -EPERM);
+}
+
+long do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
+{
+    long rc = -EFAULT;
+
+    if ( acm_authorize_acm_ops(current->domain) )
         return -EPERM;
 
     switch ( cmd )
@@ -226,11 +211,9 @@ ret_t do_acm_op(int cmd, XEN_GUEST_HANDL
 
         rc = acm_change_policy(&chgpolicy);
 
-        if (rc == 0) {
-            if (copy_to_guest(arg, &chgpolicy, 1) != 0) {
+        if (rc == 0)
+            if (copy_to_guest(arg, &chgpolicy, 1) != 0)
                 rc = -EFAULT;
-            }
-        }
         break;
     }
 
@@ -244,11 +227,9 @@ ret_t do_acm_op(int cmd, XEN_GUEST_HANDL
 
         rc = acm_relabel_domains(&relabeldoms);
 
-        if (rc == 0) {
-            if (copy_to_guest(arg, &relabeldoms, 1) != 0) {
+        if (rc == 0)
+            if (copy_to_guest(arg, &relabeldoms, 1) != 0)
                 rc = -EFAULT;
-            }
-        }
         break;
     }
 
@@ -260,11 +241,7 @@ ret_t do_acm_op(int cmd, XEN_GUEST_HANDL
     return rc;
 }
 
-#endif
-
-#if defined(CONFIG_COMPAT) && !defined(COMPAT)
-#include "compat/acm_ops.c"
-#endif
+#endif /* defined(ACM_SECURITY) */
 
 /*
  * Local variables:
diff -r f8fd9afd2aad -r d0acb5a3e8d8 xen/common/compat/acm_ops.c
--- a/xen/common/compat/acm_ops.c       Thu Apr 26 15:25:09 2007 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/******************************************************************************
- * 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 f8fd9afd2aad -r d0acb5a3e8d8 xen/include/Makefile
--- a/xen/include/Makefile      Thu Apr 26 15:25:09 2007 +0100
+++ b/xen/include/Makefile      Thu Apr 26 15:36:09 2007 +0100
@@ -3,8 +3,6 @@ compat-arch-$(CONFIG_X86) := x86_32
 compat-arch-$(CONFIG_X86) := x86_32
 
 headers-y := \
-    compat/acm.h \
-    compat/acm_ops.h \
     compat/callback.h \
     compat/elfnote.h \
     compat/event_channel.h \
diff -r f8fd9afd2aad -r d0acb5a3e8d8 xen/include/xlat.lst
--- a/xen/include/xlat.lst      Thu Apr 26 15:25:09 2007 +0100
+++ b/xen/include/xlat.lst      Thu Apr 26 15:36:09 2007 +0100
@@ -9,7 +9,6 @@
 !      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®.