Whamcloud - gitweb
LU-9575 obdclass: remove cl_for_each defines
[fs/lustre-release.git] / lnet / selftest / console.c
index 0be173d..f2cf0a4 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * 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
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -40,7 +36,6 @@
  * Author: Liang Zhen <liangzhen@clusterfs.com>
  */
 
-#ifdef __KERNEL__
 
 #include <libcfs/libcfs.h>
 #include <lnet/lib-lnet.h>
@@ -62,7 +57,7 @@ do {                                                    \
 
 lstcon_session_t        console_session;
 
-void
+static void
 lstcon_node_get(lstcon_node_t *nd)
 {
         LASSERT (nd->nd_ref >= 1);
@@ -71,7 +66,7 @@ lstcon_node_get(lstcon_node_t *nd)
 }
 
 static int
-lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)
+lstcon_node_find(struct lnet_process_id id, lstcon_node_t **ndpp, int create)
 {
        lstcon_ndlink_t *ndl;
        unsigned int     idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE;
@@ -116,7 +111,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)
        return 0;
 }
 
-void
+static void
 lstcon_node_put(lstcon_node_t *nd)
 {
        lstcon_ndlink_t *ndl;
@@ -139,8 +134,8 @@ lstcon_node_put(lstcon_node_t *nd)
 }
 
 static int
-lstcon_ndlink_find(struct list_head *hash,
-                   lnet_process_id_t id, lstcon_ndlink_t **ndlpp, int create)
+lstcon_ndlink_find(struct list_head *hash, struct lnet_process_id id,
+                  lstcon_ndlink_t **ndlpp, int create)
 {
        unsigned int     idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE;
        lstcon_ndlink_t *ndl;
@@ -206,9 +201,6 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp)
         if (grp == NULL)
                 return -ENOMEM;
 
-        memset(grp, 0, offsetof(lstcon_group_t,
-                                grp_ndl_hash[LST_NODE_HASHSIZE]));
-
         grp->grp_ref = 1;
        if (name != NULL) {
                if (strlen(name) > sizeof(grp->grp_name)-1) {
@@ -288,14 +280,8 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp)
        return -ENOENT;
 }
 
-static void
-lstcon_group_put(lstcon_group_t *grp)
-{
-        lstcon_group_decref(grp);
-}
-
 static int
-lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
+lstcon_group_ndlink_find(lstcon_group_t *grp, struct lnet_process_id id,
                          lstcon_ndlink_t **ndlpp, int create)
 {
        int rc;
@@ -351,7 +337,7 @@ lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new)
        }
 }
 
-int
+static int
 lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
 {
         lstcon_group_t *grp = (lstcon_group_t *)arg;
@@ -380,9 +366,9 @@ lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
         return 1;
 }
 
-int
+static int
 lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
-                     lstcon_rpc_ent_t __user *ent_up)
+                     struct lstcon_rpc_ent __user *ent_up)
 {
         srpc_debug_reply_t *rep;
 
@@ -411,13 +397,13 @@ lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
 
 static int
 lstcon_group_nodes_add(lstcon_group_t *grp,
-                      int count, lnet_process_id_t __user *ids_up,
+                      int count, struct lnet_process_id __user *ids_up,
                       unsigned *featp, struct list_head __user *result_up)
 {
         lstcon_rpc_trans_t      *trans;
         lstcon_ndlink_t         *ndl;
         lstcon_group_t          *tmp;
-        lnet_process_id_t        id;
+       struct lnet_process_id        id;
         int                      i;
         int                      rc;
 
@@ -447,7 +433,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
         }
 
         if (rc != 0) {
-                lstcon_group_put(tmp);
+               lstcon_group_decref(tmp);
                 return rc;
         }
 
@@ -456,7 +442,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
                                      tmp, lstcon_sesrpc_condition, &trans);
         if (rc != 0) {
                 CERROR("Can't create transaction: %d\n", rc);
-                lstcon_group_put(tmp);
+               lstcon_group_decref(tmp);
                 return rc;
         }
 
