netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] socket: SOCK_DEBUG type checking
@ 2008-03-21 14:51 Stephen Hemminger
  2008-03-21 22:56 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2008-03-21 14:51 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Use the inline trick (same as pr_debug) to get checking
of debug statements even if no code is generated.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/include/net/sock.h	2008-03-20 20:25:04.000000000 -0700
+++ b/include/net/sock.h	2008-03-20 20:28:48.000000000 -0700
@@ -70,7 +70,11 @@
 #define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
 					printk(KERN_DEBUG msg); } while (0)
 #else
-#define SOCK_DEBUG(sk, msg...) do { } while (0)
+/* Validate arguments and do nothing */
+static void inline int __attribute__ ((format (printf, 2, 3)))
+SOCK_DEBUG(struct sock *sk, const char *msg, ...)
+{
+}
 #endif
 
 /* This is the per-socket lock.  The spinlock provides a synchronization

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] socket: SOCK_DEBUG type checking
  2008-03-21 14:51 [PATCH] socket: SOCK_DEBUG type checking Stephen Hemminger
@ 2008-03-21 22:56 ` David Miller
  2008-03-22  0:17   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2008-03-21 22:56 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 21 Mar 2008 07:51:32 -0700

> Use the inline trick (same as pr_debug) to get checking
> of debug statements even if no code is generated.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied, and I'll push to net-2.6.26 after some build
testing.

Although the use of SOCK_DEBUG is so esoteric and sparse,
I can't see how any of it can be useful for any kind of
debugging.

I'd say we should just remove this thing.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] socket: SOCK_DEBUG type checking
  2008-03-21 22:56 ` David Miller
@ 2008-03-22  0:17   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2008-03-22  0:17 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Fri, 21 Mar 2008 15:56:00 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Fri, 21 Mar 2008 07:51:32 -0700
> 
> > Use the inline trick (same as pr_debug) to get checking
> > of debug statements even if no code is generated.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> Applied, and I'll push to net-2.6.26 after some build
> testing.
> 
> Although the use of SOCK_DEBUG is so esoteric and sparse,
> I can't see how any of it can be useful for any kind of
> debugging.
> 
> I'd say we should just remove this thing.

Agreed, that was the other alternative, just saw it while
looking at filter stuff.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-22  0:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-21 14:51 [PATCH] socket: SOCK_DEBUG type checking Stephen Hemminger
2008-03-21 22:56 ` David Miller
2008-03-22  0:17   ` Stephen Hemminger

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).