Index: pvfs2-config.h.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/pvfs2-config.h.in,v
retrieving revision 1.98
diff -u -a -p -r1.98 pvfs2-config.h.in
--- pvfs2-config.h.in	12 Apr 2007 03:40:39 -0000	1.98
+++ pvfs2-config.h.in	10 May 2007 17:37:56 -0000
@@ -43,6 +43,9 @@
 /* Define if third param (message) to DB error callback function is const */
 #undef HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK
 
+/* Define if ctl_table struct has a de field */
+#undef HAVE_CTL_TABLE_DE_FIELD
+
 /* Define if DB error callback function takes dbenv parameter */
 #undef HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK
 
@@ -305,6 +308,9 @@
 
 /* Define to 1 if you have the <sys/xattr.h> header file. */
 #undef HAVE_SYS_XATTR_H
+
+/* Define if register_sysctl_table takes two arguments */
+#undef HAVE_TWO_ARG_REGISTER_SYSCTL_TABLE
 
 /* Define if DB open function takes a txnid parameter */
 #undef HAVE_TXNID_PARAMETER_TO_DB_OPEN
Index: maint/config/kernel.m4
===================================================================
RCS file: /projects/cvsroot/pvfs2/maint/config/kernel.m4,v
retrieving revision 1.34
diff -u -a -p -r1.34 kernel.m4
--- maint/config/kernel.m4	24 Apr 2007 14:59:10 -0000	1.34
+++ maint/config/kernel.m4	10 May 2007 17:37:57 -0000
@@ -774,5 +774,34 @@ AC_DEFUN([AX_KERNEL_FEATURES],
 	AC_MSG_RESULT(no)
 	)
 
+	dnl Check for two arg register_sysctl_table()
+	AC_MSG_CHECKING(for two arguments to register_sysctl_table)
+	AC_TRY_COMPILE([
+		#define __KERNEL__
+		#include <linux/sysctl.h>
+		#include <linux/proc_fs.h>
+	], [
+		register_sysctl_table(NULL, 0);
+	],
+	AC_MSG_RESULT(yes)
+	AC_DEFINE(HAVE_TWO_ARG_REGISTER_SYSCTL_TABLE, 1, Define if register_sysctl_table takes two arguments),
+	AC_MSG_RESULT(no)
+	)
+
+	dnl Checking for de field in ctl_table struct
+	AC_MSG_CHECKING(for de field in ctl_table)
+    	AC_TRY_COMPILE([
+		#define __KERNEL__
+		#include <linux/sysctl.h>
+		#include <linux/proc_fs.h>
+	], [
+		ctl_table a;
+		a.de = NULL;
+	],
+	AC_MSG_RESULT(yes)
+	AC_DEFINE(HAVE_CTL_TABLE_DE_FIELD, 1, Define if ctl_table struct has a de field),
+	AC_MSG_RESULT(no)
+	)
+
 	CFLAGS=$oldcflags
 ])
Index: src/kernel/linux-2.6/pvfs2-proc.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-proc.c,v
retrieving revision 1.6
diff -u -a -p -r1.6 pvfs2-proc.c
--- src/kernel/linux-2.6/pvfs2-proc.c	10 Aug 2006 19:02:24 -0000	1.6
+++ src/kernel/linux-2.6/pvfs2-proc.c	10 May 2007 17:37:57 -0000
@@ -260,74 +260,108 @@ static struct pvfs2_param_extra perf_res
 };
 static int min_debug[] = {0}, max_debug[] = {GOSSIP_MAX_DEBUG};
 static int min_op_timeout_secs[] = {0}, max_op_timeout_secs[] = {INT_MAX};