@@ -471,20 +457,20 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
         lstcon_rpc_trans_destroy(trans);
 
         lstcon_group_move(tmp, grp);
-        lstcon_group_put(tmp);
+       lstcon_group_decref(tmp);
 
         return rc;
 }
 
 static int
 lstcon_group_nodes_remove(lstcon_group_t *grp,
-                         int count, lnet_process_id_t __user *ids_up,
+                         int count, struct lnet_process_id __user *ids_up,
                          struct list_head __user *result_up)
 {
         lstcon_rpc_trans_t     *trans;
         lstcon_ndlink_t        *ndl;
         lstcon_group_t         *tmp;
-        lnet_process_id_t       id;
+       struct lnet_process_id       id;
         int                     rc;
         int                     i;
 
@@ -521,12 +507,12 @@ lstcon_group_nodes_remove(lstcon_group_t *grp,
 
         lstcon_rpc_trans_destroy(trans);
         /* release nodes anyway, because we can't rollback status */
-        lstcon_group_put(tmp);
+       lstcon_group_decref(tmp);
 
         return rc;
 error:
         lstcon_group_move(tmp, grp);
-        lstcon_group_put(tmp);
+       lstcon_group_decref(tmp);
 
         return rc;
 }
@@ -540,7 +526,7 @@ lstcon_group_add(char *name)
         rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0;
         if (rc != 0) {
                 /* find a group with same name */
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return rc;
         }
 
@@ -556,7 +542,7 @@ lstcon_group_add(char *name)
 }
 
 int
-lstcon_nodes_add(char *name, int count, lnet_process_id_t __user *ids_up,
+lstcon_nodes_add(char *name, int count, struct lnet_process_id __user *ids_up,
                 unsigned *featp, struct list_head __user *result_up)
 {
         lstcon_group_t         *grp;
@@ -574,14 +560,14 @@ lstcon_nodes_add(char *name, int count, lnet_process_id_t __user *ids_up,
         if (grp->grp_ref > 2) {
                 /* referred by other threads or test */
                 CDEBUG(D_NET, "Group %s is busy\n", name);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
 
                 return -EBUSY;
         }
 
        rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up);
 
-        lstcon_group_put(grp);
+       lstcon_group_decref(grp);
 
         return rc;
 }
@@ -602,7 +588,7 @@ lstcon_group_del(char *name)
         if (grp->grp_ref > 2) {
                 /* referred by others threads or test */
                 CDEBUG(D_NET, "Group %s is busy\n", name);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return -EBUSY;
         }
 
@@ -611,7 +597,7 @@ lstcon_group_del(char *name)
                                      grp, lstcon_sesrpc_condition, &trans);
         if (rc != 0) {
                 CERROR("Can't create transaction: %d\n", rc);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return rc;
         }
 
@@ -619,10 +605,10 @@ lstcon_group_del(char *name)
 
         lstcon_rpc_trans_destroy(trans);
 
-        lstcon_group_put(grp);
+       lstcon_group_decref(grp);
         /* -ref for session, it's destroyed,
          * status can't be rolled back, destroy group anway */
-        lstcon_group_put(grp);
+       lstcon_group_decref(grp);
 
         return rc;
 }
@@ -642,7 +628,7 @@ lstcon_group_clean(char *name, int args)
         if (grp->grp_ref > 2) {
                 /* referred by test */
                 CDEBUG(D_NET, "Group %s is busy\n", name);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return -EBUSY;
         }
 
@@ -651,17 +637,17 @@ lstcon_group_clean(char *name, int args)
 
         lstcon_group_drain(grp, args);
 
-       lstcon_group_put(grp);
+       lstcon_group_decref(grp);
        /* release empty group */
        if (list_empty(&grp->grp_ndl_list))
