Module: xenomai-forge
Branch: next
Commit: 72534270316e3fd3c4399c2a9b07afa49f2e247d
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=72534270316e3fd3c4399c2a9b07afa49f2e247d

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Sep  8 12:42:54 2014 +0200

cobalt/kernel, lib/cobalt: drop /dev/rtheap entirely

---

 include/cobalt/kernel/heap.h      |    4 ----
 include/cobalt/uapi/kernel/heap.h |    3 ---
 kernel/cobalt/heap.c              |   18 ------------------
 kernel/cobalt/init.c              |    8 +-------
 kernel/cobalt/posix/process.c     |   14 +++-----------
 kernel/cobalt/rtdm/drvlib.c       |   25 ++++++++-----------------
 kernel/cobalt/udev/rtheap.rules   |    2 --
 lib/alchemy/queue.c               |    3 ---
 lib/cobalt/init.c                 |    7 -------
 9 files changed, 12 insertions(+), 72 deletions(-)

diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index 81899e9..565f346 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -168,10 +168,6 @@ static inline void xnheap_init_proc(void) { }
 static inline void xnheap_cleanup_proc(void) { }
 #endif /* !CONFIG_XENO_OPT_VFILE */
 
-int xnheap_mount(void);
-
-void xnheap_umount(void);
-
 #define xnheap_base_memory(heap) \
        ((unsigned long)((heap)->heapbase))
 
diff --git a/include/cobalt/uapi/kernel/heap.h 
b/include/cobalt/uapi/kernel/heap.h
index 9be6bf3..75e7289 100644
--- a/include/cobalt/uapi/kernel/heap.h
+++ b/include/cobalt/uapi/kernel/heap.h
@@ -20,9 +20,6 @@
 
 #include <linux/types.h>
 
-#define XNHEAP_DEV_NAME  "/dev/rtheap"
-#define XNHEAP_DEV_MINOR 254
-
 #define COBALT_MEMDEV_PRIVATE  "memdev-private"
 #define COBALT_MEMDEV_SHARED   "memdev-shared"
 #define COBALT_MEMDEV_SYS      "memdev-sys"
diff --git a/kernel/cobalt/heap.c b/kernel/cobalt/heap.c
index 43f8123..69dfadb 100644
--- a/kernel/cobalt/heap.c
+++ b/kernel/cobalt/heap.c
@@ -940,22 +940,4 @@ out:
 }
 EXPORT_SYMBOL_GPL(xnheap_check_block);
 
-static struct file_operations xnheap_fops = {
-       .owner = THIS_MODULE,
-};
-
-static struct miscdevice xnheap_dev = {
-       XNHEAP_DEV_MINOR, "rtheap", &xnheap_fops
-};
-
-void xnheap_umount(void)
-{
-       misc_deregister(&xnheap_dev);
-}
-
-int __init xnheap_mount(void)
-{
-       return misc_register(&xnheap_dev);
-}
-
 /** @} */
diff --git a/kernel/cobalt/init.c b/kernel/cobalt/init.c
index 999b96b..252dbd8 100644
--- a/kernel/cobalt/init.c
+++ b/kernel/cobalt/init.c
@@ -405,15 +405,11 @@ static int __init xenomai_init(void)
        if (ret)
                goto cleanup_proc;
 
-       ret = xnheap_mount();
-       if (ret)
-               goto cleanup_mach;
-
        xnintr_mount();
 
        ret = xnpipe_mount();
        if (ret)
-               goto cleanup_heap;
+               goto cleanup_mach;
 
        ret = xnselect_mount();
        if (ret)
@@ -449,8 +445,6 @@ cleanup_select:
        xnselect_umount();
 cleanup_pipe:
        xnpipe_umount();
-cleanup_heap:
-       xnheap_umount();
 cleanup_mach:
        mach_cleanup();
 cleanup_proc:
diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index c9ed940..b1f0d72 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -23,13 +23,10 @@
  */
 #include <stdarg.h>
 #include <linux/unistd.h>
-#include <linux/wait.h>
-#include <linux/semaphore.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/fs.h>
-#include <linux/sched.h>
-#include <linux/kthread.h>
+#include <linux/anon_inodes.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
@@ -37,9 +34,8 @@
 #include <linux/file.h>
 #include <linux/ptrace.h>
 #include <linux/vmalloc.h>
-#include <linux/completion.h>
-#include <linux/kallsyms.h>
 #include <linux/signal.h>
+#include <linux/kallsyms.h>
 #include <linux/ipipe.h>
 #include <linux/ipipe_tickdev.h>
 #include <cobalt/kernel/sched.h>
