Whamcloud - gitweb
LU-1346 gnilnd: remove libcfs abstractions
[fs/lustre-release.git] / lnet / klnds / ralnd / ralnd_modparams.c
index 159f8ca..79f1572 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -16,8 +14,8 @@
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -89,9 +87,35 @@ kra_tunables_t kranal_tunables = {
 };
 
 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
-static cfs_sysctl_table_t kranal_ctl_table[] = {
+
+#ifndef HAVE_SYSCTL_UNNUMBERED
+enum {
+        KRANAL_N_CONND = 1,
+        KRANAL_RECONNECT_MIN,
+        KRANAL_RECONNECT_MAX,
+        KRANAL_NTX,
+        KRANAL_CREDITS,
+        KRANAL_PEERCREDITS,
+        KRANAL_FMA_CQ_SIZE,
+        KRANAL_TIMEOUT,
+        KRANAL_IMMEDIATE_MAX
+};
+#else
+
+#define KRANAL_N_CONND          CTL_UNNUMBERED
+#define KRANAL_RECONNECT_MIN    CTL_UNNUMBERED
+#define KRANAL_RECONNECT_MAX    CTL_UNNUMBERED
+#define KRANAL_NTX              CTL_UNNUMBERED
+#define KRANAL_CREDITS          CTL_UNNUMBERED
+#define KRANAL_PEERCREDITS      CTL_UNNUMBERED
+#define KRANAL_FMA_CQ_SIZE      CTL_UNNUMBERED
+#define KRANAL_TIMEOUT          CTL_UNNUMBERED
+#define KRENAL_IMMEDIATE_MAX    CTL_UNNUMBERED
+#endif
+
+static struct ctl_table kranal_ctl_table[] = {
         {
-                .ctl_name = 1,
+                .ctl_name = KRANAL_N_CONND,
                 .procname = "n_connd",
                 .data     = &n_connd,
                 .maxlen   = sizeof(int),
@@ -99,7 +123,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 2,
+                .ctl_name = KRANAL_RECONNECT_MIN,
                 .procname = "min_reconnect_interval",
                 .data     = &min_reconnect_interval,
                 .maxlen   = sizeof(int),
@@ -107,7 +131,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 3,
+                .ctl_name = KRANAL_RECONNECT_MAX,
                 .procname = "max_reconnect_interval",
                 .data     = &max_reconnect_interval,
                 .maxlen   = sizeof(int),
@@ -115,7 +139,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 4,
+                .ctl_name = KRANAL_NTX,
                 .procname = "ntx",
                 .data     = &ntx,
                 .maxlen   = sizeof(int),
@@ -123,7 +147,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 5,
+                .ctl_name = KRANAL_CREDITS,
                 .procname = "credits",
                 .data     = &credits,
                 .maxlen   = sizeof(int),
@@ -131,7 +155,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 6,
+                .ctl_name = KRANAL_PEERCREDITS,
                 .procname = "peer_credits",
                 .data     = &peer_credits,
                 .maxlen   = sizeof(int),
@@ -139,7 +163,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 7,
+                .ctl_name = KRANAL_FMA_CQ_SIZE,
                 .procname = "fma_cq_size",
                 .data     = &fma_cq_size,
                 .maxlen   = sizeof(int),
@@ -147,7 +171,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 8,
+                .ctl_name = KRANAL_TIMEOUT,
                 .procname = "timeout",
                 .data     = &timeout,
                 .maxlen   = sizeof(int),
@@ -155,7 +179,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
                 .proc_handler = &proc_dointvec
         },
         {
-                .ctl_name = 9,
+                .ctl_name = KRANAL_IMMEDIATE_MAX,
                 .procname = "max_immediate",
                 .data     = &max_immediate,
                 .maxlen   = sizeof(int),
@@ -165,9 +189,9 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
         {0}
 };
 
-static cfs_sysctl_table_t kranal_top_ctl_table[] = {
+static struct ctl_table kranal_top_ctl_table[] = {
         {
-                .ctl_name = 202,
+                .ctl_name = CTL_KRANAL,
                 .procname = "ranal",
                 .data     = NULL,
                 .maxlen   = 0,
@@ -180,20 +204,19 @@ static cfs_sysctl_table_t kranal_top_ctl_table[] = {
 int
 kranal_tunables_init ()
 {
-        kranal_tunables.kra_sysctl =
-                cfs_register_sysctl_table(kranal_top_ctl_table, 0);
+       kranal_tunables.kra_sysctl =
+               register_sysctl_table(kranal_top_ctl_table);
 
-        if (kranal_tunables.kra_sysctl == NULL)
-                CWARN("Can't setup /proc tunables\n");
+       if (kranal_tunables.kra_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
 
-        return 0;
+       return 0;
 }
 
-void
-kranal_tunables_fini ()
+void kranal_tunables_fini()
 {
-        if (kranal_tunables.kra_sysctl != NULL)
-                cfs_unregister_sysctl_table(kranal_tunables.kra_sysctl);
+       if (kranal_tunables.kra_sysctl != NULL)
+               unregister_sysctl_table(kranal_tunables.kra_sysctl);
 }
 
 #else
@@ -201,7 +224,7 @@ kranal_tunables_fini ()
 int
 kranal_tunables_init ()
 {
-        return 0;
+       return 0;
 }
 
 void