[DRBD-cvs] svn commit by phil - r2868 - in branches/drbd-0.7: drbd drbd/linux scripts - Get rid of this "kmem_cache_t is depricated" warning.

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Fri May 4 22:54:41 CEST 2007


Author: phil
Date: 2007-05-04 22:54:40 +0200 (Fri, 04 May 2007)
New Revision: 2868

Modified:
   branches/drbd-0.7/drbd/drbd_compat_types.h
   branches/drbd-0.7/drbd/drbd_int.h
   branches/drbd-0.7/drbd/drbd_main.c
   branches/drbd-0.7/drbd/linux/drbd_config.h
   branches/drbd-0.7/scripts/adjust_drbd_config_h.sh
Log:
Get rid of this "kmem_cache_t is depricated" warning.


Modified: branches/drbd-0.7/drbd/drbd_compat_types.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_compat_types.h	2007-05-04 13:41:31 UTC (rev 2867)
+++ branches/drbd-0.7/drbd/drbd_compat_types.h	2007-05-04 20:54:40 UTC (rev 2868)
@@ -314,8 +314,16 @@
 #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
 #endif
 
+typedef kmem_cache_t drbd_kmem_cache_t;
+
 #else // LINUX 2.6
 
+#ifdef USE_KMEM_CACHE_S
+typedef struct kmem_cache_s drbd_kmem_cache_t;
+#else
+typedef struct kmem_cache drbd_kmem_cache_t;
+#endif
+
 typedef struct bio drbd_bio_t;
 
 #define REQ_NEXT bi_next

Modified: branches/drbd-0.7/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_int.h	2007-05-04 13:41:31 UTC (rev 2867)
+++ branches/drbd-0.7/drbd/drbd_int.h	2007-05-04 20:54:40 UTC (rev 2868)
@@ -1028,8 +1028,8 @@
 // drbd_main.c
 extern drbd_dev *drbd_conf;
 extern int minor_count;
-extern kmem_cache_t *drbd_request_cache;
-extern kmem_cache_t *drbd_ee_cache;
+extern drbd_kmem_cache_t *drbd_request_cache;
+extern drbd_kmem_cache_t *drbd_ee_cache;
 extern mempool_t *drbd_request_mempool;
 
 // drbd_req

Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c	2007-05-04 13:41:31 UTC (rev 2867)
+++ branches/drbd-0.7/drbd/drbd_main.c	2007-05-04 20:54:40 UTC (rev 2868)
@@ -162,8 +162,8 @@
 STATIC int *drbd_sizes;
 )
 struct Drbd_Conf *drbd_conf;
-kmem_cache_t *drbd_request_cache;
-kmem_cache_t *drbd_ee_cache;
+drbd_kmem_cache_t *drbd_request_cache;
+drbd_kmem_cache_t *drbd_ee_cache;
 mempool_t *drbd_request_mempool;
 
 STATIC struct block_device_operations drbd_ops = {

Modified: branches/drbd-0.7/drbd/linux/drbd_config.h
===================================================================
--- branches/drbd-0.7/drbd/linux/drbd_config.h	2007-05-04 13:41:31 UTC (rev 2867)
+++ branches/drbd-0.7/drbd/linux/drbd_config.h	2007-05-04 20:54:40 UTC (rev 2868)
@@ -71,4 +71,9 @@
 
 //#define NO_MORE_DEV_FS
 
+// 2.6.something has deprecated kmem_cache_t
+// some older still use it.
+// some have it defined as struct kmem_cache_s, some as struct kmem_cache
+//#define USE_KMEM_CACHE_S
+
 #endif

Modified: branches/drbd-0.7/scripts/adjust_drbd_config_h.sh
===================================================================
--- branches/drbd-0.7/scripts/adjust_drbd_config_h.sh	2007-05-04 13:41:31 UTC (rev 2867)
+++ branches/drbd-0.7/scripts/adjust_drbd_config_h.sh	2007-05-04 20:54:40 UTC (rev 2868)
@@ -90,7 +90,8 @@
   else
     have_mm_inline_h=0
   fi
-    no_more_dev_fs=0
+  no_more_dev_fs=0
+  have_kmem_cache_s=0
 else
     # 2.6. kernel. just leave it alone...
     need_sighand_hack=0
@@ -99,6 +100,12 @@
     have_find_next_bit=0
     have_mm_inline_h=0
     no_more_dev_fs=1
+    
+    if grep_q "typedef.*kmem_cache_s" $KDIR/include/linux/slab.h ; then
+      have_kmem_cache_s=1
+    else
+      have_kmem_cache_s=0
+    fi
 fi
 
 test -e ./linux/drbd_config.h.orig || cp ./linux/drbd_config.h{,.orig}
@@ -115,7 +122,9 @@
  s{.*(#define HAVE_MM_INLINE_H.*)}
   { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;
  s{.*(#define NO_MORE_DEV_FS.*)}
-  { ( $no_more_dev_fs ? '' : '//' ) . \$1}e;" \
+  { ( $no_more_dev_fs ? '' : '//' ) . \$1}e;
+ s{.*(#define USE_KMEM_CACHE_S.*)}
+  { ( $have_kmem_cache_s ? '' : '//' ) . \$1}e;" \
 	  < ./linux/drbd_config.h \
 	  > ./linux/drbd_config.h.new
 



More information about the drbd-cvs mailing list