[Xenomai-git] Philippe Gerum : alchemy/heap: fix for remote requests (pshared)
Module: xenomai-3 Branch: master Commit: 380f6de994327058309e4e5a146e1a58e15ae98c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=380f6de994327058309e4e5a146e1a58e15ae98c Author: Philippe Gerum r...@xenomai.org Date: Mon Jun 1 17:23:50 2015 +0200 alchemy/heap: fix for remote requests (pshared) --- lib/alchemy/heap.c | 15 +-- lib/alchemy/heap.h |4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/alchemy/heap.c b/lib/alchemy/heap.c index 38ffc26..10b7f83 100644 --- a/lib/alchemy/heap.c +++ b/lib/alchemy/heap.c @@ -245,7 +245,7 @@ int rt_heap_create(RT_HEAP *heap, generate_name(hcb-name, name, heap_namegen); hcb-mode = mode; hcb-size = heapsz; - hcb-sba = NULL; + hcb-sba = __moff(NULL); if (mode H_PRIO) sobj_flags = SYNCOBJ_PRIO; @@ -432,7 +432,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, goto out; if (hcb-mode H_SINGLE) { - p = hcb-sba; + p = __mptr(hcb-sba); if (p) goto done; if (size 0 size != hcb-size) { @@ -444,7 +444,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, ret = -ENOMEM; goto done; } - hcb-sba = p; + hcb-sba = __moff(p); goto done; } @@ -467,7 +467,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, goto out; } } else - p = wait-ptr; + p = __mptr(wait-ptr); threadobj_finish_wait(); done: @@ -509,6 +509,7 @@ int rt_heap_free(RT_HEAP *heap, void *block) struct syncstate syns; struct service svc; int ret = 0; + void *ptr; CANCEL_DEFER(svc); @@ -534,9 +535,11 @@ int rt_heap_free(RT_HEAP *heap, void *block) */ syncobj_for_each_grant_waiter_safe(hcb-sobj, thobj, tmp) { wait = threadobj_get_wait(thobj); - wait-ptr = heapobj_alloc(hcb-hobj, wait-size); - if (wait-ptr) + ptr = heapobj_alloc(hcb-hobj, wait-size); + if (ptr) { + wait-ptr = __moff(ptr); syncobj_grant_to(hcb-sobj, thobj); + } } done: put_alchemy_heap(hcb, syns); diff --git a/lib/alchemy/heap.h b/lib/alchemy/heap.h index 909454d..e76e36f 100644 --- a/lib/alchemy/heap.h +++ b/lib/alchemy/heap.h @@ -33,13 +33,13 @@ struct alchemy_heap { struct clusterobj cobj; int mode; size_t size; - void *sba; + dref_type(void *) sba; struct fsobj fsobj; }; struct alchemy_heap_wait { size_t size; - void *ptr; + dref_type (void *) ptr; }; #define heap_magic 0x8a8aebeb ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : alchemy/heap: fix for remote requests (pshared)
Module: xenomai-3 Branch: next Commit: 380f6de994327058309e4e5a146e1a58e15ae98c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=380f6de994327058309e4e5a146e1a58e15ae98c Author: Philippe Gerum r...@xenomai.org Date: Mon Jun 1 17:23:50 2015 +0200 alchemy/heap: fix for remote requests (pshared) --- lib/alchemy/heap.c | 15 +-- lib/alchemy/heap.h |4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/alchemy/heap.c b/lib/alchemy/heap.c index 38ffc26..10b7f83 100644 --- a/lib/alchemy/heap.c +++ b/lib/alchemy/heap.c @@ -245,7 +245,7 @@ int rt_heap_create(RT_HEAP *heap, generate_name(hcb-name, name, heap_namegen); hcb-mode = mode; hcb-size = heapsz; - hcb-sba = NULL; + hcb-sba = __moff(NULL); if (mode H_PRIO) sobj_flags = SYNCOBJ_PRIO; @@ -432,7 +432,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, goto out; if (hcb-mode H_SINGLE) { - p = hcb-sba; + p = __mptr(hcb-sba); if (p) goto done; if (size 0 size != hcb-size) { @@ -444,7 +444,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, ret = -ENOMEM; goto done; } - hcb-sba = p; + hcb-sba = __moff(p); goto done; } @@ -467,7 +467,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, goto out; } } else - p = wait-ptr; + p = __mptr(wait-ptr); threadobj_finish_wait(); done: @@ -509,6 +509,7 @@ int rt_heap_free(RT_HEAP *heap, void *block) struct syncstate syns; struct service svc; int ret = 0; + void *ptr; CANCEL_DEFER(svc); @@ -534,9 +535,11 @@ int rt_heap_free(RT_HEAP *heap, void *block) */ syncobj_for_each_grant_waiter_safe(hcb-sobj, thobj, tmp) { wait = threadobj_get_wait(thobj); - wait-ptr = heapobj_alloc(hcb-hobj, wait-size); - if (wait-ptr) + ptr = heapobj_alloc(hcb-hobj, wait-size); + if (ptr) { + wait-ptr = __moff(ptr); syncobj_grant_to(hcb-sobj, thobj); + } } done: put_alchemy_heap(hcb, syns); diff --git a/lib/alchemy/heap.h b/lib/alchemy/heap.h index 909454d..e76e36f 100644 --- a/lib/alchemy/heap.h +++ b/lib/alchemy/heap.h @@ -33,13 +33,13 @@ struct alchemy_heap { struct clusterobj cobj; int mode; size_t size; - void *sba; + dref_type(void *) sba; struct fsobj fsobj; }; struct alchemy_heap_wait { size_t size; - void *ptr; + dref_type (void *) ptr; }; #define heap_magic 0x8a8aebeb ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git