Module: xenomai-3
Branch: master
Commit: ed4ca674af080ecfccc62e8a4fec9f7237bfaf3c
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ed4ca674af080ecfccc62e8a4fec9f7237bfaf3c

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Jun 19 14:37:46 2015 +0200

copperplate: fix naming conflict with C++ access modifiers

---

 include/copperplate/cluster.h     |    4 ++--
 include/copperplate/heapobj.h     |   16 ++++++++--------
 lib/copperplate/cluster.c         |   10 +++++-----
 lib/copperplate/heapobj-malloc.c  |   12 ++++++------
 lib/copperplate/heapobj-pshared.c |   36 ++++++++++++++++++------------------
 lib/copperplate/heapobj-tlsf.c    |    2 +-
 6 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/include/copperplate/cluster.h b/include/copperplate/cluster.h
index c29d6f2..923e1bf 100644
--- a/include/copperplate/cluster.h
+++ b/include/copperplate/cluster.h
@@ -158,10 +158,10 @@ struct syncluster_wait_struct {
        union {
                struct {
                        dref_type(char *) name;
-               } shared;
+               } shrd;
                struct {
                        const char *name;
-               } private;
+               } priv;
        };
 };
 
diff --git a/include/copperplate/heapobj.h b/include/copperplate/heapobj.h
index 682848e..42fe0d1 100644
--- a/include/copperplate/heapobj.h
+++ b/include/copperplate/heapobj.h
@@ -38,11 +38,11 @@ struct heapobj {
                struct {
                        dref_type(void *) pool;
                        char fsname[256];
-               } shared;
+               } shrd;
 #endif
                struct {
                        void *pool;
-               } private;
+               } priv;
        };
        size_t size;
        char name[32];