-               lstcon_group_put(grp);
+               lstcon_group_decref(grp);
 
        return 0;
 }
 
 int
 lstcon_nodes_remove(char *name, int count,
-                   lnet_process_id_t __user *ids_up,
+                   struct lnet_process_id __user *ids_up,
                    struct list_head __user *result_up)
 {
         lstcon_group_t *grp = NULL;
@@ -676,16 +662,16 @@ lstcon_nodes_remove(char *name, int count,
         if (grp->grp_ref > 2) {
                 /* referred by test */
                 CDEBUG(D_NET, "Group %s is busy\n", name);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return -EBUSY;
         }
 
         rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up);
 
-       lstcon_group_put(grp);
+       lstcon_group_decref(grp);
        /* release empty group */
        if (list_empty(&grp->grp_ndl_list))
-               lstcon_group_put(grp);
+               lstcon_group_decref(grp);
 
        return rc;
 }
@@ -706,7 +692,7 @@ lstcon_group_refresh(char *name, struct list_head __user *result_up)
         if (grp->grp_ref > 2) {
                 /* referred by test */
                 CDEBUG(D_NET, "Group %s is busy\n", name);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return -EBUSY;
         }
 
@@ -717,7 +703,7 @@ lstcon_group_refresh(char *name, struct list_head __user *result_up)
         if (rc != 0) {
                 /* local error, return */
                 CDEBUG(D_NET, "Can't create transaction: %d\n", rc);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return rc;
         }
 
@@ -727,7 +713,7 @@ lstcon_group_refresh(char *name, struct list_head __user *result_up)
 
         lstcon_rpc_trans_destroy(trans);
         /* -ref for me */
-        lstcon_group_put(grp);
+       lstcon_group_decref(grp);
 
         return rc;
 }
@@ -752,7 +738,7 @@ lstcon_group_list(int index, int len, char __user *name_up)
 
 static int
 lstcon_nodes_getent(struct list_head *head, int *index_p,
-                   int *count_p, lstcon_node_ent_t __user *dents_up)
+                   int *count_p, struct lstcon_node_ent __user *dents_up)
 {
         lstcon_ndlink_t  *ndl;
         lstcon_node_t    *nd;
@@ -791,11 +777,11 @@ lstcon_nodes_getent(struct list_head *head, int *index_p,
 }
 
 int
-lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p,
+lstcon_group_info(char *name, struct lstcon_ndlist_ent __user *gents_p,
                  int *index_p, int *count_p,
-                 lstcon_node_ent_t __user *dents_up)
+                 struct lstcon_node_ent __user *dents_up)
 {
-        lstcon_ndlist_ent_t *gentp;
+       struct lstcon_ndlist_ent *gentp;
         lstcon_group_t      *grp;
         lstcon_ndlink_t     *ndl;
         int                  rc;
@@ -806,35 +792,33 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p,
                 return rc;
         }
 
-        if (dents_up != 0) {
+       if (dents_up != NULL) {
                 /* verbose query */
                 rc = lstcon_nodes_getent(&grp->grp_ndl_list,
                                          index_p, count_p, dents_up);
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
 
                 return rc;
         }
 
         /* non-verbose query */
-        LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t));
+       LIBCFS_ALLOC(gentp, sizeof(struct lstcon_ndlist_ent));
         if (gentp == NULL) {
                 CERROR("Can't allocate ndlist_ent\n");
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
 
                 return -ENOMEM;
         }
 
-       memset(gentp, 0, sizeof(lstcon_ndlist_ent_t));
-
        list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link)
                 LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp);
 
        rc = copy_to_user(gents_p, gentp,
-                         sizeof(lstcon_ndlist_ent_t)) ? -EFAULT : 0;
+                         sizeof(struct lstcon_ndlist_ent)) ? -EFAULT : 0;
 
-       LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t));
+       LIBCFS_FREE(gentp, sizeof(struct lstcon_ndlist_ent));
 
