minix/include/minix/chardriver.h
David van Moolenbroek 597151d963 libchardriver: full API rewrite
The new API now covers the entire character driver protocol, while
hiding all the message details. It should therefore be used by all
new character drivers. All existing drivers that already made use of
libchardriver have been changed to use the new API.

As one of the most important API changes, support for scatter and
gather transfers has been removed, as several key drivers already
did not support this, and it could be supported at the safecopy
level instead (for a future readv/writev).

Additional changes include:

- respond to block device open requests to avoid hanging VFS threads;
- add support for sef_cancel.

Change-Id: I1bab6c1cb66916c71b87aeb1db54a9bdf171fe6b
2014-03-01 09:04:50 +01:00

35 lines
1.4 KiB
C

#ifndef _MINIX_CHARDRIVER_H
#define _MINIX_CHARDRIVER_H
#include <minix/driver.h>
typedef unsigned int cdev_id_t;
/* Entry points into the device dependent code of character drivers. */
struct chardriver {
int (*cdr_open)(devminor_t minor, int access, endpoint_t user_endpt);
int (*cdr_close)(devminor_t minor);
ssize_t (*cdr_read)(devminor_t minor, u64_t position, endpoint_t endpt,
cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
ssize_t (*cdr_write)(devminor_t minor, u64_t position, endpoint_t endpt,
cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
int (*cdr_ioctl)(devminor_t minor, unsigned long request, endpoint_t endpt,
cp_grant_id_t grant, int flags, endpoint_t user_endpt, cdev_id_t id);
int (*cdr_cancel)(devminor_t minor, endpoint_t endpt, cdev_id_t id);
int (*cdr_select)(devminor_t minor, unsigned int ops, endpoint_t endpt);
void (*cdr_intr)(unsigned int mask);
void (*cdr_alarm)(clock_t stamp);
void (*cdr_other)(message *m_ptr, int ipc_status);
};
/* Functions defined by libchardriver. */
void chardriver_announce(void);
void chardriver_process(struct chardriver *cdp, message *m_ptr,
int ipc_status);
void chardriver_terminate(void);
void chardriver_task(struct chardriver *cdp);
void chardriver_reply_task(endpoint_t endpt, cdev_id_t id, int r);
void chardriver_reply_select(endpoint_t endpt, devminor_t minor, int ops);
#endif /* _MINIX_CHARDRIVER_H */