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

[Xen-ia64-devel] [PATCH 2/7] introduce rcu_lock_target_domain_by_id() for later use



[IA64] add helper function rcu_lock_target_domain_by_id()

Introduce helper function, rcu_lock_target_domain_by_id().

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r 4a2b1b8dc9c2 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Thu Oct 02 15:23:26 2008 +0900
+++ b/xen/arch/ia64/xen/mm.c    Thu Oct 02 15:24:17 2008 +0900
@@ -3134,6 +3134,23 @@
     return (efi_mem_type(p) == EFI_CONVENTIONAL_MEMORY);
 }
 
+int
+rcu_lock_target_domain_by_id(domid_t domid, struct domain **d)
+{
+    if (domid == DOMID_SELF)
+        *d = rcu_lock_current_domain();
+    else {
+        *d = rcu_lock_domain_by_id(domid);
+        if (d == NULL)
+            return -ESRCH;
+        if (!IS_PRIV_FOR(current->domain, *d)) {
+            rcu_lock_domain(*d);
+            return -EPERM;
+        }
+    }
+
+    return 0;
+}
 
 long
 arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
diff -r 4a2b1b8dc9c2 xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Thu Oct 02 15:23:26 2008 +0900
+++ b/xen/include/asm-ia64/domain.h     Thu Oct 02 15:24:17 2008 +0900
@@ -316,6 +316,9 @@
            unsigned long iim, unsigned long itir, unsigned long arg5,
            unsigned long arg6, unsigned long arg7, unsigned long stack);
 
+int
+rcu_lock_target_domain_by_id(domid_t domid, struct domain **d);
+
 #endif /* __ASM_DOMAIN_H__ */
 
 /*

Attachment: rcu-get-target-domain-by-id.patch
Description: Text Data

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

 


Rackspace

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