-       lstcon_group_put(grp);
+       lstcon_group_decref(grp);
 
        return 0;
 }
@@ -939,11 +923,11 @@ lstcon_batch_list(int index, int len, char __user *name_up)
 }
 
 int
-lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up,
+lstcon_batch_info(char *name, struct lstcon_test_batch_ent __user *ent_up,
                  int server, int testidx, int *index_p, int *ndent_p,
-                 lstcon_node_ent_t __user *dents_up)
+                 struct lstcon_node_ent __user *dents_up)
 {
-        lstcon_test_batch_ent_t *entp;
+       struct lstcon_test_batch_ent *entp;
        struct list_head        *clilst;
        struct list_head        *srvlst;
         lstcon_test_t           *test = NULL;
@@ -982,12 +966,10 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up,
         }
 
         /* non-verbose query */
-        LIBCFS_ALLOC(entp, sizeof(lstcon_test_batch_ent_t));
+       LIBCFS_ALLOC(entp, sizeof(struct lstcon_test_batch_ent));
         if (entp == NULL)
                 return -ENOMEM;
 
-        memset(entp, 0, sizeof(lstcon_test_batch_ent_t));
-
         if (test == NULL) {
                 entp->u.tbe_batch.bae_ntest = bat->bat_ntest;
                 entp->u.tbe_batch.bae_state = bat->bat_state;
@@ -1006,14 +988,14 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up,
                LST_NODE_STATE_COUNTER(ndl->ndl_node, &entp->tbe_srv_nle);
 
        rc = copy_to_user(ent_up, entp,
-                         sizeof(lstcon_test_batch_ent_t)) ? -EFAULT : 0;
+                         sizeof(struct lstcon_test_batch_ent)) ? -EFAULT : 0;
 
-       LIBCFS_FREE(entp, sizeof(lstcon_test_batch_ent_t));
+       LIBCFS_FREE(entp, sizeof(struct lstcon_test_batch_ent));
 
        return rc;
 }
 
-int
+static int
 lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg)
 {
         switch (transop) {
@@ -1119,8 +1101,8 @@ lstcon_batch_destroy(lstcon_batch_t *bat)
 
                list_del(&test->tes_link);
 
-               lstcon_group_put(test->tes_src_grp);
-               lstcon_group_put(test->tes_dst_grp);
+               lstcon_group_decref(test->tes_src_grp);
+               lstcon_group_decref(test->tes_dst_grp);
 
                LIBCFS_FREE(test, offsetof(lstcon_test_t,
                                           tes_param[test->tes_paramlen]));
@@ -1156,7 +1138,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat)
        LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
 }
 
-int
+static int
 lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
 {
        lstcon_test_t    *test;
@@ -1335,7 +1317,6 @@ lstcon_test_add(char *batch_name, int type, int loop,
                goto out;
        }
 
-       memset(test, 0, offsetof(lstcon_test_t, tes_param[paramlen]));
        test->tes_hdr.tsb_id    = batch->bat_hdr.tsb_id;
        test->tes_batch         = batch;
        test->tes_type          = type;
@@ -1378,15 +1359,15 @@ out:
                LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
 
        if (dst_grp != NULL)
-               lstcon_group_put(dst_grp);
+               lstcon_group_decref(dst_grp);
 
        if (src_grp != NULL)
-               lstcon_group_put(src_grp);
+               lstcon_group_decref(src_grp);
 
        return rc;
 }
 
-int
+static int
 lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
 {
        lstcon_test_t *test;
@@ -1401,9 +1382,9 @@ lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
        return -ENOENT;
 }
 
-int
+static int
 lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg,
