Whamcloud - gitweb
LU-6068 misc: update old URLs to hpdd.intel.com
[fs/lustre-release.git] / lnet / lnet / router_proc.c
index 1211b35..0fe5a3f 100644 (file)
@@ -3,8 +3,7 @@
  *
  * Copyright (c) 2011, 2013, Intel Corporation.
  *
- *   This file is part of Portals
- *   http://sourceforge.net/projects/sandiaportals/
+ *   This file is part of Lustre, https://wiki.hpdd.intel.com/
  *
  *   Portals is free software; you can redistribute it and/or
  *   modify it under the terms of version 2 of the GNU General Public
@@ -25,8 +24,6 @@
 #include <libcfs/libcfs.h>
 #include <lnet/lib-lnet.h>
 
-#if defined(__KERNEL__) && defined(LNET_ROUTER)
-
 /* This is really lnet_proc.c. You might need to update sanity test 215
  * if any file format is changed. */
 
@@ -80,7 +77,7 @@ static struct ctl_table_header *lnet_table_header = NULL;
 #define LNET_PROC_VERSION(v)   ((unsigned int)((v) & LNET_PROC_VER_MASK))
 
 static int __proc_lnet_stats(void *data, int write,
-                             loff_t pos, void *buffer, int nob)
+                            loff_t pos, void __user *buffer, int nob)
 {
         int              rc;
         lnet_counters_t *ctrs;
@@ -128,9 +125,17 @@ static int __proc_lnet_stats(void *data, int write,
         return rc;
 }
 
-DECLARE_PROC_HANDLER(proc_lnet_stats);
+static int
+proc_lnet_stats(struct ctl_table *table, int write, void __user *buffer,
+               size_t *lenp, loff_t *ppos)
+{
+       return lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                   __proc_lnet_stats);
+}
 
-int LL_PROC_PROTO(proc_lnet_routes)
+static int
+proc_lnet_routes(struct ctl_table *table, int write, void __user *buffer,
+                size_t *lenp, loff_t *ppos)
 {
        const int       tmpsiz = 256;
        char            *tmpstr;
@@ -255,7 +260,9 @@ int LL_PROC_PROTO(proc_lnet_routes)
         return rc;
 }
 
-int LL_PROC_PROTO(proc_lnet_routers)
+static int
+proc_lnet_routers(struct ctl_table *table, int write, void __user *buffer,
+                 size_t *lenp, loff_t *ppos)
 {
         int        rc = 0;
         char      *tmpstr;
@@ -389,7 +396,9 @@ int LL_PROC_PROTO(proc_lnet_routers)
         return rc;
 }
 
-int LL_PROC_PROTO(proc_lnet_peers)
+static int
+proc_lnet_peers(struct ctl_table *table, int write, void __user *buffer,
+               size_t *lenp, loff_t *ppos)
 {
        const int               tmpsiz  = 256;
        struct lnet_peer_table  *ptable;
@@ -556,7 +565,7 @@ int LL_PROC_PROTO(proc_lnet_peers)
 }
 
 static int __proc_lnet_buffers(void *data, int write,
-                               loff_t pos, void *buffer, int nob)
+                              loff_t pos, void __user *buffer, int nob)
 {
        char            *s;
        char            *tmpstr;
@@ -613,9 +622,17 @@ static int __proc_lnet_buffers(void *data, int write,
         return rc;
 }
 
-DECLARE_PROC_HANDLER(proc_lnet_buffers);
+static int
+proc_lnet_buffers(struct ctl_table *table, int write, void __user *buffer,
+                 size_t *lenp, loff_t *ppos)
+{
+       return lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                   __proc_lnet_buffers);
+}
 
-int LL_PROC_PROTO(proc_lnet_nis)
+static int
+proc_lnet_nis(struct ctl_table *table, int write, void __user *buffer,
+             size_t *lenp, loff_t *ppos)
 {
        int     tmpsiz = 128 * LNET_CPT_NUMBER;
         int        rc = 0;
@@ -770,10 +787,8 @@ static struct lnet_portal_rotors   portal_rotors[] = {
        },
 };
 
-extern int portal_rotor;
-
 static int __proc_lnet_portal_rotor(void *data, int write,
-                                   loff_t pos, void *buffer, int nob)
+                                   loff_t pos, void __user *buffer, int nob)
 {
        const int       buf_len = 128;
        char            *buf;
@@ -820,8 +835,8 @@ static int __proc_lnet_portal_rotor(void *data, int write,
        rc = -EINVAL;
        lnet_res_lock(0);
        for (i = 0; portal_rotors[i].pr_name != NULL; i++) {
-               if (cfs_strncasecmp(portal_rotors[i].pr_name, tmp,
-                                   strlen(portal_rotors[i].pr_name)) == 0) {
+               if (strncasecmp(portal_rotors[i].pr_name, tmp,
+                               strlen(portal_rotors[i].pr_name)) == 0) {
                        portal_rotor = portal_rotors[i].pr_value;
                        rc = 0;
                        break;
@@ -832,7 +847,15 @@ out:
        LIBCFS_FREE(buf, buf_len);
        return rc;
 }
-DECLARE_PROC_HANDLER(proc_lnet_portal_rotor);
+
+static int
+proc_lnet_portal_rotor(struct ctl_table *table, int write, void __user *buffer,
+                      size_t *lenp, loff_t *ppos)
+{
+       return lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                   __proc_lnet_portal_rotor);
+}
+
 
 static struct ctl_table lnet_table[] = {
        /*
@@ -915,17 +938,3 @@ lnet_proc_fini(void)
        lnet_table_header = NULL;
 #endif
 }
-
-#else
-
-void
-lnet_proc_init(void)
-{
-}
-
-void
-lnet_proc_fini(void)
-{
-}
-
-#endif