[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3aa310cede544d76e53ec962676a6ea4e3bd6b23.camel@perches.com>
Date: Sun, 17 Feb 2019 03:58:42 -0800
From: Joe Perches <joe@...ches.com>
To: Yafang Shao <laoar.shao@...il.com>, davem@...emloft.net
Cc: daniel@...earbox.net, edumazet@...gle.com,
xiyou.wangcong@...il.com, netdev@...r.kernel.org,
shaoyafang@...iglobal.com
Subject: Re: [PATCH v2 net-next 2/2] net: sock: undefine SOCK_DEBUGGING
On Sun, 2019-02-17 at 00:28 +0800, Yafang Shao wrote:
> SOCK_DEBUG() is a old facility for debugging.
> If the user want to use it for debugging, the user must modify the
> application first, that doesn't seem like a good way.
> Now we have more powerful facilities, i.e. bpf or tracepoint, for this kind
> of debugging purpose.
> So we'd better disable it by default.
> The reason why I don't remove it comepletely is that someone may still
> would like to use it for debugging.
>
> Signed-off-by: Yafang Shao <laoar.shao@...il.com>
> Suggested-by: Joe Perches <joe@...ches.com>
> ---
> include/net/sock.h | 13 ++++++++-----
> net/core/sock.c | 3 +++
> 2 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 6679f3c..d41e8f4 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -81,14 +81,17 @@
> */
>
> /* Define this to get the SOCK_DBG debugging facility. */
> -#define SOCK_DEBUGGING
> +/* #define SOCK_DEBUGGING */
> #ifdef SOCK_DEBUGGING
> -#define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
> - printk(KERN_DEBUG msg); } while (0)
> +#define SOCK_DEBUG(sk, fmt, ...) \
> +do { \
> + if ((sk) && sock_flag((sk), SOCK_DBG)) \
> + pr_debug(fmt, ##__VA_ARGS__); \
trivia:
I would not suggest pr_debug here as it also requires
either DEBUG to be defined or CONFIG_DYNAMIC_DEBUG
to be set.
If you really set SOCK_DEBUGGING, then printk(KERN_DEBUG
is probably right.
Powered by blists - more mailing lists