summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexander Viro <viro@www.linux.org.uk>2003-06-11 07:41:09 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-06-11 07:41:09 -0700
commite9f92fa1c214e52fa9afe50ac6e59be0fe20c6eb (patch)
treef7d5d79cb8af69f139d82dfa45e82ebb20706679 /include
parent0835153fc18fdaf0764a0c077df4fc9976df0e74 (diff)
[PATCH] tty_driver refcounting
added helper functions for allocation and freeing tty_driver
Diffstat (limited to 'include')
-rw-r--r--include/linux/tty_driver.h40
1 files changed, 39 insertions, 1 deletions
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 <linux/list.h>
#include <linux/cdev.h>
+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