Module: xenomai-abe
Branch: analogy
Commit: 6a18c52710d8cc73f1036343b9ff67ab191de235
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=6a18c52710d8cc73f1036343b9ff67ab191de235

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Wed Apr 21 01:17:07 2010 +0200

analogy: add calls to rtdm_rt_capable() in ioctl handlers

Analogy now integrates calls to rtdm_rt_capable() in many ioctl
handlers. Not all of them were updated: the ioctls in charge of
the description of the board configuration  (dev_info, subd_info,
chan_info, rng_info) needs no real-time warranty in any way.

---

 ksrc/drivers/analogy/buffer.c      |   30 ++++++++++++++++++------------
 ksrc/drivers/analogy/command.c     |    3 +++
 ksrc/drivers/analogy/instruction.c |    6 ++++++
 ksrc/drivers/analogy/transfer.c    |    3 +++
 4 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c
index d882810..916a571 100644
--- a/ksrc/drivers/analogy/buffer.c
+++ b/ksrc/drivers/analogy/buffer.c
@@ -389,6 +389,12 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
        __a4l_dbg(1, core_dbg, 
                  "a4l_ioctl_mmap: minor=%d\n", a4l_get_minor(cxt));
 
+       /* The mmap operation cannot be performed in a 
+          real-time context */
+       if (rtdm_in_rt_context() != 0) {
+               return -ENOSYS;
+       }
+
        dev = a4l_get_dev(cxt);
 
        /* Basically check the device */
@@ -398,12 +404,6 @@ int a4l_ioctl_mmap(a4l_cxt_t *cxt, void *arg)
                return -EINVAL;
        }
 
-       /* The mmap operation cannot be performed in a 
-          real-time context */
-       if (rtdm_in_rt_context() != 0) {
-               return -ENOSYS;
-       }
-
        /* Recover the argument structure */
        if (rtdm_safe_copy_from_user(cxt->user_info,
                                     &map_cfg, arg, sizeof(a4l_mmap_t)) != 0)
@@ -467,18 +467,18 @@ int a4l_ioctl_bufcfg(a4l_cxt_t * cxt, void *arg)
        __a4l_dbg(1, core_dbg, 
                  "a4l_ioctl_bufcfg: minor=%d\n", a4l_get_minor(cxt));
 
-       /* Basic checking */
-       if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
-               __a4l_err("a4l_ioctl_bufcfg: unattached device\n");
-               return -EINVAL;
-       }
-
        /* As Linux API is used to allocate a virtual buffer,
           the calling process must not be in primary mode */
        if (rtdm_in_rt_context() != 0) {
                return -ENOSYS;
        }
 
+       /* Basic checking */
+       if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
+               __a4l_err("a4l_ioctl_bufcfg: unattached device\n");
+               return -EINVAL;
+       }
+
        if (rtdm_safe_copy_from_user(cxt->user_info,
                                     &buf_cfg, 
                                     arg, sizeof(a4l_bufcfg_t)) != 0)
@@ -536,6 +536,9 @@ int a4l_ioctl_bufinfo(a4l_cxt_t * cxt, void *arg)
        __a4l_dbg(1, core_dbg, 
                  "a4l_ioctl_bufinfo: minor=%d\n", a4l_get_minor(cxt));
 
+       if (rtdm_rt_capable(cxt->user_info) != 0)
+               return -ENOSYS;
+
        /* Basic checking */
        if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
                __a4l_err("a4l_ioctl_bufinfo: unattached device\n");
@@ -879,6 +882,9 @@ int a4l_ioctl_poll(a4l_cxt_t * cxt, void *arg)
        a4l_buf_t *buf;
        a4l_poll_t poll;
 
+       if (rtdm_rt_capable(cxt->user_info) != 0)
+               return -ENOSYS;
+
        /* Basic checking */
        if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
                __a4l_err("a4l_poll: unattached device\n");
diff --git a/ksrc/drivers/analogy/command.c b/ksrc/drivers/analogy/command.c
index d58f05f..05e4d78 100644
--- a/ksrc/drivers/analogy/command.c
+++ b/ksrc/drivers/analogy/command.c
@@ -304,6 +304,9 @@ int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg)
        __a4l_dbg(1, core_dbg, 
                  "a4l_ioctl_cmd: minor=%d\n", a4l_get_minor(cxt));
 
+       if (rtdm_rt_capable(cxt->user_info) != 0)
+               return -ENOSYS;
+
        /* Basically check the device */
        if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
                __a4l_err("a4l_ioctl_cmd: cannot command "
diff --git a/ksrc/drivers/analogy/instruction.c 
b/ksrc/drivers/analogy/instruction.c
index f3a4ed7..a95c8c5 100644
--- a/ksrc/drivers/analogy/instruction.c
+++ b/ksrc/drivers/analogy/instruction.c
@@ -292,6 +292,9 @@ int a4l_ioctl_insn(a4l_cxt_t * cxt, void *arg)
        a4l_kinsn_t insn;
        a4l_dev_t *dev = a4l_get_dev(cxt);
 
+       if (rtdm_rt_capable(cxt->user_info) != 0)
+               return -ENOSYS;
+
        /* Basic checking */
        if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
                __a4l_err("a4l_ioctl_insn: unattached device\n");
@@ -391,6 +394,9 @@ int a4l_ioctl_insnlist(a4l_cxt_t * cxt, void *arg)
        a4l_kilst_t ilst;
        a4l_dev_t *dev = a4l_get_dev(cxt);
 
+       if (rtdm_rt_capable(cxt->user_info) != 0)
+               return -ENOSYS;
+
        /* Basic checking */
        if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
                __a4l_err("a4l_ioctl_insnlist: unattached device\n");
diff --git a/ksrc/drivers/analogy/transfer.c b/ksrc/drivers/analogy/transfer.c
index c2a8d90..c8a7d43 100644
--- a/ksrc/drivers/analogy/transfer.c
+++ b/ksrc/drivers/analogy/transfer.c
@@ -498,6 +498,9 @@ int a4l_ioctl_cancel(a4l_cxt_t * cxt, void *arg)
        a4l_dev_t *dev = a4l_get_dev(cxt);
        a4l_subd_t *subd;
 
+       __a4l_dbg(1, core_dbg, 
+                 "a4l_ioctl_cancel: minor=%d\n", a4l_get_minor(cxt));
+
        /* Basically check the device */
        if (!test_bit(A4L_DEV_ATTACHED, &dev->flags)) {
                __a4l_err("a4l_ioctl_cancel: operation not supported on "


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to