mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [ERROR][PATCH] smbfs compilation in 2.5.21
@ 2002-06-16  4:28 Erik McKee
  2002-06-16 12:59 ` Urban Widmark
  0 siblings, 1 reply; 6+ messages in thread
From: Erik McKee @ 2002-06-16  4:28 UTC (permalink / raw)
  To: linux-kernel, torvalde, kernel-newbies, davej

The attatched patch fixes smbfs compilation in 2.5.  The problem was that the
paranoia macro required a format string, and one or more substitution elements.
 4 callers only used the string with no substitution.  This patch defines a
paranoia2 which allows for not substitutions ;)

Compilation tested only, as i can not run latest 2.5 due to raid5 not
compiling, but this has to be ok, since it doesn't change any code paths.

Erik McKee

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.484   -> 1.485  
#	fs/smbfs/smb_debug.h	1.2     -> 1.3    
#	     fs/smbfs/proc.c	1.20    -> 1.21   
#	     fs/smbfs/sock.c	1.7     -> 1.8    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/06/15	root@camhanaich.local	1.485
# sock.c:
#   Same edit as proc.c
# proc.c:
#   This makes use of the PARANOIA2 to allow compilation
# smb_debug.h:
#   Added PARANOIA2 to handle cases where there are no
#   format specifiers in the string
# --------------------------------------------
#
diff -Nru a/fs/smbfs/proc.c b/fs/smbfs/proc.c
--- a/fs/smbfs/proc.c	Sat Jun 15 23:12:04 2002
+++ b/fs/smbfs/proc.c	Sat Jun 15 23:12:05 2002
@@ -872,7 +872,7 @@
 		goto out;
 	}
 	if (smb_valid_packet(s->packet) != 0) {
-		PARANOIA("invalid packet!\n");
+		PARANOIA2("invalid packet!\n");
 		goto out;
 	}
 
diff -Nru a/fs/smbfs/smb_debug.h b/fs/smbfs/smb_debug.h
--- a/fs/smbfs/smb_debug.h	Sat Jun 15 23:12:04 2002
+++ b/fs/smbfs/smb_debug.h	Sat Jun 15 23:12:04 2002
@@ -12,8 +12,10 @@
  */
 #ifdef SMBFS_PARANOIA
 # define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__, ## a)
+# define PARANOIA2(f) printk(KERN_NOTICE "%s: "f, __FUNCTION__)
 #else
 # define PARANOIA(f, a...) do { ; } while(0)
+# defind PARANOIA2(f) do { ; } while(0)
 #endif
 
 /* lots of debug messages */
diff -Nru a/fs/smbfs/sock.c b/fs/smbfs/sock.c
--- a/fs/smbfs/sock.c	Sat Jun 15 23:12:05 2002
+++ b/fs/smbfs/sock.c	Sat Jun 15 23:12:05 2002
@@ -125,7 +125,7 @@
 
 		result = -EIO;
 		if (job->sk->dead) {
-			PARANOIA("sock dead!\n");
+			PARANOIA2("sock dead!\n");
 			break;
 		}
 
@@ -189,7 +189,7 @@
 	{
 #ifdef SMBFS_PARANOIA
 		if (!smb_valid_socket(file->f_dentry->d_inode))
-			PARANOIA("bad socket!\n");
+			PARANOIA2("bad socket!\n");
 #endif
 		return SOCKET_I(file->f_dentry->d_inode);
 	}
@@ -299,7 +299,7 @@
 		VERBOSE("closing socket %p\n", server_sock(server));
 #ifdef SMBFS_PARANOIA
 		if (server_sock(server)->sk->data_ready == smb_data_ready)
-			PARANOIA("still catching keepalives!\n");
+			PARANOIA2("still catching keepalives!\n");
 #endif
 		server->sock_file = NULL;
 		fput(file);
@@ -585,7 +585,7 @@
 	return result;
 
 out_no_mem:
-	PARANOIA("couldn't allocate data area\n");
+	PARANOIA2("couldn't allocate data area\n");
 	result = -ENOMEM;
 	goto out;
 out_too_long:



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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

* Re: [ERROR][PATCH] smbfs compilation in 2.5.21
  2002-06-16  4:28 [ERROR][PATCH] smbfs compilation in 2.5.21 Erik McKee
@ 2002-06-16 12:59 ` Urban Widmark
  2002-06-16 16:24   ` Erik McKee
  2002-06-16 18:26   ` Linus Torvalds
  0 siblings, 2 replies; 6+ messages in thread
