* [PATCH 1/2] pty: define and set show_fdinfo only if procfs is enabled
@ 2020-03-02 10:49 Tobias Klauser
2020-03-02 10:49 ` [PATCH 2/2] tty: " Tobias Klauser
2020-03-02 10:51 ` [PATCH 1/2] pty: " Greg Kroah-Hartman
0 siblings, 2 replies; 5+ messages in thread
From: Tobias Klauser @ 2020-03-02 10:49 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel
Follow the pattern used with other *_show_fdinfo functions and only
define and use pty_show_fdinfo if CONFIG_PROC_FS is set.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/tty/pty.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 00099a8439d2..dceaff332ca5 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -756,10 +756,12 @@ static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
}
}
+#ifdef CONFIG_PROC_FS
static void pty_show_fdinfo(struct tty_struct *tty, struct seq_file *m)
{
seq_printf(m, "tty-index:\t%d\n", tty->index);
}
+#endif
static const struct tty_operations ptm_unix98_ops = {
.lookup = ptm_unix98_lookup,
@@ -776,7 +778,9 @@ static const struct tty_operations ptm_unix98_ops = {
.compat_ioctl = pty_unix98_compat_ioctl,
.resize = pty_resize,
.cleanup = pty_cleanup,
+#ifdef CONFIG_PROC_FS
.show_fdinfo = pty_show_fdinfo,
+#endif
};
static const struct tty_operations pty_unix98_ops = {
--
2.25.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] tty: define and set show_fdinfo only if procfs is enabled
2020-03-02 10:49 [PATCH 1/2] pty: define and set show_fdinfo only if procfs is enabled Tobias Klauser
@ 2020-03-02 10:49 ` Tobias Klauser
2020-03-02 10:52 ` Greg Kroah-Hartman
2020-03-02 10:51 ` [PATCH 1/2] pty: " Greg Kroah-Hartman
1 sibling, 1 reply; 5+ messages in thread
From: Tobias Klauser @ 2020-03-02 10:49 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel
Follow the pattern used with other *_show_fdinfo functions and only
define and use tty_show_fdinfo if CONFIG_PROC_FS is set.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/tty/tty_io.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index a1453fe10862..4a6b6116aa72 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -467,6 +467,7 @@ static int hung_up_tty_fasync(int fd, struct file *file, int on)
return -ENOTTY;
}
+#ifdef CONFIG_PROC_FS
static void tty_show_fdinfo(struct seq_file *m, struct file *file)
{
struct tty_struct *tty = file_tty(file);
@@ -474,6 +475,7 @@ static void tty_show_fdinfo(struct seq_file *m, struct file *file)
if (tty && tty->ops && tty->ops->show_fdinfo)
tty->ops->show_fdinfo(tty, m);
}
+#endif
static const struct file_operations tty_fops = {
.llseek = no_llseek,
@@ -485,7 +487,9 @@ static const struct file_operations tty_fops = {
.open = tty_open,
.release = tty_release,
.fasync = tty_fasync,
+#ifdef CONFIG_PROC_FS
.show_fdinfo = tty_show_fdinfo,
+#endif
};
static const struct file_operations console_fops = {
--
2.25.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] pty: define and set show_fdinfo only if procfs is enabled
2020-03-02 10:49 [PATCH 1/2] pty: define and set show_fdinfo only if procfs is enabled Tobias Klauser
2020-03-02 10:49 ` [PATCH 2/2] tty: " Tobias Klauser
@ 2020-03-02 10:51 ` Greg Kroah-Hartman
2020-03-02 13:37 ` Tobias Klauser
1 sibling, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-02 10:51 UTC (permalink / raw)
To: Tobias Klauser; +Cc: Jiri Slaby, linux-kernel
On Mon, Mar 02, 2020 at 11:49:53AM +0100, Tobias Klauser wrote:
> Follow the pattern used with other *_show_fdinfo functions and only
> define and use pty_show_fdinfo if CONFIG_PROC_FS is set.
if proc_fs is not set, it will not be used anyway, right?
I'd rather keep #ifdef out of the .c files than add this. How much
memory does it save, and are you using a system without procfs that
needs this savings?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] tty: define and set show_fdinfo only if procfs is enabled
2020-03-02 10:49 ` [PATCH 2/2] tty: " Tobias Klauser
@ 2020-03-02 10:52 ` Greg Kroah-Hartman
0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-02 10:52 UTC (permalink / raw)
To: Tobias Klauser; +Cc: Jiri Slaby, linux-kernel
On Mon, Mar 02, 2020 at 11:49:54AM +0100, Tobias Klauser wrote:
> Follow the pattern used with other *_show_fdinfo functions and only
> define and use tty_show_fdinfo if CONFIG_PROC_FS is set.
>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
> drivers/tty/tty_io.c | 4 ++++
> 1 file changed, 4 insertions(+)
Same comments here as I made on patch 1/2.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] pty: define and set show_fdinfo only if procfs is enabled
2020-03-02 10:51 ` [PATCH 1/2] pty: " Greg Kroah-Hartman
@ 2020-03-02 13:37 ` Tobias Klauser
0 siblings, 0 replies; 5+ messages in thread
From: Tobias Klauser @ 2020-03-02 13:37 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-kernel
On 2020-03-02 at 11:51:53 +0100, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> On Mon, Mar 02, 2020 at 11:49:53AM +0100, Tobias Klauser wrote:
> > Follow the pattern used with other *_show_fdinfo functions and only
> > define and use pty_show_fdinfo if CONFIG_PROC_FS is set.
>
> if proc_fs is not set, it will not be used anyway, right?
Right, it should never get called.
> I'd rather keep #ifdef out of the .c files than add this. How much
> memory does it save, and are you using a system without procfs that
> needs this savings?
The savings are marginal, so no I don't strictly need this. I just
figured all other *_show_fdinfo functions in the tree are #ifdef'ed in
the same way and it would be nice to be consistent.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-02 13:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 10:49 [PATCH 1/2] pty: define and set show_fdinfo only if procfs is enabled Tobias Klauser
2020-03-02 10:49 ` [PATCH 2/2] tty: " Tobias Klauser
2020-03-02 10:52 ` Greg Kroah-Hartman
2020-03-02 10:51 ` [PATCH 1/2] pty: " Greg Kroah-Hartman
2020-03-02 13:37 ` Tobias Klauser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).