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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Nov  8 13:43:29 2014 +0100

include/rtdm: drop obsolete rt_dev API, move to trank support

---

 include/rtdm/rtdm.h       |   25 -----------
 include/rtdm/uapi/rtdm.h  |  103 ---------------------------------------------
 include/trank/rtdm/rtdm.h |  103 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+), 128 deletions(-)

diff --git a/include/rtdm/rtdm.h b/include/rtdm/rtdm.h
index a6c1e49..dab4bf9 100644
--- a/include/rtdm/rtdm.h
+++ b/include/rtdm/rtdm.h
@@ -53,31 +53,6 @@
  * rtdm_profiles "Device Profiles" for precise information.
  */
 
-/*
- * Define RTDM_NO_DEFAULT_USER_API to switch off the default
- * rt_dev_xxx interface when providing a customised user API.
- */
-#if !defined(RTDM_NO_DEFAULT_USER_API) && !defined(DOXYGEN_CPP)
-
-#define rt_dev_call(__call, __args...) \
-({                                     \
-       int __ret;                      \
-       __ret = __RT(__call(__args));   \
-       __ret < 0 ? -errno : __ret;     \
-})
-
-#define rt_dev_open(__args...)         rt_dev_call(open, __args)
-#define rt_dev_socket(__args...)       rt_dev_call(socket, __args)
-#define rt_dev_close(__args...)                rt_dev_call(close, __args)
-#define rt_dev_ioctl(__args...)                rt_dev_call(ioctl, __args)
-#define rt_dev_read(__args...)         rt_dev_call(read, __args)
-#define rt_dev_write(__args...)                rt_dev_call(write, __args)
-#define rt_dev_recvmsg(__args...)      rt_dev_call(recvmsg, __args)
-#define rt_dev_sendmsg(__args...)      rt_dev_call(sendmsg, __args)
-#define rt_dev_recvfrom(__args...)     rt_dev_call(recvfrom, __args)
-
-#endif /* !(RTDM_NO_DEFAULT_USER_API && DOXYGEN_CPP) */
-
 #include <rtdm/uapi/rtdm.h>
 
 #endif /* !_RTDM_RTDM_H */
diff --git a/include/rtdm/uapi/rtdm.h b/include/rtdm/uapi/rtdm.h
index 59923e3..2faa14f 100644
--- a/include/rtdm/uapi/rtdm.h
+++ b/include/rtdm/uapi/rtdm.h
@@ -203,107 +203,4 @@ struct _rtdm_mmap_request {
        int flags;
 };
 
-#ifndef RTDM_NO_DEFAULT_USER_API
-
-static inline ssize_t rt_dev_recv(int fd, void *buf, size_t len, int flags)
-{
-       return rt_dev_recvfrom(fd, buf, len, flags, NULL, NULL);
-}
-
-static inline ssize_t rt_dev_sendto(int fd, const void *buf, size_t len,
-                                   int flags, const struct sockaddr *to,
-                                   socklen_t tolen)
-{
-       struct iovec iov;
-       struct msghdr msg;
-
-       iov.iov_base = (void *)buf;
-       iov.iov_len = len;
-
-       msg.msg_name = (struct sockaddr *)to;
-       msg.msg_namelen = tolen;
-       msg.msg_iov = &iov;
-       msg.msg_iovlen = 1;
-       msg.msg_control = NULL;
-       msg.msg_controllen = 0;
-
-       return rt_dev_sendmsg(fd, &msg, flags);
-}
-
-static inline ssize_t rt_dev_send(int fd, const void *buf, size_t len,
-                                 int flags)
-{
-       return rt_dev_sendto(fd, buf, len, flags, NULL, 0);
-}
-
-static inline int rt_dev_getsockopt(int fd, int level, int optname,
-                                   void *optval, socklen_t *optlen)
-{
-       struct _rtdm_getsockopt_args args =
-               { level, optname, optval, optlen };
-
-       return rt_dev_ioctl(fd, _RTIOC_GETSOCKOPT, &args);
-}
-
-static inline int rt_dev_setsockopt(int fd, int level, int optname,
-                                   const void *optval, socklen_t optlen)
-{
-       struct _rtdm_setsockopt_args args =
-               { level, optname, (void *)optval, optlen };
-
-       return rt_dev_ioctl(fd, _RTIOC_SETSOCKOPT, &args);
-}
-
-static inline int rt_dev_bind(int fd, const struct sockaddr *my_addr,
-                             socklen_t addrlen)
-{
-       struct _rtdm_setsockaddr_args args = { my_addr, addrlen };
-
-       return rt_dev_ioctl(fd, _RTIOC_BIND, &args);
-}
-
-static inline int rt_dev_connect(int fd, const struct sockaddr *serv_addr,
-                                socklen_t addrlen)
-{
-       struct _rtdm_setsockaddr_args args = { serv_addr, addrlen };
-
-       return rt_dev_ioctl(fd, _RTIOC_CONNECT, &args);
-}
-
-static inline int rt_dev_listen(int fd, int backlog)
-{
-       return rt_dev_ioctl(fd, _RTIOC_LISTEN, backlog);
-}
-
-static inline int rt_dev_accept(int fd, struct sockaddr *addr,
-                               socklen_t *addrlen)
-{
-       struct _rtdm_getsockaddr_args args = { addr, addrlen };
-
-       return rt_dev_ioctl(fd, _RTIOC_ACCEPT, &args);
-}
-
-static inline int rt_dev_getsockname(int fd, struct sockaddr *name,
-                                    socklen_t *namelen)
-{
-       struct _rtdm_getsockaddr_args args = { name, namelen };
-
-       return rt_dev_ioctl(fd, _RTIOC_GETSOCKNAME, &args);
-}
-
-static inline int rt_dev_getpeername(int fd, struct sockaddr *name,
-                                    socklen_t *namelen)
-{
-       struct _rtdm_getsockaddr_args args = { name, namelen };
-
-       return rt_dev_ioctl(fd, _RTIOC_GETPEERNAME, &args);
-}
-
-static inline int rt_dev_shutdown(int fd, int how)
-{
-       return rt_dev_ioctl(fd, _RTIOC_SHUTDOWN, how);
-}
-
-#endif /* RTDM_NO_DEFAULT_USER_API */
-
 #endif /* !_RTDM_UAPI_RTDM_H */
