Whamcloud - gitweb
LU-9679 lnet: use LIST_HEAD() for local lists.
[fs/lustre-release.git] / lnet / selftest / console.c
index 1e37454..ccaced7 100644 (file)
@@ -315,15 +315,11 @@ lstcon_group_ndlink_move(struct lstcon_group *old,
        unsigned int idx = LNET_NIDADDR(ndl->ndl_node->nd_id.nid) %
                                        LST_NODE_HASHSIZE;
 
-       list_del(&ndl->ndl_hlink);
-       list_del(&ndl->ndl_link);
        old->grp_nnode--;
 
-       list_add_tail(&ndl->ndl_hlink, &new->grp_ndl_hash[idx]);
-       list_add_tail(&ndl->ndl_link, &new->grp_ndl_list);
+       list_move_tail(&ndl->ndl_hlink, &new->grp_ndl_hash[idx]);
+       list_move_tail(&ndl->ndl_link, &new->grp_ndl_list);
        new->grp_nnode++;
-
-       return;
 }
 
 static void
@@ -804,7 +800,7 @@ lstcon_group_info(char *name, struct lstcon_ndlist_ent __user *gents_p,
         }
 
         /* non-verbose query */
-       LIBCFS_ALLOC(gentp, sizeof(struct lstcon_ndlist_ent));
+       CFS_ALLOC_PTR(gentp);
         if (gentp == NULL) {
                 CERROR("Can't allocate ndlist_ent\n");
                lstcon_group_decref(grp);
@@ -818,7 +814,7 @@ lstcon_group_info(char *name, struct lstcon_ndlist_ent __user *gents_p,
        rc = copy_to_user(gents_p, gentp,
                          sizeof(struct lstcon_ndlist_ent)) ? -EFAULT : 0;
 
-       LIBCFS_FREE(gentp, sizeof(struct lstcon_ndlist_ent));
+       CFS_FREE_PTR(gentp);
 
        lstcon_group_decref(grp);
 
@@ -968,7 +964,7 @@ lstcon_batch_info(char *name, struct lstcon_test_batch_ent __user *ent_up,
         }
 
         /* non-verbose query */
-       LIBCFS_ALLOC(entp, sizeof(struct lstcon_test_batch_ent));
+       CFS_ALLOC_PTR(entp);
         if (entp == NULL)
                 return -ENOMEM;
 
@@ -992,7 +988,7 @@ lstcon_batch_info(char *name, struct lstcon_test_batch_ent __user *ent_up,
        rc = copy_to_user(ent_up, entp,
                          sizeof(struct lstcon_test_batch_ent)) ? -EFAULT : 0;
 
-       LIBCFS_FREE(entp, sizeof(struct lstcon_test_batch_ent));
+       CFS_FREE_PTR(entp)
 
        return rc;
 }
@@ -1495,11 +1491,9 @@ static int
 lstcon_ndlist_stat(struct list_head *ndlist,
                   int timeout, struct list_head __user *result_up)
 {
-       struct list_head    head;
+       LIST_HEAD(head);
        struct lstcon_rpc_trans *trans;
-       int                 rc;
-
-       INIT_LIST_HEAD(&head);
+       int rc;
 
         rc = lstcon_rpc_trans_ndlist(ndlist, &head,
                                      LST_TRANS_STATQRY, NULL, NULL, &trans);
@@ -1816,7 +1810,7 @@ lstcon_session_info(struct lst_sid __user *sid_up, int __user *key_up,
 }
 
 int
-lstcon_session_end()
+lstcon_session_end(void)
 {
        struct lstcon_rpc_trans *trans;
        struct lstcon_group *grp;