提交 accff793 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

tty: Replace #ifdef TTY_DEBUG_HANGUP with tty_debug_hangup()

Add tty_debug_hangup() macro which uses tty_debug to print the
debug message; remove inlined #ifdefs.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e2dfa3d3
...@@ -106,6 +106,11 @@ ...@@ -106,6 +106,11 @@
#include <linux/nsproxy.h> #include <linux/nsproxy.h>
#undef TTY_DEBUG_HANGUP #undef TTY_DEBUG_HANGUP
#ifdef TTY_DEBUG_HANGUP
# define tty_debug_hangup(tty, f, args...) tty_debug(tty, f, ##args)
#else
# define tty_debug_hangup(tty, f, args...) do { } while (0)
#endif
#define TTY_PARANOIA_CHECK 1 #define TTY_PARANOIA_CHECK 1
#define CHECK_TTY_COUNT 1 #define CHECK_TTY_COUNT 1
...@@ -774,9 +779,7 @@ static void do_tty_hangup(struct work_struct *work) ...@@ -774,9 +779,7 @@ static void do_tty_hangup(struct work_struct *work)
void tty_hangup(struct tty_struct *tty) void tty_hangup(struct tty_struct *tty)
{ {
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "\n");
tty_debug(tty, "\n");
#endif
schedule_work(&tty->hangup_work); schedule_work(&tty->hangup_work);
} }
...@@ -793,9 +796,7 @@ EXPORT_SYMBOL(tty_hangup); ...@@ -793,9 +796,7 @@ EXPORT_SYMBOL(tty_hangup);
void tty_vhangup(struct tty_struct *tty) void tty_vhangup(struct tty_struct *tty)
{ {
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "\n");
tty_debug(tty, "\n")
#endif
__tty_hangup(tty, 0); __tty_hangup(tty, 0);
} }
...@@ -832,9 +833,7 @@ void tty_vhangup_self(void) ...@@ -832,9 +833,7 @@ void tty_vhangup_self(void)
static void tty_vhangup_session(struct tty_struct *tty) static void tty_vhangup_session(struct tty_struct *tty)
{ {
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "\n");
tty_debug(tty, "\n");
#endif
__tty_hangup(tty, 1); __tty_hangup(tty, 1);
} }
...@@ -928,11 +927,8 @@ void disassociate_ctty(int on_exit) ...@@ -928,11 +927,8 @@ void disassociate_ctty(int on_exit)
tty->pgrp = NULL; tty->pgrp = NULL;
spin_unlock_irqrestore(&tty->ctrl_lock, flags); spin_unlock_irqrestore(&tty->ctrl_lock, flags);
tty_kref_put(tty); tty_kref_put(tty);
} else { } else
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "no current tty\n");
tty_debug(tty, "no current tty\n");
#endif
}
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->sighand->siglock);
/* Now clear signal->tty under the lock */ /* Now clear signal->tty under the lock */
...@@ -1788,9 +1784,7 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1788,9 +1784,7 @@ int tty_release(struct inode *inode, struct file *filp)
return 0; return 0;
} }
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "(tty count=%d)...\n", tty->count);
tty_debug(tty, "(tty count=%d)...\n", tty->count);
#endif
if (tty->ops->close) if (tty->ops->close)
tty->ops->close(tty, filp); tty->ops->close(tty, filp);
...@@ -1900,9 +1894,7 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1900,9 +1894,7 @@ int tty_release(struct inode *inode, struct file *filp)
if (!final) if (!final)
return 0; return 0;
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "final close\n");
tty_debug(tty, "final close\n");
#endif
/* /*
* Ask the line discipline code to release its structures * Ask the line discipline code to release its structures
*/ */
...@@ -1911,9 +1903,7 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1911,9 +1903,7 @@ int tty_release(struct inode *inode, struct file *filp)
/* Wait for pending work before tty destruction commmences */ /* Wait for pending work before tty destruction commmences */
tty_flush_works(tty); tty_flush_works(tty);
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "freeing structure...\n");
tty_debug(tty, "freeing structure...\n");
#endif
/* /*
* The release_tty function takes care of the details of clearing * The release_tty function takes care of the details of clearing
* the slots and preserving the termios structure. The tty_unlock_pair * the slots and preserving the termios structure. The tty_unlock_pair
...@@ -2102,9 +2092,9 @@ static int tty_open(struct inode *inode, struct file *filp) ...@@ -2102,9 +2092,9 @@ static int tty_open(struct inode *inode, struct file *filp)
if (tty->driver->type == TTY_DRIVER_TYPE_PTY && if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER) tty->driver->subtype == PTY_TYPE_MASTER)
noctty = 1; noctty = 1;
#ifdef TTY_DEBUG_HANGUP
tty_debug(tty, "(tty count=%d)\n", tty->count); tty_debug_hangup(tty, "(tty count=%d)\n", tty->count);
#endif
if (tty->ops->open) if (tty->ops->open)
retval = tty->ops->open(tty, filp); retval = tty->ops->open(tty, filp);
else else
...@@ -2112,9 +2102,8 @@ static int tty_open(struct inode *inode, struct file *filp) ...@@ -2112,9 +2102,8 @@ static int tty_open(struct inode *inode, struct file *filp)
filp->f_flags = saved_flags; filp->f_flags = saved_flags;
if (retval) { if (retval) {
#ifdef TTY_DEBUG_HANGUP tty_debug_hangup(tty, "error %d, releasing...\n", retval);
tty_debug(tty, "error %d, releasing...\n", retval);
#endif
tty_unlock(tty); /* need to call tty_release without BTM */ tty_unlock(tty); /* need to call tty_release without BTM */
tty_release(inode, filp); tty_release(inode, filp);
if (retval != -ERESTARTSYS) if (retval != -ERESTARTSYS)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册