Skip to contentSkip to conversation

AFS compile breakage in 2.5.43

PATCH In review Matt Reppert 4 participants 6 messages Oct 16, 2002 – Oct 17, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 AFS compile breakage in 2.5.43

Is this valid? gcc-2.95.3 doesn't like it at all. [fs/afs/dir.c line 65]

typedef union afs_dirent {
        struct {
                u8      valid;
                u8      unused[1];
                u16     hash_next;
                u32     vnode;
                u32     unique;
                u8      name[16];
                u8      overflow[4];    /* if any char of the name (inc NUL) reaches here, consume
                                         * the next dirent too */
        };
        u8      extended_name[32];
} afs_dirent_t;

This breaks compile of AFS due to members of the unnamed struct being used as members of afs_dirent_t objects:
fs/afs/dir.c:75: warning: unnamed struct/union that defines no instances fs/afs/dir.c: In function `afs_dir_iterate_block':
fs/afs/dir.c:261: union has no member named name' fs/afs/dir.c:293: union has no member named name' fs/afs/dir.c:296: union has no member named vnode' fs/afs/dir.c:296: union has no member named vnode' fs/afs/dir.c:296: union has no member named vnode' fs/afs/dir.c:297: union has no member named unique'

The following makes it compile.

fs/afs/dir.c renamed from fs/afs/dir +5 -5
@@ -72,7 +72,7 @@
 		u8	name[16];
 		u8	overflow[4];	/* if any char of the name (inc NUL) reaches here, consume
 					 * the next dirent too */
-	};
+	} ent;
 	u8	extended_name[32];
 } afs_dirent_t;
 
@@ -258,7 +258,7 @@
 
 		/* got a valid entry */
 		dire = &block->dirents[offset];
-		nlen = strnlen(dire->name,sizeof(*block) - offset*sizeof(afs_dirent_t));
+		nlen = strnlen(dire->ent.name,sizeof(*block) - offset*sizeof(afs_dirent_t));
 
 		_debug("ENT[%u.%u]: %s %u \"%.*s\"\n",
 		       blkoff/sizeof(afs_dir_block_t),offset,
@@ -290,11 +290,11 @@
 
 		/* found the next entry */
 		ret = filldir(cookie,
-			      dire->name,
+			      dire->ent.name,
 			      nlen,
 			      blkoff + offset * sizeof(afs_dirent_t),
-			      ntohl(dire->vnode),
-			      filldir==afs_dir_lookup_filldir ? dire->unique : DT_UNKNOWN);
+			      ntohl(dire->ent.vnode),
+			      filldir==afs_dir_lookup_filldir ? dire->ent.unique : DT_UNKNOWN);
 		if (ret<0) {
 			_leave(" = 0 [full]");
 			return 0;

Matt

#1 lore raw

From: Matt Reppert <[email protected]>
Date: Wed, 16 Oct 2002 18:03:50 -0500

Is this valid? gcc-2.95.3 doesn't like it at all. [fs/afs/dir.c line 65]

David has patches coming to fix this.

It is valid, but only in newer versions of gcc.

#2 lore raw
Quoted 4 lines · On Wed, 16 Oct 2002 16:16:43 -0700 (PDT) "David S. Miller" <[email protected]>…

Is this valid? gcc-2.95.3 doesn't like it at all. [fs/afs/dir.c line 65]

David has patches coming to fix this.

Hm ... too bad this mail didn't get here just a minute sooner, I just* sent a patch for rxrpc too.

Quoted 1 line

It is valid, but only in newer versions of gcc.

I see ... I thought that might be the case. Thanks.

Matt

#3 lore raw
In reply to Matt Reppert
Quoted 1 line · * Matt Reppert ([email protected]) wrote:

Is this valid? gcc-2.95.3 doesn't like it at all.

Yes, it's valid for newer compilers. I have a similar patch that also updates the varargs macro stuff used in AFS (and rxrpc) (for akpm's "crusty" compilers ;-)

thanks,
-chris

fs/afs/dir.c renamed from fs/afs/dir.c.egcs +5 -5
@@ -72,7 +72,7 @@
 		u8	name[16];
 		u8	overflow[4];	/* if any char of the name (inc NUL) reaches here, consume
 					 * the next dirent too */
-	};
+	} de;
 	u8	extended_name[32];
 } afs_dirent_t;
 
@@ -258,7 +258,7 @@
 
 		/* got a valid entry */
 		dire = &block->dirents[offset];
-		nlen = strnlen(dire->name,sizeof(*block) - offset*sizeof(afs_dirent_t));
+		nlen = strnlen(dire->de.name,sizeof(*block) - offset*sizeof(afs_dirent_t));
 
 		_debug("ENT[%u.%u]: %s %u \"%.*s\"\n",
 		       blkoff/sizeof(afs_dir_block_t),offset,
@@ -290,11 +290,11 @@
 
 		/* found the next entry */
 		ret = filldir(cookie,
-			      dire->name,
+			      dire->de.name,
 			      nlen,
 			      blkoff + offset * sizeof(afs_dirent_t),
-			      ntohl(dire->vnode),
-			      filldir==afs_dir_lookup_filldir ? dire->unique : DT_UNKNOWN);
+			      ntohl(dire->de.vnode),
+			      filldir==afs_dir_lookup_filldir ? dire->de.unique : DT_UNKNOWN);
 		if (ret<0) {
 			_leave(" = 0 [full]");
 			return 0;
fs/afs/internal.h renamed from fs/afs/internal.h.egcs +15 -15
@@ -21,24 +21,24 @@
 /*
  * debug tracing
  */
-#define kenter(FMT,...)	printk("==> %s("FMT")\n",__FUNCTION__,##__VA_ARGS__)
-#define kleave(FMT,...)	printk("<== %s()"FMT"\n",__FUNCTION__,##__VA_ARGS__)
-#define kdebug(FMT,...)	printk(FMT"\n",##__VA_ARGS__)
-#define kproto(FMT,...)	printk("### "FMT"\n",##__VA_ARGS__)
-#define knet(FMT,...)	printk(FMT"\n",##__VA_ARGS__)
+#define kenter(FMT, VA...) printk("==> %s("FMT")\n", __FUNCTION__ , ##VA)
+#define kleave(FMT, VA...) printk("<== %s()"FMT"\n", __FUNCTION__ , ##VA)
+#define kdebug(FMT, VA...) printk(FMT"\n", ##VA)
+#define kproto(FMT, VA...) printk("### "FMT"\n", ##VA)
+#define knet(FMT, VA...)   printk(FMT"\n", ##VA)
 
 #if 0
-#define _enter(FMT,...)	kenter(FMT,##__VA_ARGS__)
-#define _leave(FMT,...)	kleave(FMT,##__VA_ARGS__)
-#define _debug(FMT,...)	kdebug(FMT,##__VA_ARGS__)
-#define _proto(FMT,...)	kproto(FMT,##__VA_ARGS__)
-#define _net(FMT,...)	knet(FMT,##__VA_ARGS__)
+#define _enter(FMT, VA...) kenter(FMT, ##VA)
+#define _leave(FMT, VA...) kleave(FMT, ##VA)
+#define _debug(FMT, VA...) kdebug(FMT, ##VA)
+#define _proto(FMT, VA...) kproto(FMT, ##VA)
+#define _net(FMT, VA...)   knet(FMT, ##VA)
 #else
-#define _enter(FMT,...)	do { } while(0)
-#define _leave(FMT,...)	do { } while(0)
-#define _debug(FMT,...)	do { } while(0)
-#define _proto(FMT,...)	do { } while(0)
-#define _net(FMT,...)	do { } while(0)
+#define _enter(FMT, VA...) do { } while(0)
+#define _leave(FMT, VA...) do { } while(0)
+#define _debug(FMT, VA...) do { } while(0)
+#define _proto(FMT, VA...) do { } while(0)
+#define _net(FMT, VA...)   do { } while(0)
 #endif
 
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
net/rxrpc/internal.h renamed from net/rxrpc/internal.h.egcs +15 -15
@@ -29,24 +29,24 @@
 /*
  * debug tracing
  */
-#define kenter(FMT,...)	printk("==> %s("FMT")\n",__FUNCTION__,##__VA_ARGS__)
-#define kleave(FMT,...)	printk("<== %s()"FMT"\n",__FUNCTION__,##__VA_ARGS__)
-#define kdebug(FMT,...)	printk("    "FMT"\n",##__VA_ARGS__)
-#define kproto(FMT,...)	printk("### "FMT"\n",##__VA_ARGS__)
-#define knet(FMT,...)	printk("    "FMT"\n",##__VA_ARGS__)
+#define kenter(FMT, VA...)	printk("==> %s("FMT")\n", __FUNCTION__ , ##VA)
+#define kleave(FMT, VA...)	printk("<== %s()"FMT"\n", __FUNCTION__ , ##VA)
+#define kdebug(FMT, VA...)	printk("    "FMT"\n", ##VA)
+#define kproto(FMT, VA...)	printk("### "FMT"\n", ##VA)
+#define knet(FMT, VA...)	printk("    "FMT"\n", ##VA)
 
 #if 0
-#define _enter(FMT,...)	kenter(FMT,##__VA_ARGS__)
-#define _leave(FMT,...)	kleave(FMT,##__VA_ARGS__)
-#define _debug(FMT,...)	kdebug(FMT,##__VA_ARGS__)
-#define _proto(FMT,...)	kproto(FMT,##__VA_ARGS__)
-#define _net(FMT,...)	knet(FMT,##__VA_ARGS__)
+#define _enter(FMT, VA...)	kenter(FMT,##VA)
+#define _leave(FMT, VA...)	kleave(FMT,##VA)
+#define _debug(FMT, VA...)	kdebug(FMT,##VA)
+#define _proto(FMT, VA...)	kproto(FMT,##VA)
+#define _net(FMT, VA...)	knet(FMT,##VA)
 #else
-#define _enter(FMT,...)	do { if (rxrpc_ktrace) kenter(FMT,##__VA_ARGS__); } while(0)
-#define _leave(FMT,...)	do { if (rxrpc_ktrace) kleave(FMT,##__VA_ARGS__); } while(0)
-#define _debug(FMT,...)	do { if (rxrpc_kdebug) kdebug(FMT,##__VA_ARGS__); } while(0)
-#define _proto(FMT,...)	do { if (rxrpc_kproto) kproto(FMT,##__VA_ARGS__); } while(0)
-#define _net(FMT,...)	do { if (rxrpc_knet)   knet  (FMT,##__VA_ARGS__); } while(0)
+#define _enter(FMT, VA...)	do { if (rxrpc_ktrace) kenter(FMT, ##VA); } while(0)
+#define _leave(FMT, VA...)	do { if (rxrpc_ktrace) kleave(FMT, ##VA); } while(0)
+#define _debug(FMT, VA...)	do { if (rxrpc_kdebug) kdebug(FMT, ##VA); } while(0)
+#define _proto(FMT, VA...)	do { if (rxrpc_kproto) kproto(FMT, ##VA); } while(0)
+#define _net(FMT, VA...)	do { if (rxrpc_knet)   knet  (FMT, ##VA); } while(0)
 #endif
 
 static inline void rxrpc_discard_my_signals(void)
net/rxrpc/main.c renamed from net/rxrpc/main.c.egcs +1 -1
@@ -123,5 +123,5 @@
 	__RXACCT(printk("Outstanding Peers      : %d\n",atomic_read(&rxrpc_peer_count)));
 	__RXACCT(printk("Outstanding Transports : %d\n",atomic_read(&rxrpc_transport_count)));
 
-	kleave();
+	kleave("");
 } /* end rxrpc_cleanup() */
#4 lore raw
Quoted 4 lines

Yes, it's valid for newer compilers. I have a similar patch that also updates the varargs macro stuff used in AFS (and rxrpc) (for akpm's "crusty" compilers ;-)

Can you try the attached patch please.

David

inst-afs/devel/afs/fs/afs/cmservice.c renamed from fs/afs/cmservice.c +0 -4
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/cmservice.c /inst-afs/devel/afs/fs/afs/cmservice.c
@@ -129,11 +129,7 @@
 	/* only certain signals are of interest */
 	spin_lock_irq(&current->sig->siglock);
 	siginitsetinv(&current->blocked,0);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
 	recalc_sigpending();
-#else
-	recalc_sigpending(current);
-#endif
 	spin_unlock_irq(&current->sig->siglock);
 
 	/* loop around looking for things to attend to */
inst-afs/devel/afs/fs/afs/dir.c renamed from fs/afs/dir.c +28 -36

146 lines not on this page · raw message

inst-afs/devel/afs/fs/afs/errors.h renamed from fs/afs/errors.h +3 -3
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/errors.h /inst-afs/devel/afs/fs/afs/errors.h
@@ -9,8 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#ifndef _H_DB712916_5113_11D6_9A6D_0002B3163499
-#define _H_DB712916_5113_11D6_9A6D_0002B3163499
+#ifndef _LINUX_AFS_ERRORS_H
+#define _LINUX_AFS_ERRORS_H
 
 #include "types.h"
 
@@ -31,4 +31,4 @@
 
 extern int afs_abort_to_error(int abortcode);
 
-#endif /* _H_DB712916_5113_11D6_9A6D_0002B3163499 */
+#endif /* _LINUX_AFS_ERRORS_H */
inst-afs/devel/afs/fs/afs/file.c renamed from fs/afs/file.c +10 -29
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/file.c /inst-afs/devel/afs/fs/afs/file.c
@@ -21,30 +21,28 @@
 #include <rxrpc/call.h>
 #include "internal.h"
 
-//static int afs_file_open(struct inode *inode, struct file *file);
-//static int afs_file_release(struct inode *inode, struct file *file);
+#if 0
+static int afs_file_open(struct inode *inode, struct file *file);
+static int afs_file_release(struct inode *inode, struct file *file);
+#endif
 
 static int afs_file_readpage(struct file *file, struct page *page);
 
-//static ssize_t afs_file_read(struct file *file, char *buf, size_t size, loff_t *off);
-
 static ssize_t afs_file_write(struct file *file, const char *buf, size_t size, loff_t *off);
 
 struct inode_operations afs_file_inode_operations = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	.getattr	= afs_inode_getattr,
-#else
-	.revalidate	= afs_inode_revalidate,
-#endif
 };
 
 struct file_operations afs_file_file_operations = {
-//	.open		= afs_file_open,
-//	.release	= afs_file_release,
-	.read		= generic_file_read, //afs_file_read,
+	.read		= generic_file_read,
 	.write		= afs_file_write,
 	.mmap		= generic_file_mmap,
-//	.fsync		= afs_file_fsync,
+#if 0
+	.open		= afs_file_open,
+	.release	= afs_file_release,
+	.fsync		= afs_file_fsync,
+#endif
 };
 
 struct address_space_operations afs_fs_aops = {
@@ -53,23 +51,6 @@
 
 /*****************************************************************************/
 /*
- * AFS file read
- */
-#if 0
-static ssize_t afs_file_read(struct file *file, char *buf, size_t size, loff_t *off)
-{
-	struct afs_inode_info *ai;
-
-	ai = AFS_FS_I(file->f_dentry->d_inode);
-	if (ai->flags & AFS_INODE_DELETED)
-		return -ESTALE;
-
-	return -EIO;
-} /* end afs_file_read() */
-#endif
-
-/*****************************************************************************/
-/*
  * AFS file write
  */
 static ssize_t afs_file_write(struct file *file, const char *buf, size_t size, loff_t *off)
inst-afs/devel/afs/fs/afs/fsclient.c renamed from fs/afs/fsclient.c +1 -1
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/fsclient.c /inst-afs/devel/afs/fs/afs/fsclient.c
@@ -426,7 +426,7 @@
 	int ret;
 	u32 *bp;
 
-	_enter("%p,{fid={%u,%u,%u},sz=%u,of=%lu}",
+	_enter("%p,{fid={%u,%u,%u},sz=%Zu,of=%lu}",
 	       server,
 	       desc->fid.vid,
 	       desc->fid.vnode,
inst-afs/devel/afs/fs/afs/inode.c renamed from fs/afs/inode.c +1 -152

223 lines not on this page · raw message

inst-afs/devel/afs/fs/afs/internal.h renamed from fs/afs/internal.h +16 -31

69 lines not on this page · raw message

inst-afs/devel/afs/fs/afs/kafsasyncd.c renamed from fs/afs/kafsasyncd.c +0 -4
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/kafsasyncd.c /inst-afs/devel/afs/fs/afs/kafsasyncd.c
@@ -103,11 +103,7 @@
 	/* only certain signals are of interest */
 	spin_lock_irq(&current->sig->siglock);
 	siginitsetinv(&current->blocked,0);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
 	recalc_sigpending();
-#else
-	recalc_sigpending(current);
-#endif
 	spin_unlock_irq(&current->sig->siglock);
 
 	/* loop around looking for things to attend to */
inst-afs/devel/afs/fs/afs/kafstimod.c renamed from fs/afs/kafstimod.c +0 -4
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/kafstimod.c /inst-afs/devel/afs/fs/afs/kafstimod.c
@@ -80,11 +80,7 @@
 	/* only certain signals are of interest */
 	spin_lock_irq(&current->sig->siglock);
 	siginitsetinv(&current->blocked,0);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
 	recalc_sigpending();
-#else
-	recalc_sigpending(current);
-#endif
 	spin_unlock_irq(&current->sig->siglock);
 
 	/* loop around looking for things to attend to */
inst-afs/devel/afs/fs/afs/main.c renamed from fs/afs/main.c +2 -2
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/main.c /inst-afs/devel/afs/fs/afs/main.c
@@ -173,8 +173,8 @@
 
 	_debug("Discarding peer %08x (rtt=%lu.%lumS)\n",
 	       ntohl(peer->addr.s_addr),
-	       peer->rtt/1000,
-	       peer->rtt%1000);
+	       (long)(peer->rtt/1000),
+	       (long)(peer->rtt%1000));
 
 	/* uncross-point the structs under a global lock */
 	spin_lock(&afs_server_peer_lock);
inst-afs/devel/afs/fs/afs/Makefile renamed from fs/afs/Makefile +0 -8
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/Makefile /inst-afs/devel/afs/fs/afs/Makefile
@@ -23,14 +23,6 @@
 	vnode.o \
 	volume.o
 
-#	cache.o
-
 obj-m  := kafs.o
 
-# superfluous for 2.5, but needed for 2.4..
-ifeq "$(VERSION).$(PATCHLEVEL)" "2.4"
-kafs.o: $(kafs-objs)
-	$(LD) -r -o kafs.o $(kafs-objs)
-endif
-
 include $(TOPDIR)/Rules.make
inst-afs/devel/afs/fs/afs/mntpt.c renamed from fs/afs/mntpt.c +1 -5
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/mntpt.c /inst-afs/devel/afs/fs/afs/mntpt.c
@@ -31,11 +31,7 @@
 struct inode_operations afs_mntpt_inode_operations = {
 	.lookup		= afs_mntpt_lookup,
 	.readlink	= page_readlink,
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	.getattr	= afs_inode_getattr,
-#else
-	.revalidate	= afs_inode_revalidate,
-#endif
 };
 
 /*****************************************************************************/
@@ -70,7 +66,7 @@
 
 	/* examine the symlink's contents */
 	size = vnode->status.size;
-	_debug("symlink to %*.*s",size,size,buf);
+	_debug("symlink to %*.*s",size,(int)size,buf);
 
 	if (size>2 &&
 	    (buf[0]=='%' || buf[0]=='#') &&
inst-afs/devel/afs/fs/afs/proc.c renamed from fs/afs/proc.c +3 -0
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/proc.c /inst-afs/devel/afs/fs/afs/proc.c
@@ -412,6 +412,7 @@
 
 	afs_put_cell(cell);
 
+	return ret;
 } /* end afs_proc_cell_volumes_release() */
 
 /*****************************************************************************/
@@ -536,6 +537,7 @@
 
 	afs_put_cell(cell);
 
+	return ret;
 } /* end afs_proc_cell_vlservers_release() */
 
 /*****************************************************************************/
@@ -651,6 +653,7 @@
 
 	afs_put_cell(cell);
 
+	return ret;
 } /* end afs_proc_cell_servers_release() */
 
 /*****************************************************************************/
inst-afs/devel/afs/fs/afs/super.c renamed from fs/afs/super.c +0 -86

185 lines not on this page · raw message

inst-afs/devel/afs/fs/afs/vlclient.c renamed from fs/afs/vlclient.c +1 -1
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/vlclient.c /inst-afs/devel/afs/fs/afs/vlclient.c
@@ -626,7 +626,7 @@
 	case RXRPC_CSTATE_CLNT_GOT_REPLY:
 		if (call->app_read_count==0)
 			break;
-		printk("kAFS: Reply bigger than expected {cst=%u asyn=%d mark=%d rdy=%u pr=%u%s}",
+		printk("kAFS: Reply bigger than expected {cst=%u asyn=%d mark=%Zu rdy=%Zu pr=%u%s}",
 		       call->app_call_state,
 		       call->app_async_read,
 		       call->app_mark,
inst-afs/devel/afs/fs/afs/vnode.h renamed from fs/afs/vnode.h +1 -13
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/fs/afs/vnode.h /inst-afs/devel/afs/fs/afs/vnode.h
@@ -27,11 +27,7 @@
  */
 struct afs_vnode
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	struct inode		vfs_inode;	/* the VFS's inode record */
-#else
-	struct inode		*inode;		/* the VFS's inode */
-#endif
 
 	afs_volume_t		*volume;	/* volume on which vnode resides */
 	afs_fid_t		fid;		/* the file identifier for this inode */
@@ -59,20 +55,12 @@
 
 static inline afs_vnode_t *AFS_FS_I(struct inode *inode)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-	return list_entry(inode,afs_vnode_t,vfs_inode);
-#else
-	return inode->u.generic_ip;
-#endif
+	return container_of(inode,afs_vnode_t,vfs_inode);
 }
 
 static inline struct inode *AFS_VNODE_TO_I(afs_vnode_t *vnode)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	return &vnode->vfs_inode;
-#else
-	return vnode->inode;
-#endif
 }
 
 extern int afs_vnode_fetch_status(afs_vnode_t *vnode);
inst-afs/devel/afs/net/rxrpc/call.c renamed from net/rxrpc/call.c +20 -20
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/call.c /inst-afs/devel/afs/net/rxrpc/call.c
@@ -1005,7 +1005,7 @@
 	}
 
 	/* next in sequence - simply append into the call's ready queue */
-	_debug("Call add packet %d to readyq (+%d => %d bytes)",
+	_debug("Call add packet %d to readyq (+%Zd => %Zd bytes)",
 	       msg->seq,msg->dsize,call->app_ready_qty);
 
 	spin_lock(&call->lock);
@@ -1021,7 +1021,7 @@
 			break;
 
 		/* next in sequence - just move list-to-list */
-		_debug("Call transfer packet %d to readyq (+%d => %d bytes)",
+		_debug("Call transfer packet %d to readyq (+%Zd => %Zd bytes)",
 		       pmsg->seq,pmsg->dsize,call->app_ready_qty);
 
 		call->app_ready_seq = pmsg->seq;
@@ -1156,7 +1156,7 @@
 	/* otherwise just invoke the data function whenever we can satisfy its desire for more
 	 * data
 	 */
-	_proto("Rx Received Op Data: st=%u qty=%u mk=%u%s",
+	_proto("Rx Received Op Data: st=%u qty=%Zu mk=%Zu%s",
 	       call->app_call_state,call->app_ready_qty,call->app_mark,
 	       call->app_last_rcv ? " last-rcvd" : "");
 
@@ -1394,7 +1394,7 @@
 	char resend, now_complete;
 	u8 acks[16];
 
-	_enter("%p{apc=%u ads=%u},%p,%u,%u",
+	_enter("%p{apc=%u ads=%u},%p,%u,%Zu",
 	       call,call->acks_pend_cnt,call->acks_dftv_seq,msg,seq,count);
 
 	/* handle re-ACK'ing of definitively ACK'd packets (may be out-of-order ACKs) */
@@ -1443,7 +1443,7 @@
 		}
 
 		_proto("Rx ACK of packets #%u-#%u [%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c] (pend=%u)",
-		       seq,seq+chunk-1,
+		       seq,(unsigned)(seq+chunk-1),
 		       _acktype[acks[0x0]],
 		       _acktype[acks[0x1]],
 		       _acktype[acks[0x2]],
@@ -1552,7 +1552,7 @@
 	size_t qty;
 	int ret;
 
-	_enter("%p{as=%d buf=%p qty=%u/%u}",
+	_enter("%p{as=%d buf=%p qty=%Zu/%Zu}",
 	       call,call->app_async_read,call->app_read_buf,call->app_ready_qty,call->app_mark);
 
 	/* check the state */
@@ -1560,7 +1560,7 @@
 	case RXRPC_CSTATE_SRVR_RCV_ARGS:
 	case RXRPC_CSTATE_CLNT_RCV_REPLY:
 		if (call->app_last_rcv) {
-			printk("%s(%p,%p,%d): Inconsistent call state (%s, last pkt)",
+			printk("%s(%p,%p,%Zd): Inconsistent call state (%s, last pkt)",
 			      __FUNCTION__,call,call->app_read_buf,call->app_mark,
 			      rxrpc_call_states[call->app_call_state]);
 			BUG();
@@ -1574,7 +1574,7 @@
 
 	case RXRPC_CSTATE_SRVR_SND_REPLY:
 		if (!call->app_last_rcv) {
-			printk("%s(%p,%p,%d): Inconsistent call state (%s, not last pkt)",
+			printk("%s(%p,%p,%Zd): Inconsistent call state (%s, not last pkt)",
 			      __FUNCTION__,call,call->app_read_buf,call->app_mark,
 			      rxrpc_call_states[call->app_call_state]);
 			BUG();
@@ -1616,11 +1616,11 @@
 		/* drag as much data as we need out of this packet */
 		qty = min(call->app_mark,msg->dsize);
 
-		_debug("reading %u from skb=%p off=%lu",qty,msg->pkt,msg->offset);
+		_debug("reading %Zu from skb=%p off=%lu",qty,msg->pkt,msg->offset);
 
 		if (call->app_read_buf)
 			if (skb_copy_bits(msg->pkt,msg->offset,call->app_read_buf,qty)<0)
-				panic("%s: Failed to copy data from packet: (%p,%p,%d)",
+				panic("%s: Failed to copy data from packet: (%p,%p,%Zd)",
 				      __FUNCTION__,call,call->app_read_buf,qty);
 
 		/* if that packet is now empty, discard it */
@@ -1673,7 +1673,7 @@
 	}
 
 	if (call->app_last_rcv) {
-		_debug("Insufficient data (%u/%u)",call->app_ready_qty,call->app_mark);
+		_debug("Insufficient data (%Zu/%Zu)",call->app_ready_qty,call->app_mark);
 		call->app_async_read = 0;
 		call->app_mark = RXRPC_APP_MARK_EOF;
 		call->app_read_buf = NULL;
@@ -1703,7 +1703,7 @@
 {
 	int ret;
 
-	_enter("%p{arq=%u},%p,%d,%x",call,call->app_ready_qty,buffer,size,flags);
+	_enter("%p{arq=%Zu},%p,%Zd,%x",call,call->app_ready_qty,buffer,size,flags);
 
 	spin_lock(&call->lock);
 
@@ -1799,7 +1799,7 @@
 	char *buf;
 	int ret;
 
-	_enter("%p,%u,%p,%02x,%x,%d,%p",call,sioc,siov,rxhdr_flags,alloc_flags,dup_data,size_sent);
+	_enter("%p,%Zu,%p,%02x,%x,%d,%p",call,sioc,siov,rxhdr_flags,alloc_flags,dup_data,size_sent);
 
 	*size_sent = 0;
 	size = 0;
@@ -1827,7 +1827,7 @@
 		size += sptr->iov_len;
 	}
 
-	_debug("- size=%u mtu=%u",size,call->conn->mtu_size);
+	_debug("- size=%Zu mtu=%Zu",size,call->conn->mtu_size);
 
 	do {
 		/* make sure there's a message under construction */
@@ -1837,7 +1837,7 @@
 						0,NULL,alloc_flags,&call->snd_nextmsg);
 			if (ret<0)
 				goto out;
-			_debug("- allocated new message [ds=%u]",call->snd_nextmsg->dsize);
+			_debug("- allocated new message [ds=%Zu]",call->snd_nextmsg->dsize);
 		}
 
 		msg = call->snd_nextmsg;
@@ -1857,7 +1857,7 @@
 		space = call->conn->mtu_size - msg->dsize;
 		chunk = min(space,size);
 
-		_debug("- [before] space=%u chunk=%u",space,chunk);
+		_debug("- [before] space=%Zu chunk=%Zu",space,chunk);
 
 		while (!siov->iov_len)
 			siov++;
@@ -1916,7 +1916,7 @@
 			}
 		}
 
-		_debug("- [loaded] chunk=%u size=%u",chunk,size);
+		_debug("- [loaded] chunk=%Zu size=%Zu",chunk,size);
 
 		/* dispatch the message when full, final or requesting ACK */
 		if (msg->dsize>=call->conn->mtu_size || rxhdr_flags) {
@@ -1929,7 +1929,7 @@
 
 	ret = 0;
  out:
-	_leave(" = %d (%d queued, %d rem)",ret,*size_sent,size);
+	_leave(" = %d (%Zd queued, %Zd rem)",ret,*size_sent,size);
 	return ret;
 
 } /* end rxrpc_call_write_data() */
@@ -1960,7 +1960,7 @@
 			msg->hdr.flags |= RXRPC_MORE_PACKETS;
 		}
 
-		_proto("Sending DATA message { ds=%u dc=%u df=%02lu }",
+		_proto("Sending DATA message { ds=%Zu dc=%u df=%02lu }",
 		       msg->dsize,msg->dcount,msg->dfree);
 
 		/* queue and adjust call state */
@@ -2061,7 +2061,7 @@
 		spin_unlock(&call->lock);
 
 		/* send each message again (and ignore any errors we might incur) */
-		_proto("Resending DATA message { ds=%u dc=%u df=%02lu }",
+		_proto("Resending DATA message { ds=%Zu dc=%u df=%02lu }",
 		       msg->dsize,msg->dcount,msg->dfree);
 
 		if (rxrpc_conn_sendmsg(call->conn,msg)==0)
inst-afs/devel/afs/net/rxrpc/connection.c renamed from net/rxrpc/connection.c +2 -2
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/connection.c /inst-afs/devel/afs/net/rxrpc/connection.c
@@ -121,7 +121,7 @@
 	conn->out_epoch		= rxrpc_epoch;
 	conn->in_clientflag	= 0;
 	conn->out_clientflag	= RXRPC_CLIENT_INITIATED;
-	conn->conn_id		= htonl((unsigned) conn & RXRPC_CIDMASK);
+	conn->conn_id		= htonl((unsigned long) conn & RXRPC_CIDMASK);
 	conn->service_id	= htons(service_id);
 
 	/* attach to peer */
@@ -547,7 +547,7 @@
 	msghdr.msg_controllen	= 0;
 	msghdr.msg_flags	= MSG_CONFIRM|MSG_DONTWAIT;
 
-	_net("Sending message type %d of %d bytes to %08x:%d",
+	_net("Sending message type %d of %Zd bytes to %08x:%d",
 	     msg->hdr.type,
 	     msg->dsize,
 	     htonl(conn->addr.sin_addr.s_addr),
inst-afs/devel/afs/net/rxrpc/internal.h renamed from net/rxrpc/internal.h +15 -15
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/internal.h /inst-afs/devel/afs/net/rxrpc/internal.h
@@ -29,24 +29,24 @@
 /*
  * debug tracing
  */
-#define kenter(FMT,...)	printk("==> %s("FMT")\n",__FUNCTION__,##__VA_ARGS__)
-#define kleave(FMT,...)	printk("<== %s()"FMT"\n",__FUNCTION__,##__VA_ARGS__)
-#define kdebug(FMT,...)	printk("    "FMT"\n",##__VA_ARGS__)
-#define kproto(FMT,...)	printk("### "FMT"\n",##__VA_ARGS__)
-#define knet(FMT,...)	printk("    "FMT"\n",##__VA_ARGS__)
+#define kenter(FMT, a...)	printk("==> %s("FMT")\n",__FUNCTION__ , ##a)
+#define kleave(FMT, a...)	printk("<== %s()"FMT"\n",__FUNCTION__ , ##a)
+#define kdebug(FMT, a...)	printk("    "FMT"\n" , ##a)
+#define kproto(FMT, a...)	printk("### "FMT"\n" , ##a)
+#define knet(FMT, a...)		printk("    "FMT"\n" , ##a)
 
 #if 0
-#define _enter(FMT,...)	kenter(FMT,##__VA_ARGS__)
-#define _leave(FMT,...)	kleave(FMT,##__VA_ARGS__)
-#define _debug(FMT,...)	kdebug(FMT,##__VA_ARGS__)
-#define _proto(FMT,...)	kproto(FMT,##__VA_ARGS__)
-#define _net(FMT,...)	knet(FMT,##__VA_ARGS__)
+#define _enter(FMT, a...)	kenter(FMT , ##a)
+#define _leave(FMT, a...)	kleave(FMT , ##a)
+#define _debug(FMT, a...)	kdebug(FMT , ##a)
+#define _proto(FMT, a...)	kproto(FMT , ##a)
+#define _net(FMT, a...)		knet(FMT , ##a)
 #else
-#define _enter(FMT,...)	do { if (rxrpc_ktrace) kenter(FMT,##__VA_ARGS__); } while(0)
-#define _leave(FMT,...)	do { if (rxrpc_ktrace) kleave(FMT,##__VA_ARGS__); } while(0)
-#define _debug(FMT,...)	do { if (rxrpc_kdebug) kdebug(FMT,##__VA_ARGS__); } while(0)
-#define _proto(FMT,...)	do { if (rxrpc_kproto) kproto(FMT,##__VA_ARGS__); } while(0)
-#define _net(FMT,...)	do { if (rxrpc_knet)   knet  (FMT,##__VA_ARGS__); } while(0)
+#define _enter(FMT, a...)	do { if (rxrpc_ktrace) kenter(FMT , ##a); } while(0)
+#define _leave(FMT, a...)	do { if (rxrpc_ktrace) kleave(FMT , ##a); } while(0)
+#define _debug(FMT, a...)	do { if (rxrpc_kdebug) kdebug(FMT , ##a); } while(0)
+#define _proto(FMT, a...)	do { if (rxrpc_kproto) kproto(FMT , ##a); } while(0)
+#define _net(FMT, a...)		do { if (rxrpc_knet)   knet  (FMT , ##a); } while(0)
 #endif
 
 static inline void rxrpc_discard_my_signals(void)
inst-afs/devel/afs/net/rxrpc/krxiod.c renamed from net/rxrpc/krxiod.c +0 -4
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/krxiod.c /inst-afs/devel/afs/net/rxrpc/krxiod.c
@@ -49,11 +49,7 @@
 	/* only certain signals are of interest */
 	spin_lock_irq(&current->sig->siglock);
 	siginitsetinv(&current->blocked,0);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
 	recalc_sigpending();
-#else
-	recalc_sigpending(current);
-#endif
 	spin_unlock_irq(&current->sig->siglock);
 
 	/* loop around waiting for work to do */
inst-afs/devel/afs/net/rxrpc/krxsecd.c renamed from net/rxrpc/krxsecd.c +0 -4
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/krxsecd.c /inst-afs/devel/afs/net/rxrpc/krxsecd.c
@@ -61,11 +61,7 @@
 	/* only certain signals are of interest */
 	spin_lock_irq(&current->sig->siglock);
 	siginitsetinv(&current->blocked,0);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
 	recalc_sigpending();
-#else
-	recalc_sigpending(current);
-#endif
 	spin_unlock_irq(&current->sig->siglock);
 
 	/* loop around waiting for work to do */
inst-afs/devel/afs/net/rxrpc/krxtimod.c renamed from net/rxrpc/krxtimod.c +0 -4
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/krxtimod.c /inst-afs/devel/afs/net/rxrpc/krxtimod.c
@@ -79,11 +79,7 @@
 	/* only certain signals are of interest */
 	spin_lock_irq(&current->sig->siglock);
 	siginitsetinv(&current->blocked,0);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
 	recalc_sigpending();
-#else
-	recalc_sigpending(current);
-#endif
 	spin_unlock_irq(&current->sig->siglock);
 
 	/* loop around looking for things to attend to */
inst-afs/devel/afs/net/rxrpc/main.c renamed from net/rxrpc/main.c +1 -1
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/main.c /inst-afs/devel/afs/net/rxrpc/main.c
@@ -123,5 +123,5 @@
 	__RXACCT(printk("Outstanding Peers      : %d\n",atomic_read(&rxrpc_peer_count)));
 	__RXACCT(printk("Outstanding Transports : %d\n",atomic_read(&rxrpc_transport_count)));
 
-	kleave();
+	kleave("");
 } /* end rxrpc_cleanup() */
inst-afs/devel/afs/net/rxrpc/Makefile renamed from net/rxrpc/Makefile +5 -11
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/Makefile /inst-afs/devel/afs/net/rxrpc/Makefile
@@ -15,19 +15,13 @@
 	rxrpc_syms.o \
 	transport.o
 
-#ifeq ($(CONFIG_PROC_FS),y)
-rxrpc-objs	+= proc.o
-#endif
-#ifeq ($(CONFIG_SYSCTL),y)
+ifeq ($(CONFIG_PROC_FS),y)
+rxrpc-objs += proc.o
+endif
+ifeq ($(CONFIG_SYSCTL),y)
 rxrpc-objs += sysctl.o
-#endif
+endif
 
 obj-m  := rxrpc.o
 
-# superfluous for 2.5, but needed for 2.4..
-ifeq "$(VERSION).$(PATCHLEVEL)" "2.4"
-rxrpc.o: $(rxrpc-objs)
-	$(LD) -r -o $@ $(rxrpc-objs)
-endif
-
 include $(TOPDIR)/Rules.make
inst-afs/devel/afs/net/rxrpc/peer.c renamed from net/rxrpc/peer.c +1 -1
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/peer.c /inst-afs/devel/afs/net/rxrpc/peer.c
@@ -375,6 +375,6 @@
 
 	peer->rtt = do_div(rtt,peer->rtt_usage);
 
-	_leave(" RTT=%lu.%lums",peer->rtt/1000,peer->rtt%1000);
+	_leave(" RTT=%lu.%lums",(long)(peer->rtt/1000),(long)(peer->rtt%1000));
 
 } /* end rxrpc_peer_calculate_rtt() */
inst-afs/devel/afs/net/rxrpc/proc.c renamed from net/rxrpc/proc.c +3 -10
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/proc.c /inst-afs/devel/afs/net/rxrpc/proc.c
@@ -22,13 +22,6 @@
 #include <rxrpc/message.h>
 #include "internal.h"
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-static inline struct proc_dir_entry *PDE(const struct inode *inode)
-{
-	return (struct proc_dir_entry *)inode->u.generic_ip;
-}
-#endif
-
 static struct proc_dir_entry *proc_rxrpc;
 
 static int rxrpc_proc_transports_open(struct inode *inode, struct file *file);
@@ -379,14 +372,14 @@
 	if (!list_empty(&peer->timeout.link))
 		timeout = (signed long)peer->timeout.timo_jif - (signed long)jiffies;
 
-	seq_printf(m,"%5hu %08x %5d %5d %8ld %5u %7lu\n",
+	seq_printf(m,"%5hu %08x %5d %5d %8ld %5Zu %7lu\n",
 		   peer->trans->port,
 		   ntohl(peer->addr.s_addr),
 		   atomic_read(&peer->usage),
 		   atomic_read(&peer->conn_count),
 		   timeout,
 		   peer->if_mtu,
-		   peer->rtt
+		   (long) peer->rtt
 		   );
 
 	return 0;
@@ -484,7 +477,7 @@
 	if (!list_empty(&conn->timeout.link))
 		timeout = (signed long)conn->timeout.timo_jif - (signed long)jiffies;
 
-	seq_printf(m,"%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5u %8ld\n",
+	seq_printf(m,"%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5Zu %8ld\n",
 		   conn->trans->port,
 		   ntohl(conn->addr.sin_addr.s_addr),
 		   ntohs(conn->addr.sin_port),
inst-afs/devel/afs/net/rxrpc/transport.c renamed from net/rxrpc/transport.c +3 -3
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/net/rxrpc/transport.c /inst-afs/devel/afs/net/rxrpc/transport.c
@@ -691,12 +691,12 @@
 		msg.msg_controllen = (char*)msg.msg_control - (char*)&emsg;
 
 		if (msg.msg_controllen<sizeof(emsg.cmsg) || msg.msg_namelen<sizeof(sin)) {
-			printk("%s: short control message (nlen=%u clen=%u fl=%x)\n",
+			printk("%s: short control message (nlen=%u clen=%Zu fl=%x)\n",
 			       __FUNCTION__,msg.msg_namelen,msg.msg_controllen,msg.msg_flags);
 			continue;
 		}
 
-		_net("Rx Received control message { len=%u level=%u type=%u }",
+		_net("Rx Received control message { len=%Zu level=%u type=%u }",
 		     emsg.cmsg.cmsg_len,emsg.cmsg.cmsg_level,emsg.cmsg.cmsg_type);
 
 		if (sin.sin_family!=AF_INET) {
@@ -715,7 +715,7 @@
 		}
 
 		if (msg.msg_controllen<sizeof(emsg.cmsg)+sizeof(emsg.ee)) {
-			printk("%s: short error message (%u)\n",__FUNCTION__,msg.msg_controllen);
+			printk("%s: short error message (%Zu)\n",__FUNCTION__,msg.msg_controllen);
 			_leave("");
 			return;
 		}
inst-afs/devel/afs/include/rxrpc/call.h renamed from include/rxrpc/call.h +2 -2
diff -ur -x '*.o' -x '*.cmd' -x '*~' linux-2.5.43/include/rxrpc/call.h /inst-afs/devel/afs/include/rxrpc/call.h
@@ -153,7 +153,7 @@
 	(CALL)->app_scr_alloc += (SIZE);						\
 	if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE ||						\
 	    (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) {	\
-		printk("rxrpc_call_alloc_scratch(%p,%u)\n",(CALL),(SIZE));		\
+		printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),(size_t)(SIZE));	\
 		BUG();									\
 	}										\
 	ptr;										\
@@ -167,7 +167,7 @@
 	(CALL)->app_scr_alloc += size;							\
 	if (size>RXRPC_CALL_SCRATCH_SIZE ||						\
 	    (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) {	\
-		printk("rxrpc_call_alloc_scratch(%p,%u)\n",(CALL),size);		\
+		printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),size);		\
 		BUG();									\
 	}										\
 	ptr;										\
#5 lore raw
Quoted 6 lines · * David Howells ([email protected]) wrote:
Quoted 4 lines

Yes, it's valid for newer compilers. I have a similar patch that also updates the varargs macro stuff used in AFS (and rxrpc) (for akpm's "crusty" compilers ;-)

Can you try the attached patch please.

Works for me. Cleans up the fs/afs/proc.c warnings as well.

thanks,
-chris

Signature · 1 line
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net