20 #ifndef _COBALT_KERNEL_FD_H 21 #define _COBALT_KERNEL_FD_H 23 #include <linux/types.h> 24 #include <linux/socket.h> 25 #include <linux/file.h> 26 #include <cobalt/kernel/tree.h> 27 #include <asm-generic/xenomai/syscall.h> 29 struct vm_area_struct;
31 struct _rtdm_mmap_request;
182 unsigned int type,
unsigned int index);
234 unsigned long len,
unsigned long pgoff,
235 unsigned long flags);
246 int (*
open)(
struct rtdm_fd *fd,
int oflags);
248 int (*
socket)(
struct rtdm_fd *fd,
int protocol);
253 unsigned int request,
void __user *arg);
256 unsigned int request,
void __user *arg);
259 void __user *buf,
size_t size);
262 void __user *buf,
size_t size);
265 const void __user *buf,
size_t size);
268 const void __user *buf,
size_t size);
271 struct user_msghdr *msg,
int flags);
274 struct user_msghdr *msg,
int flags);
277 const struct user_msghdr *msg,
int flags);
280 const struct user_msghdr *msg,
int flags);
283 struct xnselector *selector,
284 unsigned int type,
unsigned int index);
286 int (*
mmap)(
struct rtdm_fd *fd,
287 struct vm_area_struct *vma);
292 unsigned long flags);
300 struct cobalt_ppd *owner;
305 #ifdef CONFIG_XENO_ARCH_SYS3264 309 struct list_head cleanup;
310 struct list_head next;
313 #define RTDM_FD_MAGIC 0x52544446 315 #define RTDM_FD_COMPAT __COBALT_COMPAT_BIT 316 #define RTDM_FD_COMPATX __COBALT_COMPATX_BIT 318 int __rtdm_anon_getfd(
const char *name,
int flags);
320 void __rtdm_anon_putfd(
int ufd);
322 static inline struct cobalt_ppd *rtdm_fd_owner(
const struct rtdm_fd *fd)
327 static inline int rtdm_fd_ufd(
const struct rtdm_fd *fd)
332 static inline int rtdm_fd_minor(
const struct rtdm_fd *fd)
337 static inline int rtdm_fd_flags(
const struct rtdm_fd *fd)
342 #ifdef CONFIG_XENO_ARCH_SYS3264 343 static inline int rtdm_fd_is_compat(
const struct rtdm_fd *fd)
348 static inline int rtdm_fd_is_compat(
const struct rtdm_fd *fd)
354 int rtdm_fd_enter(
struct rtdm_fd *rtdm_fd,
int ufd,
357 int rtdm_fd_register(
struct rtdm_fd *fd,
int ufd);
359 struct rtdm_fd *
rtdm_fd_get(
int ufd,
unsigned int magic);
367 int rtdm_fd_fcntl(
int ufd,
int cmd, ...);
369 int rtdm_fd_ioctl(
int ufd,
unsigned int request, ...);
371 ssize_t rtdm_fd_read(
int ufd,
void __user *buf,
size_t size);
373 ssize_t rtdm_fd_write(
int ufd,
const void __user *buf,
size_t size);
375 int rtdm_fd_close(
int ufd,
unsigned int magic);
377 ssize_t rtdm_fd_recvmsg(
int ufd,
struct user_msghdr *msg,
int flags);
379 int __rtdm_fd_recvmmsg(
int ufd,
void __user *u_msgvec,
unsigned int vlen,
380 unsigned int flags,
void __user *u_timeout,
381 int (*get_mmsg)(
struct mmsghdr *mmsg,
void __user *u_mmsg),
382 int (*put_mmsg)(
void __user **u_mmsg_p,
const struct mmsghdr *mmsg),
383 int (*get_timespec)(
struct timespec *ts,
const void __user *u_ts));
385 ssize_t rtdm_fd_sendmsg(
int ufd,
const struct user_msghdr *msg,
388 int __rtdm_fd_sendmmsg(
int ufd,
void __user *u_msgvec,
unsigned int vlen,
390 int (*get_mmsg)(
struct mmsghdr *mmsg,
void __user *u_mmsg),
391 int (*put_mmsg)(
void __user **u_mmsg_p,
const struct mmsghdr *mmsg));
393 int rtdm_fd_mmap(
int ufd,
struct _rtdm_mmap_request *rma,
396 int rtdm_fd_valid_p(
int ufd);
401 int rtdm_device_new_fd(
struct rtdm_fd *fd,
int ufd,
404 void rtdm_device_flush_fds(
struct rtdm_device *dev);
406 void rtdm_fd_cleanup(
struct cobalt_ppd *p);
408 void rtdm_fd_init(
void);
ssize_t(* read_nrt)(struct rtdm_fd *fd, void __user *buf, size_t size)
See rtdm_read_handler().
Definition: fd.h:261
int(* mmap)(struct rtdm_fd *fd, struct vm_area_struct *vma)
See rtdm_mmap_handler().
Definition: fd.h:286
ssize_t(* sendmsg_nrt)(struct rtdm_fd *fd, const struct user_msghdr *msg, int flags)
See rtdm_sendmsg_handler().
Definition: fd.h:279
void rtdm_fd_put(struct rtdm_fd *fd)
Release a RTDM file descriptor obtained via rtdm_fd_get()
Definition: fd.c:362
ssize_t(* recvmsg_rt)(struct rtdm_fd *fd, struct user_msghdr *msg, int flags)
See rtdm_recvmsg_handler().
Definition: fd.h:270
RTDM file operation descriptor.
Definition: fd.h:244
ssize_t(* read_rt)(struct rtdm_fd *fd, void __user *buf, size_t size)
See rtdm_read_handler().
Definition: fd.h:258
ssize_t rtdm_write_handler(struct rtdm_fd *fd, const void __user *buf, size_t size)
Write handler.
int rtdm_mmap_handler(struct rtdm_fd *fd, struct vm_area_struct *vma)
Memory mapping handler.
int(* socket)(struct rtdm_fd *fd, int protocol)
See rtdm_socket_handler().
Definition: fd.h:248
unsigned long rtdm_get_unmapped_area_handler(struct rtdm_fd *fd, unsigned long len, unsigned long pgoff, unsigned long flags)
Allocate mapping region in address space.
struct rtdm_fd * rtdm_fd_get(int ufd, unsigned int magic)
Retrieve and lock a RTDM file descriptor
Definition: fd.c:234
ssize_t rtdm_sendmsg_handler(struct rtdm_fd *fd, const struct user_msghdr *msg, int flags)
Transmit message handler.
int(* ioctl_rt)(struct rtdm_fd *fd, unsigned int request, void __user *arg)
See rtdm_ioctl_handler().
Definition: fd.h:252
int rtdm_fd_lock(struct rtdm_fd *fd)
Hold a reference on a RTDM file descriptor
Definition: fd.c:386
int(* ioctl_nrt)(struct rtdm_fd *fd, unsigned int request, void __user *arg)
See rtdm_ioctl_handler().
Definition: fd.h:255
ssize_t(* write_rt)(struct rtdm_fd *fd, const void __user *buf, size_t size)
See rtdm_write_handler().
Definition: fd.h:264
int rtdm_ioctl_handler(struct rtdm_fd *fd, unsigned int request, void __user *arg)
IOCTL handler.
int rtdm_fd_select(int ufd, struct xnselector *selector, unsigned int type)
Bind a selector to specified event types of a given file descriptor
Definition: fd.c:952
int rtdm_open_handler(struct rtdm_fd *fd, int oflags)
Open handler for named devices.
ssize_t(* recvmsg_nrt)(struct rtdm_fd *fd, struct user_msghdr *msg, int flags)
See rtdm_recvmsg_handler().
Definition: fd.h:273
int rtdm_select_handler(struct rtdm_fd *fd, struct xnselector *selector, unsigned int type, unsigned int index)
Select handler.
int(* select)(struct rtdm_fd *fd, struct xnselector *selector, unsigned int type, unsigned int index)
See rtdm_select_handler().
Definition: fd.h:282
ssize_t rtdm_read_handler(struct rtdm_fd *fd, void __user *buf, size_t size)
Read handler.
void rtdm_close_handler(struct rtdm_fd *fd)
Close handler.
ssize_t(* write_nrt)(struct rtdm_fd *fd, const void __user *buf, size_t size)
See rtdm_write_handler().
Definition: fd.h:267
int(* open)(struct rtdm_fd *fd, int oflags)
See rtdm_open_handler().
Definition: fd.h:246
int rtdm_socket_handler(struct rtdm_fd *fd, int protocol)
Socket creation handler for protocol devices.
ssize_t(* sendmsg_rt)(struct rtdm_fd *fd, const struct user_msghdr *msg, int flags)
See rtdm_sendmsg_handler().
Definition: fd.h:276
void(* close)(struct rtdm_fd *fd)
See rtdm_close_handler().
Definition: fd.h:250
ssize_t rtdm_recvmsg_handler(struct rtdm_fd *fd, struct user_msghdr *msg, int flags)
Receive message handler.
void rtdm_fd_unlock(struct rtdm_fd *fd)
Drop a reference on a RTDM file descriptor
Definition: fd.c:413
RTDM device.
Definition: driver.h:338
unsigned long(* get_unmapped_area)(struct rtdm_fd *fd, unsigned long len, unsigned long pgoff, unsigned long flags)
See rtdm_get_unmapped_area_handler().
Definition: fd.h:289