* [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them
@ 2011-10-30 16:40 Arjan van de Ven
2011-10-30 16:41 ` [PATCH 2/3] tty: make the ptmx_fops initialized at compile time Arjan van de Ven
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Arjan van de Ven @ 2011-10-30 16:40 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel
>From 7e5c44c1d42a1e66ea5df069f3f8ee50a5c46168 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 29 Oct 2011 10:41:19 -0700
Subject: [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them
The pty code currently does a partial function-pointer copy to fill its
struct file_operations; this patch makes the functions it copies non-static
in preparation of switching the pty code over to using proper prototypes.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
drivers/tty/tty_io.c | 19 ++++---------------
include/linux/tty.h | 14 ++++++++++++++
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 4f1fc81..1f79760 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -138,21 +138,10 @@ EXPORT_SYMBOL(tty_mutex);
/* Spinlock to protect the tty->tty_files list */
DEFINE_SPINLOCK(tty_files_lock);
-static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *);
-static ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *);
ssize_t redirected_tty_write(struct file *, const char __user *,
size_t, loff_t *);
-static unsigned int tty_poll(struct file *, poll_table *);
static int tty_open(struct inode *, struct file *);
-long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
-#ifdef CONFIG_COMPAT
-static long tty_compat_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg);
-#else
-#define tty_compat_ioctl NULL
-#endif
static int __tty_fasync(int fd, struct file *filp, int on);
-static int tty_fasync(int fd, struct file *filp, int on);
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);
@@ -936,7 +925,7 @@ EXPORT_SYMBOL(start_tty);
* read calls may be outstanding in parallel.
*/
-static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
+ssize_t tty_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{
int i;
@@ -1113,7 +1102,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)
* write method will not be invoked in parallel for each device.
*/
-static ssize_t tty_write(struct file *file, const char __user *buf,
+ssize_t tty_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct inode *inode = file->f_path.dentry->d_inode;
@@ -1968,7 +1957,7 @@ got_driver:
* may be re-entered freely by other callers.
*/
-static unsigned int tty_poll(struct file *filp, poll_table *wait)
+unsigned int tty_poll(struct file *filp, poll_table *wait)
{
struct tty_struct *tty = file_tty(filp);
struct tty_ldisc *ld;
@@ -2025,7 +2014,7 @@ out:
return retval;
}
-static int tty_fasync(int fd, struct file *filp, int on)
+int tty_fasync(int fd, struct file *filp, int on)
{
int retval;
tty_lock();
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5f2ede8..f1ba6c1 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -43,6 +43,7 @@
#include <linux/tty_driver.h>
#include <linux/tty_ldisc.h>
#include <linux/mutex.h>
+#include <linux/poll.h>
#include <asm/system.h>
@@ -481,6 +482,19 @@ extern void deinitialize_tty_struct(struct tty_struct *tty);
extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
int first_ok);
extern int tty_release(struct inode *inode, struct file *filp);
+extern ssize_t tty_read(struct file *, char __user *, size_t, loff_t *);
+extern ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *);
+extern unsigned int tty_poll(struct file *, poll_table *);
+
+#ifdef CONFIG_COMPAT
+extern long tty_compat_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg);
+#else
+#define tty_compat_ioctl NULL
+#endif
+extern int tty_fasync(int fd, struct file *filp, int on);
+
+
extern int tty_init_termios(struct tty_struct *tty);
extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
--
1.7.6
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] tty: make the ptmx_fops initialized at compile time
2011-10-30 16:40 [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Arjan van de Ven
@ 2011-10-30 16:41 ` Arjan van de Ven
2011-10-30 16:42 ` [PATCH 3/3] tty: remove the (now) unused tty_default_fops() function Arjan van de Ven
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Arjan van de Ven @ 2011-10-30 16:41 UTC (permalink / raw)
To: gregkh; +Cc: Arjan van de Ven, linux-kernel
>From 0d4c4ba964e65485fe87c4ce439522588956133c Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 29 Oct 2011 10:43:57 -0700
Subject: [PATCH 2/3] tty: make the ptmx_fops initialized at compile time
Now that the tty file operations functions are no longer static,
the pty code can do compile time initialization of the ptmx_fops
struct, which then also allows it to be marked "const".
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
drivers/tty/pty.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index e809e9d..54e0e56 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -713,7 +713,18 @@ out:
return retval;
}
-static struct file_operations ptmx_fops;
+static const struct file_operations ptmx_fops =
+{
+ .llseek = no_llseek,
+ .read = tty_read,
+ .write = tty_write,
+ .poll = tty_poll,
+ .unlocked_ioctl = tty_ioctl,
+ .compat_ioctl = tty_compat_ioctl,
+ .open = ptmx_open,
+ .release = tty_release,
+ .fasync = tty_fasync,
+};
static void __init unix98_pty_init(void)
{
@@ -767,9 +778,6 @@ static void __init unix98_pty_init(void)
register_sysctl_table(pty_root_table);
/* Now create the /dev/ptmx special device */
- tty_default_fops(&ptmx_fops);
- ptmx_fops.open = ptmx_open;
-
cdev_init(&ptmx_cdev, &ptmx_fops);
if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
--
1.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] tty: remove the (now) unused tty_default_fops() function
2011-10-30 16:40 [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Arjan van de Ven
2011-10-30 16:41 ` [PATCH 2/3] tty: make the ptmx_fops initialized at compile time Arjan van de Ven
@ 2011-10-30 16:42 ` Arjan van de Ven
2011-11-15 20:18 ` [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Greg KH
2011-11-15 20:21 ` Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Arjan van de Ven @ 2011-10-30 16:42 UTC (permalink / raw)
To: gregkh; +Cc: Arjan van de Ven, linux-kernel
>From 0e52df366ca86e54b8dec9bf6617cee065c9f359 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 29 Oct 2011 10:48:37 -0700
Subject: [PATCH 3/3] tty: remove the (now) unused tty_default_fops() function
Now that the pty code uses compile time initialization for its
ptmx file operations structure, the tty_default_fops() is completely
unused.
This patch removes it.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
drivers/tty/tty_io.c | 5 -----
include/linux/tty.h | 1 -
2 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 1f79760..0eb1df5 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3201,11 +3201,6 @@ struct tty_struct *get_current_tty(void)
}
EXPORT_SYMBOL_GPL(get_current_tty);
-void tty_default_fops(struct file_operations *fops)
-{
- *fops = tty_fops;
-}
-
/*
* Initialize the console device. This is called *early*, so
* we can't necessarily depend on lots of kernel help here.
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f1ba6c1..1831c24 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -472,7 +472,6 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
extern dev_t tty_devnum(struct tty_struct *tty);
extern void proc_clear_tty(struct task_struct *p);
extern struct tty_struct *get_current_tty(void);
-extern void tty_default_fops(struct file_operations *fops);
extern struct tty_struct *alloc_tty_struct(void);
extern int tty_add_file(struct tty_struct *tty, struct file *file);
extern void free_tty_struct(struct tty_struct *tty);
--
1.7.6
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them
2011-10-30 16:40 [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Arjan van de Ven
2011-10-30 16:41 ` [PATCH 2/3] tty: make the ptmx_fops initialized at compile time Arjan van de Ven
2011-10-30 16:42 ` [PATCH 3/3] tty: remove the (now) unused tty_default_fops() function Arjan van de Ven
@ 2011-11-15 20:18 ` Greg KH
2011-11-15 20:21 ` Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2011-11-15 20:18 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: gregkh, linux-kernel
On Sun, Oct 30, 2011 at 09:40:38AM -0700, Arjan van de Ven wrote:
>
> From 7e5c44c1d42a1e66ea5df069f3f8ee50a5c46168 Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven <arjan@linux.intel.com>
> Date: Sat, 29 Oct 2011 10:41:19 -0700
> Subject: [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them
>
> The pty code currently does a partial function-pointer copy to fill its
> struct file_operations; this patch makes the functions it copies non-static
> in preparation of switching the pty code over to using proper prototypes.
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Next time, please use 'git send-email' to send your patches out so that
I don't have to manually edit them by hand to get them to apply properly
:(
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them
2011-10-30 16:40 [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Arjan van de Ven
` (2 preceding siblings ...)
2011-11-15 20:18 ` [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Greg KH
@ 2011-11-15 20:21 ` Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2011-11-15 20:21 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: gregkh, linux-kernel
On Sun, Oct 30, 2011 at 09:40:38AM -0700, Arjan van de Ven wrote:
> From: Arjan van de Ven <arjan@linux.intel.com>
>
> The pty code currently does a partial function-pointer copy to fill its
> struct file_operations; this patch makes the functions it copies non-static
> in preparation of switching the pty code over to using proper prototypes.
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
With this patch, I get the following build error:
drivers/tty/tty_io.c:2712:13: error: static declaration of ‘tty_compat_ioctl’ follows non-static declaration
include/linux/tty.h:492:13: note: previous declaration of ‘tty_compat_ioctl’ was here
drivers/tty/tty_io.c:2712:13: warning: ‘tty_compat_ioctl’ defined but not used
Please fix up the series and resend them, in a format that I can apply
them in, without having to edit the body of the patch by hand.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-15 20:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-30 16:40 [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Arjan van de Ven
2011-10-30 16:41 ` [PATCH 2/3] tty: make the ptmx_fops initialized at compile time Arjan van de Ven
2011-10-30 16:42 ` [PATCH 3/3] tty: remove the (now) unused tty_default_fops() function Arjan van de Ven
2011-11-15 20:18 ` [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Greg KH
2011-11-15 20:21 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.