+
+#ifdef HAVE_CTL_TABLE_DE_FIELD
+#define DECLARE_STATIC_CTL_TABLE(_NAME, _PROCNAME, _DATA, _MAXLEN, _MODE,    \
+                                 _CHILD,  _PROC_HANDLER, _STRATEGY, _EXTRA1, \
+                                 _EXTRA2)                                    \
+{_NAME, _PROCNAME, _DATA, _MAXLEN, _MODE, _CHILD,                            \
+ _PROC_HANDLER, _STRATEGY, NULL, _EXTRA1, _EXTRA2}
+#else
+#define DECLARE_STATIC_CTL_TABLE(_NAME, _PROCNAME, _DATA, _MAXLEN, _MODE,   \
+                                 _CHILD, _PROC_HANDLER, _STRATEGY, _EXTRA1, \
+                                 _EXTRA2)                                   \
+{_NAME, _PROCNAME, _DATA, _MAXLEN, _MODE, _CHILD, NULL,                     \
+ _PROC_HANDLER, _STRATEGY, _EXTRA1, _EXTRA2}
+#endif
+
 static ctl_table pvfs2_acache_table[] = {
     /* controls acache timeout */
-    {1, "timeout-msecs", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &acache_timeout_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(1, "timeout-msecs", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &acache_timeout_extra, NULL),
     /* controls acache hard limit */
-    {2, "hard-limit", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &acache_hard_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(2, "hard-limit", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &acache_hard_extra, NULL),
     /* controls acache soft limit */
-    {3, "soft-limit", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &acache_soft_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(3, "soft-limit", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &acache_soft_extra, NULL),
     /* controls acache reclaim percentage */
-    {4, "reclaim-percentage", NULL, sizeof(int), 
-        0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &acache_rec_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(4, "reclaim-percentage", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &acache_rec_extra, NULL),
     {0}
 };
 static ctl_table pvfs2_ncache_table[] = {
     /* controls ncache timeout */
-    {1, "timeout-msecs", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &ncache_timeout_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(1, "timeout-msecs", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &ncache_timeout_extra, NULL),
     /* controls ncache hard limit */
-    {2, "hard-limit", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &ncache_hard_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(2, "hard-limit", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &ncache_hard_extra, NULL),
     /* controls ncache soft limit */
-    {3, "soft-limit", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &ncache_soft_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(3, "soft-limit", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &ncache_soft_extra, NULL),
     /* controls ncache reclaim percentage */
-    {4, "reclaim-percentage", NULL, sizeof(int), 
-        0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &ncache_rec_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(4, "reclaim-percentage", NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &ncache_rec_extra, NULL),
     {0}
 };
 static int acache_perf_count = PVFS2_PERF_COUNT_REQUEST_ACACHE;
 static int ncache_perf_count = PVFS2_PERF_COUNT_REQUEST_NCACHE;
 static ctl_table pvfs2_pc_table[] = {
-    {1, "acache", NULL, 4096, 0444, NULL,
-        pvfs2_pc_proc_handler, NULL, NULL, &acache_perf_count, NULL},
-    {2, "ncache", NULL, 4096, 0444, NULL,
-        pvfs2_pc_proc_handler, NULL, NULL, &ncache_perf_count, NULL},
+    DECLARE_STATIC_CTL_TABLE(1, "acache", NULL, 4096, 0444,
+                             NULL, pvfs2_pc_proc_handler, NULL,
+                             &acache_perf_count, NULL),
+    DECLARE_STATIC_CTL_TABLE(2, "ncache", NULL, 4096, 0444,
+                             NULL, pvfs2_pc_proc_handler, NULL,
+                             &ncache_perf_count, NULL),
     {0}
 };
 static ctl_table pvfs2_table[] = {
     /* controls debugging level */
-    {1, "debug", &gossip_debug_mask, sizeof(int), 0644, NULL,
-        &proc_dointvec_minmax, &sysctl_intvec,
-        NULL, &min_debug, &max_debug},
+    DECLARE_STATIC_CTL_TABLE(1, "debug", &gossip_debug_mask, sizeof(int), 0644,
+                             NULL, &proc_dointvec_minmax, &sysctl_intvec,
+                             &min_debug, &max_debug),
     /* operation timeout */
-    {2, "op-timeout-secs", &op_timeout_secs, sizeof(int), 0644, NULL,
-        &proc_dointvec_minmax, &sysctl_intvec,
-        NULL, &min_op_timeout_secs, &max_op_timeout_secs},
+    DECLARE_STATIC_CTL_TABLE(2, "op-timeout-secs", 
+                             &op_timeout_secs, sizeof(int), 0644,
+                             NULL, &proc_dointvec_minmax, &sysctl_intvec,
+                             &min_op_timeout_secs, &max_op_timeout_secs),
     /* time interval for client side performance counters */
-    {3, "perf-time-interval-secs", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &perf_time_interval_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(3, "perf-time-interval-secs",
+                             NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &perf_time_interval_extra, NULL),
     /* time interval for client side performance counters */
-    {4, "perf-history-size", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &perf_history_size_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(4, "perf-history-size", 
+                             NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &perf_history_size_extra, NULL),
     /* reset performance counters */
-    {5, "perf-counter-reset", NULL, sizeof(int), 0644, NULL,
-        &pvfs2_param_proc_handler, NULL, NULL, &perf_reset_extra, NULL},
+    DECLARE_STATIC_CTL_TABLE(5, "perf-counter-reset",
+                             NULL, sizeof(int), 0644,
+                             NULL, &pvfs2_param_proc_handler, NULL,
+                             &perf_reset_extra, NULL),
     /* subdir for acache control */
-    {6, "acache", NULL, 0, 0555, pvfs2_acache_table},
-    {7, "perf-counters", NULL, 0, 0555, pvfs2_pc_table},
+    DECLARE_STATIC_CTL_TABLE(6, "acache", NULL, 0, 0555, pvfs2_acache_table,
+                             NULL, NULL, NULL, NULL),
+    DECLARE_STATIC_CTL_TABLE(7, "perf-counters", NULL, 0, 0555, pvfs2_pc_table,
+                             NULL, NULL, NULL, NULL),
     /* subdir for ncache control */
-    {8, "ncache", NULL, 0, 0555, pvfs2_ncache_table},
+    DECLARE_STATIC_CTL_TABLE(8, "ncache", NULL, 0, 0555, pvfs2_ncache_table,
+                             NULL, NULL, NULL, NULL),
     {0}
 };
 static ctl_table fs_table[] = {
-    {1, "pvfs2", NULL, 0, 0555, pvfs2_table},
+    DECLARE_STATIC_CTL_TABLE(1, "pvfs2", NULL, 0, 0555, pvfs2_table,
+                             NULL, NULL, NULL, NULL),
     {0}
 };
 #endif
@@ -337,7 +371,11 @@ void pvfs2_proc_initialize(void)
 #ifdef CONFIG_SYSCTL
     if (!fs_table_header)
     {
+#ifdef HAVE_TWO_ARG_REGISTER_SYSCTL_TABLE
         fs_table_header = register_sysctl_table(fs_table, 0);
+#else
+        fs_table_header = register_sysctl_table(fs_table);
+#endif
     }
 #endif
 