-                     lstcon_rpc_ent_t __user *ent_up)
+                     struct lstcon_rpc_ent __user *ent_up)
 {
         srpc_batch_reply_t *rep = &msg->msg_body.bat_reply;
 
@@ -1480,22 +1461,22 @@ lstcon_test_batch_query(char *name, int testidx, int client,
         return rc;
 }
 
-int
+static int
 lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
-                      lstcon_rpc_ent_t __user *ent_up)
+                      struct lstcon_rpc_ent __user *ent_up)
 {
        srpc_stat_reply_t *rep = &msg->msg_body.stat_reply;
-       sfw_counters_t __user  *sfwk_stat;
-       srpc_counters_t __user *srpc_stat;
-       lnet_counters_t __user *lnet_stat;
+       struct sfw_counters __user  *sfwk_stat;
+       struct srpc_counters __user *srpc_stat;
+       struct lnet_counters __user *lnet_stat;
 
         if (rep->str_status != 0)
                 return 0;
 
-       sfwk_stat = (sfw_counters_t __user *)&ent_up->rpe_payload[0];
-       srpc_stat = (srpc_counters_t __user *)
+       sfwk_stat = (struct sfw_counters __user *)&ent_up->rpe_payload[0];
+       srpc_stat = (struct srpc_counters __user *)
                ((char __user *)sfwk_stat + sizeof(*sfwk_stat));
-       lnet_stat = (lnet_counters_t __user *)
+       lnet_stat = (struct lnet_counters __user *)
                ((char __user *)srpc_stat + sizeof(*srpc_stat));
 
        if (copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) ||
@@ -1506,7 +1487,7 @@ lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
         return 0;
 }
 
-int
+static int
 lstcon_ndlist_stat(struct list_head *ndlist,
                   int timeout, struct list_head __user *result_up)
 {
@@ -1547,18 +1528,18 @@ lstcon_group_stat(char *grp_name, int timeout,
 
         rc = lstcon_ndlist_stat(&grp->grp_ndl_list, timeout, result_up);
 
-        lstcon_group_put(grp);
+       lstcon_group_decref(grp);
 
         return rc;
 }
 
 int
-lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up,
+lstcon_nodes_stat(int count, struct lnet_process_id __user *ids_up,
                  int timeout, struct list_head __user *result_up)
 {
         lstcon_ndlink_t         *ndl;
         lstcon_group_t          *tmp;
-        lnet_process_id_t        id;
+       struct lnet_process_id        id;
         int                      i;
         int                      rc;
 
@@ -1585,18 +1566,18 @@ lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up,
         }
 
         if (rc != 0) {
-                lstcon_group_put(tmp);
+               lstcon_group_decref(tmp);
                 return rc;
         }
 
         rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up);
 
-        lstcon_group_put(tmp);
+       lstcon_group_decref(tmp);
 
         return rc;
 }
 
-int
+static int
 lstcon_debug_ndlist(struct list_head *ndlist,
                    struct list_head *translist,
                    int timeout, struct list_head __user *result_up)
@@ -1658,17 +1639,17 @@ lstcon_group_debug(int timeout, char *name,
 
         rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
                                  timeout, result_up);
-        lstcon_group_put(grp);
+       lstcon_group_decref(grp);
 
         return rc;
 }
 
 int
 lstcon_nodes_debug(int timeout,
-                  int count, lnet_process_id_t __user *ids_up,
+                  int count, struct lnet_process_id __user *ids_up,
                   struct list_head __user *result_up)
 {
-        lnet_process_id_t  id;
+       struct lnet_process_id  id;
         lstcon_ndlink_t   *ndl;
         lstcon_group_t    *grp;
         int                i;
@@ -1695,29 +1676,29 @@ lstcon_nodes_debug(int timeout,
         }
 
         if (rc != 0) {
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
                 return rc;
         }
 
         rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
                                  timeout, result_up);
 
-        lstcon_group_put(grp);
+       lstcon_group_decref(grp);
 
         return rc;
 }
 
 int
-lstcon_session_match(lst_sid_t sid)
+lstcon_session_match(struct lst_sid sid)
 {
         return (console_session.ses_id.ses_nid   == sid.ses_nid &&
                 console_session.ses_id.ses_stamp == sid.ses_stamp) ?  1: 0;
 }
 
 static void
