[kdb] [PATCH 3] kdb-fixups-atomic-long

Joe Korty joe.korty at ccur.com
Mon Oct 12 10:20:23 CDT 2009


Fix gcc warning due to kdb's misuse of 'struct file's f_count.

f_count these days is now always of type atomic_long_t.  So
change kdb's usage/display of this field to match.

This eliminates these compile time warnings:

    kdb/modules/kdbm_vm.c: In function 'kdbm_filp':
    kdb/modules/kdbm_vm.c:754: warning:
	passing argument 1 of 'atomic_read'
	from incompatible pointer type
    kdb/modules/kdbm_vm.c:754: warning:
	format '%ld' expects type 'long int',
	but argument 2 has type 'int'

Signed-off-by: Joe Korty <joe.korty at ccur.com>

Index: 2.6.31.3-kdb/arch/x86/include/asm/kdb.h
===================================================================
--- 2.6.31.3-kdb.orig/arch/x86/include/asm/kdb.h	2009-10-12 11:05:01.000000000 -0400
+++ 2.6.31.3-kdb/arch/x86/include/asm/kdb.h	2009-10-12 11:06:52.000000000 -0400
@@ -39,7 +39,7 @@
 #define kdb_bfd_vma_fmt0	"0x%08lx"
 #define kdb_elfw_addr_fmt	"0x%x"
 #define kdb_elfw_addr_fmt0	"0x%08x"
-#define kdb_f_count_fmt		"%d"
+#define kdb_f_count_fmt		"%ld"
 
 #else	/* CONFIG_X86_32 */
 
Index: 2.6.31.3-kdb/kdb/modules/kdbm_vm.c
===================================================================
--- 2.6.31.3-kdb.orig/kdb/modules/kdbm_vm.c	2009-10-12 11:05:01.000000000 -0400
+++ 2.6.31.3-kdb/kdb/modules/kdbm_vm.c	2009-10-12 11:06:52.000000000 -0400
@@ -748,7 +748,7 @@
 
 	kdb_printf(" f_count = " kdb_f_count_fmt
 			" f_flags = 0x%x f_mode = 0x%x\n",
-			atomic_read(&f.f_count), f.f_flags, f.f_mode);
+			atomic_long_read(&f.f_count), f.f_flags, f.f_mode);
 
 	kdb_printf(" f_pos = %Ld\n", f.f_pos);
 #ifdef	CONFIG_SECURITY



More information about the kdb mailing list