Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lnet / klnds / gmlnd / gmlnd_module.c
index 114a286..70933be 100644 (file)
@@ -1,22 +1,40 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+/*
+ * -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  Copyright (c) 2003 Los Alamos National Laboratory (LANL)
+ * GPL HEADER START
  *
- *   This file is part of Lustre, http://www.lustre.org/
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * 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].
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2003 Los Alamos National Laboratory (LANL)
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #include "gmlnd.h"
@@ -60,71 +78,120 @@ gmnal_tunables_t gmnal_tunables = {
         .gm_nrx_large       = &nrx_large,
 };
 
-#if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
-static ctl_table gmnal_ctl_table[] = {
-       {1, "port", &port,
-        sizeof (int), 0444, NULL, &proc_dointvec},
-       {2, "ntx", &ntx, 
-        sizeof (int), 0444, NULL, &proc_dointvec},
-       {3, "credits", &credits,
-        sizeof (int), 0444, NULL, &proc_dointvec},
-       {4, "peer_credits", &peer_credits,
-        sizeof (int), 0444, NULL, &proc_dointvec},
-       {5, "nlarge_tx_bufs", &nlarge_tx_bufs,
-        sizeof (int), 0444, NULL, &proc_dointvec},
-       {6, "nrx_small", &nrx_small,
-        sizeof (int), 0444, NULL, &proc_dointvec},
-       {7, "nrx_large", &nrx_large,
-        sizeof (int), 0444, NULL, &proc_dointvec},
-       {0}
+#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+static cfs_sysctl_table_t gmnal_ctl_table[] = {
+        {
+                .ctl_name = 1,
+                .procname = "port",
+                .data     = &port,
+                .maxlen   = sizeof (int),
+                .mode     = 0444,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = 2,
+                .procname = "ntx",
+                .data     = &ntx,
+                .maxlen   = sizeof (int),
+                .mode     = 0444,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = 3,
+                .procname = "credits",
+                .data     = &credits,
+                .maxlen   = sizeof (int),
+                .mode     = 0444,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = 4,
+                .procname = "peer_credits",
+                .data     = &peer_credits,
+                .maxlen   = sizeof (int),
+                .mode     = 0444,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = 5,
+                .procname = "nlarge_tx_bufs",
+                .data     = &nlarge_tx_bufs,
+                .maxlen   = sizeof (int),
+                .mode     = 0444,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = 6,
+                .procname = "nrx_small",
+                .data     = &nrx_small,
+                .maxlen   = sizeof (int),
+                .mode     = 0444,
+                .proc_handler = &proc_dointvec
+        },
+        {
+                .ctl_name = 7,
+                .procname = "nrx_large",
+                .data     = &nrx_large,
+                .maxlen   = sizeof (int),
+                .mode     = 0444,
+                .proc_handler = &proc_dointvec
+        },
+        {0}
 };
 
-static ctl_table gmnal_top_ctl_table[] = {
-       {207, "gmnal", NULL, 0, 0555, gmnal_ctl_table},
-       {0}
+static cfs_sysctl_table_t gmnal_top_ctl_table[] = {
+        {
+                .ctl_name = 207,
+                .procname = "gmnal",
+                .data     = NULL,
+                .maxlen   = 0,
+                .mode     = 0555,
+                .child    = gmnal_ctl_table
+        },
+        {0}
 };
 #endif
 
 static int __init
 gmnal_load(void)
 {
-       int     status;
-       CDEBUG(D_TRACE, "This is the gmnal module initialisation routine\n");
+        int     status;
+        CDEBUG(D_TRACE, "This is the gmnal module initialisation routine\n");
 
-#if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
+#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
         gmnal_tunables.gm_sysctl =
-                register_sysctl_table(gmnal_top_ctl_table, 0);
-        
+                cfs_register_sysctl_table(gmnal_top_ctl_table, 0);
+
         if (gmnal_tunables.gm_sysctl == NULL)
                 CWARN("Can't setup /proc tunables\n");
 #endif
-       CDEBUG(D_NET, "Calling gmnal_init\n");
+        CDEBUG(D_NET, "Calling gmnal_init\n");
         status = gmnal_init();
-       if (status == 0) {
-               CDEBUG(D_NET, "Portals GMNAL initialised ok\n");
-       } else {
-               CDEBUG(D_NET, "Portals GMNAL Failed to initialise\n");
-               return(-ENODEV);
-       }
+        if (status == 0) {
+                CDEBUG(D_NET, "Portals GMNAL initialised ok\n");
+        } else {
+                CDEBUG(D_NET, "Portals GMNAL Failed to initialise\n");
+                return(-ENODEV);
+        }
 
-       CDEBUG(D_NET, "This is the end of the gmnal init routine");
+        CDEBUG(D_NET, "This is the end of the gmnal init routine");
 
-       return(0);
+        return(0);
 }
 
 static void __exit
 gmnal_unload(void)
 {
-       gmnal_fini();
-#if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
+        gmnal_fini();
+#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
         if (gmnal_tunables.gm_sysctl != NULL)
-                unregister_sysctl_table(gmnal_tunables.gm_sysctl);
+                cfs_unregister_sysctl_table(gmnal_tunables.gm_sysctl);
 #endif
 }
 
 module_init(gmnal_load);
 module_exit(gmnal_unload);
 
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
 MODULE_DESCRIPTION("Kernel GM LND v1.01");
 MODULE_LICENSE("GPL");