-lstcon_new_session_id(lst_sid_t *sid)
+lstcon_new_session_id(struct lst_sid *sid)
 {
-        lnet_process_id_t      id;
+       struct lnet_process_id id;
 
         LASSERT (console_session.ses_state == LST_SESSION_NONE);
 
@@ -1726,11 +1707,9 @@ lstcon_new_session_id(lst_sid_t *sid)
         sid->ses_stamp = cfs_time_current();
 }
 
-extern srpc_service_t lstcon_acceptor_service;
-
 int
 lstcon_session_new(char *name, int key, unsigned feats,
-                  int timeout, int force, lst_sid_t __user *sid_up)
+                  int timeout, int force, struct lst_sid __user *sid_up)
 {
         int     rc = 0;
         int     i;
@@ -1789,7 +1768,7 @@ lstcon_session_new(char *name, int key, unsigned feats,
         }
 
        if (copy_to_user(sid_up, &console_session.ses_id,
-                             sizeof(lst_sid_t)) == 0)
+                            sizeof(struct lst_sid)) == 0)
                 return rc;
 
         lstcon_session_end();
@@ -1798,12 +1777,12 @@ lstcon_session_new(char *name, int key, unsigned feats,
 }
 
 int
-lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up,
+lstcon_session_info(struct lst_sid __user *sid_up, int __user *key_up,
                    unsigned __user *featp,
-                   lstcon_ndlist_ent_t __user *ndinfo_up,
+                   struct lstcon_ndlist_ent __user *ndinfo_up,
                    char __user *name_up, int len)
 {
-        lstcon_ndlist_ent_t *entp;
+       struct lstcon_ndlist_ent *entp;
         lstcon_ndlink_t     *ndl;
         int                  rc = 0;
 
@@ -1814,13 +1793,11 @@ lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up,
         if (entp == NULL)
                 return -ENOMEM;
 
-        memset(entp, 0, sizeof(*entp));
-
        list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link)
                LST_NODE_STATE_COUNTER(ndl->ndl_node, entp);
 
        if (copy_to_user(sid_up, &console_session.ses_id,
-                             sizeof(lst_sid_t)) ||
+                        sizeof(struct lst_sid)) ||
            copy_to_user(key_up, &console_session.ses_key,
                             sizeof(*key_up)) ||
            copy_to_user(featp, &console_session.ses_features,
@@ -1884,7 +1861,7 @@ lstcon_session_end()
                                 lstcon_group_t, grp_link);
                LASSERT(grp->grp_ref == 1);
 
-               lstcon_group_put(grp);
+               lstcon_group_decref(grp);
        }
 
        /* all nodes should be released */
@@ -2005,15 +1982,15 @@ lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
 out:
        rep->msg_ses_feats = console_session.ses_features;
         if (grp != NULL)
-                lstcon_group_put(grp);
+               lstcon_group_decref(grp);
 
        mutex_unlock(&console_session.ses_mutex);
 
         return rc;
 }
 
-srpc_service_t lstcon_acceptor_service;
-void lstcon_init_acceptor_service(void)
+static srpc_service_t lstcon_acceptor_service;
+static void lstcon_init_acceptor_service(void)
 {
         /* initialize selftest console acceptor service table */
         lstcon_acceptor_service.sv_name    = "join session";
@@ -2042,7 +2019,7 @@ lstcon_console_init(void)
        console_session.ses_expired         = 0;
        console_session.ses_feats_updated   = 0;
        console_session.ses_features        = LST_FEATS_MASK;
-       console_session.ses_laststamp       = cfs_time_current_sec();
+       console_session.ses_laststamp = ktime_get_real_seconds();
 
        mutex_init(&console_session.ses_mutex);
 
@@ -2132,4 +2109,3 @@ lstcon_console_fini(void)
        return 0;
 }
 
-#endif