Index: pvfs2-config.h.in =================================================================== RCS file: /projects/cvsroot/pvfs2/pvfs2-config.h.in,v diff -u -r1.113 -r1.114 --- pvfs2-config.h.in 11 Jan 2008 15:00:08 -0000 1.113 +++ pvfs2-config.h.in 11 Jan 2008 20:30:17 -0000 1.114 @@ -159,6 +159,10 @@ /* Define if kernel lacks device classes */ #undef HAVE_KERNEL_DEVICE_CLASSES +/* Define if kernel kmem_cache_create constructor has new-style two-parameter + form */ +#undef HAVE_KMEM_CACHE_CREATE_CTOR_TWO_PARAM + /* Define if kernel kmem_cache_create has destructor param */ #undef HAVE_KMEM_CACHE_CREATE_DESTRUCTOR_PARAM Index: maint/config/kernel.m4 =================================================================== RCS file: /projects/cvsroot/pvfs2/maint/config/kernel.m4,v diff -u -r1.50 -r1.51 --- maint/config/kernel.m4 11 Jan 2008 20:07:20 -0000 1.50 +++ maint/config/kernel.m4 11 Jan 2008 20:30:16 -0000 1.51 @@ -126,6 +126,7 @@ AC_MSG_CHECKING(for struct kmem_cache in kernel) AC_TRY_COMPILE([ #define __KERNEL__ + #include #include int foo(struct kmem_cache *s) @@ -866,6 +865,32 @@ AC_MSG_RESULT(no) ) + dnl 2.6.24 changed the constructor parameter signature of + dnl kmem_cache_create. Check for this newer two-param style and + dnl if not, assume it is old. Note we can get away with just + dnl struct kmem_cache (and not kmem_cache_t) as that change happened + dnl in older kernels. If they don't match, gcc complains about + dnl passing argument ... from incompatible pointer type, hence the + dnl need for the -Werror. + tmp_cflags=$CFLAGS + CFLAGS="$CFLAGS -Werror" + AC_MSG_CHECKING(for two-param kmem_cache_create constructor) + AC_TRY_COMPILE([ + #define __KERNEL__ + #include + #include + void ctor(struct kmem_cache *cachep, void *req) + { + } + ], [ + kmem_cache_create("config-test", 0, 0, 0, ctor); + ], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_KMEM_CACHE_CREATE_CTOR_TWO_PARAM, 1, [Define if kernel kmem_cache_create constructor has new-style two-parameter form]), + AC_MSG_RESULT(no) + ) + CFLAGS=$tmp_cflags + AC_MSG_CHECKING(if kernel address_space struct has a spin_lock field named page_lock) AC_TRY_COMPILE([ #define __KERNEL__ Index: src/kernel/linux-2.6/pvfs2-cache.c =================================================================== RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-cache.c,v diff -u -r1.44 -r1.45 --- src/kernel/linux-2.6/pvfs2-cache.c 4 Nov 2007 01:38:57 -0000 1.44 +++ src/kernel/linux-2.6/pvfs2-cache.c 11 Jan 2008 20:30:17 -0000 1.45 @@ -202,10 +202,17 @@ } } + static void dev_req_cache_ctor( +#ifdef HAVE_KMEM_CACHE_CREATE_CTOR_TWO_PARAM + struct kmem_cache *cachep, + void *req +#else void *req, pvfs2_kmem_cache_t * cachep, - unsigned long flags) + unsigned long flags +#endif +) { memset(req, 0, sizeof(MAX_ALIGNED_DEV_REQ_DOWNSIZE)); } @@ -264,11 +271,17 @@ } static void pvfs2_inode_cache_ctor( - void *new_pvfs2_inode, +#ifdef HAVE_KMEM_CACHE_CREATE_CTOR_TWO_PARAM + struct kmem_cache *cachep, + void *req +#else + void *req, pvfs2_kmem_cache_t * cachep, - unsigned long flags) + unsigned long flags +#endif +) { - pvfs2_inode_t *pvfs2_inode = (pvfs2_inode_t *)new_pvfs2_inode; + pvfs2_inode_t *pvfs2_inode = req; memset(pvfs2_inode, 0, sizeof(pvfs2_inode_t)); ClearInitFlag(pvfs2_inode); @@ -382,9 +395,15 @@ #ifdef HAVE_AIO_VFS_SUPPORT static void kiocb_ctor( +#ifdef HAVE_KMEM_CACHE_CREATE_CTOR_TWO_PARAM + struct kmem_cache *cachep, + void *req +#else void *req, pvfs2_kmem_cache_t * cachep, - unsigned long flags) + unsigned long flags +#endif +) { memset(req, 0, sizeof(pvfs2_kiocb)); }