Skip to contentSkip to conversation

smbfs compilation in 2.5.21

PATCH In review Erik McKee 3 participants 6 messages Jun 16, 2002

lore
Share & tools
lore

Erik McKee

author
#0 lore raw

PATCH 1/1 smbfs compilation in 2.5.21

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 [email protected] 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
# --------------------------------------------
#

fs/smbfs/proc.c +1 -1
diff -Nru a/fs/smbfs/proc.c b/fs/smbfs/proc.c
@@ -872,7 +872,7 @@
 		goto out;
 	}
 	if (smb_valid_packet(s->packet) != 0) {
-		PARANOIA("invalid packet!\n");
+		PARANOIA2("invalid packet!\n");
 		goto out;
 	}
 
fs/smbfs/smb_debug.h +2 -0
diff -Nru a/fs/smbfs/smb_debug.h b/fs/smbfs/smb_debug.h
@@ -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 */
fs/smbfs/sock.c +4 -4
diff -Nru a/fs/smbfs/sock.c b/fs/smbfs/sock.c
@@ -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

#1 lore raw

fs/smbfs/smb_debug.h line 15

Quoted 8 lines · Erik McKee

diff -Nru a/fs/smbfs/smb_debug.h b/fs/smbfs/smb_debug.h

fs/smbfs/smb_debug.h +1 -0
@@ -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

author
#2 lore raw

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

Quoted 58 lines · --- Urban Widmark

fs/smbfs/smb_debug.h line 14

Quoted 7 lines · Erik McKee

diff -Nru a/fs/smbfs/smb_debug.h b/fs/smbfs/smb_debug.h

fs/smbfs/smb_debug.h +0 -0
@@ -12,8 +12,10 @@
  */
 #ifdef SMBFS_PARANOIA
 # define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__, ##

a)

fs/smbfs/smb_debug.h line 15

Quoted 1 line
fs/smbfs/smb_debug.h +1 -0
+# 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

Quoted 8 lines

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

#3 lore raw
Quoted 3 lines · Erik McKee

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

#4 lore raw
In reply to Urban Widmark
Quoted 6 lines · Urban Widmark
Quoted 3 lines
 # 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

#5 lore raw
Quoted 5 lines · Linus Torvalds

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