Commit 04df9389 authored by Sebastian Smolorz's avatar Sebastian Smolorz Committed by Jan Kiszka

rtdm: expose user-side file descriptors to drivers

RTDM drivers refer to open files or sockets by using struct rtdm_fd.
Normally, the user-side file descriptors returned by socket() or open()
calls are not necessary for driver operations. However, in some special
cases the user-side fd has to be determined, for example as return
value of rt_tcp_accept() which is a driver function of RTnet's TCP
protocol driver.
Signed-off-by: 's avatarSebastian Smolorz <sebastian.smolorz@gmx.de>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent bed7acf3
...@@ -298,6 +298,7 @@ struct rtdm_fd { ...@@ -298,6 +298,7 @@ struct rtdm_fd {
struct rtdm_fd_ops *ops; struct rtdm_fd_ops *ops;
struct cobalt_ppd *owner; struct cobalt_ppd *owner;
unsigned int refs; unsigned int refs;
int ufd;
int minor; int minor;
int oflags; int oflags;
#ifdef CONFIG_XENO_ARCH_SYS3264 #ifdef CONFIG_XENO_ARCH_SYS3264
...@@ -320,6 +321,11 @@ static inline struct cobalt_ppd *rtdm_fd_owner(const struct rtdm_fd *fd) ...@@ -320,6 +321,11 @@ static inline struct cobalt_ppd *rtdm_fd_owner(const struct rtdm_fd *fd)
return fd->owner; return fd->owner;
} }
static inline int rtdm_fd_ufd(const struct rtdm_fd *fd)
{
return fd->ufd;
}
static inline int rtdm_fd_minor(const struct rtdm_fd *fd) static inline int rtdm_fd_minor(const struct rtdm_fd *fd)
{ {
return fd->minor; return fd->minor;
......
...@@ -166,6 +166,7 @@ int rtdm_fd_enter(struct rtdm_fd *fd, int ufd, unsigned int magic, ...@@ -166,6 +166,7 @@ int rtdm_fd_enter(struct rtdm_fd *fd, int ufd, unsigned int magic,
fd->magic = magic; fd->magic = magic;
fd->ops = ops; fd->ops = ops;
fd->owner = ppd; fd->owner = ppd;
fd->ufd = ufd;
fd->refs = 1; fd->refs = 1;
set_compat_bit(fd); set_compat_bit(fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment