Module: xenomai-forge Branch: master Commit: 77a96f645a0eb90b06b8f90ba0421be9f5c87893 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=77a96f645a0eb90b06b8f90ba0421be9f5c87893
Author: Philippe Gerum <r...@xenomai.org> Date: Sun Jan 1 18:19:57 2012 +0100 hal, nucleus: drop useless bits/heap.h indirection --- include/asm-arm/bits/Makefile.am | 1 - include/asm-arm/bits/Makefile.in | 1 - include/asm-arm/bits/heap.h | 28 ----------------------- include/asm-blackfin/bits/Makefile.am | 1 - include/asm-blackfin/bits/Makefile.in | 1 - include/asm-blackfin/bits/heap.h | 25 --------------------- include/asm-generic/bits/Makefile.am | 1 - include/asm-generic/bits/Makefile.in | 1 - include/asm-generic/bits/heap.h | 35 ----------------------------- include/asm-generic/system.h | 11 --------- include/asm-nios2/bits/Makefile.am | 1 - include/asm-nios2/bits/Makefile.in | 1 - include/asm-nios2/bits/heap.h | 25 --------------------- include/asm-powerpc/bits/Makefile.am | 1 - include/asm-powerpc/bits/Makefile.in | 1 - include/asm-powerpc/bits/heap.h | 28 ----------------------- include/asm-sh/bits/Makefile.am | 1 - include/asm-sh/bits/Makefile.in | 1 - include/asm-sh/bits/heap.h | 25 --------------------- include/asm-x86/bits/Makefile.am | 1 - include/asm-x86/bits/Makefile.in | 1 - include/asm-x86/bits/heap.h | 25 --------------------- include/cobalt/nucleus/heap.h | 11 +++++++- kernel/cobalt/nucleus/heap.c | 39 +++++++++++++++++---------------- 24 files changed, 29 insertions(+), 237 deletions(-) diff --git a/include/asm-arm/bits/Makefile.am b/include/asm-arm/bits/Makefile.am index 1a56ee0..4b8d207 100644 --- a/include/asm-arm/bits/Makefile.am +++ b/include/asm-arm/bits/Makefile.am @@ -2,7 +2,6 @@ includesubdir = $(includedir)/asm-arm/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-arm/bits/Makefile.in b/include/asm-arm/bits/Makefile.in index dd96a9d..6a54cc1 100644 --- a/include/asm-arm/bits/Makefile.in +++ b/include/asm-arm/bits/Makefile.in @@ -243,7 +243,6 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/asm-arm/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-arm/bits/heap.h b/include/asm-arm/bits/heap.h deleted file mode 100644 index a8f71e2..0000000 --- a/include/asm-arm/bits/heap.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003,2004 Philippe Gerum <r...@xenomai.org>. - * - * ARM port - * Copyright (C) 2005 Stelian Pop - * - * Xenomai is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Xenomai is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _XENO_ASM_ARM_BITS_HEAP_H -#define _XENO_ASM_ARM_BITS_HEAP_H - -#include <asm-generic/xenomai/bits/heap.h> - -#endif /* !_XENO_ASM_ARM_BITS_HEAP_H */ diff --git a/include/asm-blackfin/bits/Makefile.am b/include/asm-blackfin/bits/Makefile.am index 7fd7f9d..d8d7037 100644 --- a/include/asm-blackfin/bits/Makefile.am +++ b/include/asm-blackfin/bits/Makefile.am @@ -2,7 +2,6 @@ includesubdir = $(includedir)/asm-blackfin/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-blackfin/bits/Makefile.in b/include/asm-blackfin/bits/Makefile.in index 3aca3f0..ba2befc 100644 --- a/include/asm-blackfin/bits/Makefile.in +++ b/include/asm-blackfin/bits/Makefile.in @@ -243,7 +243,6 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/asm-blackfin/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-blackfin/bits/heap.h b/include/asm-blackfin/bits/heap.h deleted file mode 100644 index de3fbd9..0000000 --- a/include/asm-blackfin/bits/heap.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2005 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Xenomai is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _XENO_ASM_BLACKFIN_BITS_HEAP_H -#define _XENO_ASM_BLACKFIN_BITS_HEAP_H - -#include <asm-generic/xenomai/bits/heap.h> - -#endif /* !_XENO_ASM_BLACKFIN_BITS_HEAP_H */ diff --git a/include/asm-generic/bits/Makefile.am b/include/asm-generic/bits/Makefile.am index 4e6e4ec..267c297 100644 --- a/include/asm-generic/bits/Makefile.am +++ b/include/asm-generic/bits/Makefile.am @@ -3,7 +3,6 @@ includesubdir = $(includedir)/asm-generic/bits includesub_HEADERS = \ bind.h \ current.h \ - heap.h \ intr.h \ pod.h \ sigshadow.h \ diff --git a/include/asm-generic/bits/Makefile.in b/include/asm-generic/bits/Makefile.in index d0718c6..480c123 100644 --- a/include/asm-generic/bits/Makefile.in +++ b/include/asm-generic/bits/Makefile.in @@ -244,7 +244,6 @@ includesubdir = $(includedir)/asm-generic/bits includesub_HEADERS = \ bind.h \ current.h \ - heap.h \ intr.h \ pod.h \ sigshadow.h \ diff --git a/include/asm-generic/bits/heap.h b/include/asm-generic/bits/heap.h deleted file mode 100644 index 4d0c41a..0000000 --- a/include/asm-generic/bits/heap.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003,2004,2005 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Xenomai is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _XENO_ASM_GENERIC_BITS_HEAP_H -#define _XENO_ASM_GENERIC_BITS_HEAP_H - -#ifndef __KERNEL__ -#error "Pure kernel header included from user-space!" -#endif - -static inline void xnarch_init_heapcb (xnarch_heapcb_t *hcb) - -{ - hcb->numaps = 0; - hcb->kmflags = 0; - hcb->heapbase = NULL; -} - -#endif /* !_XENO_ASM_GENERIC_BITS_HEAP_H */ diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h index e5bc798..3d1c61b 100644 --- a/include/asm-generic/system.h +++ b/include/asm-generic/system.h @@ -202,17 +202,6 @@ typedef cpumask_t xnarch_cpumask_t; #define xnarch_supported_cpus rthal_supported_cpus #define xnarch_cpu_supported(cpu) rthal_cpu_supported(cpu) -struct xnheap; - -typedef struct xnarch_heapcb { - - unsigned long numaps; /* # of active user-space mappings. */ - int kmflags; /* Kernel memory flags (0 if vmalloc()). */ - void *heapbase; /* Shared heap memory base. */ - void (*release)(struct xnheap *heap); /* callback upon last unmap */ - -} xnarch_heapcb_t; - unsigned long long xnarch_get_host_time(void); unsigned long long xnarch_get_cpu_time(void); diff --git a/include/asm-nios2/bits/Makefile.am b/include/asm-nios2/bits/Makefile.am index d8ef2b6..f0b663a 100644 --- a/include/asm-nios2/bits/Makefile.am +++ b/include/asm-nios2/bits/Makefile.am @@ -2,7 +2,6 @@ includesubdir = $(includedir)/asm-nios2/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-nios2/bits/Makefile.in b/include/asm-nios2/bits/Makefile.in index df6c8fa..2e25915 100644 --- a/include/asm-nios2/bits/Makefile.in +++ b/include/asm-nios2/bits/Makefile.in @@ -243,7 +243,6 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/asm-nios2/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-nios2/bits/heap.h b/include/asm-nios2/bits/heap.h deleted file mode 100644 index 03f1e4e..0000000 --- a/include/asm-nios2/bits/heap.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2009 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Xenomai is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _XENO_ASM_NIOS2_BITS_HEAP_H -#define _XENO_ASM_NIOS2_BITS_HEAP_H - -#include <asm-generic/xenomai/bits/heap.h> - -#endif /* !_XENO_ASM_NIOS2_BITS_HEAP_H */ diff --git a/include/asm-powerpc/bits/Makefile.am b/include/asm-powerpc/bits/Makefile.am index 19043e0..2ebc3da 100644 --- a/include/asm-powerpc/bits/Makefile.am +++ b/include/asm-powerpc/bits/Makefile.am @@ -2,7 +2,6 @@ includesubdir = $(includedir)/asm-powerpc/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-powerpc/bits/Makefile.in b/include/asm-powerpc/bits/Makefile.in index 9e5ef49..9df428b 100644 --- a/include/asm-powerpc/bits/Makefile.in +++ b/include/asm-powerpc/bits/Makefile.in @@ -243,7 +243,6 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/asm-powerpc/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-powerpc/bits/heap.h b/include/asm-powerpc/bits/heap.h deleted file mode 100644 index c1193e9..0000000 --- a/include/asm-powerpc/bits/heap.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003,2004 Philippe Gerum <r...@xenomai.org>. - * - * 64-bit PowerPC adoption - * copyright (C) 2005 Taneli Vähäkangas and Heikki Lindholm - * - * Xenomai is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Xenomai is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _XENO_ASM_POWERPC_BITS_HEAP_H -#define _XENO_ASM_POWERPC_BITS_HEAP_H - -#include <asm-generic/xenomai/bits/heap.h> - -#endif /* !_XENO_ASM_POWERPC_BITS_HEAP_H */ diff --git a/include/asm-sh/bits/Makefile.am b/include/asm-sh/bits/Makefile.am index 5cf154c..bcbf85d 100644 --- a/include/asm-sh/bits/Makefile.am +++ b/include/asm-sh/bits/Makefile.am @@ -2,7 +2,6 @@ includesubdir = $(includedir)/asm-sh/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-sh/bits/Makefile.in b/include/asm-sh/bits/Makefile.in index e531db2..f501623 100644 --- a/include/asm-sh/bits/Makefile.in +++ b/include/asm-sh/bits/Makefile.in @@ -243,7 +243,6 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/asm-sh/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod.h \ sched.h \ diff --git a/include/asm-sh/bits/heap.h b/include/asm-sh/bits/heap.h deleted file mode 100644 index ba37af3..0000000 --- a/include/asm-sh/bits/heap.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2011 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Xenomai is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _XENO_ASM_SH_BITS_HEAP_H -#define _XENO_ASM_SH_BITS_HEAP_H - -#include <asm-generic/xenomai/bits/heap.h> - -#endif /* !_XENO_ASM_SH_BITS_HEAP_H */ diff --git a/include/asm-x86/bits/Makefile.am b/include/asm-x86/bits/Makefile.am index 79fae9b..1a4011c 100644 --- a/include/asm-x86/bits/Makefile.am +++ b/include/asm-x86/bits/Makefile.am @@ -2,7 +2,6 @@ includesubdir = $(includedir)/asm-x86/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod_32.h \ pod_64.h \ diff --git a/include/asm-x86/bits/Makefile.in b/include/asm-x86/bits/Makefile.in index 23dc849..cc56e35 100644 --- a/include/asm-x86/bits/Makefile.in +++ b/include/asm-x86/bits/Makefile.in @@ -243,7 +243,6 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/asm-x86/bits includesub_HEADERS = \ bind.h \ - heap.h \ intr.h \ pod_32.h \ pod_64.h \ diff --git a/include/asm-x86/bits/heap.h b/include/asm-x86/bits/heap.h deleted file mode 100644 index c43e676..0000000 --- a/include/asm-x86/bits/heap.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003 Philippe Gerum <r...@xenomai.org>. - * - * Xenomai is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Xenomai is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xenomai; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _XENO_ASM_X86_BITS_HEAP_H -#define _XENO_ASM_X86_BITS_HEAP_H - -#include <asm-generic/xenomai/bits/heap.h> - -#endif /* !_XENO_ASM_X86_BITS_HEAP_H */ diff --git a/include/cobalt/nucleus/heap.h b/include/cobalt/nucleus/heap.h index 630d6cf..93effe2 100644 --- a/include/cobalt/nucleus/heap.h +++ b/include/cobalt/nucleus/heap.h @@ -107,7 +107,14 @@ typedef struct xnheap { xnholder_t *idleq[XNARCH_NR_CPUS]; - xnarch_heapcb_t archdep; + /* # of active user-space mappings. */ + unsigned long numaps; + /* Kernel memory flags (0 if vmalloc()). */ + int kmflags; + /* Shared heap memory base. */ + void *heapbase; + /* Callback upon last munmap. */ + void (*release)(struct xnheap *heap); XNARCH_DECL_DISPLAY_CONTEXT(); @@ -207,7 +214,7 @@ void xnheap_destroy_mapped(xnheap_t *heap, void __user *mapaddr); #define xnheap_base_memory(heap) \ - ((unsigned long)((heap)->archdep.heapbase)) + ((unsigned long)((heap)->heapbase)) #define xnheap_mapped_offset(heap,ptr) \ (((caddr_t)(ptr)) - (caddr_t)xnheap_base_memory(heap)) diff --git a/kernel/cobalt/nucleus/heap.c b/kernel/cobalt/nucleus/heap.c index 64b6677..1660dd3 100644 --- a/kernel/cobalt/nucleus/heap.c +++ b/kernel/cobalt/nucleus/heap.c @@ -69,7 +69,6 @@ HEAP { #include <nucleus/heap.h> #include <nucleus/vfile.h> #include <nucleus/assert.h> -#include <asm/xenomai/bits/heap.h> struct xnheap kheap; /* System heap */ EXPORT_SYMBOL_GPL(kheap); @@ -319,9 +318,12 @@ int xnheap_init(xnheap_t *heap, inith(&heap->stat_link); initq(&heap->extents); xnlock_init(&heap->lock); - xnarch_init_heapcb(&heap->archdep); + heap->numaps = 0; + heap->kmflags = 0; + heap->heapbase = NULL; + heap->release = NULL; memset(heap->buckets, 0, sizeof(heap->buckets)); - extent = (xnextent_t *)heapaddr; + extent = heapaddr; init_extent(heap, extent); appendq(&heap->extents, &extent->link); @@ -1165,7 +1167,7 @@ static void xnheap_vmopen(struct vm_area_struct *vma) xnheap_t *heap = vma->vm_private_data; spin_lock(&kheapq_lock); - heap->archdep.numaps++; + heap->numaps++; spin_unlock(&kheapq_lock); } @@ -1175,13 +1177,13 @@ static void xnheap_vmclose(struct vm_area_struct *vma) spin_lock(&kheapq_lock); - if (--heap->archdep.numaps == 0 && heap->archdep.release) { + if (--heap->numaps == 0 && heap->release) { removeq(&kheapq, &heap->link); spin_unlock(&kheapq_lock); - __unreserve_and_free_heap(heap->archdep.heapbase, + __unreserve_and_free_heap(heap->heapbase, xnheap_extentsize(heap), - heap->archdep.kmflags); - heap->archdep.release(heap); + heap->kmflags); + heap->release(heap); return; } @@ -1206,7 +1208,7 @@ static inline struct xnheap *__validate_heap_addr(void *addr) for (h = getheadq(&kheapq); h; h = nextq(&kheapq, h)) { heap = link2heap(h); - if (heap == addr && heap->archdep.release == NULL) + if (heap == addr && heap->release == NULL) return heap; } @@ -1241,14 +1243,14 @@ static int xnheap_mmap(struct file *file, struct vm_area_struct *vma) return -EINVAL; } - heap->archdep.numaps++; + heap->numaps++; spin_unlock(&kheapq_lock); vma->vm_private_data = file->private_data; vma->vm_ops = &xnheap_vmops; size = vma->vm_end - vma->vm_start; - kmflags = heap->archdep.kmflags; + kmflags = heap->kmflags; ret = -ENXIO; /* @@ -1369,9 +1371,8 @@ int xnheap_init_mapped(xnheap_t *heap, u_long heapsize, int memflags) return err; } - heap->archdep.kmflags = memflags; - heap->archdep.heapbase = heapbase; - heap->archdep.release = NULL; + heap->kmflags = memflags; + heap->heapbase = heapbase; spin_lock(&kheapq_lock); appendq(&kheapq, &heap->link); @@ -1414,7 +1415,7 @@ void xnheap_destroy_mapped(xnheap_t *heap, */ if (mapaddr) { down_write(¤t->mm->mmap_sem); - heap->archdep.release = NULL; + heap->release = NULL; do_munmap(current->mm, (unsigned long)mapaddr, len); up_write(¤t->mm->mmap_sem); } @@ -1426,9 +1427,9 @@ void xnheap_destroy_mapped(xnheap_t *heap, */ spin_lock(&kheapq_lock); - if (heap->archdep.numaps > 0) { + if (heap->numaps > 0) { /* The release handler is supposed to clean up the rest. */ - heap->archdep.release = release; + heap->release = release; spin_unlock(&kheapq_lock); XENO_ASSERT(NUCLEUS, release != NULL, /* nop */); return; @@ -1446,8 +1447,8 @@ void xnheap_destroy_mapped(xnheap_t *heap, spin_unlock(&kheapq_lock); - __unreserve_and_free_heap(heap->archdep.heapbase, len, - heap->archdep.kmflags); + __unreserve_and_free_heap(heap->heapbase, len, heap->kmflags); + if (release) release(heap); } _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git