From: Urban Widmark @ 2002-06-16 12:59 UTC (permalink / raw)
  To: Erik McKee
  Cc: linux-kernel, Linus Torvalds, kernel-newbies, davej, Adrian Bunk

On Sat, 15 Jun 2002, Erik McKee wrote:

> diff -Nru a/fs/smbfs/smb_debug.h b/fs/smbfs/smb_debug.h
> --- a/fs/smbfs/smb_debug.h	Sat Jun 15 23:12:04 2002
> +++ b/fs/smbfs/smb_debug.h	Sat Jun 15 23:12:04 2002
> @@ -12,8 +12,10 @@
>   */
>  #ifdef SMBFS_PARANOIA
>  # define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__, ## a)
> +# define PARANOIA2(f) printk(KERN_NOTICE "%s: "f, __FUNCTION__)

Are you looking at BK, the 2.5.21 tree I'm looking at still has:
#define PARANOIA(x...) printk(KERN_NOTICE __FUNCTION__ ": " x)

I assume you are using gcc 3.x? (which one?)
I don't get any warnings/errors on 2.96.


I think having two macros for exactly the same thing is ugly. A better
solution might be to borrow some code from arch/ia64/kernel/unaligned.c

#define PARANOIA(f...) \
	do { printk(KERN_NOTICE "%s: ", __FUNCTION__); printk(f); } while(0)

(untested, and I think this will print an extra "<4>" ?)
Unless someone has a better idea. In any case, the other printk macros in
smb_debug.h needs treatment too and not just the PARANOIA macro.


If you are cleaning things up I think that the following also sometimes
use debug macros with a single string, but with a 'macro(a, b...)' syntax:

drivers/net/pci-skeleton.c
drivers/char/i810_rng.c
sound/oss/via82cxxx_audio.c
	DPRINTK

drivers/hotplug/pci_hotplug_{core,util}.c
	dbg/err/info/warn

drivers/char/machzwd.c
	dprnintk

drivers/ieee1394/sbp2.c
	SBP2_ORB_DEBUG

net/ipv4/netfilter/ipt_ULOG.c
net/ipv4/netfilter/ip_conntrack_irc.c
	DEBUGP

sound/oss/vwsnd.c
	DBGP

fs/ntfs/debug.h
	ntfs_warning/ntfs_error


Many of them are not enabled by default, and maybe they have already been
taken care of.

And maybe run suggested changes by the respective maintainers first.
Thanks.

/Urban


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

* Re: [ERROR][PATCH] smbfs compilation in 2.5.21
  2002-06-16 12:59 ` Urban Widmark
@ 2002-06-16 16:24   ` Erik McKee
  2002-06-16 17:13     ` Urban Widmark
  2002-06-16 18:26   ` Linus Torvalds
  1 sibling, 1 reply; 6+ messages in thread
From: Erik McKee @ 2002-06-16 16:24 UTC (permalink / raw)
  To: Urban Widmark
  Cc: linux-kernel, Linus Torvalds, kernel-newbies, davej, Adrian Bunk

THis is from the bk tree.  It's gcc 2.95.3.  That solution might be a bettr one
after all ;)  However, would the stringifying done here to get the function
name in there mess that up?

Erik McKee


--- Urban Widmark <urban@teststation.com> wrote:
> On Sat, 15 Jun 2002, Erik McKee wrote:
> 
> > diff -Nru a/fs/smbfs/smb_debug.h b/fs/smbfs/smb_debug.h
> > --- a/fs/smbfs/smb_debug.h	Sat Jun 15 23:12:04 2002
> > +++ b/fs/smbfs/smb_debug.h	Sat Jun 15 23:12:04 2002
> > @@ -12,8 +12,10 @@
> >   */
> >  #ifdef SMBFS_PARANOIA
> >  # define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__, ##
> a)
> > +# define PARANOIA2(f) printk(KERN_NOTICE "%s: "f, __FUNCTION__)
> 
> Are you looking at BK, the 2.5.21 tree I'm looking at still has:
> #define PARANOIA(x...) printk(KERN_NOTICE __FUNCTION__ ": " x)
> 
> I assume you are using gcc 3.x? (which one?)
> I don't get any warnings/errors on 2.96.
> 
> 
> I think having two macros for exactly the same thing is ugly. A better
> solution might be to borrow some code from arch/ia64/kernel/unaligned.c
> 
> #define PARANOIA(f...) \
> 	do { printk(KERN_NOTICE "%s: ", __FUNCTION__); printk(f); } while(0)
> 
> (untested, and I think this will print an extra "<4>" ?)
> Unless someone has a better idea. In any case, the other printk macros in
> smb_debug.h needs treatment too and not just the PARANOIA macro.
> 
> 
> If you are cleaning things up I think that the following also sometimes
> use debug macros with a single string, but with a 'macro(a, b...)' syntax:
> 
> drivers/net/pci-skeleton.c
> drivers/char/i810_rng.c
> sound/oss/via82cxxx_audio.c
> 	DPRINTK
> 
> drivers/hotplug/pci_hotplug_{core,util}.c
> 	dbg/err/info/warn
> 
> drivers/char/machzwd.c
> 	dprnintk
> 
> drivers/ieee1394/sbp2.c
> 	SBP2_ORB_DEBUG
> 
> net/ipv4/netfilter/ipt_ULOG.c
> net/ipv4/netfilter/ip_conntrack_irc.c
> 	DEBUGP
> 
> sound/oss/vwsnd.c
> 	DBGP
> 
> fs/ntfs/debug.h
> 	ntfs_warning/ntfs_error
> 
> 
> Many of them are not enabled by default, and maybe they have already been
> taken care of.
> 
> And maybe run suggested changes by the respective maintainers first.
> Thanks.
> 
> /Urban
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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

