diff options
author | Jiri Olsa <Jiri Olsa jolsa@redhat.com> | 2010-04-20 14:32:10 +0200 |
---|---|---|
committer | Jiri Olsa <Jiri Olsa jolsa@redhat.com> | 2010-04-20 14:32:10 +0200 |
commit | e47aa812a3aa8dd3a73d66cce60afeacf76d9646 (patch) | |
tree | 7fea76797240087e84ae24a387f419074be2efb7 | |
parent | 3112afc7a545b79917c17cfbbe3cd2211ff8ca62 (diff) | |
download | tsnif-e47aa812a3aa8dd3a73d66cce60afeacf76d9646.tar.gz tsnif-e47aa812a3aa8dd3a73d66cce60afeacf76d9646.tar.xz tsnif-e47aa812a3aa8dd3a73d66cce60afeacf76d9646.zip |
new kernel patches
-rw-r--r-- | kernel/0001-tty-notifier.patch | 58 | ||||
-rw-r--r-- | kernel/0002-notifier-tty_list-tty_is_active-functions.patch | 6 | ||||
-rw-r--r-- | kernel/0003-gennl-changes-adding-non-locking-multicast-functions.patch | 4 | ||||
-rw-r--r-- | kernel/0004-tsnif.patch | 24 |
4 files changed, 56 insertions, 36 deletions
diff --git a/kernel/0001-tty-notifier.patch b/kernel/0001-tty-notifier.patch index d531fb8..6e1b29d 100644 --- a/kernel/0001-tty-notifier.patch +++ b/kernel/0001-tty-notifier.patch @@ -1,13 +1,13 @@ -From a578319c78d30fe0a6cae11723daa1f65a2200c9 Mon Sep 17 00:00:00 2001 +From 5ab78e8b939366aa096c28898bbf20ddcb3a61f4 Mon Sep 17 00:00:00 2001 From: Jiri Olsa <Jiri Olsa jolsa@redhat.com> -Date: Wed, 14 Apr 2010 12:03:26 +0200 +Date: Tue, 20 Apr 2010 14:21:39 +0200 Subject: [PATCH 1/4] tty notifier --- - drivers/char/Kconfig | 6 +++ - drivers/char/tty_io.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++ - include/linux/tty.h | 22 ++++++++++ - 3 files changed, 134 insertions(+), 0 deletions(-) + drivers/char/Kconfig | 6 ++ + drivers/char/tty_io.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ + include/linux/tty.h | 22 +++++++++ + 3 files changed, 153 insertions(+), 0 deletions(-) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 3141dd3..9be342e 100644 @@ -26,10 +26,10 @@ index 3141dd3..9be342e 100644 endmenu diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c -index 6da962c..1f77159 100644 +index 6da962c..f0463d0 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c -@@ -154,6 +154,90 @@ static void release_tty(struct tty_struct *tty, int idx); +@@ -154,6 +154,112 @@ static void release_tty(struct tty_struct *tty, int idx); static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty); static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty); @@ -115,12 +115,34 @@ index 6da962c..1f77159 100644 + atomic_notifier_call_chain(&tty_notifier_list, TTY_NOTIFY_DATA, ¶m); +} + ++/** ++ * tty_del - remove tty from the global list ++ * ++ * Locking: tty_mutex ++ */ ++ ++static void tty_del(struct tty_struct *tty) ++{ ++ ++ mutex_lock(&tty_mutex); ++ ++ /* It's the master who's on the list... */ ++ if (tty->driver->type == TTY_DRIVER_TYPE_PTY) ++ if (tty->driver->subtype == PTY_TYPE_SLAVE); ++ tty = tty->link; ++ ++ if (tty) ++ list_del(&tty->list); ++ ++ mutex_unlock(&tty_mutex); ++} ++ +#endif + /** * alloc_tty_struct - allocate a tty object * -@@ -981,6 +1065,11 @@ static inline ssize_t do_tty_write( +@@ -981,6 +1087,11 @@ static inline ssize_t do_tty_write( ret = -EFAULT; if (copy_from_user(tty->write_buf, buf, size)) break; @@ -132,7 +154,7 @@ index 6da962c..1f77159 100644 ret = write(tty, file, tty->write_buf, size); if (ret <= 0) break; -@@ -1352,6 +1441,11 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, +@@ -1352,6 +1463,11 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, retval = tty_ldisc_setup(tty, tty->link); if (retval) goto release_mem_out; @@ -144,30 +166,20 @@ index 6da962c..1f77159 100644 return tty; fail_no_mem: -@@ -1476,6 +1570,10 @@ static void release_tty(struct tty_struct *tty, int idx) - /* This should always be true but check for the moment */ - WARN_ON(tty->index != idx); - -+#ifdef CONFIG_TTY_NOTIFIER -+ list_del(&tty->list); -+#endif -+ - if (tty->link) - tty_kref_put(tty->link); - tty_kref_put(tty); -@@ -1705,6 +1803,11 @@ int tty_release(struct inode *inode, struct file *filp) +@@ -1705,6 +1821,12 @@ int tty_release(struct inode *inode, struct file *filp) #ifdef TTY_DEBUG_HANGUP printk(KERN_DEBUG "freeing tty structure..."); #endif + +#ifdef CONFIG_TTY_NOTIFIER + notify_tty_release(tty); ++ tty_del(tty); +#endif + /* * Ask the line discipline code to release its structures */ -@@ -2770,6 +2873,9 @@ void initialize_tty_struct(struct tty_struct *tty, +@@ -2770,6 +2892,9 @@ void initialize_tty_struct(struct tty_struct *tty, spin_lock_init(&tty->read_lock); spin_lock_init(&tty->ctrl_lock); INIT_LIST_HEAD(&tty->tty_files); diff --git a/kernel/0002-notifier-tty_list-tty_is_active-functions.patch b/kernel/0002-notifier-tty_list-tty_is_active-functions.patch index 673fa59..bcddfd8 100644 --- a/kernel/0002-notifier-tty_list-tty_is_active-functions.patch +++ b/kernel/0002-notifier-tty_list-tty_is_active-functions.patch @@ -1,6 +1,6 @@ -From 33949820c7029bde6a22cbe277ed5edee82255ca Mon Sep 17 00:00:00 2001 +From 58a8c208a9960285e65eecd15a185d03b81a5c18 Mon Sep 17 00:00:00 2001 From: Jiri Olsa <Jiri Olsa jolsa@redhat.com> -Date: Wed, 14 Apr 2010 12:04:23 +0200 +Date: Tue, 20 Apr 2010 14:22:13 +0200 Subject: [PATCH 2/4] notifier tty_list/tty_is_active functions --- @@ -9,7 +9,7 @@ Subject: [PATCH 2/4] notifier tty_list/tty_is_active functions 2 files changed, 53 insertions(+), 0 deletions(-) diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c -index 1f77159..4375844 100644 +index f0463d0..b4d4f60 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -159,6 +159,54 @@ static LIST_HEAD(tty_structs); /* linked list of tty structs */ diff --git a/kernel/0003-gennl-changes-adding-non-locking-multicast-functions.patch b/kernel/0003-gennl-changes-adding-non-locking-multicast-functions.patch index 1cd1c25..3196d9e 100644 --- a/kernel/0003-gennl-changes-adding-non-locking-multicast-functions.patch +++ b/kernel/0003-gennl-changes-adding-non-locking-multicast-functions.patch @@ -1,6 +1,6 @@ -From 9d89f2cfbce1360d67ea850165a1816044c75d4c Mon Sep 17 00:00:00 2001 +From 9a3c28351c2061d3174a1637d70eb8bbaf43dfc5 Mon Sep 17 00:00:00 2001 From: Jiri Olsa <Jiri Olsa jolsa@redhat.com> -Date: Wed, 14 Apr 2010 12:05:09 +0200 +Date: Tue, 20 Apr 2010 14:22:39 +0200 Subject: [PATCH 3/4] gennl changes - adding non locking multicast functions --- diff --git a/kernel/0004-tsnif.patch b/kernel/0004-tsnif.patch index 0fa4303..7b90a71 100644 --- a/kernel/0004-tsnif.patch +++ b/kernel/0004-tsnif.patch @@ -1,14 +1,14 @@ -From 187fdd80d29d9b4443197a9ca44e14e5f36e788c Mon Sep 17 00:00:00 2001 +From 0d9d60c12f1b7e23f2093c8e73cf3da0a2e1e54d Mon Sep 17 00:00:00 2001 From: Jiri Olsa <Jiri Olsa jolsa@redhat.com> -Date: Wed, 14 Apr 2010 12:06:29 +0200 -Subject: [PATCH 4/4] tsnif +Date: Tue, 20 Apr 2010 14:24:00 +0200 +Subject: [PATCH 4/4] alive --- drivers/char/Kconfig | 9 + drivers/char/Makefile | 2 + - drivers/char/tsnif.c | 935 +++++++++++++++++++++++++++++++++++++++++++++++++ + drivers/char/tsnif.c | 943 +++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/tsnif.h | 65 ++++ - 4 files changed, 1011 insertions(+), 0 deletions(-) + 4 files changed, 1019 insertions(+), 0 deletions(-) create mode 100644 drivers/char/tsnif.c create mode 100644 include/linux/tsnif.h @@ -46,10 +46,10 @@ index f957edf..537c771 100644 diff --git a/drivers/char/tsnif.c b/drivers/char/tsnif.c new file mode 100644 -index 0000000..9b436ba +index 0000000..8774f1e --- /dev/null +++ b/drivers/char/tsnif.c -@@ -0,0 +1,935 @@ +@@ -0,0 +1,943 @@ + +#include <linux/module.h> +#include <linux/kernel.h> @@ -171,6 +171,9 @@ index 0000000..9b436ba + +static int get_type(struct tty_struct *tty) +{ ++ if (!tty || !tty->driver) ++ return -1; ++ + switch(tty->driver->type) { + case TTY_DRIVER_TYPE_SYSTEM: + return TSNIF_TYPE_TTY; @@ -831,12 +834,17 @@ index 0000000..9b436ba +{ + struct list_head *h = data; + struct ts_tty *t; ++ int type; ++ ++ type = get_type(tty); ++ if (type == -1) ++ return; + + t = kmalloc(sizeof(*t), GFP_KERNEL); + if (!t) + return; + -+ t->type = get_type(tty); ++ t->type = type; + t->idx = tty->index; + list_add(&t->list, h); + |