diff options
Diffstat (limited to 'include/linux/tty.h')
| -rw-r--r-- | include/linux/tty.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index f0f43d08d8b8..405a9035fe40 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -190,9 +190,17 @@ struct tty_port_operations { | |||
| 190 | /* Control the DTR line */ | 190 | /* Control the DTR line */ |
| 191 | void (*dtr_rts)(struct tty_port *port, int raise); | 191 | void (*dtr_rts)(struct tty_port *port, int raise); |
| 192 | /* Called when the last close completes or a hangup finishes | 192 | /* Called when the last close completes or a hangup finishes |
| 193 | IFF the port was initialized. Do not use to free resources */ | 193 | IFF the port was initialized. Do not use to free resources. Called |
| 194 | under the port mutex to serialize against activate/shutdowns */ | ||
| 194 | void (*shutdown)(struct tty_port *port); | 195 | void (*shutdown)(struct tty_port *port); |
| 195 | void (*drop)(struct tty_port *port); | 196 | void (*drop)(struct tty_port *port); |
| 197 | /* Called under the port mutex from tty_port_open, serialized using | ||
| 198 | the port mutex */ | ||
| 199 | /* FIXME: long term getting the tty argument *out* of this would be | ||
| 200 | good for consoles */ | ||
| 201 | int (*activate)(struct tty_port *port, struct tty_struct *tty); | ||
| 202 | /* Called on the final put of a port */ | ||
| 203 | void (*destruct)(struct tty_port *port); | ||
| 196 | }; | 204 | }; |
| 197 | 205 | ||
| 198 | struct tty_port { | 206 | struct tty_port { |
| @@ -206,12 +214,14 @@ struct tty_port { | |||
| 206 | wait_queue_head_t delta_msr_wait; /* Modem status change */ | 214 | wait_queue_head_t delta_msr_wait; /* Modem status change */ |
| 207 | unsigned long flags; /* TTY flags ASY_*/ | 215 | unsigned long flags; /* TTY flags ASY_*/ |
| 208 | struct mutex mutex; /* Locking */ | 216 | struct mutex mutex; /* Locking */ |
| 217 | struct mutex buf_mutex; /* Buffer alloc lock */ | ||
| 209 | unsigned char *xmit_buf; /* Optional buffer */ | 218 | unsigned char *xmit_buf; /* Optional buffer */ |
| 210 | unsigned int close_delay; /* Close port delay */ | 219 | unsigned int close_delay; /* Close port delay */ |
| 211 | unsigned int closing_wait; /* Delay for output */ | 220 | unsigned int closing_wait; /* Delay for output */ |
| 212 | int drain_delay; /* Set to zero if no pure time | 221 | int drain_delay; /* Set to zero if no pure time |
| 213 | based drain is needed else | 222 | based drain is needed else |
| 214 | set to size of fifo */ | 223 | set to size of fifo */ |
| 224 | struct kref kref; /* Ref counter */ | ||
| 215 | }; | 225 | }; |
| 216 | 226 | ||
| 217 | /* | 227 | /* |
| @@ -439,7 +449,7 @@ extern void initialize_tty_struct(struct tty_struct *tty, | |||
| 439 | struct tty_driver *driver, int idx); | 449 | struct tty_driver *driver, int idx); |
| 440 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, | 450 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, |
| 441 | int first_ok); | 451 | int first_ok); |
| 442 | extern void tty_release_dev(struct file *filp); | 452 | extern int tty_release(struct inode *inode, struct file *filp); |
| 443 | extern int tty_init_termios(struct tty_struct *tty); | 453 | extern int tty_init_termios(struct tty_struct *tty); |
| 444 | 454 | ||
| 445 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); | 455 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); |
| @@ -454,6 +464,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay); | |||
| 454 | extern void tty_port_init(struct tty_port *port); | 464 | extern void tty_port_init(struct tty_port *port); |
| 455 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); | 465 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); |
| 456 | extern void tty_port_free_xmit_buf(struct tty_port *port); | 466 | extern void tty_port_free_xmit_buf(struct tty_port *port); |
| 467 | extern void tty_port_put(struct tty_port *port); | ||
| 468 | |||
| 469 | extern inline struct tty_port *tty_port_get(struct tty_port *port) | ||
| 470 | { | ||
| 471 | if (port) | ||
| 472 | kref_get(&port->kref); | ||
| 473 | return port; | ||
| 474 | } | ||
| 475 | |||
| 457 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); | 476 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); |
| 458 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); | 477 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); |
| 459 | extern int tty_port_carrier_raised(struct tty_port *port); | 478 | extern int tty_port_carrier_raised(struct tty_port *port); |
| @@ -467,6 +486,8 @@ extern int tty_port_close_start(struct tty_port *port, | |||
| 467 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); | 486 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); |
| 468 | extern void tty_port_close(struct tty_port *port, | 487 | extern void tty_port_close(struct tty_port *port, |
| 469 | struct tty_struct *tty, struct file *filp); | 488 | struct tty_struct *tty, struct file *filp); |
| 489 | extern int tty_port_open(struct tty_port *port, | ||
| 490 | struct tty_struct *tty, struct file *filp); | ||
| 470 | extern inline int tty_port_users(struct tty_port *port) | 491 | extern inline int tty_port_users(struct tty_port *port) |
| 471 | { | 492 | { |
| 472 | return port->count + port->blocked_open; | 493 | return port->count + port->blocked_open; |
