Merge branch 'sched/urgent' into sched/core
[safe/jmp/linux-2.6] / include / linux / tty.h
index e9269ca..6abfcf5 100644 (file)
@@ -199,6 +199,8 @@ struct tty_port_operations {
         /* FIXME: long term getting the tty argument *out* of this would be
            good for consoles */
        int (*activate)(struct tty_port *port, struct tty_struct *tty);
+       /* Called on the final put of a port */
+       void (*destruct)(struct tty_port *port);
 };
        
 struct tty_port {
@@ -219,6 +221,7 @@ struct tty_port {
        int                     drain_delay;    /* Set to zero if no pure time
                                                   based drain is needed else
                                                   set to size of fifo */
+       struct kref             kref;           /* Ref counter */
 };
 
 /*
@@ -347,8 +350,6 @@ extern void tty_write_flush(struct tty_struct *);
 
 extern struct ktermios tty_std_termios;
 
-extern int kmsg_redirect;
-
 extern void console_init(void);
 extern int vcs_init(void);
 
@@ -446,7 +447,7 @@ extern void initialize_tty_struct(struct tty_struct *tty,
                struct tty_driver *driver, int idx);
 extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
                                                                int first_ok);
-extern void tty_release_dev(struct file *filp);
+extern int tty_release(struct inode *inode, struct file *filp);
 extern int tty_init_termios(struct tty_struct *tty);
 
 extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
@@ -461,6 +462,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay);
 extern void tty_port_init(struct tty_port *port);
 extern int tty_port_alloc_xmit_buf(struct tty_port *port);
 extern void tty_port_free_xmit_buf(struct tty_port *port);
+extern void tty_port_put(struct tty_port *port);
+
+static inline struct tty_port *tty_port_get(struct tty_port *port)
+{
+       if (port)
+               kref_get(&port->kref);
+       return port;
+}
+
 extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
 extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
 extern int tty_port_carrier_raised(struct tty_port *port);
@@ -476,7 +486,7 @@ extern void tty_port_close(struct tty_port *port,
                                struct tty_struct *tty, struct file *filp);
 extern int tty_port_open(struct tty_port *port,
                                struct tty_struct *tty, struct file *filp);
-extern inline int tty_port_users(struct tty_port *port)
+static inline int tty_port_users(struct tty_port *port)
 {
        return port->count + port->blocked_open;
 }