[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xen: Add versions of rcu_lock_*_domain without IS_PRIV
# HG changeset patch # User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> # Date 1350316304 -3600 # Node ID c1c549c4fe9ebdc460cbf51e296edad157b6e518 # Parent 37bb894121c7e0d7661656656a6e0749b41f2298 xen: Add versions of rcu_lock_*_domain without IS_PRIV These functions will be used to avoid duplication of IS_PRIV calls that will be introduced in XSM hooks. This also fixes a build error with XSM enabled introduced by 25925:d1c3375c3f11 which depends on this patch. Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> Committed-by: Keir Fraser <keir@xxxxxxx> --- diff -r 37bb894121c7 -r c1c549c4fe9e xen/common/domain.c --- a/xen/common/domain.c Mon Oct 15 17:41:39 2012 +0200 +++ b/xen/common/domain.c Mon Oct 15 16:51:44 2012 +0100 @@ -420,6 +420,13 @@ struct domain *rcu_lock_domain_by_id(dom return d; } +struct domain *rcu_lock_domain_by_any_id(domid_t dom) +{ + if ( dom == DOMID_SELF ) + return rcu_lock_current_domain(); + return rcu_lock_domain_by_id(dom); +} + int rcu_lock_target_domain_by_id(domid_t dom, struct domain **d) { if ( dom == DOMID_SELF ) @@ -454,6 +461,20 @@ int rcu_lock_remote_target_domain_by_id( return 0; } +int rcu_lock_remote_domain_by_id(domid_t dom, struct domain **d) +{ + if ( (*d = rcu_lock_domain_by_id(dom)) == NULL ) + return -ESRCH; + + if ( *d == current->domain ) + { + rcu_unlock_domain(*d); + return -EPERM; + } + + return 0; +} + int domain_kill(struct domain *d) { int rc = 0; diff -r 37bb894121c7 -r c1c549c4fe9e xen/include/xen/sched.h --- a/xen/include/xen/sched.h Mon Oct 15 17:41:39 2012 +0200 +++ b/xen/include/xen/sched.h Mon Oct 15 16:51:44 2012 +0100 @@ -447,6 +447,11 @@ struct domain *domain_create( struct domain *rcu_lock_domain_by_id(domid_t dom); /* + * As above function, but resolves DOMID_SELF to current domain + */ +struct domain *rcu_lock_domain_by_any_id(domid_t dom); + +/* * As above function, but accounts for current domain context: * - Translates target DOMID_SELF into caller's domain id; and * - Checks that caller has permission to act on the target domain. @@ -460,6 +465,12 @@ int rcu_lock_target_domain_by_id(domid_t */ int rcu_lock_remote_target_domain_by_id(domid_t dom, struct domain **d); +/* + * As rcu_lock_domain_by_id(), but will fail EPERM or ESRCH rather than resolve + * to local domain. + */ +int rcu_lock_remote_domain_by_id(domid_t dom, struct domain **d); + /* Finish a RCU critical region started by rcu_lock_domain_by_id(). */ static inline void rcu_unlock_domain(struct domain *d) { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |