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;
181 unsigned int type,
unsigned int index);
233 unsigned long len,
unsigned long pgoff,
234 unsigned long flags);
245 int (*
open)(
struct rtdm_fd *fd,
int oflags);
247 int (*
socket)(
struct rtdm_fd *fd,
int protocol);
252 unsigned int request,
void __user *arg);
255 unsigned int request,
void __user *arg);
258 void __user *buf,
size_t size);
261 void __user *buf,
size_t size);
264 const void __user *buf,
size_t size);
267 const void __user *buf,
size_t size);
270 struct user_msghdr *msg,
int flags);
273 struct user_msghdr *msg,
int flags);
276 const struct user_msghdr *msg,
int flags);
279 const struct user_msghdr *msg,
int flags);
282 struct xnselector *selector,
283 unsigned int type,
unsigned int index);
285 int (*
mmap)(
struct rtdm_fd *fd,
286 struct vm_area_struct *vma);
291 unsigned long flags);
299 struct cobalt_ppd *owner;
303 #ifdef CONFIG_XENO_ARCH_SYS3264 306 struct list_head cleanup;
309 #define RTDM_FD_MAGIC 0x52544446 311 #define RTDM_FD_COMPAT __COBALT_COMPAT_BIT 312 #define RTDM_FD_COMPATX __COBALT_COMPATX_BIT 314 int __rtdm_anon_getfd(
const char *name,
int flags);
316 void __rtdm_anon_putfd(
int ufd);
318 static inline struct cobalt_ppd *rtdm_fd_owner(
const struct rtdm_fd *fd)
323 static inline int rtdm_fd_minor(
const struct rtdm_fd *fd)
328 static inline int rtdm_fd_flags(
const struct rtdm_fd *fd)
333 #ifdef CONFIG_XENO_ARCH_SYS3264 334 static inline int rtdm_fd_is_compat(
const struct rtdm_fd *fd)
339 static inline int rtdm_fd_is_compat(
const struct rtdm_fd *fd)
345 int rtdm_fd_enter(
struct rtdm_fd *rtdm_fd,
int ufd,
348 struct rtdm_fd *
rtdm_fd_get(
int ufd,
unsigned int magic);
356 int rtdm_fd_fcntl(
int ufd,
int cmd, ...);
358 int rtdm_fd_ioctl(
int ufd,
unsigned int request, ...);
360 ssize_t rtdm_fd_read(
int ufd,
void __user *buf,
size_t size);
362 ssize_t rtdm_fd_write(
int ufd,
const void __user *buf,
size_t size);
364 int rtdm_fd_close(
int ufd,
unsigned int magic);
366 ssize_t rtdm_fd_recvmsg(
int ufd,
struct user_msghdr *msg,
int flags);
368 ssize_t rtdm_fd_sendmsg(
int ufd,
const struct user_msghdr *msg,
371 int rtdm_fd_mmap(
int ufd,
struct _rtdm_mmap_request *rma,
374 int rtdm_fd_valid_p(
int ufd);
379 void rtdm_fd_cleanup(
struct cobalt_ppd *p);
381 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:260
int(* mmap)(struct rtdm_fd *fd, struct vm_area_struct *vma)
See rtdm_mmap_handler().
Definition: fd.h:285
ssize_t(* sendmsg_nrt)(struct rtdm_fd *fd, const struct user_msghdr *msg, int flags)
See rtdm_sendmsg_handler().
Definition: fd.h:278
void rtdm_fd_put(struct rtdm_fd *fd)
Release a RTDM file descriptor obtained via rtdm_fd_get()
Definition: fd.c:301
ssize_t(* recvmsg_rt)(struct rtdm_fd *fd, struct user_msghdr *msg, int flags)
See rtdm_recvmsg_handler().
Definition: fd.h:269
RTDM file operation descriptor.
Definition: fd.h:243
ssize_t(* read_rt)(struct rtdm_fd *fd, void __user *buf, size_t size)
See rtdm_read_handler().
Definition: fd.h:257
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:247
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:205
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:251
int rtdm_fd_lock(struct rtdm_fd *fd)
Hold a reference on a RTDM file descriptor.
Definition: fd.c:324
int(* ioctl_nrt)(struct rtdm_fd *fd, unsigned int request, void __user *arg)
See rtdm_ioctl_handler().
Definition: fd.h:254
ssize_t(* write_rt)(struct rtdm_fd *fd, const void __user *buf, size_t size)
See rtdm_write_handler().
Definition: fd.h:263
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:723
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:272
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:281
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:266
int(* open)(struct rtdm_fd *fd, int oflags)
See rtdm_open_handler().
Definition: fd.h:245
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:275
void(* close)(struct rtdm_fd *fd)
See rtdm_close_handler().
Definition: fd.h:249
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:350
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:288