diff --git a/include/trank/rtdm/rtdm.h b/include/trank/rtdm/rtdm.h
index ad6bb58..eaf18e9 100644
--- a/include/trank/rtdm/rtdm.h
+++ b/include/trank/rtdm/rtdm.h
@@ -20,4 +20,107 @@
 
 #include_next <rtdm/rtdm.h>
 
+#ifndef RTDM_NO_DEFAULT_USER_API
+
+static inline ssize_t rt_dev_recv(int fd, void *buf, size_t len, int flags)
+{
+       return __RT(recvfrom(fd, buf, len, flags, NULL, NULL));
+}
+
+static inline ssize_t rt_dev_sendto(int fd, const void *buf, size_t len,
+                                   int flags, const struct sockaddr *to,
+                                   socklen_t tolen)
+{
+       struct iovec iov;
+       struct msghdr msg;
+
+       iov.iov_base = (void *)buf;
+       iov.iov_len = len;
+
+       msg.msg_name = (struct sockaddr *)to;
+       msg.msg_namelen = tolen;
+       msg.msg_iov = &iov;
+       msg.msg_iovlen = 1;
+       msg.msg_control = NULL;
+       msg.msg_controllen = 0;
+
+       return __RT(sendmsg(fd, &msg, flags));
+}
+
+static inline ssize_t rt_dev_send(int fd, const void *buf, size_t len,
+                                 int flags)
+{
+       return __RT(sendto(fd, buf, len, flags, NULL, 0));
+}
+
+static inline int rt_dev_getsockopt(int fd, int level, int optname,
+                                   void *optval, socklen_t *optlen)
+{
+       struct _rtdm_getsockopt_args args =
+               { level, optname, optval, optlen };
+
+       return __RT(ioctl(fd, _RTIOC_GETSOCKOPT, &args));
+}
+
+static inline int rt_dev_setsockopt(int fd, int level, int optname,
+                                   const void *optval, socklen_t optlen)
+{
+       struct _rtdm_setsockopt_args args =
+               { level, optname, (void *)optval, optlen };
+
+       return __RT(ioctl(fd, _RTIOC_SETSOCKOPT, &args));
+}
+
+static inline int rt_dev_bind(int fd, const struct sockaddr *my_addr,
+                             socklen_t addrlen)
+{
+       struct _rtdm_setsockaddr_args args = { my_addr, addrlen };
+
+       return __RT(ioctl(fd, _RTIOC_BIND, &args));
+}
+
+static inline int rt_dev_connect(int fd, const struct sockaddr *serv_addr,
+                                socklen_t addrlen)
+{
+       struct _rtdm_setsockaddr_args args = { serv_addr, addrlen };
+
+       return __RT(ioctl(fd, _RTIOC_CONNECT, &args));
+}
+
+static inline int rt_dev_listen(int fd, int backlog)
+{
+       return __RT(ioctl(fd, _RTIOC_LISTEN, backlog));
+}
+
+static inline int rt_dev_accept(int fd, struct sockaddr *addr,
+                               socklen_t *addrlen)
+{
+       struct _rtdm_getsockaddr_args args = { addr, addrlen };
+
+       return __RT(ioctl(fd, _RTIOC_ACCEPT, &args));
+}
+
+static inline int rt_dev_getsockname(int fd, struct sockaddr *name,
+                                    socklen_t *namelen)
+{
+       struct _rtdm_getsockaddr_args args = { name, namelen };
+
+       return __RT(ioctl(fd, _RTIOC_GETSOCKNAME, &args));
+}
+
+static inline int rt_dev_getpeername(int fd, struct sockaddr *name,
+                                    socklen_t *namelen)
+{
+       struct _rtdm_getsockaddr_args args = { name, namelen };
+
+       return __RT(ioctl(fd, _RTIOC_GETPEERNAME, &args));
+}
+
+static inline int rt_dev_shutdown(int fd, int how)
+{
+       return __RT(ioctl(fd, _RTIOC_SHUTDOWN, how));
+}
+
+#endif /* RTDM_NO_DEFAULT_USER_API */
+
 #endif /* _XENOMAI_TRANK_RTDM_RTDM_H */


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

Reply via email to