diff mbox series

unix: define and set show_fdinfo only if procfs is enabled

Message ID 20200226172953.16471-1-tklauser@distanz.ch
State Accepted
Delegated to: David Miller
Headers show
Series unix: define and set show_fdinfo only if procfs is enabled | expand

Commit Message

Tobias Klauser Feb. 26, 2020, 5:29 p.m. UTC
Follow the pattern used with other *_show_fdinfo functions and only
define unix_show_fdinfo and set it in proto_ops if CONFIG_PROCFS
is set.

Fixes: 3c32da19a858 ("unix: Show number of pending scm files of receive queue in fdinfo")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 net/unix/af_unix.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Kirill Tkhai Feb. 27, 2020, 8:50 a.m. UTC | #1
On 26.02.2020 20:29, Tobias Klauser wrote:
> Follow the pattern used with other *_show_fdinfo functions and only
> define unix_show_fdinfo and set it in proto_ops if CONFIG_PROCFS
> is set.
> 
> Fixes: 3c32da19a858 ("unix: Show number of pending scm files of receive queue in fdinfo")
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  net/unix/af_unix.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 62c12cb5763e..aa6e2530e1ec 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -682,6 +682,7 @@ static int unix_set_peek_off(struct sock *sk, int val)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PROCFS
>  static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
>  {
>  	struct sock *sk = sock->sk;
> @@ -692,6 +693,9 @@ static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
>  		seq_printf(m, "scm_fds: %u\n", READ_ONCE(u->scm_stat.nr_fds));
>  	}
>  }
> +#else
> +#define unix_show_fdinfo NULL
> +#endif
>  
>  static const struct proto_ops unix_stream_ops = {
>  	.family =	PF_UNIX,
>
David Miller Feb. 27, 2020, 7:12 p.m. UTC | #2
From: Tobias Klauser <tklauser@distanz.ch>
Date: Wed, 26 Feb 2020 18:29:53 +0100

> Follow the pattern used with other *_show_fdinfo functions and only
> define unix_show_fdinfo and set it in proto_ops if CONFIG_PROCFS
> is set.
> 
> Fixes: 3c32da19a858 ("unix: Show number of pending scm files of receive queue in fdinfo")
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Applied, thanks.
diff mbox series

Patch

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 62c12cb5763e..aa6e2530e1ec 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -682,6 +682,7 @@  static int unix_set_peek_off(struct sock *sk, int val)
 	return 0;
 }
 
+#ifdef CONFIG_PROCFS
 static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
 {
 	struct sock *sk = sock->sk;
@@ -692,6 +693,9 @@  static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
 		seq_printf(m, "scm_fds: %u\n", READ_ONCE(u->scm_stat.nr_fds));
 	}
 }
+#else
+#define unix_show_fdinfo NULL
+#endif
 
 static const struct proto_ops unix_stream_ops = {
 	.family =	PF_UNIX,