[Devel] [PATCH rh7] tty: vtty -- Drop TTY_PINNED_BY_OTHER bit
Cyrill Gorcunov
gorcunov at virtuozzo.com
Fri Mar 18 11:45:05 PDT 2016
This bit was introduced during our vttys code rework but eventually
we don't need it, plain comparision with slave vtty driver is enough.
So lets drop it off since it might conflict with some new tty bits
in future.
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
CC: Vladimir Davydov <vdavydov at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
---
drivers/tty/n_tty.c | 4 ++--
drivers/tty/pty.c | 12 ++++++------
include/linux/tty.h | 3 ---
include/linux/ve.h | 1 +
4 files changed, 9 insertions(+), 11 deletions(-)
Index: linux-pcs7.git/drivers/tty/n_tty.c
===================================================================
--- linux-pcs7.git.orig/drivers/tty/n_tty.c
+++ linux-pcs7.git/drivers/tty/n_tty.c
@@ -50,6 +50,7 @@
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/ratelimit.h>
+#include <linux/ve.h>
/* number of characters left in xmit buffer before select has we have room */
@@ -2043,8 +2044,7 @@ static ssize_t n_tty_write(struct tty_st
}
#ifdef CONFIG_VE
if (tty_hung_up_p(file) ||
- (tty->link && !tty->link->count &&
- !(test_bit(TTY_PINNED_BY_OTHER, &tty->link->flags)))) {
+ (tty->link && !tty->link->count && !vtty_is_master(tty->link))) {
#else
if (tty_hung_up_p(file) || (tty->link && !tty->link->count)) {
#endif
Index: linux-pcs7.git/drivers/tty/pty.c
===================================================================
--- linux-pcs7.git.orig/drivers/tty/pty.c
+++ linux-pcs7.git/drivers/tty/pty.c
@@ -857,6 +857,12 @@ static struct file_operations vtty_fops;
#define vtty_match_index(idx) ((idx) >= 0 && (idx) < MAX_NR_VTTY_CONSOLES)
+bool vtty_is_master(struct tty_struct *tty)
+{
+ return tty->driver == vttym_driver;
+}
+EXPORT_SYMBOL(vtty_is_master);
+
typedef struct {
envid_t veid;
struct tty_struct *vttys[MAX_NR_VTTY_CONSOLES];
@@ -1038,12 +1044,6 @@ static int vtty_install(struct tty_drive
tty->link = peer;
peer->link = tty;
- /*
- * Defer master closing if a slave peer
- * will be alive at this moment.
- */
- set_bit(TTY_PINNED_BY_OTHER, &peer->flags);
-
vtty_map_set(map, tty);
return 0;
Index: linux-pcs7.git/include/linux/tty.h
===================================================================
--- linux-pcs7.git.orig/include/linux/tty.h
+++ linux-pcs7.git/include/linux/tty.h
@@ -320,9 +320,6 @@ struct tty_file_private {
#define TTY_HUPPING 21 /* ->hangup() in progress */
#define TTY_LDISC_HALTED 22 /* Line discipline is halted */
#define TTY_CHARGED 23 /* Charged as ub resource */
-#ifdef CONFIG_VE
-#define TTY_PINNED_BY_OTHER 24 /* TTY is pinned by other link end, defer closing */
-#endif
#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
Index: linux-pcs7.git/include/linux/ve.h
===================================================================
--- linux-pcs7.git.orig/include/linux/ve.h
+++ linux-pcs7.git/include/linux/ve.h
@@ -225,6 +225,7 @@ extern struct tty_driver *vtty_console_d
extern int vtty_open_master(envid_t veid, int idx);
extern void vtty_release(struct tty_struct *tty, struct tty_struct *o_tty,
int *tty_closing, int *o_tty_closing);
+extern bool vtty_is_master(struct tty_struct *tty);
#endif /* CONFIG_TTY */
static inline int ve_mount_allowed(void)
More information about the Devel
mailing list