From 853d4aac597bda4538f2e5409c3e366483f2e78f Mon Sep 17 00:00:00 2001
From: liuy <liuy>
Date: Thu, 2 Aug 2007 08:30:10 +0000
Subject: [PATCH] Branch b1_6 b=13006 i=shadow, deen

Description: warnings with build patchless client with vanila 2.6.19 and up
Details    : change the old ctl_table style and replace ctl_table/ctl_table_header
             with cfs_sysctl_table_t/cfs_sysctl_table_header_t
---
 lustre/ChangeLog                     |   6 ++
 lustre/obdclass/linux/linux-sysctl.c | 108 +++++++++++++++++++++------
 2 files changed, 90 insertions(+), 24 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 88d64bd3b6..2f21c08326 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -70,6 +70,12 @@ Bugzilla   : 12415
 Description: updated patchess for new RHEL4 kernel
 Details    : Fixed ext3-unlink-race.patch per Kalpak's comment.
 
+Severity   : normal
+Bugzilla   : 13006
+Description: warnings with build patchless client with vanila 2.6.19 and up
+Details    : change the old ctl_table style and replace ctl_table/ctl_table_header 
+	     with cfs_sysctl_table_t/cfs_sysctl_table_header_t
+
 --------------------------------------------------------------------------------
 
 2007-07-30         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/obdclass/linux/linux-sysctl.c b/lustre/obdclass/linux/linux-sysctl.c
index 19fc3bb48c..7d919b8a96 100644
--- a/lustre/obdclass/linux/linux-sysctl.c
+++ b/lustre/obdclass/linux/linux-sysctl.c
@@ -47,7 +47,7 @@
 #include <obd_support.h>
 #include <lprocfs_status.h>
 
-struct ctl_table_header *obd_table_header = NULL;
+cfs_sysctl_table_header_t *obd_table_header = NULL;
 
 #define OBD_SYSCTL 300
 
@@ -91,7 +91,7 @@ int LL_PROC_PROTO(proc_alloc_fail_rate)
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
         loff_t *ppos = &filp->f_pos;
 #endif
-        int rc          = 0;
+        int rc = 0;
 
         if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) {
                 *lenp = 0;
@@ -120,33 +120,93 @@ int LL_PROC_PROTO(proc_alloc_fail_rate)
 }
 #endif
 
-static ctl_table obd_table[] = {
-        {OBD_FAIL_LOC, "fail_loc", &obd_fail_loc, sizeof(int), 0644, NULL,
-                &proc_fail_loc},
-        {OBD_FAIL_VAL, "fail_val", &obd_fail_val, sizeof(int), 0644, NULL,
-                &proc_dointvec},
-        {OBD_TIMEOUT, "timeout", &obd_timeout, sizeof(int), 0644, NULL,
-                &proc_set_timeout},
-        {OBD_DEBUG_PEER_ON_TIMEOUT, "debug_peer_on_timeout", 
-                &obd_debug_peer_on_timeout,
-                sizeof(int), 0644, NULL, &proc_dointvec},
-        {OBD_DUMP_ON_TIMEOUT, "dump_on_timeout", &obd_dump_on_timeout,
-                sizeof(int), 0644, NULL, &proc_dointvec},
-        {OBD_DUMP_ON_EVICTION, "dump_on_eviction", &obd_dump_on_eviction,
-                sizeof(int), 0644, NULL, &proc_dointvec},
-        {OBD_MEMUSED, "memused", (int *)&obd_memory.counter,
-                sizeof(int), 0644, NULL, &proc_dointvec},
-        {OBD_LDLM_TIMEOUT, "ldlm_timeout", &ldlm_timeout, sizeof(int), 0644,
-                NULL, &proc_set_timeout},
+static cfs_sysctl_table_t obd_table[] = {
+        {
+                .ctl_name = OBD_FAIL_LOC,
+                .procname = "fail_loc",
+                .data     = &obd_fail_loc,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_fail_loc
+        },
+        {
+                .ctl_name = OBD_FAIL_VAL,
+                .procname = "fail_val",
+                .data     = &obd_fail_val,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = OBD_TIMEOUT,
+                .procname = "timeout",
+                .data     = &obd_timeout,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_set_timeout
+        },
+        {
+                .ctl_name = OBD_DEBUG_PEER_ON_TIMEOUT,
+                .procname = "debug_peer_on_timeout",
+                .data     = &obd_debug_peer_on_timeout,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = OBD_DUMP_ON_TIMEOUT,
+                .procname = "dump_on_timeout",
+                .data     = &obd_dump_on_timeout,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = OBD_DUMP_ON_EVICTION,
+                .procname = "dump_on_eviction",
+                .data     = &obd_dump_on_eviction,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = OBD_MEMUSED,
+                .procname = "memused",
+                .data     = (int *)&obd_memory.counter,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_dointvec
+        },
+       {
+                .ctl_name = OBD_LDLM_TIMEOUT,
+                .procname = "ldlm_timeout",
+                .data     = &ldlm_timeout,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_set_timeout
+        },
 #ifdef RANDOM_FAIL_ALLOC
-        {OBD_ALLOC_FAIL_RATE, "alloc_fail_rate", &obd_alloc_fail_rate, 
-                sizeof(int), 0644, NULL, &proc_alloc_fail_rate},
+        {
+                .ctl_name = OBD_ALLOC_FAIL_RATE,
+                .procname = "alloc_fail_rate",
+                .data     = &obd_alloc_fail_rate,
+                .maxlen   = sizeof(int),
+                .mode     = 0644,
+                .proc_handler = &proc_alloc_fail_rate
+        },
 #endif
         { 0 }
 };
 
-static ctl_table parent_table[] = {
-       {OBD_SYSCTL, "lustre", NULL, 0, 0555, obd_table},
+static cfs_sysctl_table_t parent_table[] = {
+       {
+               .ctl_name = OBD_SYSCTL,
+               .procname = "lustre",
+               .data     = NULL,
+               .maxlen   = 0,
+               .mode     = 0555,
+               .child    = obd_table
+       },
        {0}
 };
 
-- 
GitLab