All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] [PATCH v2] rtdm: expose user-side file descriptors to drivers
@ 2018-10-17 10:16 Sebastian Smolorz
  0 siblings, 0 replies; only message in thread
From: Sebastian Smolorz @ 2018-10-17 10:16 UTC (permalink / raw)
  To: xenomai

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.

Signed-off-by: Sebastian Smolorz <sebastian.smolorz@gmx.de>
---
 include/cobalt/kernel/rtdm/fd.h | 6 ++++++
 kernel/cobalt/rtdm/fd.c         | 1 +
 2 files changed, 7 insertions(+)

diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h
index 58d3c4a..572b17e 100644
--- a/include/cobalt/kernel/rtdm/fd.h
+++ b/include/cobalt/kernel/rtdm/fd.h
@@ -298,6 +298,7 @@ struct rtdm_fd {
 	struct rtdm_fd_ops *ops;
 	struct cobalt_ppd *owner;
 	unsigned int refs;
+	int ufd;
 	int minor;
 	int oflags;
 #ifdef CONFIG_XENO_ARCH_SYS3264
@@ -320,6 +321,11 @@ static inline struct cobalt_ppd *rtdm_fd_owner(const struct rtdm_fd *fd)
 	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)
 {
 	return fd->minor;
diff --git a/kernel/cobalt/rtdm/fd.c b/kernel/cobalt/rtdm/fd.c
index 8d577b2..807a11e 100644
--- a/kernel/cobalt/rtdm/fd.c
+++ b/kernel/cobalt/rtdm/fd.c
@@ -166,6 +166,7 @@ int rtdm_fd_enter(struct rtdm_fd *fd, int ufd, unsigned int magic,
 	fd->magic = magic;
 	fd->ops = ops;
 	fd->owner = ppd;
+	fd->ufd = ufd;
 	fd->refs = 1;
 	set_compat_bit(fd);
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-17 10:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17 10:16 [Xenomai] [PATCH v2] rtdm: expose user-side file descriptors to drivers Sebastian Smolorz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.