tty: implement read/write support
This commit is contained in:
@@ -41,12 +41,14 @@ enum device_type {
|
||||
};
|
||||
|
||||
struct device_type_ops {
|
||||
kern_status_t(*read)(struct device *, void *, size_t, size_t *, socks_flags_t);
|
||||
kern_status_t(*write)(struct device *, const void *, size_t, size_t *, socks_flags_t);
|
||||
kern_status_t(*register_device)(struct device *);
|
||||
};
|
||||
|
||||
struct block_device_ops {
|
||||
kern_status_t(*read_blocks)(struct device *, size_t, size_t *, void *, socks_flags_t);
|
||||
kern_status_t(*write_blocks)(struct device *, size_t, size_t *, const void *, socks_flags_t);
|
||||
kern_status_t(*read_blocks)(struct device *, void *, size_t, size_t *, socks_flags_t);
|
||||
kern_status_t(*write_blocks)(struct device *, const void *, size_t, size_t *, socks_flags_t);
|
||||
kern_status_t(*ioctl)(struct device *, unsigned int, void *);
|
||||
};
|
||||
|
||||
@@ -58,8 +60,8 @@ struct net_device_ops {
|
||||
};
|
||||
|
||||
struct char_device_ops {
|
||||
kern_status_t(*read)(struct device *, size_t, size_t *, void *, socks_flags_t);
|
||||
kern_status_t(*write)(struct device *, size_t, size_t *, const void *, socks_flags_t);
|
||||
kern_status_t(*read)(struct device *, void *, size_t, size_t *, socks_flags_t);
|
||||
kern_status_t(*write)(struct device *, const void *, size_t, size_t *, socks_flags_t);
|
||||
};
|
||||
|
||||
struct input_device_ops {
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#include <socks/object.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define TTY_DEVICE(dev) ((dev)->dev_type == DEV_TYPE_CHAR ? (dev)->chr.c_tty : NULL)
|
||||
#define TTY_DRIVER(drv) ((struct tty_driver *)((char *)drv - offsetof(struct tty_driver, tty_base)))
|
||||
|
||||
struct kext;
|
||||
|
||||
/* The TTY system.
|
||||
@@ -82,9 +85,10 @@ struct tty_device {
|
||||
unsigned int tty_xcells, tty_ycells;
|
||||
unsigned int tty_xcur, tty_ycur;
|
||||
unsigned int tty_iflag, tty_oflag, tty_lflag;
|
||||
tty_attrib_t tty_curattrib;
|
||||
};
|
||||
|
||||
extern kern_status_t tty_init(void);
|
||||
extern kern_status_t tty_bootstrap(void);
|
||||
|
||||
extern struct device *tty_device_create(void);
|
||||
extern kern_status_t tty_device_register(struct device *dev, struct tty_driver *owner, struct device *parent);
|
||||
@@ -98,6 +102,9 @@ static inline struct driver *tty_driver_base(struct tty_driver *drv)
|
||||
return &drv->tty_base;
|
||||
}
|
||||
|
||||
extern kern_status_t tty_read(struct device *tty, void *buf, size_t max, size_t *nr_read, socks_flags_t flags);
|
||||
extern kern_status_t tty_write(struct device *tty, const void *buf, size_t len, size_t *nr_written, socks_flags_t flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user