headers_check fix: linux/ip6_tunnel.h
[safe/jmp/linux-2.6] / include / linux / tty_driver.h
index 2c5c35c..08e0883 100644 (file)
  *
  *     Optional method. Default behaviour is to use the ttys array
  *
+ * int (*install)(struct tty_driver *self, struct tty_struct *tty)
+ *
+ *     Install a new tty into the tty driver internal tables. Used in
+ *     conjunction with lookup and remove methods.
+ *
+ *     Optional method. Default behaviour is to use the ttys array
+ *
+ * void (*remove)(struct tty_driver *self, struct tty_struct *tty)
+ *
+ *     Remove a closed tty from the tty driver internal tables. Used in
+ *     conjunction with lookup and remove methods.
+ *
+ *     Optional method. Default behaviour is to use the ttys array
+ *
  * int  (*open)(struct tty_struct * tty, struct file * filp);
  *
  *     This routine is called when a particular tty device is opened.
  *     Optional: If not provided then the write method is called under
  *     the atomic write lock to keep it serialized with the ldisc.
  *
- * int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty,
- *                             unsigned int rows, unsigned int cols);
+ * int (*resize)(struct tty_struct *tty, struct winsize *ws)
  *
  *     Called when a termios request is issued which changes the
  *     requested terminal geometry.
@@ -211,7 +224,10 @@ struct tty_struct;
 struct tty_driver;
 
 struct tty_operations {
-       struct tty_struct * (*lookup)(struct tty_driver *driver, int idx);
+       struct tty_struct * (*lookup)(struct tty_driver *driver,
+                       struct inode *inode, int idx);
+       int  (*install)(struct tty_driver *driver, struct tty_struct *tty);
+       void (*remove)(struct tty_driver *driver, struct tty_struct *tty);
        int  (*open)(struct tty_struct * tty, struct file * filp);
        void (*close)(struct tty_struct * tty, struct file * filp);
        void (*shutdown)(struct tty_struct *tty);
@@ -241,8 +257,7 @@ struct tty_operations {
        int (*tiocmget)(struct tty_struct *tty, struct file *file);
        int (*tiocmset)(struct tty_struct *tty, struct file *file,
                        unsigned int set, unsigned int clear);
-       int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty,
-                               struct winsize *ws);
+       int (*resize)(struct tty_struct *tty, struct winsize *ws);
        int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
 #ifdef CONFIG_CONSOLE_POLL
        int (*poll_init)(struct tty_driver *driver, int line, char *options);
@@ -253,6 +268,7 @@ struct tty_operations {
 
 struct tty_driver {
        int     magic;          /* magic number for this structure */
+       struct kref kref;       /* Reference management */
        struct cdev cdev;
        struct module   *owner;
        const char      *driver_name;
@@ -266,7 +282,6 @@ struct tty_driver {
        short   subtype;        /* subtype of tty driver */
        struct ktermios init_termios; /* Initial termios */
        int     flags;          /* tty driver flags */
-       int     refcount;       /* for loadable tty drivers */
        struct proc_dir_entry *proc_entry; /* /proc fs entry */
        struct tty_driver *other; /* only used for the PTY driver */
 
@@ -288,12 +303,19 @@ struct tty_driver {
 
 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,
+extern struct tty_driver *alloc_tty_driver(int lines);
+extern void put_tty_driver(struct tty_driver *driver);
+extern void tty_set_operations(struct tty_driver *driver,
                        const struct tty_operations *op);
 extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
 
+extern void tty_driver_kref_put(struct tty_driver *driver);
+extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
+{
+       kref_get(&d->kref);
+       return d;
+}
+
 /* tty driver magic number */
 #define TTY_DRIVER_MAGIC               0x5402