diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-12-10 11:18:25 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-12-10 11:18:25 +0100 |
commit | e93e0d9d73ce77bd1f3471af68a194b47e0e8c45 (patch) | |
tree | be7768d89381228bc3ed5f4867db23f631a78054 /xen/common/xenoprof.c | |
parent | edaa3f893f8f046e05099bc0d087b276a90451d4 (diff) | |
download | xen-e93e0d9d73ce77bd1f3471af68a194b47e0e8c45.tar.gz xen-e93e0d9d73ce77bd1f3471af68a194b47e0e8c45.tar.bz2 xen-e93e0d9d73ce77bd1f3471af68a194b47e0e8c45.zip |
streamline guest copy operations
- use the variants not validating the VA range when writing back
structures/fields to the same space that they were previously read
from
- when only a single field of a structure actually changed, copy back
just that field where possible
- consolidate copying back results in a few places
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/xenoprof.c')
-rw-r--r-- | xen/common/xenoprof.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index ae0435bcee..f545e26bbc 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -449,7 +449,7 @@ static int add_passive_list(XEN_GUEST_HANDLE_PARAM(void) arg) current->domain, __pa(d->xenoprof->rawbuf), passive.buf_gmaddr, d->xenoprof->npages); - if ( copy_to_guest(arg, &passive, 1) ) + if ( __copy_to_guest(arg, &passive, 1) ) { put_domain(d); return -EFAULT; @@ -604,7 +604,7 @@ static int xenoprof_op_init(XEN_GUEST_HANDLE_PARAM(void) arg) if ( xenoprof_init.is_primary ) xenoprof_primary_profiler = current->domain; - return (copy_to_guest(arg, &xenoprof_init, 1) ? -EFAULT : 0); + return __copy_to_guest(arg, &xenoprof_init, 1) ? -EFAULT : 0; } #define ret_t long @@ -651,10 +651,7 @@ static int xenoprof_op_get_buffer(XEN_GUEST_HANDLE_PARAM(void) arg) d, __pa(d->xenoprof->rawbuf), xenoprof_get_buffer.buf_gmaddr, d->xenoprof->npages); - if ( copy_to_guest(arg, &xenoprof_get_buffer, 1) ) - return -EFAULT; - - return 0; + return __copy_to_guest(arg, &xenoprof_get_buffer, 1) ? -EFAULT : 0; } #define NONPRIV_OP(op) ( (op == XENOPROF_init) \ |