Whamcloud - gitweb
LU-5275 gnilnd: Add definition for PDE_DATA
[fs/lustre-release.git] / lnet / selftest / conrpc.c
index 100b447..ea56f35 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -40,7 +40,6 @@
  * Author: Liang Zhen <liang@whamcloud.com>
  */
 
-#ifdef __KERNEL__
 
 #include <libcfs/libcfs.h>
 #include <lnet/lib-lnet.h>
@@ -89,7 +88,7 @@ lstcon_rpc_done(srpc_client_rpc_t *rpc)
        spin_unlock(&rpc->crpc_lock);
 }
 
-int
+static int
 lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats,
                int bulk_npg, int bulk_len, int embedded, lstcon_rpc_t *crpc)
 {
@@ -114,7 +113,7 @@ lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats,
        return 0;
 }
 
-int
+static int
 lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats,
                int bulk_npg, int bulk_len, lstcon_rpc_t **crpcpp)
 {
@@ -183,7 +182,7 @@ lstcon_rpc_put(lstcon_rpc_t *crpc)
        atomic_dec(&console_session.ses_rpc_counter);
 }
 
-void
+static void
 lstcon_rpc_post(lstcon_rpc_t *crpc)
 {
         lstcon_rpc_trans_t *trans = crpc->crp_trans;
@@ -385,7 +384,7 @@ lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout)
         return rc;
 }
 
-int
+static int
 lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
 {
         lstcon_node_t        *nd  = crpc->crp_node;
@@ -470,11 +469,11 @@ lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat)
 
 int
 lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
-                            struct list_head *head_up,
+                            struct list_head __user *head_up,
                             lstcon_rpc_readent_func_t readent)
 {
        struct list_head      tmp;
-       struct list_head     *next;
+       struct list_head     __user *next;
         lstcon_rpc_ent_t     *ent;
         srpc_generic_reply_t *rep;
         lstcon_rpc_t         *crpc;
@@ -614,8 +613,8 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop,
                 msrq = &(*crpc)->crp_rpc->crpc_reqstmsg.msg_body.mksn_reqst;
                 msrq->mksn_sid     = console_session.ses_id;
                 msrq->mksn_force   = console_session.ses_force;
-                strncpy(msrq->mksn_name, console_session.ses_name,
-                        strlen(console_session.ses_name));
+               strlcpy(msrq->mksn_name, console_session.ses_name,
+                       sizeof(msrq->mksn_name));
                 break;
 
         case LST_TRANS_SESEND:
@@ -704,14 +703,14 @@ lstcon_statrpc_prep(lstcon_node_t *nd, unsigned feats, lstcon_rpc_t **crpc)
         return 0;
 }
 
-lnet_process_id_packed_t *
+static lnet_process_id_packed_t *
 lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov)
 {
         lnet_process_id_packed_t *pid;
         int                       i;
 
         i = idx / SFW_ID_PER_PAGE;
-        
+
         LASSERT (i < nkiov);
 
        pid = (lnet_process_id_packed_t *)page_address(kiov[i].kiov_page);
@@ -719,7 +718,7 @@ lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov)
         return &pid[idx % SFW_ID_PER_PAGE];
 }
 
-int
+static int
 lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
                      int dist, int span, int nkiov, lnet_kiov_t *kiov)
 {
@@ -773,7 +772,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
        return 0;
 }
 
-int
+static int
 lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req)
 {
         test_ping_req_t *prq = &req->tsr_u.ping;
@@ -784,7 +783,7 @@ lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req)
         return 0;
 }
 
-int
+static int
 lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req)
 {
        test_bulk_req_t *brq = &req->tsr_u.bulk_v0;
@@ -797,7 +796,7 @@ lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req)
        return 0;
 }
 
-int
+static int
 lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req)
 {
        test_bulk_req_v1_t *brq = &req->tsr_u.bulk_v1;
@@ -883,7 +882,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
 
                 trq->tsr_ndest = test->tes_span;
                 trq->tsr_loop  = test->tes_loop;
-        } 
+       }
 
         trq->tsr_sid        = console_session.ses_id;
         trq->tsr_bid        = test->tes_hdr.tsb_id;
@@ -917,7 +916,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
         return rc;
 }
 
-int
+static int
 lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans,
                         lstcon_node_t *nd, srpc_msg_t *reply)
 {
@@ -1023,7 +1022,7 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,
                         return;
                 }
 
-                if (bat_rep->bar_status == EPERM && 
+               if (bat_rep->bar_status == EPERM &&
                    trans->tas_opc == LST_TRANS_TSBSTOP) {
                         lstcon_tsbop_stat_success(stat, 1);
                         return;
@@ -1037,12 +1036,12 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,
         case LST_TRANS_TSBSRVQRY:
                 bat_rep = &msg->msg_body.bat_reply;
 
-                if (bat_rep->bar_active != 0) 
+               if (bat_rep->bar_active != 0)
                         lstcon_tsbqry_stat_run(stat, 1);
                 else
                         lstcon_tsbqry_stat_idle(stat, 1);
 
-                if (bat_rep->bar_status == 0) 
+               if (bat_rep->bar_status == 0)
                         return;
 
                 lstcon_tsbqry_stat_failure(stat, 1);
@@ -1169,7 +1168,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
         return rc;
 }
 
-void
+static void
 lstcon_rpc_pinger(void *arg)
 {
         stt_timer_t        *ptimer = (stt_timer_t *)arg;
@@ -1403,4 +1402,3 @@ lstcon_rpc_module_fini(void)
        LASSERT(atomic_read(&console_session.ses_rpc_counter) == 0);
 }
 
-#endif