From e9f92fa1c214e52fa9afe50ac6e59be0fe20c6eb Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Wed, 11 Jun 2003 07:41:09 -0700 Subject: [PATCH] tty_driver refcounting added helper functions for allocation and freeing tty_driver --- include/linux/tty_driver.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index a3a175aea96e..63051af4d8ac 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -119,6 +119,39 @@ #include #include +struct tty_struct; + +struct tty_operations { + int (*open)(struct tty_struct * tty, struct file * filp); + void (*close)(struct tty_struct * tty, struct file * filp); + int (*write)(struct tty_struct * tty, int from_user, + const unsigned char *buf, int count); + void (*put_char)(struct tty_struct *tty, unsigned char ch); + void (*flush_chars)(struct tty_struct *tty); + int (*write_room)(struct tty_struct *tty); + int (*chars_in_buffer)(struct tty_struct *tty); + int (*ioctl)(struct tty_struct *tty, struct file * file, + unsigned int cmd, unsigned long arg); + void (*set_termios)(struct tty_struct *tty, struct termios * old); + void (*throttle)(struct tty_struct * tty); + void (*unthrottle)(struct tty_struct * tty); + void (*stop)(struct tty_struct *tty); + void (*start)(struct tty_struct *tty); + void (*hangup)(struct tty_struct *tty); + void (*break_ctl)(struct tty_struct *tty, int state); + void (*flush_buffer)(struct tty_struct *tty); + void (*set_ldisc)(struct tty_struct *tty); + void (*wait_until_sent)(struct tty_struct *tty, int timeout); + void (*send_xchar)(struct tty_struct *tty, char ch); + int (*read_proc)(char *page, char **start, off_t off, + int count, int *eof, void *data); + int (*write_proc)(struct file *file, const char *buffer, + unsigned long count, void *data); + int (*tiocmget)(struct tty_struct *tty, struct file *file); + int (*tiocmset)(struct tty_struct *tty, struct file *file, + unsigned int set, unsigned int clear); +}; + struct tty_driver { int magic; /* magic number for this structure */ struct cdev cdev; @@ -148,7 +181,7 @@ struct tty_driver { /* * Interface routines from the upper tty layer to the tty - * driver. + * driver. Will be replaced with struct tty_operations. */ int (*open)(struct tty_struct * tty, struct file * filp); void (*close)(struct tty_struct * tty, struct file * filp); @@ -178,11 +211,16 @@ struct tty_driver { int (*tiocmget)(struct tty_struct *tty, struct file *file); int (*tiocmset)(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); + struct list_head tty_drivers; }; extern struct list_head tty_drivers; +struct tty_driver *alloc_tty_driver(int lines); +void put_tty_driver(struct tty_driver *driver); +void tty_set_operations(struct tty_driver *driver, struct tty_operations *op); + /* tty driver magic number */ #define TTY_DRIVER_MAGIC 0x5402 -- cgit v1.2.3