@@ -850,18 +846,14 @@ static struct file_operations mayday_fops = {
 
 static unsigned long map_mayday_page(struct task_struct *p)
 {
-       const struct file_operations *old_fops;
        unsigned long u_addr;
        struct file *filp;
 
-       filp = filp_open(XNHEAP_DEV_NAME, O_RDONLY, 0);
+       filp = anon_inode_getfile("[mayday]", &mayday_fops, NULL, O_RDONLY);
        if (IS_ERR(filp))
                return 0;
 
-       old_fops = filp->f_op;
-       filp->f_op = &mayday_fops;
        u_addr = vm_mmap(filp, 0, PAGE_SIZE, PROT_EXEC|PROT_READ, MAP_SHARED, 
0);
-       filp->f_op = (typeof(filp->f_op))old_fops;
        filp_close(filp, p->files);
 
        return IS_ERR_VALUE(u_addr) ? 0UL : u_addr;
diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index eb07dcd..aab8725 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -27,7 +27,7 @@
 #include <asm/pgtable.h>
 #include <linux/highmem.h>
 #include <linux/err.h>
-
+#include <linux/anon_inodes.h>
 #include <rtdm/driver.h>
 #include "internal.h"
 #include <trace/events/cobalt-rtdm.h>
@@ -1633,30 +1633,21 @@ static struct file_operations mmap_fops = {
        .get_unmapped_area = unmapped_area_trampoline
 };
 
-static int rtdm_mmap(struct mmap_tramp_data *tramp_data,
-                    size_t len, off_t offset, int prot, int flags,
-                    void **pptr)
+static int do_rtdm_mmap(struct mmap_tramp_data *tramp_data,
+                       size_t len, off_t offset, int prot, int flags,
+                       void **pptr)
 {
-       const struct file_operations *old_fops;
        unsigned long u_addr;
-       void *old_priv_data;
        struct file *filp;
 
        if (!XENO_ASSERT(COBALT, xnsched_root_p()))
                return -EPERM;
 
-       filp = filp_open(XNHEAP_DEV_NAME, O_RDWR, 0);
+       filp = anon_inode_getfile("[rtdm]", &mmap_fops, tramp_data, O_RDWR);
        if (IS_ERR(filp))
                return PTR_ERR(filp);
 
-       old_fops = filp->f_op;
-       filp->f_op = &mmap_fops;
-       old_priv_data = filp->private_data;
-       filp->private_data = tramp_data;
        u_addr = vm_mmap(filp, (unsigned long)*pptr, len, prot, flags, offset);
-       filp->f_op = (typeof(filp->f_op))old_fops;
-       filp->private_data = old_priv_data;
-
        filp_close(filp, current->files);
 
        if (IS_ERR_VALUE(u_addr))
@@ -1676,7 +1667,7 @@ int __rtdm_mmap_from_fdop(struct rtdm_fd *fd, size_t len, 
off_t offset,
                .unmapped_area_handler = NULL,
        };
 
-       return rtdm_mmap(&tramp_data, len, offset, prot, flags, pptr);
+       return do_rtdm_mmap(&tramp_data, len, offset, prot, flags, pptr);
 }
 
 /**
@@ -1745,7 +1736,7 @@ int rtdm_mmap_to_user(struct rtdm_fd *fd,
                .vm_private_data = vm_private_data
        };
 
-       return rtdm_mmap(&helper_data.tramp_data, len, 0, prot, MAP_SHARED, 
pptr);
+       return do_rtdm_mmap(&helper_data.tramp_data, len, 0, prot, MAP_SHARED, 
pptr);
 }
 EXPORT_SYMBOL_GPL(rtdm_mmap_to_user);
 
@@ -1811,7 +1802,7 @@ int rtdm_iomap_to_user(struct rtdm_fd *fd,
                .vm_private_data = vm_private_data
        };
 
-       return rtdm_mmap(&helper_data.tramp_data, len, 0, prot, MAP_SHARED, 
pptr);
+       return do_rtdm_mmap(&helper_data.tramp_data, len, 0, prot, MAP_SHARED, 
pptr);
 }
 EXPORT_SYMBOL_GPL(rtdm_iomap_to_user);
 
diff --git a/kernel/cobalt/udev/rtheap.rules b/kernel/cobalt/udev/rtheap.rules
deleted file mode 100644
index 1585b76..0000000
--- a/kernel/cobalt/udev/rtheap.rules
+++ /dev/null
@@ -1,2 +0,0 @@
-# real-time heap device (Xenomai:rtheap)
-KERNEL=="rtheap", MODE="0660", GROUP=="xenomai"
diff --git a/lib/alchemy/queue.c b/lib/alchemy/queue.c
index 9f68b05..f53bc7a 100644
--- a/lib/alchemy/queue.c
+++ b/lib/alchemy/queue.c
@@ -147,9 +147,6 @@ fnref_register(libalchemy, queue_finalize);
  * exchange data through the use of variable-sized messages. A message
  * queue is created empty.
  *
- * This service needs the special character device /dev/rtheap
- * (10,254) when called from user-space tasks.
- *
  * @param q The address of a queue descriptor which can be later used
  * to identify uniquely the created object, upon success of this call.
  *
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index ab95d4c..ed4cbb7 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -67,13 +67,6 @@ static void low_init(void)
        struct cobalt_featinfo *f;
        int ret;
 
-       /* Some sanity checks first. */
-       if (access(XNHEAP_DEV_NAME, 0)) {
-               report_error("%s is missing\n(chardev, major=10 minor=%d)",
-                            XNHEAP_DEV_NAME, XNHEAP_DEV_MINOR);
-               exit(EXIT_FAILURE);
-       }
-
        old_sigill_handler = signal(SIGILL, sigill_handler);
        if (old_sigill_handler == SIG_ERR) {
                report_error("signal(SIGILL): %s", strerror(errno));


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

Reply via email to