* Re: [ERROR][PATCH] smbfs compilation in 2.5.21
  2002-06-16 16:24   ` Erik McKee
@ 2002-06-16 17:13     ` Urban Widmark
  0 siblings, 0 replies; 6+ messages in thread
From: Urban Widmark @ 2002-06-16 17:13 UTC (permalink / raw)
  To: Erik McKee; +Cc: linux-kernel, Adrian Bunk

On Sun, 16 Jun 2002, Erik McKee wrote:

> THis is from the bk tree.  It's gcc 2.95.3.  That solution might be a bettr one
> after all ;)  However, would the stringifying done here to get the function
> name in there mess that up?

stringifying?

The whole point of the original change was to not do any string
concatenation of __FUNCTION__, but it is a string already.


However, could you try this change instead:

-# define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__, ## a)
+# define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__ , ## a)

Apparently an extra space before the comma before ## is supposed to
matter. Several of the macros I pointed at before already do that.

See also
http://gcc.gnu.org/onlinedocs/gcc-3.1/cpp/Variadic-Macros.html

/Urban


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

* Re: [ERROR][PATCH] smbfs compilation in 2.5.21
  2002-06-16 12:59 ` Urban Widmark
  2002-06-16 16:24   ` Erik McKee
@ 2002-06-16 18:26   ` Linus Torvalds
  2002-06-16 18:40     ` Urban Widmark
  1 sibling, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2002-06-16 18:26 UTC (permalink / raw)
  To: Urban Widmark
  Cc: Erik McKee, linux-kernel, kernel-newbies, davej, Adrian Bunk



On Sun, 16 Jun 2002, Urban Widmark wrote:
>
> >  # define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__, ## a)
> > +# define PARANOIA2(f) printk(KERN_NOTICE "%s: "f, __FUNCTION__)
>
> Are you looking at BK, the 2.5.21 tree I'm looking at still has:
> #define PARANOIA(x...) printk(KERN_NOTICE __FUNCTION__ ": " x)

Should not

  # define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__ , ##  a)

work? Notice the one added extra space between __FUNCTION__ and ",".

		Linus


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

* Re: [ERROR][PATCH] smbfs compilation in 2.5.21
  2002-06-16 18:26   ` Linus Torvalds
@ 2002-06-16 18:40     ` Urban Widmark
  0 siblings, 0 replies; 6+ messages in thread
From: Urban Widmark @ 2002-06-16 18:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Erik McKee, linux-kernel, davej, Adrian Bunk

On Sun, 16 Jun 2002, Linus Torvalds wrote:

> Should not
> 
>   # define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__ , ##  a)
> 
> work? Notice the one added extra space between __FUNCTION__ and ",".

That's what the gcc manual says.

There was a separate mail where I dropped some people I figured didn't
care too much about smbfs debug macros from the Cc list.

I will get back to you when someone with 2.95.x has verified it - or if
you know that it is supposed to work just change it. It's in use in
other places in the kernel tree.

/Urban


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

end of thread, other threads:[~2002-06-16 18:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-16  4:28 [ERROR][PATCH] smbfs compilation in 2.5.21 Erik McKee
2002-06-16 12:59 ` Urban Widmark
2002-06-16 16:24   ` Erik McKee
2002-06-16 17:13     ` Urban Widmark
2002-06-16 18:26   ` Linus Torvalds
2002-06-16 18:40     ` Urban Widmark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®