diff options
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r-- | include/linux/tty.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index e3612c3ac194..b6e6c26883ee 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -209,6 +209,7 @@ struct tty_operations; | |||
209 | 209 | ||
210 | struct tty_struct { | 210 | struct tty_struct { |
211 | int magic; | 211 | int magic; |
212 | struct kref kref; | ||
212 | struct tty_driver *driver; | 213 | struct tty_driver *driver; |
213 | const struct tty_operations *ops; | 214 | const struct tty_operations *ops; |
214 | int index; | 215 | int index; |
@@ -311,6 +312,23 @@ extern int kmsg_redirect; | |||
311 | extern void console_init(void); | 312 | extern void console_init(void); |
312 | extern int vcs_init(void); | 313 | extern int vcs_init(void); |
313 | 314 | ||
315 | /** | ||
316 | * tty_kref_get - get a tty reference | ||
317 | * @tty: tty device | ||
318 | * | ||
319 | * Return a new reference to a tty object. The caller must hold | ||
320 | * sufficient locks/counts to ensure that their existing reference cannot | ||
321 | * go away | ||
322 | */ | ||
323 | |||
324 | extern inline struct tty_struct *tty_kref_get(struct tty_struct *tty) | ||
325 | { | ||
326 | if (tty) | ||
327 | kref_get(&tty->kref); | ||
328 | return tty; | ||
329 | } | ||
330 | extern void tty_kref_put(struct tty_struct *tty); | ||
331 | |||
314 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, | 332 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, |
315 | const char *routine); | 333 | const char *routine); |
316 | extern char *tty_name(struct tty_struct *tty, char *buf); | 334 | extern char *tty_name(struct tty_struct *tty, char *buf); |