@@ -85,13 +85,13 @@ size_t malloc_usable_size_ex(void *ptr, void *pool);
 static inline
 void pvheapobj_destroy(struct heapobj *hobj)
 {
-       destroy_memory_pool(hobj->private.pool);
+       destroy_memory_pool(hobj->priv.pool);
 }
 
 static inline
 int pvheapobj_extend(struct heapobj *hobj, size_t size, void *mem)
 {
-       hobj->size = add_new_area(hobj->private.pool, size, mem);
+       hobj->size = add_new_area(hobj->priv.pool, size, mem);
        if (hobj->size == (size_t)-1)
                return __bt(-EINVAL);
 
@@ -101,25 +101,25 @@ int pvheapobj_extend(struct heapobj *hobj, size_t size, 
void *mem)
 static inline
 void *pvheapobj_alloc(struct heapobj *hobj, size_t size)
 {
-       return malloc_ex(size, hobj->private.pool);
+       return malloc_ex(size, hobj->priv.pool);
 }
 
 static inline
 void pvheapobj_free(struct heapobj *hobj, void *ptr)
 {
-       free_ex(ptr, hobj->private.pool);
+       free_ex(ptr, hobj->priv.pool);
 }
 
 static inline
 size_t pvheapobj_validate(struct heapobj *hobj, void *ptr)
 {
-       return malloc_usable_size_ex(ptr, hobj->private.pool);
+       return malloc_usable_size_ex(ptr, hobj->priv.pool);
 }
 
 static inline
 size_t pvheapobj_inquire(struct heapobj *hobj)
 {
-       return get_used_size(hobj->private.pool);
+       return get_used_size(hobj->priv.pool);
 }
 
 static inline void *pvmalloc(size_t size)
diff --git a/lib/copperplate/cluster.c b/lib/copperplate/cluster.c
index 9355d94..880ad58 100644
--- a/lib/copperplate/cluster.c
+++ b/lib/copperplate/cluster.c
@@ -309,7 +309,7 @@ int syncluster_addobj(struct syncluster *sc, const char 
*name,
         */
        syncobj_for_each_grant_waiter_safe(&sc->d->sobj, thobj, tmp) {
                wait = threadobj_get_wait(thobj);
-               if (strcmp(__mptr(wait->shared.name), name) == 0)
+               if (strcmp(__mptr(wait->shrd.name), name) == 0)
                        syncobj_grant_to(&sc->d->sobj, thobj);
        }
 out:
@@ -365,7 +365,7 @@ int syncluster_findobj(struct syncluster *sc,
                }
                if (wait == NULL) {
                        wait = threadobj_prepare_wait(struct 
syncluster_wait_struct);
-                       wait->shared.name = __moff(xnstrdup(name));
+                       wait->shrd.name = __moff(xnstrdup(name));
                }
                ret = syncobj_wait_grant(&sc->d->sobj, timeout, &syns);
                if (ret) {
@@ -378,7 +378,7 @@ int syncluster_findobj(struct syncluster *sc,
        syncobj_unlock(&sc->d->sobj, &syns);
 out:
        if (wait) {
-               xnfree(__mptr(wait->shared.name));
+               xnfree(__mptr(wait->shrd.name));
                threadobj_finish_wait();
        }
 
@@ -518,7 +518,7 @@ int pvsyncluster_addobj(struct pvsyncluster *sc, const char 
*name,
         */
        syncobj_for_each_grant_waiter_safe(&sc->sobj, thobj, tmp) {
                wait = threadobj_get_wait(thobj);
-               if (strcmp(wait->private.name, name) == 0)
+               if (strcmp(wait->priv.name, name) == 0)
                        syncobj_grant_to(&sc->sobj, thobj);
        }
 out:
@@ -573,7 +573,7 @@ int pvsyncluster_findobj(struct pvsyncluster *sc,
                }
                if (wait == NULL) {
                        wait = threadobj_prepare_wait(struct 
syncluster_wait_struct);
-                       wait->private.name = name;
+                       wait->priv.name = name;
                }
                ret = syncobj_wait_grant(&sc->sobj, timeout, &syns);
                if (ret) {
diff --git a/lib/copperplate/heapobj-malloc.c b/lib/copperplate/heapobj-malloc.c
index 2c66259..9dbed81 100644
--- a/lib/copperplate/heapobj-malloc.c
+++ b/lib/copperplate/heapobj-malloc.c
@@ -71,7 +71,7 @@ int __heapobj_init_private(struct heapobj *hobj, const char 
*name,
 
        ph->used = 0;
 
-       hobj->private.pool = ph;
+       hobj->priv.pool = ph;
        hobj->size = size;
        if (name)
                snprintf(hobj->name, sizeof(hobj->name), "%s", name);
@@ -89,7 +89,7 @@ int heapobj_init_array_private(struct heapobj *hobj, const 
char *name,
 
 void pvheapobj_destroy(struct heapobj *hobj)
 {
-       struct pool_header *ph = hobj->private.pool;
+       struct pool_header *ph = hobj->priv.pool;
 
        __RT(pthread_mutex_destroy(&ph->lock));
        __STD(free(ph));
@@ -97,7 +97,7 @@ void pvheapobj_destroy(struct heapobj *hobj)
 
 int pvheapobj_extend(struct heapobj *hobj, size_t size, void *mem)
 {
-       struct pool_header *ph = hobj->private.pool;
+       struct pool_header *ph = hobj->priv.pool;
 
        write_lock_nocancel(&ph->lock);
        hobj->size += size;
@@ -108,7 +108,7 @@ int pvheapobj_extend(struct heapobj *hobj, size_t size, 
void *mem)
 
 void *pvheapobj_alloc(struct heapobj *hobj, size_t size)
 {
-       struct pool_header *ph = hobj->private.pool;
+       struct pool_header *ph = hobj->priv.pool;
        struct block_header *bh;
        void *ptr;
 
@@ -143,7 +143,7 @@ fail:
 void pvheapobj_free(struct heapobj *hobj, void *ptr)
 {
        struct block_header *bh = ptr - sizeof(*bh);
-       struct pool_header *ph = hobj->private.pool;
+       struct pool_header *ph = hobj->priv.pool;
 
        assert(hobj->size >= bh->size);
        __STD(free(bh));
@@ -154,7 +154,7 @@ void pvheapobj_free(struct heapobj *hobj, void *ptr)
 
 size_t pvheapobj_inquire(struct heapobj *hobj)
 {
-       struct pool_header *ph = hobj->private.pool;
+       struct pool_header *ph = hobj->priv.pool;
 
        return ph->used;
 }
diff --git a/lib/copperplate/heapobj-pshared.c 
b/lib/copperplate/heapobj-pshared.c
index 4235218..0b3f76d 100644
--- a/lib/copperplate/heapobj-pshared.c
+++ b/lib/copperplate/heapobj-pshared.c
@@ -625,10 +625,10 @@ static int create_main_heap(pid_t *cnode_r)
         * bind to it.
         */
        snprintf(hobj->name, sizeof(hobj->name), "%s.heap", session);
-       snprintf(hobj->shared.fsname, sizeof(hobj->shared.fsname),
+       snprintf(hobj->shrd.fsname, sizeof(hobj->shrd.fsname),
                 "/xeno:%s", hobj->name);
 
-       fd = shm_open(hobj->shared.fsname, O_RDWR|O_CREAT, 0600);
+       fd = shm_open(hobj->shrd.fsname, O_RDWR|O_CREAT, 0600);
        if (fd < 0)
                return __bt(-errno);
 
@@ -652,7 +652,7 @@ static int create_main_heap(pid_t *cnode_r)
                        /* CAUTION: __moff() depends on __main_heap. */
                        __main_heap = m_heap;
                        __main_sysgroup = &m_heap->sysgroup;
-                       hobj->shared.pool = __moff(&m_heap->base);
+                       hobj->shrd.pool = __moff(&m_heap->base);
                        goto done;
                }
                *cnode_r = m_heap->cpid;
@@ -676,8 +676,8 @@ init:
                goto unlink_fail;
 
        m_heap->maplen = len;
-       /* CAUTION: init_main_heap() depends on hobj->shared.pool. */
-       hobj->shared.pool = __moff(&m_heap->base);
+       /* CAUTION: init_main_heap() depends on hobj->shrd.pool. */
+       hobj->shrd.pool = __moff(&m_heap->base);
        ret = init_main_heap(m_heap, (caddr_t)m_heap + sizeof(*m_heap), size);
        if (ret) {
                errno = -ret;
@@ -699,7 +699,7 @@ unmap_fail:
        munmap(m_heap, len);
 unlink_fail:
        ret = __bt(-errno);
-       shm_unlink(hobj->shared.fsname);
+       shm_unlink(hobj->shrd.fsname);
        goto close_fail;
 errno_fail:
        ret = __bt(-errno);
@@ -720,10 +720,10 @@ static int bind_main_heap(const char *session)
        /* No error tracking, this is for internal users. */
 
        snprintf(hobj->name, sizeof(hobj->name), "%s.heap", session);
-       snprintf(hobj->shared.fsname, sizeof(hobj->shared.fsname),
+       snprintf(hobj->shrd.fsname, sizeof(hobj->shrd.fsname),
                 "/xeno:%s", hobj->name);
 
-       fd = shm_open(hobj->shared.fsname, O_RDWR, 0400);
+       fd = shm_open(hobj->shrd.fsname, O_RDWR, 0400);
        if (fd < 0)
                return -errno;
 
@@ -753,7 +753,7 @@ static int bind_main_heap(const char *session)
                return -ENOENT;
        }
 
-       hobj->shared.pool = __moff(&m_heap->base);
+       hobj->shrd.pool = __moff(&m_heap->base);
        hobj->size = len - sizeof(*m_heap);
        __main_heap = m_heap;
        __main_catalog = &m_heap->catalog;
@@ -780,7 +780,7 @@ int pshared_check(void *__heap, void *__addr)
         * this one, so the address shall fall into the file-backed
         * memory range.
         */
-       if (__moff(heap) == main_pool.shared.pool) {
+       if (__moff(heap) == main_pool.shrd.pool) {
                m_heap = container_of(heap, struct session_heap, base);
                return __addr >= (void *)m_heap &&
                        __addr < (void *)m_heap + m_heap->maplen;
@@ -842,7 +842,7 @@ int heapobj_init(struct heapobj *hobj, const char *name, 
size_t size)
        else
                snprintf(hobj->name, sizeof(hobj->name), "%s.%p", session, 
hobj);
 
-       hobj->shared.pool = __moff(heap);
+       hobj->shrd.pool = __moff(heap);
        hobj->size = size;
        init_heap(heap, hobj->name, (caddr_t)heap + sizeof(*heap), size);
        sysgroup_add(heap, &heap->memspec);
@@ -859,7 +859,7 @@ int heapobj_init_array(struct heapobj *hobj, const char 
*name,
 
 void heapobj_destroy(struct heapobj *hobj)
 {
-       struct shared_heap *heap = __mptr(hobj->shared.pool);
+       struct shared_heap *heap = __mptr(hobj->shrd.pool);
        int cpid;
 
        if (hobj != &main_pool) {
@@ -878,12 +878,12 @@ void heapobj_destroy(struct heapobj *hobj)
        __RT(pthread_mutex_destroy(&heap->lock));
        __RT(pthread_mutex_destroy(&main_heap.sysgroup.lock));
        munmap(&main_heap, main_heap.maplen);
-       shm_unlink(hobj->shared.fsname);
+       shm_unlink(hobj->shrd.fsname);
 }
 
 int heapobj_extend(struct heapobj *hobj, size_t size, void *unused)
 {
-       struct shared_heap *heap = __mptr(hobj->shared.pool);
+       struct shared_heap *heap = __mptr(hobj->shrd.pool);
        struct shared_extent *extent;
        int state;
 
@@ -910,22 +910,22 @@ int heapobj_extend(struct heapobj *hobj, size_t size, 
void *unused)
 
 void *heapobj_alloc(struct heapobj *hobj, size_t size)
 {
-       return alloc_block(__mptr(hobj->shared.pool), size);
+       return alloc_block(__mptr(hobj->shrd.pool), size);
 }
 
 void heapobj_free(struct heapobj *hobj, void *ptr)
 {
-       free_block(__mptr(hobj->shared.pool), ptr);
+       free_block(__mptr(hobj->shrd.pool), ptr);
 }
 
 size_t heapobj_validate(struct heapobj *hobj, void *ptr)
 {
-       return __bt(check_block(__mptr(hobj->shared.pool), ptr));
+       return __bt(check_block(__mptr(hobj->shrd.pool), ptr));
 }
 
 size_t heapobj_inquire(struct heapobj *hobj)
 {
-       struct shared_heap *heap = __mptr(hobj->shared.pool);
+       struct shared_heap *heap = __mptr(hobj->shrd.pool);
        return heap->ubytes;
 }
 
diff --git a/lib/copperplate/heapobj-tlsf.c b/lib/copperplate/heapobj-tlsf.c
index 7b1ceef..a074633 100644
--- a/lib/copperplate/heapobj-tlsf.c
+++ b/lib/copperplate/heapobj-tlsf.c
@@ -53,7 +53,7 @@ int __heapobj_init_private(struct heapobj *hobj, const char 
*name,
        else
                snprintf(hobj->name, sizeof(hobj->name), "%p", hobj);
 
-       hobj->private.pool = mem;
+       hobj->priv.pool = mem;
        /* Make sure to wipe out tlsf's signature. */
        memset(mem, 0, size < 32 ? size : 32);
        hobj->size = init_memory_pool(size, mem);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to